reddit / emacs

Weird behavior in extended background color

Tohiko · 2022-11-02 16:34
I am using the `zerodark-theme` which customizes `org-block-begin-line` and `org-block-end-line` to have a background color with the `extend` property set to `t`. I like this change to the interface but it has some weird behavior. In the following screenshot https://preview.redd.it/ogyahfuvekx91.png?width=275&format=png&auto=webp&s=b2b9f91213506ef84772672c1557043aef19fbda The color extends beyond the end of the line `#+end_src` to the following empty lines. This is not always the case and calling `font-lock-update` correctly colors the empty lines, though I am not sure why it happens in the first case! More annoyingly for collapsed items which have a source block inside them get colored like `Hello...` above. Is this a bug or intended behavior? Can I "fix" it?
eli-zaretskii · 2022-11-02 19:26
The `:extend` attribute of a face, if non-nil, exactly means that the face's background will go all the way to the right edge of the window. So if you don't want that, don't set that attribute.
Tohiko · 2022-11-02 20:17
Yes I understand that. I actually do want the background color to go all the way to the right edge but not to extend to other lines other than the ones where the face is set. The problem is that the face is applied to empty lines following lines starting with `#+end_src`. Also, the background extension remains even when the text is collapsed.
eli-zaretskii · 2022-11-03 10:07
Suggest to prepare a minimal reproduction recipe and report a bug, first to the Org list, and later to the Emacs bug tracker, if Org developers say it isn't specific to Org.
JDRiverRun · 2022-11-03 12:57
Go to those following blank lines and `C-u C-x =`. Is org-block-end-line really mentioned as the `face`? My org-block-end-line has `:extend t`, but the face is only applied on the block itself, never on following lines. Org mode version 9.5.5.
walseb · 2022-11-04 02:19
Are you using evil-mode and opening new lines with 'o'? I get the same issue at times when doing that. font-lock-update fixes it as well. So it might be a issue with evil-mode.
Tohiko · 2022-11-05 23:53
Yes. I don't use evil-mode but the problem does happen when I added new lines (in my case, by just pressing return)
Tohiko · 2022-11-05 23:58
I can't always do that because the color extends sometimes beyond the relevant line even when the buffer end. But when I can, the empty lines don't have `org-block-end-line` as the face and `update-font-luck` somestimes fixes it.