Skip to content

Commit c35a856

Browse files
committed
org-in-archived-heading-p: Improve performance
* lisp/org.el (org-in-archived-heading-p): Use explicit `while' loop instead of `org-element-lineage'.
1 parent e9bd219 commit c35a856

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lisp/org.el

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20156,9 +20156,13 @@ Optional argument ELEMENT contains element at point."
2015620156
(cl-some (apply-partially #'string= org-archive-tag) tags)))))
2015720157
(no-inheritance nil)
2015820158
(t
20159-
(if (org-element--cache-active-p)
20160-
(cl-some (lambda (el) (org-element-property :archivedp el))
20161-
(org-element-lineage (or element (org-element-at-point)) nil t))
20159+
(if (or element (org-element--cache-active-p))
20160+
(catch :archived
20161+
(unless element (setq element (org-element-at-point)))
20162+
(while element
20163+
(when (org-element-property :archivedp element)
20164+
(throw :archived t))
20165+
(setq element (org-element-property :parent element))))
2016220166
(save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p)))))))
2016320167

2016420168
(defun org-at-comment-p nil

0 commit comments

Comments
 (0)