Re: [O] [PATCH] Locally scope the variable `org-agenda-tag-filter' in `org-agenda-filter-by-tag'

2013-04-14 Thread Bastien
Hi Muchenxuan,

sorry for the delay.  The patch isn't applicable anymore and it has
problems too.

Muchenxuan Tong demon...@gmail.com writes:

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

The main problem comes from mixing overlays from hiding entries
(through filtering) and from showing entry text.  I don't think there
is a simple solution to this, but let us know if you find one.

Thanks,

-- 
 Bastien



[O] [PATCH] Locally scope the variable `org-agenda-tag-filter' in `org-agenda-filter-by-tag'

2013-03-20 Thread 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)