[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: |
Wed, 08 Jul 2020 13:50:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Kévin Le Gouguec <kevin.legouguec@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:
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))
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
Description: PNG image
If people agree, I can make at patch similar to bug#42184#17 for those
faces only.
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Erik Hetzner, 2020/07/03
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/04
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Eli Zaretskii, 2020/07/04
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/04
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/04
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Eli Zaretskii, 2020/07/04
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/05
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Eli Zaretskii, 2020/07/05
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/05
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Eli Zaretskii, 2020/07/05
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27,
Kévin Le Gouguec <=
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/09