emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug#42184: org-fontify-whole-*-line in emacs 27 (was: Couple of issues with org block meta lines faces)
  2020-07-10 11:46 ` Kévin Le Gouguec
@ 2020-07-14 10:19   ` Kévin Le Gouguec
  0 siblings, 0 replies; 2+ messages in thread
From: Kévin Le Gouguec @ 2020-07-14 10:19 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]

Could Org maintainers weigh in on bug#42184?

To recap my understanding of the issue:

- org-fontify-whole-heading-line controls whether
  org-set-font-lock-defaults includes the final newline in the headline
  regexp (resp. org-fontify-whole-block-delimiter-line with begin/end
  block regexps).

- This assumes that fontifying the final newline is enough to fontify
  everything beyond this newline.

- This assumption is no longer valid with Emacs 27, where this extension
  is opt-in, using the :extend face attribute.

With Eli's help, I proposed a patch for org-mode against the emacs-27
branch that does something similar to what is done for the org-hide
face: when setting up the major mode, depending on those user options,
the :extend attribute is (re)set for the relevant faces (using a
compatibility function defined in org-compat).

I've reattached the patch for convenience.  Does it look sound?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-org-fontify-whole-line-by-setting-face-extension.patch --]
[-- Type: text/x-diff, Size: 1851 bytes --]

From 07d123c548051eb7f6bbac5c7f5a4e4b8411f976 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@gmail.com>
Date: Thu, 9 Jul 2020 16:02:49 +0200
Subject: [PATCH] Fix org-fontify-whole-*-line by setting face extension
 (bug#42184)

* lisp/org/org-compat.el (org--set-faces-extend): New function to set
face extension, for Emacs versions where this attribute exists.
* lisp/org/org.el (org-mode): Call it to set the extend attribute of
relevant faces to the correct value.
---
 lisp/org/org-compat.el | 4 ++++
 lisp/org/org.el        | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index c1aaf17ca2..fcc325e475 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--set-faces-extend (faces extend-p)
+  (when (fboundp 'set-face-extend)
+    (mapc (lambda (f) (set-face-extend f extend-p)) faces)))
+
 \f
 ;;; Emacs < 26.1 compatibility
 
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 568f5b9b87..fb31336ea4 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -4944,7 +4944,11 @@ org-mode
   ;; 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
-- 
2.27.0


[-- Attachment #3: Type: text/plain, Size: 233 bytes --]



In addition to this issue, I'd like to ask about the org-block face:
should it be defined with :extend t unconditionally?  As explained in
bug#42184#35, I feel like it should (cf. attached screenshot), but
that's only my opinion.


[-- Attachment #4: org-block.png --]
[-- Type: image/png, Size: 319121 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Bug#42184: org-fontify-whole-*-line in emacs 27 (was: Couple of issues with org block meta lines faces)
@ 2020-07-14 12:13 Kévin Le Gouguec
  0 siblings, 0 replies; 2+ messages in thread
From: Kévin Le Gouguec @ 2020-07-14 12:13 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

(Apologies for the possible duplicate; I tried to send this with Gmane
2 hours ago and AFAICT it hasn't made it through.  Retrying over SMTP…)

-------------------- Start of forwarded message --------------------
From: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Subject: Bug#42184: org-fontify-whole-*-line in emacs 27 (was: Couple of issues with org block meta lines faces)
Date: Tue, 14 Jul 2020 12:19:38 +0200


[-- Attachment #2.1: Type: text/plain, Size: 911 bytes --]

Could Org maintainers weigh in on bug#42184?

To recap my understanding of the issue:

- org-fontify-whole-heading-line controls whether
  org-set-font-lock-defaults includes the final newline in the headline
  regexp (resp. org-fontify-whole-block-delimiter-line with begin/end
  block regexps).

- This assumes that fontifying the final newline is enough to fontify
  everything beyond this newline.

- This assumption is no longer valid with Emacs 27, where this extension
  is opt-in, using the :extend face attribute.

With Eli's help, I proposed a patch for org-mode against the emacs-27
branch that does something similar to what is done for the org-hide
face: when setting up the major mode, depending on those user options,
the :extend attribute is (re)set for the relevant faces (using a
compatibility function defined in org-compat).

I've reattached the patch for convenience.  Does it look sound?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.2: 0001-Fix-org-fontify-whole-line-by-setting-face-extension.patch --]
[-- Type: text/x-diff, Size: 1853 bytes --]

> From 07d123c548051eb7f6bbac5c7f5a4e4b8411f976 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@gmail.com>
Date: Thu, 9 Jul 2020 16:02:49 +0200
Subject: [PATCH] Fix org-fontify-whole-*-line by setting face extension
 (bug#42184)

* lisp/org/org-compat.el (org--set-faces-extend): New function to set
face extension, for Emacs versions where this attribute exists.
* lisp/org/org.el (org-mode): Call it to set the extend attribute of
relevant faces to the correct value.
---
 lisp/org/org-compat.el | 4 ++++
 lisp/org/org.el        | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index c1aaf17ca2..fcc325e475 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--set-faces-extend (faces extend-p)
+  (when (fboundp 'set-face-extend)
+    (mapc (lambda (f) (set-face-extend f extend-p)) faces)))
+
 \f
 ;;; Emacs < 26.1 compatibility
 
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 568f5b9b87..fb31336ea4 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -4944,7 +4944,11 @@ org-mode
   ;; 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
-- 
2.27.0


[-- Attachment #2.3: Type: text/plain, Size: 233 bytes --]



In addition to this issue, I'd like to ask about the org-block face:
should it be defined with :extend t unconditionally?  As explained in
bug#42184#35, I feel like it should (cf. attached screenshot), but
that's only my opinion.


[-- Attachment #2.4: org-block.png --]
[-- Type: image/png, Size: 319121 bytes --]

[-- Attachment #3: Type: text/plain, Size: 67 bytes --]

-------------------- End of forwarded message --------------------

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-14 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14 12:13 Bug#42184: org-fontify-whole-*-line in emacs 27 (was: Couple of issues with org block meta lines faces) Kévin Le Gouguec
  -- strict thread matches above, loose matches on Subject: below --
2020-07-10  9:23 Couple of issues with org block meta lines faces Sébastien Miquel
2020-07-10 11:46 ` Kévin Le Gouguec
2020-07-14 10:19   ` Bug#42184: org-fontify-whole-*-line in emacs 27 (was: Couple of issues with org block meta lines faces) Kévin Le Gouguec

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).