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

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

[elpa] externals/org ec8f359bd6 046/101: org-in-commented-heading-p: Use


From: ELPA Syncer
Subject: [elpa] externals/org ec8f359bd6 046/101: org-in-commented-heading-p: Use org-element API
Date: Sat, 1 Jul 2023 09:59:06 -0400 (EDT)

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

    org-in-commented-heading-p: Use org-element API
---
 lisp/org.el | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index fbc83d4c36..72ae318b9f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20514,20 +20514,15 @@ This function also checks ancestors of the current 
headline,
 unless optional argument NO-INHERITANCE is non-nil.
 
 Optional argument ELEMENT contains element at point."
-  (save-match-data
-    (let ((el (or element
-                  (org-element-at-point nil 'cached)
-                  (org-with-wide-buffer
-                   (org-back-to-heading-or-point-min t)
-                   (org-element-at-point)))))
-      (catch :found
-        (setq el (org-element-lineage el '(headline inlinetask) 'include-self))
-        (if no-inheritance
-            (org-element-property :commentedp el)
-          (while el
-            (when (org-element-property :commentedp el)
-              (throw :found t))
-            (setq el (org-element-parent el))))))))
+  (unless element
+    (setq
+     element
+     (org-element-lineage
+      (org-element-at-point)
+      '(headline inlinetask) 'with-self)))
+  (if no-inheritance
+      (org-element-property :commentedp element)
+    (org-element-property-inherited :commentedp element 'with-self)))
 
 (defun org-in-archived-heading-p (&optional no-inheritance element)
   "Non-nil if point is under an archived heading.



reply via email to

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