Agenda bulk commands: Add Schedule and Deadline

Agenda bulk commands on marked entries now can also set the scheduling
date or a deadline.  Normally, all entries will be set to the
specified date.  However, when writing the change as "++5d" or "++2w",
then each time stamp will independently be shifted by that amount.
This commit is contained in:
Carsten Dominik 2009-07-02 17:10:03 +02:00
parent 956c2cc87a
commit d19ebd84c3
5 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2009-07-02 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Agenda commands): Document new bulk commands.
2009-07-01 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Plain lists): Document new behavior of

View File

@ -7243,6 +7243,10 @@ t @r{Change TODO state. This prompts for a single TODO keyword and}
@r{suppressing logging notes (but not time stamps).}
+ @r{Add a tag to all selected entries.}
- @r{Remove a tag from all selected entries.}
s @r{Schedule all items to a new date. To shift existing schedule dates}
@r{by a fixed number of days, use something starting with double plus}
@r{at the prompt, for example @samp{++8d} or @samp{++2w}.}
d @r{Set deadline to a specific date.}
@end example

View File

@ -1,5 +1,12 @@
2009-07-02 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-bulk-action): Add scheduling and
setting the deadline.
* org.el (org-read-date-final-answer): New variable.
(org-read-date): Store the final answer string, including the date
from the calendar, for reuse by agenda bulk commands.
* org-publish.el (org-publish-attachment): Fix publishing of
attachments.

View File

@ -6330,7 +6330,7 @@ This will remove the markers, and the overlays."
(interactive)
(unless org-agenda-bulk-marked-entries
(error "No entries are marked"))
(message "Action: [r]efile [$]archive [A]rch-to-sib [t]odo [+]tag [-]tag")
(message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline")
(let* ((action (read-char-exclusive))
(entries (reverse org-agenda-bulk-marked-entries))
cmd rfloc state e tag (cnt 0))
@ -6371,7 +6371,22 @@ This will remove the markers, and the overlays."
(mapcar (lambda (x)
(if (stringp (car x)) x)) org-tag-alist)))))
(setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off))))
((memq action '(?s ?d))
(let* ((date (org-read-date
nil nil nil
(if (eq action ?s) "(Re)Schedule to" "Set Deadline to")))
(ans org-read-date-final-answer)
(c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline)))
(setq cmd `(let* ((bound (fboundp 'read-string))
(old (and bound (symbol-function 'read-string))))
(unwind-protect
(progn
(fset 'read-string (lambda (&rest ignore) ,ans))
(call-interactively ',c1))
(if bound
(fset 'read-string old)
(fmakunbound 'read-string)))))))
(t (error "Invalid bulk action")))
;; Now loop over all markers and apply cmd

View File

@ -12005,6 +12005,7 @@ So these are more for recording a certain time/date."
(defvar org-read-date-overlay nil)
(defvar org-dcst nil) ; dynamically scoped
(defvar org-read-date-history nil)
(defvar org-read-date-final-answer nil)
(defun org-read-date (&optional with-time to-time from-string prompt
default-time default-input)
@ -12165,6 +12166,7 @@ user."
(setq org-read-date-overlay nil)))))
(setq final (org-read-date-analyze ans def defdecode))
(setq org-read-date-final-answer ans)
(if to-time
(apply 'encode-time final)