From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toby Cubitt Subject: [PATCH] Fix org-agenda-skip-if bug Date: Sun, 12 Feb 2012 22:06:39 +0100 Message-ID: <20120212210639.GA19747@c3po.home> Reply-To: Toby Cubitt Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="FCuugMFkClbJLl1L" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:32976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwgds-0006Wi-45 for emacs-orgmode@gnu.org; Sun, 12 Feb 2012 16:07:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rwgdq-0007JU-RO for emacs-orgmode@gnu.org; Sun, 12 Feb 2012 16:07:28 -0500 Received: from starfish.geekisp.com ([216.168.135.166]:11660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwgdq-0007JQ-Nn for emacs-orgmode@gnu.org; Sun, 12 Feb 2012 16:07:26 -0500 Content-Disposition: inline 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: emacs-orgmode@gnu.org --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline There appears to be a bug in how org-agenda-skip-if parses the list of CONDITIONS supplied to it. The combination '(nottodo todo) is a valid condition, matching todo items whose state isn't a todo-type keyword (according to the keyword types defined in `org-todo-keywords'). But `org-agenda-skip-if' tests first for conditions of the form '(todo x) using (memq 'todo conditions), which mistakenly picks up '(nottodo todo) as well. Simply reversing the order of the memq tests for 'todo and 'nottodo fixes this particular case, which is what the attached patch does. Note that there's still a slightly different issue with combinations of multiple todo tests, which this patch does not fix. The docstring suggests that CONDITIONS is allowed to be a list of multiple tests. E.g. '(nottodo CANCELLED todo done) should match any done state except CANCELLED. But, faced with this combination, `organ-agenda-skip-if' will only apply the first '(nottodo CANCELLED) test, and ignores the second. However, it's not clear to me whether this is a problem with the code or the docstring. Perhaps it was never intended to support combinations of multiple todo tests. Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Agenda-Fix-bug-that-broke-nottodo-todo-skip-conditio.patch" >From 3eb5cd877ca48a2c0d2e907cf4ab7adf32520020 Mon Sep 17 00:00:00 2001 From: Toby S. Cubitt Date: Sat, 28 Jan 2012 18:21:52 +0100 Subject: [PATCH 1/2] Agenda: Fix bug that broke '(nottodo todo) skip condition * lisp/org-agenda.el (org-agenda-skip-if): Fix bug in test for '(nottodo todo) skip condition. Note: certain combinations of multiple conditions may still be broken. --- lisp/org-agenda.el | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 38fd589..ad706eb 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4285,8 +4285,8 @@ that can be put into `org-agenda-skip-function' for the duration of a command." (stringp (nth 1 m)) (not (re-search-forward (nth 1 m) end t))) (and (or - (setq m (memq 'todo conditions)) - (setq m (memq 'nottodo conditions))) + (setq m (memq 'nottodo conditions)) + (setq m (memq 'todo conditions))) (org-agenda-skip-if-todo m end))) end))) -- 1.7.3.4 --FCuugMFkClbJLl1L--