Subject: bug#65896: 30.0.50; folding text with text properties prevents background from extending past the newline

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 25 Jan 2024 08:46:10 +0100

Ihor Radchenko <[email-masked]> writes:

> Kévin Le Gouguec <[email-masked]> writes:
>
>> Ihor Radchenko <[email-masked]> writes:
>>
>>> After several attempts, I found a way to handle faces in the trailing
>>> newlines after folds without excessive changes in Org mode.
>>> Fixed, on main.
>>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=2ade16bbc
>>
>> Neat.  At first glance (including the subsequent fixup), it looks like
>> outline.el could be taught the same trick, right?  It would """just"""
>> be a matter of finding the spot(s) that map to org-fold-core-region, and
>> implementing equivalents to the org-fold-core helpers you leveraged
>> (get-regions, get-folding-spec, get-region-at-point) if they don't exist
>> already?
>
> Yes, it should be doable.
> The equivalents would be overlay* functions.
> Or outline.el can use org-fold-core to fold staff :)
> org-fold-core has no major dependencies from Org libraries.

Taking notes.  That prompts further thoughts, but emacs-devel and/or
emacs-orgmode would be better venues for them.

For the purposes of this report, all that comes to mind is

* You might have solved bug#52587?  At least I can no longer reproduce
  using the recipe there (NB: the OP needs adjustments¹) after pulling
  your changes, 'make all', and 'emacs -Q -L lisp' from the Org repo².

  (Which means I could finally dispense with newlines between "#+end_"
  lines and headings 🥹)

* Thank you so much for looking into this! 🙏

¹ As noted in the comments, the issue only comes up if you remove the
newline between "#+end_quote" and "* baz"; also AFAICT modus-operandi no
longer adds a background to org-block-*-line by default?  So I had to
theme that in manually to reproduce & test the fix.

² Don't know if there is a "blessed" way to interactively test changes
in the Org repo; thinking of e.g. magit's 'emacs-Q' target which reduces
the chance of forgetting a step.  FWIW I went in guns blazing with 'make
-j8' and got screenfuls of version-mismatch warnings, so elected to take
-j8 off; that seemed to make things quieter.