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

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

[elpa] externals/org 92c53f23d3: org-get-outline-path: Drop COMMENT keyw


From: ELPA Syncer
Subject: [elpa] externals/org 92c53f23d3: org-get-outline-path: Drop COMMENT keywords from the outline path
Date: Thu, 18 Jan 2024 09:58:40 -0500 (EST)

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

    org-get-outline-path: Drop COMMENT keywords from the outline path
    
    * lisp/org.el (org--get-outline-path-1): Remove comment keyword from
    title when current heading is commented.
    * testing/lisp/test-org.el (test-org/get-outline-path): Add test.
---
 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 bd4537f5aa..8929a72172 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7500,6 +7500,8 @@ Assume buffer is widened and point is on a headline."
                           (replace-regexp-in-string
                            "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
                            (match-string-no-properties 4))))))))
+        (when (org-element-property :commentedp (org-element-at-point))
+          (setq heading (replace-regexp-in-string (format "^%s[ \t]*" 
org-comment-string) "" heading)))
        (if (org-up-heading-safe)
            (let ((path (cons heading (org--get-outline-path-1 use-cache))))
              (when use-cache
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 62d841b373..822cbc67a7 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2780,7 +2780,16 @@ test <point>
      (org-get-outline-path)))
   (should
    (org-test-with-temp-text "* \n** H<point>"
-     (org-get-outline-path))))
+     (org-get-outline-path)))
+  ;; Remove COMMENTED keywords.
+  (should
+   (equal '("This" "is")
+          (org-test-with-temp-text
+              "* COMMENT This
+** COMMENT is
+*** test<point>
+"
+            (org-get-outline-path)))))
 
 (ert-deftest test-org/format-outline-path ()
   "Test `org-format-outline-path' specifications."



reply via email to

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