mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-29 07:58:21 +00:00
org.el/org-in-archived-heading-p: Support cache and passing element arg
This commit is contained in:
parent
86345df9ab
commit
fede2588e4
19
lisp/org.el
19
lisp/org.el
@ -20639,18 +20639,25 @@ Optional argument ELEMENT contains element at point."
|
||||
(t
|
||||
(save-excursion (and (org-up-heading-safe) (org-in-commented-heading-p))))))))
|
||||
|
||||
(defun org-in-archived-heading-p (&optional no-inheritance)
|
||||
(defun org-in-archived-heading-p (&optional no-inheritance element)
|
||||
"Non-nil if point is under an archived heading.
|
||||
This function also checks ancestors of the current headline,
|
||||
unless optional argument NO-INHERITANCE is non-nil."
|
||||
unless optional argument NO-INHERITANCE is non-nil.
|
||||
|
||||
Optional argument ELEMENT contains element at point."
|
||||
(cond
|
||||
((org-before-first-heading-p) nil)
|
||||
((let ((tags (org-get-tags nil 'local)))
|
||||
(and tags
|
||||
(cl-some (apply-partially #'string= org-archive-tag) tags))))
|
||||
((if element
|
||||
(org-element-property :archivedp element)
|
||||
(let ((tags (org-get-tags element 'local)))
|
||||
(and tags
|
||||
(cl-some (apply-partially #'string= org-archive-tag) tags)))))
|
||||
(no-inheritance nil)
|
||||
(t
|
||||
(save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p))))))
|
||||
(if (org-element--cache-active-p)
|
||||
(cl-some (lambda (el) (org-element-property :archivedp el))
|
||||
(org-element-lineage (org-element-at-point) nil t))
|
||||
(save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p)))))))
|
||||
|
||||
(defun org-at-comment-p nil
|
||||
"Return t if cursor is in a commented line."
|
||||
|
Loading…
Reference in New Issue
Block a user