emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#42184: org-fontify-whole-*-line in emacs 27


From: Kyle Meyer
Subject: Re: Bug#42184: org-fontify-whole-*-line in emacs 27
Date: Sun, 09 Aug 2020 00:43:25 -0400

Kévin Le Gouguec writes:

> I made patches for both maint and master because
>
> - the patch for maint has a small conflict in org-compat when applied
>   against master,
>
> - I'm not sure which branch will eventually be synchronized with
>   emacs-27 (assuming we'll include this fix in 27.2).

Thanks.  This patch is appropriate for maint in my view.

> diff --git a/lisp/org-compat.el b/lisp/org-compat.el
> index c757355ba..c0f4833a3 100644
> --- a/lisp/org-compat.el
> +++ b/lisp/org-compat.el
> @@ -101,6 +101,21 @@ is nil)."
>    (defun org-time-convert-to-list (time)
>      (seconds-to-time (float-time time))))
>  
> +(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))))

Two minor thoughts, neither really important:

  * Style nit-pick: s/when/and/, as the return value is of interest.

  * I'm guessing your main reason for choosing a macro when a function
    would do here is to get inline expansion at compile time.

However ...

>  ;;; Emacs < 26.1 compatibility
>  
> diff --git a/lisp/org-faces.el b/lisp/org-faces.el
> index 30eab9bc6..4c5a51624 100644
> --- a/lisp/org-faces.el
> +++ b/lisp/org-faces.el
> @@ -393,7 +393,7 @@ 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 ,(org--extended-face '(:inherit shadow))))
>    "Face text in #+begin ... #+end blocks.
>  For source-blocks `org-src-block-faces' takes precedence."
>    :group 'org-faces

... the main thing I wonder is whether this kludge is necessary at all.
AFAICT unconditionally including :extend in the face spec doesn't seem
to bother earlier Emacs versions.  Even if there is a reason to avoid
:extend on older versions, it's perhaps an overkill to add a
compatibility macro for just one spot.  Maybe instead just define it
directly in the value for org-block:

    `(t ,@(and (>= emacs-major-version 27) '(:extend t))
        :inherit shadow)


If org--extended-face stays, org-face.el should be adjusted to load
org-compat.el.  (`make single' flags this.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]