diff options
author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-07 11:04:53 +0200 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-08-10 20:22:25 -0400 |
commit | 81e2948472b1866496faaf00ccacafa66f29f5fc (patch) | |
tree | d77c64287ea2994f915cf89060d7a4b40ca90858 | |
parent | 093b474e6a11d5240f1e88e5ecc7cbbba72ead9d (diff) | |
download | org-mode-81e2948472b1866496faaf00ccacafa66f29f5fc.tar.gz |
Fix org-fontify-whole-*-line by setting face extension (bug#42184)
* lisp/org-faces.el (org-block): Set background extension beyond
end-of-line.
* lisp/org-compat.el (org--set-faces-extend): New function to
temporarily (re)set :extend for Emacs≥27.
* lisp/org.el (org-mode): Call it to set the extend attribute of
relevant faces to the correct value.
-rw-r--r-- | lisp/org-compat.el | 8 | ||||
-rw-r--r-- | lisp/org-faces.el | 3 | ||||
-rw-r--r-- | lisp/org.el | 6 |
3 files changed, 15 insertions, 2 deletions
diff --git a/lisp/org-compat.el b/lisp/org-compat.el index c757355..e405df0 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -101,6 +101,14 @@ is nil)." (defun org-time-convert-to-list (time) (seconds-to-time (float-time time)))) +(defun org--set-faces-extend (faces extend-p) + "Set the :extend attribute of FACES to EXTEND-P. + +This is a no-op for Emacs versions lower than 27, since face +extension beyond end of line was not controllable." + (when (fboundp 'set-face-extend) + (mapc (lambda (f) (set-face-extend f extend-p)) faces))) + ;;; Emacs < 26.1 compatibility diff --git a/lisp/org-faces.el b/lisp/org-faces.el index 30eab9b..ff2b0e6 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -393,7 +393,8 @@ follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword." "Face for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords." :group 'org-faces) -(defface org-block '((t :inherit shadow)) +(defface org-block `((t :inherit shadow + ,@(and (>= emacs-major-version 27) '(:extend t)))) "Face text in #+begin ... #+end blocks. For source-blocks `org-src-block-faces' takes precedence." :group 'org-faces diff --git a/lisp/org.el b/lisp/org.el index 007dd6e..34c0235 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4940,7 +4940,11 @@ The following commands are available: ;; Try to set `org-hide' face correctly. (let ((foreground (org-find-invisible-foreground))) (when foreground - (set-face-foreground 'org-hide foreground)))) + (set-face-foreground 'org-hide foreground))) + ;; Set face extension as requested. + (org--set-faces-extend '(org-block-begin-line org-block-end-line) + org-fontify-whole-block-delimiter-line) + (org--set-faces-extend org-level-faces org-fontify-whole-heading-line)) ;; Update `customize-package-emacs-version-alist' (add-to-list 'customize-package-emacs-version-alist |