Browse Source

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.
Ihor Radchenko 4 năm trước cách đây
mục cha
commit
4c6595d2b4
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      lisp/org.el

+ 2 - 2
lisp/org.el

@@ -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