emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "E.L.K." <some.any.key@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Org mode patch: when building sparse tree, suggest only local tags in minibuffer
Date: Tue, 16 Jun 2020 14:15:39 +0300	[thread overview]
Message-ID: <CAF+cOoN1jjhz3FvL0tr6EOr3fJACcKe8U36VB8zHA=C_j+SaMg@mail.gmail.com> (raw)

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


I found that if I do "C-c C-c" on heading, it suggests only local tags in
the minibuffer, but when I do "C-m / m" (build sparse tree) it suggests
agenda tags together with local tags.

It does not make sense to build sparse tree in buffer using tags that are
not in this buffer, I think. So there is small patch in attempt to fix it.


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

[-- Attachment #2: don-t-show-global-tags-in-sparse-tree-match.patch --]
[-- Type: text/x-patch, Size: 3192 bytes --]

Common subdirectories: /home/elk/.emacs.d/elpa/org-9.3.6/etc and /home/elk/temp/org-9.3.6/etc
diff -U 10 --color /home/elk/.emacs.d/elpa/org-9.3.6/org.el /home/elk/temp/org-9.3.6/org.el
--- /home/elk/.emacs.d/elpa/org-9.3.6/org.el	2020-06-15 19:07:22.148502633 +0300
+++ /home/elk/temp/org-9.3.6/org.el	2020-06-15 19:04:18.927678900 +0300
@@ -11924,21 +11924,21 @@
 MATCH is a string with match syntax.  It can contain a selection
 of tags (\"+work+urgent-boss\"), properties (\"LEVEL>3\"), and
 TODO keywords (\"TODO=\\\"WAITING\\\"\") or a combination of
 those.  See the manual for details.
 If optional argument TODO-ONLY is non-nil, only select lines that
 are also TODO tasks."
   (interactive "P")
   (org-agenda-prepare-buffers (list (current-buffer)))
   (let ((org--matcher-tags-todo-only todo-only))
-    (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match t))
+    (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match))
 (defalias 'org-tags-sparse-tree 'org-match-sparse-tree)
 (defvar org-cached-props nil)
 (defun org-cached-entry-get (pom property)
   (if (or (eq t org-use-property-inheritance)
 	  (and (stringp org-use-property-inheritance)
 	       (let ((case-fold-search t))
 		 (string-match-p org-use-property-inheritance property)))
@@ -11965,21 +11965,21 @@
 		     (set-buffer (find-file-noselect file))
 		      (mapcar (lambda (x)
 				(and (stringp (car-safe x))
 				     (list (car-safe x))))
 		   (if (car-safe files) files
-(defun org-make-tags-matcher (match &optional only-local-tags)
+(defun org-make-tags-matcher (match)
   "Create the TAGS/TODO matcher form for the selection string MATCH.
 Returns a cons of the selection string MATCH and a function
 implementing the matcher.
 The matcher is to be called at an Org entry, with point on the
 headline, and returns non-nil if the entry matches the selection
 string MATCH.  It must be called with three arguments: the TODO
 keyword at the entry (or nil if none), the list of all tags at
 the entry including inherited ones and the reduced level of the
@@ -11990,22 +11990,21 @@
 a non-nil value if the matcher restricts matching to TODO
 entries, otherwise it is not touched.
 See also `org-scan-tags'."
   (unless match
     ;; Get a new match request, with completion against the global
     ;; tags table and the local tags in current buffer.
     (let ((org-last-tags-completion-table
-	    (unless only-local-tags
-              (org-global-tags-completion-table)))))
+	    (org-global-tags-completion-table))))
       (setq match
 	     "Match: "
 	     'org-tags-completion-function nil nil nil 'org-tags-history))))
   (let ((match0 match)
 	(re (concat
Binary files /home/elk/.emacs.d/elpa/org-9.3.6/org.elc and /home/elk/temp/org-9.3.6/org.elc differ

             reply	other threads:[~2020-06-16 11:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 11:15 E.L.K. [this message]
2020-09-05  9:10 ` Org mode patch: when building sparse tree, suggest only local tags in minibuffer Bastien
  -- strict thread matches above, loose matches on Subject: below --
2020-06-15 18:55 E.L.K.

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:

  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='CAF+cOoN1jjhz3FvL0tr6EOr3fJACcKe8U36VB8zHA=C_j+SaMg@mail.gmail.com' \
    --to=some.any.key@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).