emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master d158629 1/2: Give a name to lisp-mode's adaptive-fi


From: Noam Postavsky
Subject: [Emacs-diffs] master d158629 1/2: Give a name to lisp-mode's adaptive-fill-function (Bug#22730)
Date: Tue, 23 May 2017 20:11:50 -0400 (EDT)

branch: master
commit d158629cb6d0dd7cf0227d993d59ea6faa4438c9
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Give a name to lisp-mode's adaptive-fill-function (Bug#22730)
    
    * lisp/emacs-lisp/lisp-mode.el (lisp-adaptive-fill): New function.
    (lisp-mode-variables): Use it.
---
 lisp/emacs-lisp/lisp-mode.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 3334471..1e38d44 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -576,6 +576,13 @@ Lisp font lock syntactic face function."
               font-lock-string-face))))
     font-lock-comment-face))
 
+(defun lisp-adaptive-fill ()
+  "Return fill prefix found at point.
+Value for `adaptive-fill-function'."
+  ;; Adaptive fill mode gets the fill wrong for a one-line paragraph made of
+  ;; a single docstring.  Let's fix it here.
+  (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") ""))
+
 (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive
                                       elisp)
   "Common initialization routine for lisp modes.
@@ -587,10 +594,7 @@ font-lock keywords will not be case sensitive."
     (set-syntax-table lisp-mode-syntax-table))
   (setq-local paragraph-ignore-fill-prefix t)
   (setq-local fill-paragraph-function 'lisp-fill-paragraph)
-  ;; Adaptive fill mode gets the fill wrong for a one-line paragraph made of
-  ;; a single docstring.  Let's fix it here.
-  (setq-local adaptive-fill-function
-             (lambda () (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") "")))
+  (setq-local adaptive-fill-function #'lisp-adaptive-fill)
   ;; Adaptive fill mode gets in the way of auto-fill,
   ;; and should make no difference for explicit fill
   ;; because lisp-fill-paragraph should do the job.



reply via email to

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