forked from mirrors/org-mode
org-agenda-skip: Improve performance
* lisp/org-agenda.el: Remove unnecessary variable assignment. Prefer checking ELEMENT type over regexp match when checking if we are inside comment. Postpone let-binding until it is strictly necessary.
This commit is contained in:
parent
95df82c5fc
commit
3e3588dc75
|
@ -4212,22 +4212,25 @@ Also moves point to the end of the skipped region, so that search can
|
|||
continue from there.
|
||||
|
||||
Optional argument ELEMENT contains element at point."
|
||||
(let ((p (line-beginning-position)) to)
|
||||
(when (or
|
||||
(save-excursion (goto-char p) (looking-at comment-start-skip))
|
||||
(and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
|
||||
(or (and (save-match-data (org-in-archived-heading-p nil element))
|
||||
(org-end-of-subtree t element))
|
||||
(and (member org-archive-tag org-file-tags)
|
||||
(goto-char (point-max)))))
|
||||
(and org-agenda-skip-comment-trees
|
||||
(org-in-commented-heading-p nil element)
|
||||
(org-end-of-subtree t element))
|
||||
(and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global)
|
||||
(org-agenda-skip-eval org-agenda-skip-function)))
|
||||
(goto-char to))
|
||||
(org-in-src-block-p t element))
|
||||
(throw :skip t))))
|
||||
(when (or
|
||||
(if element
|
||||
(eq (org-element-type element) 'comment)
|
||||
(save-excursion
|
||||
(goto-char (line-beginning-position))
|
||||
(looking-at comment-start-skip)))
|
||||
(and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
|
||||
(or (and (save-match-data (org-in-archived-heading-p nil element))
|
||||
(org-end-of-subtree t element))
|
||||
(and (member org-archive-tag org-file-tags)
|
||||
(goto-char (point-max)))))
|
||||
(and org-agenda-skip-comment-trees
|
||||
(org-in-commented-heading-p nil element)
|
||||
(org-end-of-subtree t element))
|
||||
(let ((to (or (org-agenda-skip-eval org-agenda-skip-function-global)
|
||||
(org-agenda-skip-eval org-agenda-skip-function))))
|
||||
(and to (goto-char to)))
|
||||
(org-in-src-block-p t element))
|
||||
(throw :skip t)))
|
||||
|
||||
(defun org-agenda-skip-eval (form)
|
||||
"If FORM is a function or a list, call (or eval) it and return the result.
|
||||
|
|
Loading…
Reference in New Issue