[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: |
Sat, 04 Jul 2020 21:52:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:
> If these options still make sense (i.e. users should be able to choose
> between extended or non-extended backgrounds/under/overlines,
> independently of how themes customize the faces), org-level-* and
> org-block-{begin,end}-line should probably be defined with :extend t?
To make the discussion more concrete: here's a suggested patch for Org
against the emacs-27 branch; what say you?
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index c1aaf17ca2..7c905ef07e 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -334,6 +334,13 @@ org-compatible-face
specs))
(make-obsolete 'org-compatible-face "you can remove it." "Org 9.0")
+(defmacro org-extended-face (attributes)
+ "Make face that extends beyond end of line.
+
+Up to Emacs 26, all faces extended beyond end of line; getting
+the same behaviour starting with Emacs 27 requires :extend t."
+ `(nconc ,attributes (when (>= emacs-major-version 27) '(:extend t))))
+
(defun org-add-link-type (type &optional follow export)
"Add a new TYPE link.
FOLLOW and EXPORT are two functions.
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index 30eab9bc6b..37a47e7c50 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -28,6 +28,8 @@
;;; Code:
+(require 'org-compat)
+
(defgroup org-faces nil
"Faces in Org mode."
:tag "Org Faces"
@@ -45,35 +47,35 @@ org-hide
color of the frame."
:group 'org-faces)
-(defface org-level-1 '((t :inherit outline-1))
+(defface org-level-1 `((t ,(org-extended-face '(:inherit outline-1))))
"Face used for level 1 headlines."
:group 'org-faces)
-(defface org-level-2 '((t :inherit outline-2))
+(defface org-level-2 `((t ,(org-extended-face '(:inherit outline-2))))
"Face used for level 2 headlines."
:group 'org-faces)
-(defface org-level-3 '((t :inherit outline-3))
+(defface org-level-3 `((t ,(org-extended-face '(:inherit outline-3))))
"Face used for level 3 headlines."
:group 'org-faces)
-(defface org-level-4 '((t :inherit outline-4))
+(defface org-level-4 `((t ,(org-extended-face '(:inherit outline-4))))
"Face used for level 4 headlines."
:group 'org-faces)
-(defface org-level-5 '((t :inherit outline-5))
+(defface org-level-5 `((t ,(org-extended-face '(:inherit outline-5))))
"Face used for level 5 headlines."
:group 'org-faces)
-(defface org-level-6 '((t :inherit outline-6))
+(defface org-level-6 `((t ,(org-extended-face '(:inherit outline-6))))
"Face used for level 6 headlines."
:group 'org-faces)
-(defface org-level-7 '((t :inherit outline-7))
+(defface org-level-7 `((t ,(org-extended-face '(:inherit outline-7))))
"Face used for level 7 headlines."
:group 'org-faces)
-(defface org-level-8 '((t :inherit outline-8))
+(defface org-level-8 `((t ,(org-extended-face '(:inherit outline-8))))
"Face used for level 8 headlines."
:group 'org-faces)
@@ -399,11 +401,16 @@ org-block
:group 'org-faces
:version "26.1")
-(defface org-block-begin-line '((t (:inherit org-meta-line)))
+(defface org-block-begin-line `((t ,(org-extended-face
+ '(:inherit org-meta-line))))
"Face used for the line delimiting the begin of source blocks."
:group 'org-faces)
-(defface org-block-end-line '((t (:inherit org-block-begin-line)))
+;; Explicitly extend this face; if a theme does not make it inherit
+;; from org-block-begin-line, the :extend attribute will remain
+;; unspecified.
+(defface org-block-end-line `((t ,(org-extended-face
+ '(:inherit org-block-begin-line))))
"Face used for the line delimiting the end of source blocks."
:group 'org-faces)
See the screenshots posted by Erik at the beginning of this thread[1]
and mine[2] for comparison.
[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42184#5
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42184#8
My aim was to allow you (Org maintainers) to commit this verbatim to the
org-mode repository, where you probably want to keep supporting Emacs
≤26.3.
NB: I'm far from an Elisp wizard, there may more elegant ways to solve
this than my backquotefest; suggestions welcome.
> Relatedly (but not crucial to solving this bug), should org-block and
> org-block-background also have :extend t? It would make sense to me
> since they delimit visual "blocks".
I still think the answer to the above is "yes". Will add to my patch if
you agree.
> Last question (that one might be answered somewhere in Org's
> documentation): how should we patch org-mode? First on emacs-27, then
> on org-mode's maint branch?
- 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 <=
- 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, 2020/07/08
- bug#42184: 27.0.91; org-fontify-whole-heading-line does not work in emacs 27, Kévin Le Gouguec, 2020/07/09