emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org 2ade16bbc2 3/3: org-fold: Honor :extend face proper


From: ELPA Syncer
Subject: [elpa] externals/org 2ade16bbc2 3/3: org-fold: Honor :extend face property in folded headings/blocks/drawers
Date: Mon, 22 Jan 2024 09:58:31 -0500 (EST)

branch: externals/org
commit 2ade16bbc235cf5c9e5b2358acce189c3c54e8cf
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-fold: Honor :extend face property in folded headings/blocks/drawers
    
    * lisp/org-fold-core.el (org-fold-core-region): When folding, when the
    fold ends at a newline, copy 'face property from the beginning of the
    fold, so that the trailing newline after ellipsis does not appear
    with different face.  This fixes :extend t in headlines, blocks, and
    drawers not being honored when the headlines are folded.
    
    * etc/ORG-NEWS (Folded lines can now extend their face beyond
    ellipsis): Announce the change.
    
    Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65896
---
 etc/ORG-NEWS          |  8 ++++++++
 lisp/org-fold-core.el | 12 ++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e413622dd2..f537486d43 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,14 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
 ** Important announcements and breaking changes
+*** Folded lines can now extend their face beyond ellipsis
+
+Previously, ~:extend t~ face attribute did not make folded headlines,
+blocks, and drawers extend their face beyond end of line.
+
+Now, the ellipsis and trailing newline use the same face as the last
+character before the fold.
+
 *** ~org-agenda-search-headline-for-time~ now ignores all the timestamp in 
headings
 
 Previously, ~org-agenda-search-headline-for-time~ made Org agenda
diff --git a/lisp/org-fold-core.el b/lisp/org-fold-core.el
index b7f9c60ca6..4619b48c41 100644
--- a/lisp/org-fold-core.el
+++ b/lisp/org-fold-core.el
@@ -1033,6 +1033,18 @@ If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold 
everything in the region."
     (when spec (org-fold-core--check-spec spec))
     (with-silent-modifications
       (org-with-wide-buffer
+       ;; Arrange face property of newlines after all the folds
+       ;; between FROM and TO to match the first character before the
+       ;; fold; not the last as per Emacs defaults.  This makes
+       ;; :extend faces span past the ellipsis.
+       ;; See bug#65896.
+       (if flag ; folding
+           (when (equal ?\n (char-after to))
+             (put-text-property to (1+ to) 'face (get-text-property from 
'face)))
+         ;; unfolding
+         (dolist (region (org-fold-core-get-regions :from from :to to :specs 
spec))
+           (when (equal ?\n (char-after (cadr region)))
+             (font-lock-flush (cadr region) (1+ (cadr region))))))
        (when (eq org-fold-core-style 'overlays)
          (if org-fold-core--keep-overlays
              (mapc



reply via email to

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