GNU bug report logs -
#42184
27.0.91; org-fontify-whole-heading-line does not work in emacs 27
Previous Next
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
Message #35 received at 42184 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:
>>> 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?
Since all the other threads I'm following are stalled, I've taken a stab
at this:
[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index c1aaf17ca2..b53c06c94f 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -101,6 +101,10 @@ org-table1-hline-regexp
(defun org-time-convert-to-list (time)
(seconds-to-time (float-time time))))
+(defun org--extend-faces (faces)
+ (when (fboundp 'set-face-extend)
+ (mapc (lambda (f) (set-face-extend f t)) faces)))
+
;;; Emacs < 26.1 compatibility
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 568f5b9b87..7ff4f5587f 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -5310,6 +5310,9 @@ org-fontify-meta-lines-and-blocks-1
beg-of-endline
(min (point-max) (if whole-blockline (min (point-max) (1+ end-of-endline)) end-of-endline))
'(face org-block-end-line))
+ (when whole-blockline
+ (org--extend-faces '(org-block-begin-line
+ org-block-end-line)))
t))
((member dc1 '("+title:" "+author:" "+email:" "+date:"))
(org-remove-flyspell-overlays-in
@@ -5600,7 +5603,8 @@ org-set-font-lock-defaults
'(org-font-lock-hook)
;; Headlines
`(,(if org-fontify-whole-heading-line
- "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)"
+ (prog1 "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)"
+ (org--extend-faces org-level-faces))
"^\\(\\**\\)\\(\\* \\)\\(.*\\)")
(1 (org-get-level-face 1))
(2 (org-get-level-face 2))
[Message part 3 (text/plain, inline)]
While it fixes the issue, I don't know if it's the cleanest way to do it
(repeatedly calling set-face-extend on the same faces every time an Org
buffer is opened/reverted seems a bit silly).
Also, while this is not part of the report because Erik's example
happens not to have any text between the block delimiters (#+begin_src
and #+end_src), I would like to re-emphasize that I'm pretty sure
org-block (and maybe org-quote and org-verse) should be defined with
:extend t unconditionally, to maintain the "rectangular" aspect the
blocks have in a browser once exported to HTML:
[bug#42184-org-block.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]
If people agree, I can make at patch similar to bug#42184#17 for those
faces only.
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.