Subject: Re: bug#27775: footnotes mode hanging indent [CODE INCLUDED]

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 23 Jul 2019 13:03:35 +0200

Noam Postavsky <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> so I've added a new fill-paragraph function to the Emacs trunk.
>
> Hmm, you did
>
>     (define-minor-mode footnote-mode
>       ...
>         (setq-local fill-paragraph-function #'footnote--fill-paragraph)
>
> But since footnote-mode is a minor mode, isn't it a mistake to just take
> over fill-paragraph-function like that?  What if the major mode has
> installed some fill-paragraph-function?

Oh, yeah, that's true.  How are minor modes supposed to do the paragraph
filling?  Hm...  For adaptive fill footnote does:

  (unless adaptive-fill-function
    ;; nil and `ignore' have the same semantics for adaptive-fill-function,
    ;; but only `ignore' behaves correctly with add/remove-function.
    (setq adaptive-fill-function #'ignore))
  (remove-function (local 'adaptive-fill-function)
                   #'footnote--adaptive-fill-function)

[...]

    (add-function :around (local 'adaptive-fill-function)
                  #'footnote--adaptive-fill-function)

and I guess it could do the same for fill-paragraph-function?   (It
seems like a mouthful, though -- perhaps there should be a helper
function to do all this?)

Hm!  Or will using fill-forward-paragraph-function do the right thing
both for adaptive filling and paragraph filling?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no