guix-commits
[Top][All Lists]
Advanced

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

03/04: .dir-locals.el: Restore Emacs 27 lisp-fill-paragraph behavior.


From: guix-commits
Subject: 03/04: .dir-locals.el: Restore Emacs 27 lisp-fill-paragraph behavior.
Date: Sun, 10 Jul 2022 01:05:41 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit c9fb789fe9eaa5dc0694ef14fe36e5aa821a646c
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Jul 8 23:29:52 2022 -0400

    .dir-locals.el: Restore Emacs 27 lisp-fill-paragraph behavior.
    
    * .dir-locals.el (scheme-mode): Set fill-paragraph-function to a
    lisp-fill-paragraph version that matches that of Emacs 27.
---
 .dir-locals.el | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 9edabba5f8..565f7c48e7 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -156,7 +156,31 @@
    ;; preceding symbol is one of these.
    (eval . (modify-syntax-entry ?~ "'"))
    (eval . (modify-syntax-entry ?$ "'"))
-   (eval . (modify-syntax-entry ?+ "'"))))
+   (eval . (modify-syntax-entry ?+ "'"))
+
+   ;; Emacs 28 changed the behavior of 'lisp-fill-paragraph', which causes the
+   ;; first line of package descriptions to extrude past 'fill-column', and
+   ;; somehow that is deemed more correct upstream (see:
+   ;; https://issues.guix.gnu.org/56197).
+   (eval . (progn
+             (require 'lisp-mode)
+             (defun emacs27-lisp-fill-paragraph (&optional justify)
+               (interactive "P")
+               (or (fill-comment-paragraph justify)
+                   (let ((paragraph-start
+                          (concat paragraph-start
+                                  "\\|\\s-*\\([(;\"]\\|\\s-:\\|`(\\|#'(\\)"))
+                         (paragraph-separate
+                          (concat paragraph-separate "\\|\\s-*\".*[,\\.]$"))
+                         (fill-column (if (and (integerp 
emacs-lisp-docstring-fill-column)
+                                               (derived-mode-p 
'emacs-lisp-mode))
+                                          emacs-lisp-docstring-fill-column
+                                        fill-column)))
+                     (fill-paragraph justify))
+                   ;; Never return nil.
+                   t))
+             (setq-local fill-paragraph-function 
#'emacs27-lisp-fill-paragraph)))))
+
  (emacs-lisp-mode . ((indent-tabs-mode . nil)))
  (texinfo-mode    . ((indent-tabs-mode . nil)
                      (fill-column . 72))))



reply via email to

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