[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 3e3588dc75 1/3: org-agenda-skip: Improve performanc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 3e3588dc75 1/3: org-agenda-skip: Improve performance |
Date: |
Wed, 21 Sep 2022 23:57:52 -0400 (EDT) |
branch: externals/org
commit 3e3588dc756bad62a99e6a6aea8e3b62d25240b8
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
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.
---
lisp/org-agenda.el | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 1d8b871d89..44af6aa1e6 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -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.