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)