emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org mode patch: when building sparse tree, suggest only local tags in minibuffer
@ 2020-06-15 18:55 E.L.K.
  0 siblings, 0 replies; 3+ messages in thread
From: E.L.K. @ 2020-06-15 18:55 UTC (permalink / raw)
  To: emacs-orgmode


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

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.

[-- Attachment #1.2: Type: text/html, Size: 556 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))
 		   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

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Org mode patch: when building sparse tree, suggest only local tags in minibuffer
@ 2020-06-16 11:15 E.L.K.
  2020-09-05  9:10 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: E.L.K. @ 2020-06-16 11:15 UTC (permalink / raw)
  To: emacs-orgmode


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

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!

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-05  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 18:55 Org mode patch: when building sparse tree, suggest only local tags in minibuffer E.L.K.
  -- strict thread matches above, loose matches on Subject: below --
2020-06-16 11:15 E.L.K.
2020-09-05  9:10 ` Bastien

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