From: Lars Ingebrigtsen Date: Sun, 21 Jul 2019 14:43:07 +0000 (+0200) Subject: Fill footnotes better on `M-q' X-Git-Tag: emacs-27.0.90~1830 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=76d0ca983b7c2e0e9f0e71630d96603b04fa0148;p=emacs.git Fill footnotes better on `M-q' * lisp/mail/footnote.el (footnote--fill-paragraph): New function (bug#27775). (footnote-mode): Use it. --- diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index bbc42e11f74..42ab35b6652 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -695,6 +695,15 @@ footnote area, returns `point-max'." ;; If not within a footnote's text, fallback to the default. (funcall orig-fun))) +(defun footnote--fill-paragraph (justify) + (when (footnote--text-under-cursor) + (let ((fill-paragraph-function nil) + (fill-prefix (if footnote-align-to-fn-text + (footnote--fill-prefix-string) + "")) + (paragraph-start "\\[")) + (fill-paragraph justify)))) + ;;; User functions (defun footnote--make-hole () @@ -875,6 +884,7 @@ play around with the following keys: (make-local-variable 'adaptive-fill-function) (add-function :around (local 'adaptive-fill-function) #'footnote--adaptive-fill-function) + (setq-local fill-paragraph-function #'footnote--fill-paragraph) ;; Filladapt was an XEmacs package which is now in GNU ELPA. (when (boundp 'filladapt-token-table)