Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-25 Thread Daniel Borchmann
ghItlhpu' Daimrod daim...@gmail.com:
 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.

It works for me.

Thanks!

  Daniel

-- 
~~
Dr. rer. nat. Daniel Borchmann
Postdoctoral Research Associate

Technische Universität Dresden
Fakultät Informatik
Institut für Theoretische Informatik
Lehrstuhl für Automatentheorie
01062 Dresden
Tel.: +49 351 463-34059
E-Mail: daniel.borchm...@tu-dresden.de
~~


signature.asc
Description: PGP signature


Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-24 Thread Daimrod
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Daimrod daim...@gmail.com writes:

 Here is an updated version of the second patch :

 Both look good. Could you can push them. Thank you.

Done, thank you.

 Regards,

-- 
Daimrod/Greg


signature.asc
Description: PGP signature


Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-23 Thread Nicolas Goaziou
Daimrod daim...@gmail.com writes:

 Here is an updated version of the second patch :

Both look good. Could you can push them. Thank you.

Regards,



Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-23 Thread Daimrod
Err, I should have tested it before sending the patch, sorry.

Here is an updated version of the second patch :

From 11ef3cc8dd804a9498edc856350d5e57d9ce3fff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= gregoire.j...@univ-nantes.fr
Date: Tue, 23 Jun 2015 10:42:25 +0200
Subject: [PATCH 2/2] lisp/org-agenda.el: Fix non-persistent category filters
 in sticky agenda

* lisp/org-agenda.el (org-agenda-prepare): Use the correct key for
  category filter.

`org-agenda-prepare-window' uses 'cat whereas `org-agenda-prepare' used 'car.
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a07eead..32509a5 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3647,7 +3647,7 @@ FILTER-ALIST is an alist of filters we need to apply when
 			(list `(tag . ,org-agenda-tag-filter)
   `(re . ,org-agenda-regexp-filter)
   `(effort . ,org-agenda-effort-filter)
-  `(car . ,org-agenda-category-filter))
+  `(cat . ,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

2015-06-23 Thread Daimrod
Nick Dokos ndo...@gmail.com writes:

 What happened to the effort filter?

Good catch! Thanks.

Here is an updated patch plus another one to fix the regexp and category 
filters.

From 59cd3eb256d9473db42f9a1629755140c0d648cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= gregoire.j...@univ-nantes.fr
Date: Fri, 12 Jun 2015 17:35:30 +0200
Subject: [PATCH 1/2] 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 | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f5d1022..a07eead 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3642,10 +3642,12 @@ 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)
+  `(effort . ,org-agenda-effort-filter)
+  `(car . ,org-agenda-category-filter))
 (if (org-agenda-use-sticky-p)
 	(progn
 	  (put 'org-agenda-tag-filter :preset-filter nil)
-- 
1.9.1

From 3dc0e17b0887b182309696b2f790dac9ad3ca018 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= gregoire.j...@univ-nantes.fr
Date: Tue, 23 Jun 2015 10:42:25 +0200
Subject: [PATCH 2/2] lisp/org-agenda.el: Fix non-persistent regexp and
 category filters in sticky agenda

* lisp/org-agenda.el (org-agenda-prepare): Use the correct key for
  category and regexp filters.

`org-agenda-finalize' uses 'regexp and 'category whereas
`org-agenda-prepare' used 're and 'car.
---
 lisp/org-agenda.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a07eead..8efc037 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3645,9 +3645,9 @@ FILTER-ALIST is an alist of filters we need to apply when
 			  (with-current-buffer
 			  (get-buffer-create org-agenda-buffer-name)
 			(list `(tag . ,org-agenda-tag-filter)
-  `(re . ,org-agenda-regexp-filter)
+  `(regexp . ,org-agenda-regexp-filter)
   `(effort . ,org-agenda-effort-filter)
-  `(car . ,org-agenda-category-filter))
+  `(category . ,org-agenda-category-filter))
 (if (org-agenda-use-sticky-p)
 	(progn
 	  (put 'org-agenda-tag-filter :preset-filter nil)
-- 
1.9.1




-- 
Daimrod/Greg


signature.asc
Description: PGP signature


Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-22 Thread Subhan Michael Tindall
 -Original Message-
 From: emacs-orgmode-bounces+subhant=familycareinc@gnu.org
 [mailto:emacs-orgmode-bounces+subhant=familycareinc@gnu.org] On
 Behalf Of Daimrod
 Sent: Sunday, June 21, 2015 9:11 PM
 To: Daniel Borchmann
 Cc: emacs-orgmode@gnu.org
 Subject: Re: [O] Filters lost after reviving buried, sticky agenda
 
 Daniel Borchmann daniel.borchm...@tu-dresden.de writes:
 
  ghItlhpu' Daimrod daim...@gmail.com:
  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.
 
  It works for me.
 
 Great! If nobody complains in the next days, I'll push it.
 
 Best,
 
 --
 Daimrod/Greg

Please do!  I use sticky agendas extensively and have been looking in to this 
problem. But if you beat me to a working solution, I'll be happy. I'll install 
the patch and give it a whirl, if you don't hear from me figure that I didn't 
find anything






This message is intended for the sole use of the individual and entity to which 
it is addressed and may contain information that is privileged, confidential 
and exempt from disclosure under applicable law. If you are not the intended 
addressee, nor authorized to receive for the intended addressee, you are hereby 
notified that you may not use, copy, disclose or distribute to anyone the 
message or any information contained in the message. If you have received this 
message in error, please immediately advise the sender by reply email and 
delete the message.  Thank you.




Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-22 Thread Nick Dokos
Daimrod daim...@gmail.com writes:

 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?= gregoire.j...@univ-nantes.fr
 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)

What happened to the effort filter?

-- 
Nick




Re: [O] Filters lost after reviving buried, sticky agenda

2015-06-21 Thread Daimrod
Daniel Borchmann daniel.borchm...@tu-dresden.de 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?= gregoire.j...@univ-nantes.fr
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

2015-06-21 Thread Daimrod
Daniel Borchmann daniel.borchm...@tu-dresden.de writes:

 ghItlhpu' Daimrod daim...@gmail.com:
 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.

 It works for me.

Great! If nobody complains in the next days, I'll push it.

Best,

-- 
Daimrod/Greg


signature.asc
Description: PGP signature


[O] Filters lost after reviving buried, sticky agenda

2015-05-01 Thread Daniel Borchmann

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?

Best,

  Daniel

-- 
Daniel Borchmann   http://daniel.kxpq.de
GPG (Mail)0849 473E 6BF0 B504 DF0B  D640 455E 3610 01FF 778F


signature.asc
Description: PGP signature