Stefan Monnier <[email protected]> writes: >> * 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. > > AFAIU `fill-forward-paragraph-function` should take care of such issues. > If it doesn't, maybe there's a bug in the way we use it or the way Org > defines it (where "it" is `fill-forward-paragraph-function`).
With * Heading<point> SCHEDULED: <...> fill-forward-paragraph will move point to * Heading <point>SCHEDULED: <...> How does it help with the fact that filling headings just cannot work - they must always be on one line? >> 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. > > Expedites part of the process ... of what exactly? > I think I'm missing some details to understand what is the issue. It switches to dedicated buffer using block's major mode (in this case emacs-lisp-mode), calls fill-paragraph there, using major mode settings, and copies the result back to Org. >> 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). > > Supposedly `fill-region-as-paragraph-function` should be able to handle > those kinds of constraints. That might be the case. This function is very new. (And Org will need to add support for it in the near future). However, in Org's context, filling region as paragraph does not always make sense. So, Org is not always going to make a single paragraph even if Org supports fill-region-as-paragraph-function. I suspect that it might break some internal logic in fill.el even if I implement Org's version. Also, fill-region-as-paragraph-function can be ignored when `use-hard-newlines' is non-nil. I think we discussed this aspect though. -- 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>
