emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Locally scope the variable `org-agenda-tag-filter' in `org-agenda-filter-by-tag'
@ 2013-03-20 10:40 Muchenxuan Tong
  2013-04-14  8:43 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Muchenxuan Tong @ 2013-03-20 10:40 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Muchenxuan Tong

* lisp/org-agenda.el: Introduce a local variable tag-filter to replace
  the global variable `org-agenda-tag-filter'.

This relates to the bug when trying to filter by tag in agenda view with
entry-text shown. In `org-agenda-filter-apply' ->
`org-agenda-entry-text-mode', it shows error when the global variable
`org-agenda-tag-filter' is set. Thus, the variable
`org-agenda-tag-filter' shouldn't be set in advance.

Modifying the global one will be done anyway in
`org-agenda-filter-apply', which happens after
calling (org-agenda-entry-text-mode).

 lisp/org-agenda.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index afaf009..acb8cb0 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7333,6 +7333,7 @@ to switch to narrowing."
 	 (effort-prompt "")
 	 (inhibit-read-only t)
 	 (current org-agenda-tag-filter)
+	 (tag-filter org-agenda-tag-filter)
 	 maybe-refresh a n tag)
     (unless char
@@ -7373,24 +7374,24 @@ to switch to narrowing."
      ((equal char ?\r)
       (when org-agenda-auto-exclude-function
-	(setq org-agenda-tag-filter '())
+	(setq tag-filter '())
 	(dolist (tag (org-agenda-get-represented-tags))
 	  (let ((modifier (funcall org-agenda-auto-exclude-function tag)))
 	    (if modifier
-		(push modifier org-agenda-tag-filter))))
-	(if (not (null org-agenda-tag-filter))
-	    (org-agenda-filter-apply org-agenda-tag-filter 'tag)))
+		(push modifier tag-filter))))
+	(if (not (null tag-filter))
+	    (org-agenda-filter-apply tag-filter 'tag)))
       (setq maybe-refresh t))
      ((equal char ?/)
-      (when (get 'org-agenda-tag-filter :preset-filter)
-	(org-agenda-filter-apply org-agenda-tag-filter 'tag))
+      (when (get 'tag-filter :preset-filter)
+	(org-agenda-filter-apply tag-filter 'tag))
       (setq maybe-refresh t))
      ((equal char ?. )
-      (setq org-agenda-tag-filter
+      (setq tag-filter
 	    (mapcar (lambda(tag) (concat "+" tag))
 		    (org-get-at-bol 'tags)))
-      (org-agenda-filter-apply org-agenda-tag-filter 'tag)
+      (org-agenda-filter-apply tag-filter 'tag)
       (setq maybe-refresh t))
      ((or (equal char ?\ )
 	  (setq a (rassoc char alist))
@@ -7404,10 +7405,10 @@ to switch to narrowing."
 	  (and tag (setq a (cons tag nil))))
       (setq tag (car a))
-      (setq org-agenda-tag-filter
+      (setq tag-filter
 	    (cons (concat (if strip "-" "+") tag)
 		  (if narrow current nil)))
-      (org-agenda-filter-apply org-agenda-tag-filter 'tag)
+      (org-agenda-filter-apply tag-filter 'tag)
       (setq maybe-refresh t))
      (t (error "Invalid tag selection character %c" char)))
     (when (and maybe-refresh
-- (Apple Git-37)

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

end of thread, other threads:[~2013-04-14  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20 10:40 [PATCH] Locally scope the variable `org-agenda-tag-filter' in `org-agenda-filter-by-tag' Muchenxuan Tong
2013-04-14  8:43 ` Bastien

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