emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] [C-c C-q] completing tags from both buffer-local and global alist of tags
Date: Wed, 2 Dec 2020 17:30:52 +0800	[thread overview]
Message-ID: <CAL1eYuLhApCNfcx3veEtR+=J8HBs-JaUFc-fThfrdUxRxQMSug@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 449 bytes --]

The default [C-c C-q] completing tags only retrieve tags from current
buffer locally.

By this patch, will merge both buffer-local tags and user defined global
`org-tags-alist`.

This is more reasonable.


[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

[-- Attachment #1.2: Type: text/html, Size: 1292 bytes --]

[-- Attachment #2: 0001-org.el-Complete-tags-from-both-global-and-buffer-loc.patch --]
[-- Type: text/x-patch, Size: 1116 bytes --]

From c1f88411835f34a8c571547bf8156c98f18d2b2e Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Wed, 2 Dec 2020 17:24:29 +0800
Subject: [PATCH] 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.
---
 lisp/org.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0e12e4b15..0249a43c3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12256,10 +12256,11 @@ (defun org-fast-tag-selection (current inherited table &optional todo-table)
 		    (condition-case nil
 			(setq tg (completing-read
 				  "Tag: "
-				  (or buffer-tags
-				      (with-current-buffer buf
-					(setq buffer-tags
-					      (org-get-buffer-tags))))))
+				  (append (or buffer-tags
+					      (with-current-buffer buf
+						(setq buffer-tags
+						      (org-get-buffer-tags))))
+					  (org-global-tags-completion-table))))
 		      (quit (setq tg "")))
 		    (when (string-match "\\S-" tg)
 		      (cl-pushnew (list tg) buffer-tags :test #'equal)
-- 
2.29.2


             reply	other threads:[~2020-12-02 10:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02  9:30 stardiviner [this message]
2020-12-03  2:40 ` [PATCH] I updated patch by deleteing duplicate tags stardiviner
2021-01-07  2:37   ` Christopher Miles
2021-01-10 22:10   ` Kyle Meyer
2021-01-11  2:24     ` Christopher Miles
2021-01-13  3:26       ` Kyle Meyer
2021-01-13  9:30         ` Christopher Miles
2021-01-14  5:24           ` Kyle Meyer
2021-01-14  6:12             ` [APPLIED] " Christopher Miles
2021-04-25  3:25             ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL1eYuLhApCNfcx3veEtR+=J8HBs-JaUFc-fThfrdUxRxQMSug@mail.gmail.com' \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [PATCH] [C-c C-q] completing tags from both buffer-local and global alist of tags' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).