summaryrefslogtreecommitdiff
path: root/lisp/mail/footnote.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-07-21 16:43:07 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-07-21 16:43:11 +0200
commit76d0ca983b7c2e0e9f0e71630d96603b04fa0148 (patch)
tree504a29dca09dfe1a17fb116414012b485fca4712 /lisp/mail/footnote.el
parent8b13ec1d7022b05ce71982c83f320d5272b92de7 (diff)
downloademacs-76d0ca983b7c2e0e9f0e71630d96603b04fa0148.tar.gz
emacs-76d0ca983b7c2e0e9f0e71630d96603b04fa0148.tar.bz2
emacs-76d0ca983b7c2e0e9f0e71630d96603b04fa0148.zip
Fill footnotes better on `M-q'
* lisp/mail/footnote.el (footnote--fill-paragraph): New function (bug#27775). (footnote-mode): Use it.
Diffstat (limited to 'lisp/mail/footnote.el')
-rw-r--r--lisp/mail/footnote.el10
1 files changed, 10 insertions, 0 deletions
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)