aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2017-04-21 00:00:26 -0400
committerNoam Postavsky2017-05-23 20:01:41 -0400
commitd158629cb6d0dd7cf0227d993d59ea6faa4438c9 (patch)
tree1988d6e4e8643a15093d01f2344e9bc5bd4f4f3c
parentbf4f69ab6d7d5b5d693c4acb91a4d8e6ce46e32d (diff)
downloademacs-d158629cb6d0dd7cf0227d993d59ea6faa4438c9.tar.gz
emacs-d158629cb6d0dd7cf0227d993d59ea6faa4438c9.zip
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.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 3334471d251..1e38d44e1b1 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."
576 font-lock-string-face)))) 576 font-lock-string-face))))
577 font-lock-comment-face)) 577 font-lock-comment-face))
578 578
579(defun lisp-adaptive-fill ()
580 "Return fill prefix found at point.
581Value for `adaptive-fill-function'."
582 ;; Adaptive fill mode gets the fill wrong for a one-line paragraph made of
583 ;; a single docstring. Let's fix it here.
584 (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") ""))
585
579(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive 586(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive
580 elisp) 587 elisp)
581 "Common initialization routine for lisp modes. 588 "Common initialization routine for lisp modes.
@@ -587,10 +594,7 @@ font-lock keywords will not be case sensitive."
587 (set-syntax-table lisp-mode-syntax-table)) 594 (set-syntax-table lisp-mode-syntax-table))
588 (setq-local paragraph-ignore-fill-prefix t) 595 (setq-local paragraph-ignore-fill-prefix t)
589 (setq-local fill-paragraph-function 'lisp-fill-paragraph) 596 (setq-local fill-paragraph-function 'lisp-fill-paragraph)
590 ;; Adaptive fill mode gets the fill wrong for a one-line paragraph made of 597 (setq-local adaptive-fill-function #'lisp-adaptive-fill)
591 ;; a single docstring. Let's fix it here.
592 (setq-local adaptive-fill-function
593 (lambda () (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") "")))
594 ;; Adaptive fill mode gets in the way of auto-fill, 598 ;; Adaptive fill mode gets in the way of auto-fill,
595 ;; and should make no difference for explicit fill 599 ;; and should make no difference for explicit fill
596 ;; because lisp-fill-paragraph should do the job. 600 ;; because lisp-fill-paragraph should do the job.