Stefan Monnier <[email protected]> writes:
> IMNSHO, `fill-paragraph-function` is a pretty bad hook whose intended
> semantics is very unclear, barely more than "do something that would be
> nice to have on `M-q`".
> So, before we add something similar to `unfill-paragraph` I think we
> should have a clear idea of the problem it should aim to fix.
> As a starting point a clear description of why
> `fill-forward-paragraph-function` and
> `fill-region-as-paragraph-function` aren't sufficient.
> [ My secret hope is that we can fix that problem with hooks that are
> applicable also to `fill-paragraph` and/or `fill-region`. ]
Let me give you two examples from Org:
1. A heading
* This is a heading, and filling it is not allowed because it juts cannot be
multiline
SCHEDULED: <2026-06-24 Wed>
If we do try
* This is a heading, and filling it is not allowed because it juts
cannot be multiline
SCHEDULED: <2026-06-24 Wed>
Org document is broken unexpectedly, because SCHEDULED line is no longer
recognized.
2. A source block
#+begin_src emacs-lisp
(if t
(message "Hello!")
(error "This should not happen!"))
#+end_src
When filling the source block, Org expedites part of the process to
emacs-lisp-mode - something fill/unfill-paragraph has no idea about.
Similar case will be with various programming modes, especially when
those modes need to take special care about indentation (e.g. docstring
indentation in Elisp).
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>