[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 78abbcd 07/29: org.el/org-get-tags: Support cache a
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 78abbcd 07/29: org.el/org-get-tags: Support cache and passing element arg |
Date: |
Sun, 17 Oct 2021 02:57:26 -0400 (EDT) |
branch: externals/org
commit 78abbcd052624b6198ad8bb4f2f72d9257b502f7
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org.el/org-get-tags: Support cache and passing element arg
* lisp/org.el (org-fast-tag-selection): Allowing passing an element or
position as first argument. Add cache support.
---
lisp/org.el | 56 ++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 38 insertions(+), 18 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index b9a062e..b76d83f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12481,9 +12481,12 @@ Assume point is at the beginning of the headline."
;; Parse tags manually.
(and (looking-at org-tag-line-re)
(split-string (match-string-no-properties 2) ":" t)))))
+
+(defun org-get-tags (&optional pos-or-element local)
"Get the list of tags specified in the current headline.
-When argument POS is non-nil, retrieve tags for headline at POS.
+When argument POS-OR-ELEMENT is non-nil, retrieve tags for headline at
+POS.
According to `org-use-tag-inheritance', tags may be inherited
from parent headlines, and from the whole document, through
@@ -12496,23 +12499,40 @@ However, when optional argument LOCAL is non-nil,
only return
tags specified at the headline.
Inherited tags have the `inherited' text property."
- (if (and org-trust-scanner-tags
- (or (not pos) (eq pos (point)))
- (not local))
- org-scanner-tags
- (org-with-point-at (or pos (point))
- (unless (org-before-first-heading-p)
- (org-back-to-heading t)
- (let ((ltags (org--get-local-tags)) itags)
- (if (or local (not org-use-tag-inheritance)) ltags
- (while (org-up-heading-safe)
- (setq itags (nconc (mapcar #'org-add-prop-inherited
- (org--get-local-tags))
- itags)))
- (setq itags (append org-file-tags itags))
- (nreverse
- (delete-dups
- (nreverse (nconc (org-remove-uninherited-tags itags)
ltags))))))))))
+ (save-match-data
+ (if (and org-trust-scanner-tags
+ (or (not pos-or-element) (eq pos-or-element (point)))
+ (not local))
+ org-scanner-tags
+ (org-with-point-at (unless (org-element-type pos-or-element)
+ (or pos-or-element (point)))
+ (unless (and (not (org-element-type pos-or-element))
+ (org-before-first-heading-p))
+ (unless (org-element-type pos-or-element) (org-back-to-heading t))
+ (let ((ltags (if (org-element-type pos-or-element)
+ (org-element-property :tags (org-element-lineage
pos-or-element '(headline) t))
+ (org--get-local-tags)))
+ itags)
+ (if (or local (not org-use-tag-inheritance)) ltags
+ (let ((cached (and (org-element--cache-active-p)
+ (if (org-element-type pos-or-element)
+ (org-element-lineage pos-or-element
'(headline) t)
+ (org-element-at-point nil 'cached)))))
+ (if cached
+ (while (setq cached (org-element-property :parent cached))
+ (setq itags (nconc (mapcar #'org-add-prop-inherited
+ ;; If we do not wrap result
into `cl-copy-list', reference would
+ ;; be returned and cache
element might be modified directly.
+ (cl-copy-list
(org-element-property :tags cached)))
+ itags)))
+ (while (org-up-heading-safe)
+ (setq itags (nconc (mapcar #'org-add-prop-inherited
+ (org--get-local-tags))
+ itags)))))
+ (setq itags (append org-file-tags itags))
+ (nreverse
+ (delete-dups
+ (nreverse (nconc (org-remove-uninherited-tags itags)
ltags)))))))))))
(defun org-get-buffer-tags ()
"Get a table of all tags used in the buffer, for completion."
- [elpa] externals/org updated (9475993 -> f4bcc0c), ELPA Syncer, 2021/10/17
- [elpa] externals/org 6933c1a 01/29: lisp/org-persist.el: New library to store data across sessions, ELPA Syncer, 2021/10/17
- [elpa] externals/org fc80d05 02/29: Re-implement org-element-cache and add headline support, ELPA Syncer, 2021/10/17
- [elpa] externals/org bc52c4d 03/29: Fix compatibility for older Emacs versions, ELPA Syncer, 2021/10/17
- [elpa] externals/org 68a44ea 04/29: org.el/org-narrow-to-subtree: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 7159ec0 05/29: org.el/org-at-planning-p: Add cache support, ELPA Syncer, 2021/10/17
- [elpa] externals/org 38b632d 06/29: org.el/org--get-local-tags: Add cache support, ELPA Syncer, 2021/10/17
- [elpa] externals/org 78abbcd 07/29: org.el/org-get-tags: Support cache and passing element arg,
ELPA Syncer <=
- [elpa] externals/org 5bf5fdb 09/29: org.el/org-entry-get-with-inheritance: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 5d162b7 10/29: org.el/org-back-to-heading: Handle inlinetasks correctly, ELPA Syncer, 2021/10/17
- [elpa] externals/org f4bcc0c 29/29: Merge branch 'main' into feature/org-element-cache-new, ELPA Syncer, 2021/10/17
- [elpa] externals/org fede258 15/29: org.el/org-in-archived-heading-p: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 07ca988 24/29: Fix compatibility with Emacs 27, ELPA Syncer, 2021/10/17
- [elpa] externals/org eeb0450 26/29: Use XDG cache dir as default dir for cache persistance, ELPA Syncer, 2021/10/17
- [elpa] externals/org 8ceb9e7 27/29: Add NEWS entry for new element cache, ELPA Syncer, 2021/10/17
- [elpa] externals/org 85e0a69 20/29: Avoid frequent cache updates in some functions, ELPA Syncer, 2021/10/17
- [elpa] externals/org 7b83168 08/29: org.el/org--property-local-values: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org ec73755 12/29: org.el/org-end-of-subtree: Support cache and passing element arg, ELPA Syncer, 2021/10/17