[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Filters lost after reviving buried, sticky agenda
From: |
Daimrod |
Subject: |
Re: [O] Filters lost after reviving buried, sticky agenda |
Date: |
Sun, 21 Jun 2015 17:47:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5.50 (gnu/linux) |
Daniel Borchmann <address@hidden> writes:
> Dear all,
>
> I regularly lose all my filters when I bury a sticky agenda and revive
> it later. In that case, the variable `org-agenda-tag-filter' is set to
> nil, although it was non-nil before burying.
>
> I played around a bit, and found out that `org-agenda-tag-filter' is
> buffer-local (which is not a surprise). When the agenda buffer is
> revived, the function `org-agenda-prepare' is called, which, among
> others, should reset the filters (provided that
> `org-agenda-persistent-filter' is set). The beginning of the function
> is
>
> --->8---
> (defun org-agenda-prepare (&optional name)
> (let ((filter-alist (if org-agenda-persistent-filter
> (list `(tag . ,org-agenda-tag-filter)
> `(re . ,org-agenda-regexp-filter)
> `(car . ,org-agenda-category-filter)))))
> ...))
> ---8<---
>
> It seems to me that `org-agenda-tag-filter' is read *before* the old
> agenda buffer is poped up (i.e., made current), and thus results in a
> `nil' value. Indeed, if I replace the definition of `filter-alist' by
>
> --->8---
> (let ((filter-alist (if org-agenda-persistent-filter
> (with-current-buffer
> (get-buffer org-agenda-buffer-name)
> (list `(tag . ,org-agenda-tag-filter)
> `(re . ,org-agenda-regexp-filter)
> `(car . ,org-agenda-category-filter))))))
> ...)
> ---8<---
>
> then the bug (seems to) disappear.
>
> My question is now: is this correct, or did I understand something
> wrong? If my understanding is correct, how this bug be fixed more
> elegantly?
It doesn't work at startup when agenda hasn't been built yet. The
following patch does seem to fix that. If it's ok, I can push it.
From d2e8fef81585c249f33fa37260f6228709a67017 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <address@hidden>
Date: Fri, 12 Jun 2015 17:35:30 +0200
Subject: [PATCH] lisp/org-agenda.el : Fix non-persistent filters when
refreshing sticky agenda
* lisp/org-agenda.el (org-agenda-prepare): Fix non-persistent filters when
refreshing sticky agenda
When a sticky agenda is buried, then reviving and refreshing, existing
filters are ignored even when org-agenda-persistent-filter is `t'.
Reported and fixed by Daniel Borchmann
---
lisp/org-agenda.el | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f5d1022..3a1f5bc 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3642,10 +3642,11 @@ FILTER-ALIST is an alist of filters we need to apply
when
(defun org-agenda-prepare (&optional name)
(let ((filter-alist (if org-agenda-persistent-filter
- (list `(tag . ,org-agenda-tag-filter)
- `(re . ,org-agenda-regexp-filter)
- `(effort . ,org-agenda-effort-filter)
- `(car . ,org-agenda-category-filter)))))
+ (with-current-buffer
+ (get-buffer-create org-agenda-buffer-name)
+ (list `(tag . ,org-agenda-tag-filter)
+ `(re . ,org-agenda-regexp-filter)
+ `(car . ,org-agenda-category-filter))))))
(if (org-agenda-use-sticky-p)
(progn
(put 'org-agenda-tag-filter :preset-filter nil)
--
1.9.1
Best,
--
Daimrod/Greg
signature.asc
Description: PGP signature
- Re: [O] Filters lost after reviving buried, sticky agenda,
Daimrod <=
Re: [O] Filters lost after reviving buried, sticky agenda, Daniel Borchmann, 2015/06/25