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

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

[elpa] externals/org 147ca39750 3/7: org-in-commented-heading-p: Do not


From: ELPA Syncer
Subject: [elpa] externals/org 147ca39750 3/7: org-in-commented-heading-p: Do not parse section unless already cached
Date: Sun, 12 Jun 2022 05:57:46 -0400 (EDT)

branch: externals/org
commit 147ca39750e089525bed8f624c01e3ddc08f593e
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-in-commented-heading-p: Do not parse section unless already cached
    
    * lisp/org.el (org-in-commented-heading-p): When element at point is
    not yet in cache, parse the parent headline instead of also parsing
    section up to point.
---
 lisp/org.el | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 94eafb393b..8e7aadde58 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19822,26 +19822,19 @@ 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))))
-      (if el
-          (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-property :parent el)))))
-        (cond
-         ((org-before-first-heading-p) nil)
-         ((let ((headline (nth 4 (org-heading-components))))
-            (and headline
-                (let ((case-fold-search nil))
-                  (string-match-p (concat "^" org-comment-string "\\(?: 
\\|$\\)")
-                                  headline)))))
-         (no-inheritance nil)
-         (t
-          (save-excursion (and (org-up-heading-safe) 
(org-in-commented-heading-p)))))))))
+    (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-property :parent el))))))))
 
 (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]