Re: Org mode patch: when building sparse tree, suggest only local tags in minibuffer

2020-09-05 Thread Bastien
Hi,

"E.L.K."  writes:

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

thanks for the patch.  I add a Changelog and documented the new
parameter `only-local-tags' in the docstring, then applied it as
f2d41de3e in maint.

If you can provide complete patches for the next ones, that'd be
great, thanks in advance.

Best,

-- 
 Bastien



Org mode patch: when building sparse tree, suggest only local tags in minibuffer

2020-06-18 Thread E.L.K.
Hello.

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.

Thanks!

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))
 		   org--matcher-tags-todo-only)))
 
 (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))
 		 (org--tag-add-to-alist
 		  (org-get-buffer-tags)
 		  (mapcar (lambda (x)
 (and (stringp (car-safe x))
  (list (car-safe x
 			  org-current-tag-alist)))
 		   (if (car-safe files) files
 		 (org-agenda-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
 	   (org--tag-add-to-alist
 	(org-get-buffer-tags)
-	(unless only-local-tags
-  (org-global-tags-completion-table)
+	(org-global-tags-completion-table
   (setq match
 	(completing-read
 	 "Match: "
 	 'org-tags-completion-function nil nil nil 'org-tags-history
 
   (let ((match0 match)
 	(re (concat
 	 "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)"
 	 "\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:-\\)*\\)+\\)"
 	 "\\([<>=]\\{1,2\\}\\)"
Binary files /home/elk/.emacs.d/elpa/org-9.3.6/org.elc and /home/elk/temp/org-9.3.6/org.elc differ


Org mode patch: when building sparse tree, suggest only local tags in minibuffer

2020-06-16 Thread E.L.K.
Hello.

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.

Thanks!
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))
 		   org--matcher-tags-todo-only)))
 
 (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))
 		 (org--tag-add-to-alist
 		  (org-get-buffer-tags)
 		  (mapcar (lambda (x)
 (and (stringp (car-safe x))
  (list (car-safe x
 			  org-current-tag-alist)))
 		   (if (car-safe files) files
 		 (org-agenda-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
 	   (org--tag-add-to-alist
 	(org-get-buffer-tags)
-	(unless only-local-tags
-  (org-global-tags-completion-table)
+	(org-global-tags-completion-table
   (setq match
 	(completing-read
 	 "Match: "
 	 'org-tags-completion-function nil nil nil 'org-tags-history
 
   (let ((match0 match)
 	(re (concat
 	 "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)"
 	 "\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:-\\)*\\)+\\)"
 	 "\\([<>=]\\{1,2\\}\\)"
Binary files /home/elk/.emacs.d/elpa/org-9.3.6/org.elc and /home/elk/temp/org-9.3.6/org.elc differ