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.


I'm not subscribed, so please CC me.
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 via email to