Sfoglia il codice sorgente

Sparse tree: New tree for times after a certain date.

Keys are `C-c / a', this command is for symmetry with `C-c / b'.
Carsten Dominik 16 anni fa
parent
commit
fd4670fe67
3 ha cambiato i file con 42 aggiunte e 13 eliminazioni
  1. 18 10
      doc/org.texi
  2. 2 0
      lisp/ChangeLog
  3. 22 3
      lisp/org.el

+ 18 - 10
doc/org.texi

@@ -4980,16 +4980,6 @@ happen in the line directly following the headline.  When called with a
 prefix arg, an existing deadline will be removed from the entry.
 @c FIXME Any CLOSED timestamp will be removed.????????
 @c
-@kindex C-c / d
-@cindex sparse tree, for deadlines
-@item C-c / d
-@vindex org-deadline-warning-days
-Create a sparse tree with all deadlines that are either past-due, or
-which will become due within @code{org-deadline-warning-days}.
-With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
-prefix, check that many days.  For example, @kbd{C-1 C-c / d} shows
-all deadlines due tomorrow.
-@c
 @kindex C-c C-s
 @item C-c C-s
 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
@@ -5005,6 +4995,24 @@ Mark the current entry for agenda action.  After you have marked the entry
 like this, you can open the agenda or the calendar to find an appropriate
 date.  With the cursor on the selected date, press @kbd{k s} or @kbd{k d} to
 schedule the marked item.
+@c
+@kindex C-c / d
+@cindex sparse tree, for deadlines
+@item C-c / d
+@vindex org-deadline-warning-days
+Create a sparse tree with all deadlines that are either past-due, or
+which will become due within @code{org-deadline-warning-days}.
+With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
+prefix, check that many days.  For example, @kbd{C-1 C-c / d} shows
+all deadlines due tomorrow.
+@c
+@kindex C-c / b
+@item C-c / b
+Sparse tree for deadlines and scheduled items before a given date.
+@c
+@kindex C-c / a
+@item C-c / a
+Sparse tree for deadlines and scheduled items after a given date.
 @end table
 
 @node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling

+ 2 - 0
lisp/ChangeLog

@@ -6,6 +6,8 @@
 	(org-store-log-note): Remove drawer if empty while note is
 	aborted.
 	(org-remove-empty-drawer-at): New function.
+	(org-check-after-date): New command.
+	(org-sparse-tree): New sparse tree command "a".
 
 	* org-exp.el (org-export-as-ascii): Improve export of plain lists.
 

+ 22 - 3
lisp/org.el

@@ -9614,17 +9614,21 @@ t      Show entries with a specific TODO keyword.
 m      Show entries selected by a tags/property match.
 p      Enter a property name and its value (both with completion on existing
        names/values) and show entries with that property.
-r      Show entries matching a regular expression
-d      Show deadlines due within `org-deadline-warning-days'."
+r      Show entries matching a regular expression.
+d      Show deadlines due within `org-deadline-warning-days'.
+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: [/]regexp [t]odo-kwd [m]atch [p]roperty [d]eadlines [b]efore-date")
+    (message "Sparse tree: [/]regexp [t]odo-kwd [m]atch [p]roperty [d]eadlines [b]efore-date [a]fter-date")
     (setq ans (read-char-exclusive))
     (cond
      ((equal ans ?d)
       (call-interactively 'org-check-deadlines))
      ((equal ans ?b)
       (call-interactively 'org-check-before-date))
+     ((equal ans ?a)
+      (call-interactively 'org-check-after-date))
      ((equal ans ?t)
       (org-show-todo-tree '(4)))
      ((member ans '(?T ?m))
@@ -12130,6 +12134,21 @@ days.  If the prefix is a raw \\[universal-argument] prefix, all deadlines are s
     (message "%d entries before %s"
 	     (org-occur regexp nil callback) date)))
 
+(defun org-check-after-date (date)
+  "Check if there are deadlines or scheduled entries after DATE."
+  (interactive (list (org-read-date)))
+  (let ((case-fold-search nil)
+	(regexp (concat "\\<\\(" org-deadline-string
+			"\\|" org-scheduled-string
+			"\\) *<\\([^>]+\\)>"))
+	(callback
+	 (lambda () (not
+		     (time-less-p
+		      (org-time-string-to-time (match-string 2))
+		      (org-time-string-to-time date))))))
+    (message "%d entries after %s"
+	     (org-occur regexp nil callback) 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