org-in-archived-heading-p: Use ELEMENT arg more optimally

* lisp/org.el (org-in-archived-heading-p): Do not check for point
position when ELEMENT is provided and use ELEMENT when checking
archive status of ancestors.
This commit is contained in:
Ihor Radchenko 2021-10-25 19:15:14 +08:00
parent 30f1f187d1
commit 4c6595d2b4
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 2 deletions

View File

@ -20747,7 +20747,7 @@ unless optional argument NO-INHERITANCE is non-nil.
Optional argument ELEMENT contains element at point."
(cond
((org-before-first-heading-p) nil)
((and (not element) (org-before-first-heading-p)) nil)
((if element
(org-element-property :archivedp element)
(let ((tags (org-get-tags element 'local)))
@ -20757,7 +20757,7 @@ Optional argument ELEMENT contains element at point."
(t
(if (org-element--cache-active-p)
(cl-some (lambda (el) (org-element-property :archivedp el))
(org-element-lineage (org-element-at-point) nil t))
(org-element-lineage (or element (org-element-at-point)) nil t))
(save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p)))))))
(defun org-at-comment-p nil