emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/visual-fill-column 106189b000: Restore compatibility with


From: ELPA Syncer
Subject: [nongnu] elpa/visual-fill-column 106189b000: Restore compatibility with Emacs < 27.1.
Date: Wed, 18 May 2022 16:04:08 -0400 (EDT)

branch: elpa/visual-fill-column
commit 106189b000ca092886dd9f1c1503613a751dbd3f
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>

    Restore compatibility with Emacs < 27.1.
    
    See Codeberg issue #6. It turns out that before Emacs 27.1, the functions in
    `window-size-change-functions` took the frame as parameter and no local 
part of
    the hook was recognised. From what I understand, in Emacs 27.1, the hook is
    still required, but starting Emacs 28.1, it is not.
---
 visual-fill-column.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/visual-fill-column.el b/visual-fill-column.el
index 44b9d9f276..03269e5290 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -175,7 +175,9 @@ that actually visit a file."
     (setq-default split-window-preferred-function 
#'visual-fill-column-split-window-sensibly))
 
   (cond
-   ((version<= emacs-version "27.1")
+   ((version< emacs-version "27.1")
+    (add-hook 'window-size-change-functions #'visual-fill-colum--adjust-frame))
+   ((version= emacs-version "27.1")
     (add-hook 'window-size-change-functions 
#'visual-fill-column--adjust-window 'append 'local)
     (setq visual-fill-column--use-split-window-parameter t))
 
@@ -191,7 +193,9 @@ that actually visit a file."
 
   (let ((window (get-buffer-window (current-buffer))))
     (cond
-     ((version<= emacs-version "27.1")
+     ((version< emacs-version "27.1")
+      (remove-hook 'window-size-change-functions 
#'visual-fill-column--adjust-frame))
+     ((version= emacs-version "27.1")
       (remove-hook 'window-size-change-functions 
#'visual-fill-column--adjust-window 'local))
 
      ((version< "27.1" emacs-version)
@@ -264,6 +268,14 @@ selected window has `visual-fill-column-mode' enabled."
           (set-window-parameter window 'min-margins '(0 . 0)))
       (visual-fill-column--set-margins window))))
 
+(defun visual-fill-column--adjust-frame (frame)
+  "Adjust the windows on FRAME.
+This function is added to `window-size-change-functions' in older
+Emacsen (before 27.1), in which the functions in this hook are
+passed the frame as argument."
+  (dolist (window (window-list frame))
+    (visual-fill-column--adjust-window window)))
+
 (defun visual-fill-column-adjust (&optional _inc)
   "Adjust the window margins and fringes.
 This function is for use as advice to `text-scale-adjust'.  It



reply via email to

[Prev in Thread] Current Thread [Next in Thread]