[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti 7f3fe83 2/2: Conditionally add hooks for Emacs
From: |
Paul Rankin |
Subject: |
[elpa] externals/olivetti 7f3fe83 2/2: Conditionally add hooks for Emacs 24 -> 27 |
Date: |
Sun, 19 May 2019 09:07:45 -0400 (EDT) |
branch: externals/olivetti
commit 7f3fe83f43be32a02c790e3b209a9d4d08bdcee1
Author: Paul W. Rankin <address@hidden>
Commit: Paul W. Rankin <address@hidden>
Conditionally add hooks for Emacs 24 -> 27
---
olivetti.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index a15df1b..6e140ce 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -312,10 +312,17 @@ body width set with `olivetti-body-width'."
:lighter olivetti-lighter
(if olivetti-mode
(progn
- (add-hook 'window-size-change-functions
- #'olivetti-set-margins t t)
- (add-hook 'window-configuration-change-hook
- 'olivetti-set-all-margins t t)
+ (cond ((<= emacs-major-version 24)
+ (add-hook 'window-configuration-change-hook
+ #'olivetti-set-all-margins t t))
+ ((<= emacs-major-version 26)
+ (add-hook 'window-configuration-change-hook
+ #'olivetti-set-all-margins t t)
+ (add-hook 'window-size-change-functions
+ #'olivetti-set-margins t t))
+ ((<= 27 emacs-major-version)
+ (add-hook 'window-size-change-functions
+ #'olivetti-set-margins t t)))
(add-hook 'change-major-mode-hook
#'olivetti-reset-all-windows nil t)
(setq-local split-window-preferred-function