emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Muchenxuan Tong <demon386@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Muchenxuan Tong <demon386@gmail.com>
Subject: [PATCH] Locally scope the variable `org-agenda-tag-filter' in `org-agenda-filter-by-tag'
Date: Wed, 20 Mar 2013 18:40:50 +0800	[thread overview]
Message-ID: <1363776050-82790-1-git-send-email-demon386@gmail.com> (raw)

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

             reply	other threads:[~2013-03-20 10:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 10:40 Muchenxuan Tong [this message]
2013-04-14  8:43 ` [PATCH] Locally scope the variable `org-agenda-tag-filter' in `org-agenda-filter-by-tag' Bastien

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=1363776050-82790-1-git-send-email-demon386@gmail.com \
    --to=demon386@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).