emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH] lisp/org.el: Obsolete `org-cached-entry-get' in favor of `org-en


From: Morgan Smith
Subject: [PATCH] lisp/org.el: Obsolete `org-cached-entry-get' in favor of `org-entry-get'
Date: Sun, 28 Apr 2024 20:28:36 -0400

* lisp/org.el (org-cached-entry-get): Rewrite in terms
`org-entry-get'.  Obsolete in favor of `org-entry-get'.
(org-make-tags-matcher): Replace uses of `org-cached-entry-get' with
`org-entry-get'.
---
Hello!

All tests pass.

I don't think we can justify the existence of this function but let me know if
I'm wrong.

The caching mechanism used here is likely to cause hard to diagnose issues.

All of the logic here already exists in `org-entry-get'.

This function is mentioned in very few commits unlike its more popular sibling.

Thanks,

Morgan

 lisp/org.el | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c91029c7f..80ffeeccf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11480,21 +11480,10 @@ are also TODO tasks."
 
 (defalias 'org-tags-sparse-tree 'org-match-sparse-tree)
 
-(defvar org-cached-props nil)
 (defun org-cached-entry-get (pom property)
-  (if (or (eq t org-use-property-inheritance)
-         (and (stringp org-use-property-inheritance)
-              (let ((case-fold-search t))
-                (string-match-p org-use-property-inheritance property)))
-         (and (listp org-use-property-inheritance)
-              (member-ignore-case property org-use-property-inheritance)))
-      ;; Caching is not possible, check it directly.
-      (org-entry-get pom property 'inherit)
-    ;; Get all properties, so we can do complicated checks easily.
-    (cdr (assoc-string property
-                      (or org-cached-props
-                          (setq org-cached-props (org-entry-properties pom)))
-                      t))))
+  (org-entry-get pom property 'selective))
+
+(make-obsolete 'org-cached-entry-get "use `org-entry-get' instead." "9.7")
 
 (defun org-global-tags-completion-table (&optional files)
   "Return the list of all tags in all agenda buffer/files.
@@ -11670,7 +11659,7 @@ See also `org-scan-tags'."
                                   ("CATEGORY"
                                    '(org-get-category (point)))
                                   ("TODO" 'todo)
-                                  (p `(org-cached-entry-get nil ,p))))
+                                  (p `(org-entry-get (point) ,p 'selective))))
                             ;; Determine operand (aka. property
                             ;; value).
                             (pv (match-string 8 term))
@@ -11707,7 +11696,7 @@ See also `org-scan-tags'."
              (setq term rest)))
          (push `(and ,@tagsmatcher) orlist)
          (setq tagsmatcher nil))
-       (setq tagsmatcher `(progn (setq org-cached-props nil) (or ,@orlist)))))
+       (setq tagsmatcher `(or ,@orlist))))
 
     ;; Make the TODO matcher.
     (when (org-string-nw-p todomatch)
-- 
2.41.0




reply via email to

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