bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emac


From: Kévin Le Gouguec
Subject: bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27
Date: Sun, 05 Jul 2020 18:02:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> The only faces I added were org-level-[3-8], because I don't see why
>> different heading levels should not work with
>> org-fontify-whole-heading-line.
>
> The original code only affects certain heading levels, it doesn't
> affect all of them.

By "the original code", you mean this part in
org-set-font-lock-defaults, right?

>          `(,(if org-fontify-whole-heading-line
>                 "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)"
>               "^\\(\\**\\)\\(\\* \\)\\(.*\\)")

That seems to apply to all heading levels to me?  Group 1 captures all
but the last stars, group 2 the last star, and group 3 the heading text?

>                                                             Which is
> another aspect of your proposed patch I'd like to change: it seems to
> cause these faces be extended unconditionally, not just under these
> optional variables.  Or did I miss something?

IIUC, org-fontify-whole-heading-line (which predates :extend t) is Org's
way of letting users "opt in" to face extension, by applying the
org-level-* face to the final newline *iff* this user option is set.

Adding :extend t to the face definition thus will not cause the
backgrounds to extend unconditionally: as long as the user option is
unset, the final newline will not be fontified.

>> AFAICT, this is the simplest way to fix org-fontify-whole-heading-line
>> and org-fontify-whole-block-delimiter-line for Emacs ≥27.  These user
>> options work under the assumption that simply fontifying the final
>> newline is enough to extend attributes past EOL.
>
> Nevertheless, I would like to see the :extend attribute applied only
> under the above options; there's the set-face-extend function for
> doing that.

OK.  That's more or less what I had in mind when I went into my
"long-term fix" ideas.

Note that Org tries to support older Emacs versions.  AFAICT, with my
patch, (1) org-fontify-whole-heading-line is fixed for Emacs 27, (2) no
further modification is needed for Emacs ≤26.

I can try to cook up a patch based on set-face-extend instead, with all
the fboundp fun that entails to prevent byte-compiler warnings with
older Emacs versions.  I'm not sure where the calls to set-face-extend
should be inserted; when setting up the major mode?

At this point, I should probably wait for Org maintainers to chime in…





reply via email to

[Prev in Thread] Current Thread [Next in Thread]