[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 86345df 14/29: org.el/org-in-commented-heading-p: S
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 86345df 14/29: org.el/org-in-commented-heading-p: Support cache and passing element arg |
Date: |
Sun, 17 Oct 2021 02:57:28 -0400 (EDT) |
branch: externals/org
commit 86345df9ab24982c8d7e6a0d518e1d7dc5ae509b
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org.el/org-in-commented-heading-p: Support cache and passing element arg
---
lisp/org.el | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index ea43d66..c17c24d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20612,20 +20612,32 @@ instead of back to heading."
"Non-nil when on a headline."
(outline-on-heading-p t))
-(defun org-in-commented-heading-p (&optional no-inheritance)
+(defun org-in-commented-heading-p (&optional no-inheritance element)
"Non-nil if point is under a commented heading.
This function also checks ancestors of the current headline,
-unless optional argument NO-INHERITANCE is non-nil."
- (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))))))
+unless optional argument NO-INHERITANCE is non-nil.
+
+Optional argument ELEMENT contains element at point."
+ (save-match-data
+ (if-let ((el (or element (org-element-at-point nil 'cached))))
+ (catch :found
+ (setq el (org-element-lineage el '(headline) '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))))))))
(defun org-in-archived-heading-p (&optional no-inheritance)
"Non-nil if point is under an archived heading.
- [elpa] externals/org 8ceb9e7 27/29: Add NEWS entry for new element cache, (continued)
- [elpa] externals/org 8ceb9e7 27/29: Add NEWS entry for new element cache, ELPA Syncer, 2021/10/17
- [elpa] externals/org 85e0a69 20/29: Avoid frequent cache updates in some functions, ELPA Syncer, 2021/10/17
- [elpa] externals/org 7b83168 08/29: org.el/org--property-local-values: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org ec73755 12/29: org.el/org-end-of-subtree: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org fe6cefd 16/29: ox.el: Support cache during export, ELPA Syncer, 2021/10/17
- [elpa] externals/org 60c927f 17/29: Add new element parser and cache tests, ELPA Syncer, 2021/10/17
- [elpa] externals/org 3c4290e 21/29: org.el/org-scan-tags: Make use of fast `org-element-cache-map', ELPA Syncer, 2021/10/17
- [elpa] externals/org 004ac14 28/29: Fix compatibility with Emacs 26, ELPA Syncer, 2021/10/17
- [elpa] externals/org d437817 11/29: org.el/org-goto-first-child: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 399a29c 13/29: org.el/org-up-heading-safe: Add cache support, ELPA Syncer, 2021/10/17
- [elpa] externals/org 86345df 14/29: org.el/org-in-commented-heading-p: Support cache and passing element arg,
ELPA Syncer <=
- [elpa] externals/org 5aeeb4f 19/29: Use `org-element-at-point-no-context' in performance-critical places, ELPA Syncer, 2021/10/17
- [elpa] externals/org e70a8aa 18/29: Use org-element-cache in place of text property cache in agenda, ELPA Syncer, 2021/10/17
- [elpa] externals/org 885808f 22/29: Fix incorrectly written test, ELPA Syncer, 2021/10/17
- [elpa] externals/org 85712d6 25/29: Add comments documenting cache diagnostics, ELPA Syncer, 2021/10/17
- [elpa] externals/org abe7222 23/29: Add declares to suppress compiler warnings, ELPA Syncer, 2021/10/17