Subject: bug#52587: 29.0.50; Wrong block header/footer background in Org

From: Kévin Le Gouguec <[email-masked]>
Date: Mon, 20 Dec 2021 07:33:07 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Kévin Le Gouguec <[email-masked]>
>> Date: Sun, 19 Dec 2021 13:10:37 +0100
>> Cc: [email-masked], Rudolf Adamkovič <[email-masked]>
>> 
>> 1. emacs -Q
>> 2. C-x b repro
>> 3. M-x outline-mode
>> 4. type in: "* foo RET bar RET * baz"
>> 5. move to "bar"
>> 6. M-: 
>>    (add-text-properties
>>     (point-at-bol)
>>     (1+ (point-at-eol))
>>     '(font-lock-face (:background "red")))
>> 7. S-TAB (to fold all sections)
>> 
>> Here, I see a single column with red background after the ellipses.
>
> Why is that a problem?  That single column has buffer position 10, and
> is the only visible buffer position that has the red color before
> S-TAB.
>
> So I think Emacs behaves as expected here.

>From an implementation POV, the current behaviour makes perfect sense,
yes, because outline-mode essentially hides everything ranging from the
newline at the end of "* foo" up to but *excluding* the newline after
"bar".

But I think this bug report shows that some users have different
expectations, rooted in an abstract sense of what is and is not "part"
of the subsection to hide.  Specifically, they consider that the
end-of-line decoration of a subsection's last line is "part" of the
subsection, and so expect it to be hidden when the subsection is folded.

To put it in picture in case that wasn't clear, assuming a derived mode
of Outline which would also fontify a headline's final newline, some
users expect that in this buffer:

Folding should not yield this:

But rather that: