Skip to content

Commit

Permalink
org-in-archived-heading-p: Improve performance
Browse files Browse the repository at this point in the history
* lisp/org.el (org-in-archived-heading-p): Use explicit `while' loop
instead of `org-element-lineage'.
  • Loading branch information
yantar92 committed Sep 21, 2022
1 parent e9bd219 commit c35a856
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lisp/org.el
Original file line number Diff line number Diff line change
Expand Up @@ -20156,9 +20156,13 @@ Optional argument ELEMENT contains element at point."
(cl-some (apply-partially #'string= org-archive-tag) tags)))))
(no-inheritance nil)
(t
(if (org-element--cache-active-p)
(cl-some (lambda (el) (org-element-property :archivedp el))
(org-element-lineage (or element (org-element-at-point)) nil t))
(if (or element (org-element--cache-active-p))
(catch :archived
(unless element (setq element (org-element-at-point)))
(while element
(when (org-element-property :archivedp element)
(throw :archived t))
(setq element (org-element-property :parent element))))
(save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p)))))))

(defun org-at-comment-p nil
Expand Down

0 comments on commit c35a856

Please sign in to comment.