From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Tucker-Kellogg Subject: [PATCH] Making org-agenda filters orthogonal and refreshed Date: Sat, 19 Apr 2014 09:53:08 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a11347e9e286e2804f75b873d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbKSu-0000Sv-BF for emacs-orgmode@gnu.org; Fri, 18 Apr 2014 21:53:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbKSs-0003jL-W2 for emacs-orgmode@gnu.org; Fri, 18 Apr 2014 21:53:12 -0400 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:45518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbKSs-0003j5-Hq for emacs-orgmode@gnu.org; Fri, 18 Apr 2014 21:53:10 -0400 Received: by mail-lb0-f175.google.com with SMTP id w7so1778511lbi.20 for ; Fri, 18 Apr 2014 18:53:08 -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: org-mode mailing list --001a11347e9e286e2804f75b873d Content-Type: text/plain; charset=UTF-8 This is org-mode version 8.2.5h, directly off the git. emacs version 24.4.50.1 I have noticed that combining top headline filters and category filters didn't always work as documented. In particular, the combination of filters displayed depends on the order of application and removal, and is not always refreshed properly. To test it, I created a new org file with a couple of simple entries. Note: the behaviour is most obvious if you have some other tasks with the same categories or tags in your global todo agenda. * A team member ** TODO Task 1 :COMPUTER: :PROPERTIES: :CATEGORY: Work :END: ** TODO Task 2 :PROPERTIES: :CATEGORY: Team :END: * Someone else ** TODO Someone else's Task 1 :COMPUTER: :PROPERTIES: :CATEGORY: Work :END: If I apply two filters in succession: "^" to filter to the "top headline" and "<" to filter to the "Work" category, it appears to work. But then if I toggle the top headline filter with "^" again, all the filters are removed, because the function is using the category filter type to apply and remove the top headline overlay. (Separately, the "|" shortcut to remove all filters does not currently recognise a top headline filter). I created a patch to fix the issues, but I think it's a bit of a hack, and I'd welcome input or a better patch by a more skilled coder. Even after separating the filter removal, I ended up advising two filter functions to reload the agenda so that it refreshed properly. All of this reflects my poor elisp skills. Nonetheless, I wonder if org-agenda doesn't need some refactoring to remove the explicit repetition of cases for different filter types. Greg --001a11347e9e286e2804f75b873d Content-Type: text/plain; charset=US-ASCII; name="org-agenda.el.diff" Content-Disposition: attachment; filename="org-agenda.el.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hu691jlv0 ZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWFnZW5kYS5lbCBiL2xpc3Avb3JnLWFnZW5kYS5lbAppbmRl eCAxODQyMDliLi5kNjg2YmQ3IDEwMDY0NAotLS0gYS9saXNwL29yZy1hZ2VuZGEuZWwKKysrIGIv bGlzcC9vcmctYWdlbmRhLmVsCkBAIC0yMDk3LDYgKzIwOTcsNyBAQCBXaGVuIG5pbCwgYHEnIHdp bGwga2lsbCB0aGUgc2luZ2xlIGFnZW5kYSBidWZmZXIuIgogICAgIG9yZy1hZ2VuZGEtdGFnLWZp bHRlcgogICAgIG9yZy1hZ2VuZGEtY2F0LWZpbHRlci1vdmVybGF5cwogICAgIG9yZy1hZ2VuZGEt Y2F0ZWdvcnktZmlsdGVyCisgICAgb3JnLWFnZW5kYS10b3AtaGVhZGxpbmUtZmlsdGVyCiAgICAg b3JnLWFnZW5kYS1yZS1maWx0ZXItb3ZlcmxheXMKICAgICBvcmctYWdlbmRhLXJlZ2V4cC1maWx0 ZXIKICAgICBvcmctYWdlbmRhLW1hcmtlcnMKQEAgLTM0MTIsNiArMzQxMyw3IEBAIElmIEFHRU5E QS1CVUZGRVItTkFNRSwgdXNlIHRoaXMgYXMg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