From mboxrd@z Thu Jan 1 00:00:00 1970 From: Muchenxuan Tong 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 Message-ID: <1363776050-82790-1-git-send-email-demon386@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:53659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIGSo-0001Nm-RJ for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 06:41:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIGSm-0002jH-6c for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 06:41:46 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:52037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIGSm-0002jA-14 for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 06:41:44 -0400 Received: by mail-pd0-f169.google.com with SMTP id 3so561582pdj.14 for ; Wed, 20 Mar 2013 03:41:42 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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). TINYCHANGE. --- 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 (message @@ -7373,24 +7374,24 @@ to switch to narrowing." ((equal char ?\r) (org-agenda-filter-show-all-tag) (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 ?/) (org-agenda-filter-show-all-tag) - (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)))) (org-agenda-filter-show-all-tag) (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 -- 1.7.12.4 (Apple Git-37)