emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org 38b632d 06/29: org.el/org--get-local-tags: Add cach


From: ELPA Syncer
Subject: [elpa] externals/org 38b632d 06/29: org.el/org--get-local-tags: Add cache support
Date: Sun, 17 Oct 2021 02:57:26 -0400 (EDT)

branch: externals/org
commit 38b632d2ea0471ab57f891473ff96a2b74854034
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org.el/org--get-local-tags: Add cache support
---
 lisp/org.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 8cedfcb..b9a062e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12472,10 +12472,15 @@ TAGS is a list of strings."
 (defun org--get-local-tags ()
   "Return list of tags for the current headline.
 Assume point is at the beginning of the headline."
-  (and (looking-at org-tag-line-re)
-       (split-string (match-string-no-properties 2) ":" t)))
-
-(defun org-get-tags (&optional pos local)
+  (let* ((cached (and (org-element--cache-active-p) (org-element-at-point nil 
'cached)))
+         (cached-tags (org-element-property :tags cached)))
+    (if cached
+        ;; If we do not wrap result into `cl-copy-list', reference would
+        ;; be returned and cache element might be modified directly.
+        (cl-copy-list cached-tags)
+      ;; Parse tags manually.
+      (and (looking-at org-tag-line-re)
+           (split-string (match-string-no-properties 2) ":" t)))))
   "Get the list of tags specified in the current headline.
 
 When argument POS is non-nil, retrieve tags for headline at POS.



reply via email to

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