emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 76d0ca9: Fill footnotes better on `M-q'


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 76d0ca9: Fill footnotes better on `M-q'
Date: Sun, 21 Jul 2019 10:43:17 -0400 (EDT)

branch: master
commit 76d0ca983b7c2e0e9f0e71630d96603b04fa0148
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Fill footnotes better on `M-q'
    
    * lisp/mail/footnote.el (footnote--fill-paragraph): New function
    (bug#27775).
    (footnote-mode): Use it.
---
 lisp/mail/footnote.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index bbc42e1..42ab35b 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)



reply via email to

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