diff options
author | Bastien Guerry <bzg@altern.org> | 2011-12-31 13:20:45 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-12-31 13:20:45 +0100 |
commit | e5d5a1e7211e80b3abcd243832c85e02045c67af (patch) | |
tree | 85e12e9fd353006078a91277d4323f91ca05c244 | |
parent | 855213f48133012d2131fac2cc4fd3853335f166 (diff) | |
download | org-mode-e5d5a1e7211e80b3abcd243832c85e02045c67af.tar.gz |
org.el: New command `org-check-dates-range'.
* org.el (org-check-dates-range): New command.
(org-sparse-tree): Use it.
Thanks to Marc-Oliver Ihm for discussions and code
about similar features.
-rw-r--r-- | lisp/org.el | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index 24b0aa1..8180ed3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12424,7 +12424,7 @@ b Show deadlines and scheduled items before a date. a Show deadlines and scheduled items after a date." (interactive "P") (let (ans kwd value) - (message "Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date") + (message "Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range") (setq ans (read-char-exclusive)) (cond ((equal ans ?d) @@ -12433,6 +12433,8 @@ a Show deadlines and scheduled items after a date." (call-interactively 'org-check-before-date)) ((equal ans ?a) (call-interactively 'org-check-after-date)) + ((equal ans ?D) + (call-interactively 'org-check-dates-range)) ((equal ans ?t) (org-show-todo-tree nil)) ((equal ans ?T) @@ -15546,6 +15548,27 @@ days. If the prefix is a raw \\[universal-argument] prefix, all deadlines are s (message "%d entries after %s" (org-occur regexp nil callback) date))) +(defun org-check-dates-range (start-date end-date) + "Check for deadlines/scheduled entries between START-DATE and END-DATE." + (interactive (list (org-read-date nil nil nil "Range starts") + (org-read-date nil nil nil "Range end"))) + (let ((case-fold-search nil) + (regexp (concat "\\<\\(" org-deadline-string + "\\|" org-scheduled-string + "\\) *<\\([^>]+\\)>")) + (callback + (lambda () + (let ((match (match-string 2))) + (and + (not (time-less-p + (org-time-string-to-time match) + (org-time-string-to-time start-date))) + (time-less-p + (org-time-string-to-time match) + (org-time-string-to-time end-date))))))) + (message "%d entries between %s and %s" + (org-occur regexp nil callback) start-date end-date))) + (defun org-evaluate-time-range (&optional to-buffer) "Evaluate a time range by computing the difference between start and end. Normally the result is just printed in the echo area, but with prefix arg |