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

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

[elpa] externals-release/org 57362f7414 3/4: org-copy-visible: Respect b


From: ELPA Syncer
Subject: [elpa] externals-release/org 57362f7414 3/4: org-copy-visible: Respect buffer-invisibility-spec
Date: Sun, 27 Feb 2022 23:57:40 -0500 (EST)

branch: externals-release/org
commit 57362f741492253782e585901d82eedc0da23064
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    org-copy-visible: Respect buffer-invisibility-spec
    
    * lisp/org.el (org-copy-visible): Decide whether text is invisible by
    calling invisible-p rather than checking whether the invisible
    property at point is non-nil.
    
    Text may have a non-nil invisible property but _not_ be hidden from
    the user (and thus should be copied by org-copy-visible).  For
    example, the link itself is shown when org-link-descriptive is nil,
    but it still has an invisible property of `org-link'.
---
 lisp/org.el              |  2 +-
 testing/lisp/test-org.el | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 4fcc2cd900..d656a51591 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17522,7 +17522,7 @@ this numeric value."
   (interactive "r")
   (let ((result ""))
     (while (/= beg end)
-      (if (get-char-property beg 'invisible)
+      (if (invisible-p beg)
           (setq beg (next-single-char-property-change beg 'invisible nil end))
         (let ((next (next-single-char-property-change beg 'invisible nil end)))
           (setq result (concat result (buffer-substring beg next)))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 6e6a1f8520..d552474e21 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -8231,6 +8231,17 @@ CLOSED: %s
      (equal "ab"
            (org-test-with-temp-text
                #("aXXb" 1 2 (invisible t) 2 3 (invisible org-link))
+             (let ((kill-ring nil))
+               (org-copy-visible (point-min) (point-max))
+               (current-kill 0 t)))))
+    ;; Copies text based on what's actually visible, as defined by
+    ;; `buffer-invisibility-spec'.
+    (should
+     (equal "aYb"
+           (org-test-with-temp-text
+               #("aXYb"
+                  1 2 (invisible t)
+                  2 3 (invisible org-test-copy-visible))
              (let ((kill-ring nil))
                (org-copy-visible (point-min) (point-max))
                (current-kill 0 t)))))))



reply via email to

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