From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: Filters lost after reviving buried, sticky agenda Date: Sun, 21 Jun 2015 17:47:02 +0200 Message-ID: <87bng9rrm1.fsf@gmail.com> References: <877fssro5z.fsf@tu-dresden.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hSj-0005zD-IH for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 11:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6hSf-0000Qw-Hx for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 11:47:13 -0400 Received: from smtptls1-cha.cpub.univ-nantes.fr ([193.52.103.113]:49021 helo=smtp-tls.univ-nantes.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hSf-0000Pz-8g for emacs-orgmode@gnu.org; Sun, 21 Jun 2015 11:47:09 -0400 In-Reply-To: <877fssro5z.fsf@tu-dresden.de> (Daniel Borchmann's message of "Fri, 01 May 2015 23:19:36 +0200") 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: Daniel Borchmann Cc: emacs-orgmode@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Daniel Borchmann 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-org-agenda.el-Fix-non-persistent-filters-when-r.patch Content-Transfer-Encoding: quoted-printable From=20d2e8fef81585c249f33fa37260f6228709a67017 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Gr=3DC3=3DA9goire=3D20Jadi?=3D 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 =2D-- 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 =2D-- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3642,10 +3642,11 @@ FILTER-ALIST is an alist of filters we need to appl= y when =20 (defun org-agenda-prepare (&optional name) (let ((filter-alist (if org-agenda-persistent-filter =2D (list `(tag . ,org-agenda-tag-filter) =2D `(re . ,org-agenda-regexp-filter) =2D `(effort . ,org-agenda-effort-filter) =2D `(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) =2D-=20 1.9.1 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Best, =2D-=20 Daimrod/Greg --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVhtx2AAoJEBNzVHcrZRiU31MQAIo0SDtTCMQ7d+dQ9+Z2ecMP /63MmfFu8GTAlpUItWF0tLqrJhawxpS1WN4EBs8tiViODJQS+10SDxdlVNFbp5FX yNmnEhnvmZnH+4Y0At5zliCFO87xBa+sd6muMYahTLEPIRd5jwr1SAhkZV0XBasB Ob85fzEiboZ9inUd+qcy2wR+ZbjiUO4bjruDLkGZoUeHzjFav/gFBFsPsDdD/Gwh tE0NhX0KnnTS/OFtOAo3xKIIA1rlqzo0dX+PInvP1XNht87jkUGgs5zlUeS2xMHZ HoWvcrXWR6k+6czmwo/gV4tpJVAHIfThmKxfvTV5Va0LIu9HSqfm+4cTY9PoYdWd g5dQ753JXU2S1pCzsw7B8X6Y1CmAbm71U9o0xEgiznO6IKKBed3ipyk0O0RXNgII F2+uXdmKQRG9aGNw9somPRiAZN2WouFzAxS0SweqoByA0R5H3ilsG4w24rz14jwb 2lyoMZc3V00uP+KTftUomCqpwwJeYd+1wqdi7SGPQdfmKkYR721SVLM17jc/CczL 11SFmi2fNIsZK35X1/1SVk55rcEa3ZRR+7rbgR3VRKYC9jpdko+l9OEmRDapRqHK srfcysDorNYlNJOeQRx3E8hwM//wU7IM/JgQGgfZbbEZ6+BIxTcb9ejGuOKjcbTY 01gz5V3meNAJlcEh9pBf =hKIf -----END PGP SIGNATURE----- --==-=-=--