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

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

[elpa] externals/org 3024e933c0 053/101: org-get-buffer-tags: Switch to


From: ELPA Syncer
Subject: [elpa] externals/org 3024e933c0 053/101: org-get-buffer-tags: Switch to org-element API
Date: Sat, 1 Jul 2023 09:59:12 -0400 (EDT)

branch: externals/org
commit 3024e933c0917661a58e9321ea4e5b85313bd697
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-get-buffer-tags: Switch to org-element API
---
 lisp/org.el | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index a29ca51f18..7b33eab905 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12287,24 +12287,15 @@ Inherited tags have the `inherited' text property."
 
 (defun org-get-buffer-tags ()
   "Get a table of all tags used in the buffer, for completion."
-  (if (org-element--cache-active-p)
-      ;; `org-element-cache-map' is about 2x faster compared to regexp
-      ;; search.
-      (let ((hashed (make-hash-table :test #'equal)))
-        (org-element-cache-map
-         (lambda (el)
-           (dolist (tag (org-element-property :tags el))
-             ;; Do not carry over the text properties.  They may look
-             ;; ugly in the completion.
-             (puthash (list (substring-no-properties tag)) t hashed))))
-        (dolist (tag org-file-tags) (puthash (list tag) t hashed))
-        (hash-table-keys hashed))
-    (org-with-point-at 1
-      (let (tags)
-        (while (re-search-forward org-tag-line-re nil t)
-         (setq tags (nconc (split-string (match-string-no-properties 2) ":")
-                           tags)))
-        (mapcar #'list (delete-dups (append org-file-tags tags)))))))
+  (let ((hashed (make-hash-table :test #'equal)))
+    (org-element-cache-map
+     (lambda (el)
+       (dolist (tag (org-element-property :tags el))
+         ;; Do not carry over the text properties.  They may look
+         ;; ugly in the completion.
+         (puthash (list (substring-no-properties tag)) t hashed))))
+    (dolist (tag org-file-tags) (puthash (list tag) t hashed))
+    (hash-table-keys hashed)))
 
 ;;;; The mapping API
 



reply via email to

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