GNU bug report logs - #42184
27.0.91; org-fontify-whole-heading-line does not work in emacs 27

Previous Next

Package: emacs;

Reported by: Erik Hetzner <egh <at> e6h.org>

Date: Sat, 4 Jul 2020 02:30:02 UTC

Severity: normal

Found in version 27.0.91

Done: Bastien <bzg <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: egh <at> e6h.org, 42184 <at> debbugs.gnu.org, mail <at> nicolasgoaziou.fr, bzg <at> gnu.org
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
Eli Zaretskii <eliz <at> 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…




This bug report was last modified 4 years and 343 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.