emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Danjou <julien@danjou.info>
To: emacs-orgmode@gnu.org
Cc: Julien Danjou <julien@danjou.info>
Subject: [PATCH] org-agenda: allow to negate skip conditions
Date: Tue, 14 Dec 2010 18:16:33 +0100	[thread overview]
Message-ID: <1292346993-17142-1-git-send-email-julien@danjou.info> (raw)

* org-agenda.el (org-agenda-skip-if): Allow to negate conditions.

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/org-agenda.el |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f476449..537a421 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4076,7 +4076,12 @@ See `org-agenda-skip-if' for details."
 See `org-agenda-skip-if' for details."
   (org-agenda-skip-if t conditions))
 
-(defun org-agenda-skip-if (subtree conditions)
+(defun org-agenda-skip-if-not (subtree conditions)
+  "Skip entry if none of CONDITIONS is false.
+See `org-agenda-skip-if' for details."
+  (org-agenda-skip-if subtree conditions t))
+
+(defun org-agenda-skip-if (subtree conditions &optional not)
   "Checks current entity for CONDITIONS.
 If SUBTREE is non-nil, the entire subtree is checked.  Otherwise, only
 the entry, i.e. the text before the next heading is checked.
@@ -4112,17 +4117,21 @@ Instead of a list a keyword class may be given
 would skip entries that haven't been marked with any of \"DONE\"
 keywords. Possible classes are: `todo', `done', `any'.
 
-If any of these conditions is met, this function returns the end point of
-the entity, causing the search to continue from there.  This is a function
-that can be put into `org-agenda-skip-function' for the duration of a command."
-  (let (beg end m)
-    (org-back-to-heading t)
-    (setq beg (point)
-	  end (if subtree
-		  (progn (org-end-of-subtree t) (point))
-		(progn (outline-next-heading) (1- (point)))))
-    (goto-char beg)
-    (and
+If any of these conditions is met, this function returns the end
+point of the entity, causing the search to continue from there.
+
+If NOT is set to t, then this function returns the end point of
+the entity only if none of the condition is met, causing the
+search to continue from there.
+
+This is a function that can be put into
+`org-agenda-skip-function' for the duration of a command."
+  (org-back-to-heading t)
+  (let ((beg (point))
+	(end (if subtree
+		 (save-excursion (org-end-of-subtree t))
+	       (save-excursion (outline-next-heading) (1- (point))))))
+    ((if not 'or 'and)
      (or
       (and (memq 'scheduled conditions)
 	   (re-search-forward org-scheduled-time-regexp end t))
-- 
1.7.2.3

             reply	other threads:[~2010-12-14 17:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 17:16 Julien Danjou [this message]
2010-12-14 17:18 ` [PATCH] org-agenda: allow to negate skip conditions Julien Danjou
2010-12-15 10:55   ` REJECT patches (was: Re: [PATCH] org-agenda: allow to negate skip conditions ) Giovanni Ridolfi
2010-12-15 11:13     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292346993-17142-1-git-send-email-julien@danjou.info \
    --to=julien@danjou.info \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).