emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] org-make-tags-matcher: Compile returned function


From: Morgan Smith
Subject: [PATCH] org-make-tags-matcher: Compile returned function
Date: Sun, 28 Apr 2024 20:06:48 -0400

This should result in a nice performance boost when the function is
called repeatedly (as is often done).

* lisp/org.el (org-make-tags-matcher): Evaluate returned function to
compile it into a closure.
---

Hello!

All tests pass.

I don't have any rigorous benchmarks but this does make things significantly
faster.  This actually seems to have a bigger performance impact on
`org-clock-sum' then my rewrite of `org-clock-sum' I submitted earlier does.
Which is a little frustrating honestly.

It does involve using the `eval' function which I know is a little taboo.
Although in this case I don't believe it actually adds any danger.

Thanks,

Morgan

 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 084132fb3..80ffeeccf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11726,7 +11726,7 @@ See also `org-scan-tags'."
                     (or tagsmatcher todomatcher t))))
       (when org--matcher-tags-todo-only
        (setq matcher `(and (member todo org-not-done-keywords) ,matcher)))
-      (cons match0 `(lambda (todo tags-list level) ,matcher)))))
+      (cons match0 (eval `(lambda (todo tags-list level) ,matcher) t)))))
 
 (defun org--tags-expand-group (group tag-groups expanded)
   "Recursively expand all tags in GROUP, according to TAG-GROUPS.
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]