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

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

[elpa] externals/org 86ad8d2 1/2: org.el: Complete tags from both global


From: ELPA Syncer
Subject: [elpa] externals/org 86ad8d2 1/2: org.el: Complete tags from both global and buffer local
Date: Thu, 14 Jan 2021 00:57:12 -0500 (EST)

branch: externals/org
commit 86ad8d2791ac141bc0b39e21f5e114387fd817a0
Author: stardiviner <numbchild@gmail.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    org.el: Complete tags from both global and buffer local
    
    * lisp/org.el (org-fast-tag-selection): Merge buffer local tags with
    global alist of tags. And it obeys the option
    org-complete-tags-always-offer-all-agenda-tags.
    
    * doc/org-manual.org: Update the TAB key doc in tags selection UI.
    
    * etc/ORG-NEWS: Mention the change in org-set-tags-command.
---
 doc/org-manual.org |  7 ++++---
 etc/ORG-NEWS       |  7 +++++++
 lisp/org.el        | 25 +++++++++++++++----------
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b015b50..e717f92 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -4860,9 +4860,10 @@ In this interface, you can also use the following 
special keys:
 
   #+kindex: TAB
   Enter a tag in the minibuffer, even if the tag is not in the
-  predefined list.  You can complete on all tags present in the
-  buffer.  You can also add several tags: just separate them with
-  a comma.
+  predefined list.  You can complete on all tags present in the buffer
+  and globally pre-defined tags from ~org-tag-alist~ and
+  ~org-tag-persistent-alist~.  You can also add several tags: just
+  separate them with a comma.
 
 - {{{kbd(SPC)}}} ::
 
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 5e5f195..ba76922 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -149,6 +149,13 @@ Example:
 A new =u= mode flag for Calc formulas in Org tables has been added to
 enable Calc units simplification mode.
 
+*** =org-set-tags-command= select tags from ~org-global-tags-completion-table~
+
+Let ~org-set-tags-command~ TAB fast tag completion interface complete
+tags including from both buffer local and user defined persistent
+global list (~org-tag-alist~ and ~org-tag-persistent-alist~).  Now
+option ~org-complete-tags-always-offer-all-agenda-tags~ is honored.
+
 ** Miscellaneous
 *** =org-goto-first-child= now works before first heading
 
diff --git a/lisp/org.el b/lisp/org.el
index 5b0ae38..5b1443c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12139,7 +12139,7 @@ Returns the new tags string, or nil to not change the 
current settings."
                                  fulltable))))
         (buf (current-buffer))
         (expert (eq org-fast-tag-selection-single-key 'expert))
-        (buffer-tags nil)
+        (tab-tags nil)
         (fwidth (+ maxlen 3 1 3))
         (ncol (/ (- (window-width) 4) fwidth))
         (i-face 'org-done)
@@ -12274,16 +12274,21 @@ Returns the new tags string, or nil to not change the 
current settings."
                    (setq current nil)
                    (when exit-after-next (setq exit-after-next 'now)))
                   ((= c ?\t)
-                   (condition-case nil
-                       (setq tg (completing-read
-                                 "Tag: "
-                                 (or buffer-tags
-                                     (with-current-buffer buf
-                                       (setq buffer-tags
-                                             (org-get-buffer-tags))))))
-                     (quit (setq tg "")))
+                    (condition-case nil
+                        (unless tab-tags
+                          (setq tab-tags
+                                (delq nil
+                                      (mapcar (lambda (x)
+                                                (let ((item (car-safe x)))
+                                                  (and (stringp item)
+                                                       (list item))))
+                                              (org--tag-add-to-alist
+                                               (with-current-buffer buf
+                                                 (org-get-buffer-tags))
+                                               table))))))
+                    (setq tg (completing-read "Tag: " tab-tags))
                    (when (string-match "\\S-" tg)
-                     (cl-pushnew (list tg) buffer-tags :test #'equal)
+                     (cl-pushnew (list tg) tab-tags :test #'equal)
                      (if (member tg current)
                          (setq current (delete tg current))
                        (push tg current)))



reply via email to

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