emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lisp/org.el: Obsolete `org-cached-entry-get' in favor of `org-entry-get'
@ 2024-04-29  0:28 Morgan Smith
  2024-04-29 16:58 ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Morgan Smith @ 2024-04-29  0:28 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Morgan Smith

* 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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-01 20:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29  0:28 [PATCH] lisp/org.el: Obsolete `org-cached-entry-get' in favor of `org-entry-get' Morgan Smith
2024-04-29 16:58 ` Ihor Radchenko
2024-04-29 18:36   ` Morgan Smith
2024-04-30 10:20     ` Ihor Radchenko
2024-05-01 17:14       ` Morgan Smith
2024-05-01 18:43         ` Ihor Radchenko
2024-05-01 19:33           ` Morgan Smith
2024-05-01 20:49             ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).