From d19ebd84c3ef9017c0a8de30d279c57b0126c4ff Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 2 Jul 2009 17:10:03 +0200 Subject: [PATCH] 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. --- doc/ChangeLog | 4 ++++ doc/org.texi | 4 ++++ lisp/ChangeLog | 7 +++++++ lisp/org-agenda.el | 19 +++++++++++++++++-- lisp/org.el | 2 ++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8ffbcf8a0..a244cad65 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2009-07-02 Carsten Dominik + + * org.texi (Agenda commands): Document new bulk commands. + 2009-07-01 Carsten Dominik * org.texi (Plain lists): Document new behavior of diff --git a/doc/org.texi b/doc/org.texi index b79a50709..f2d90030e 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -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 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e46aa58cd..f7067ceec 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2009-07-02 Carsten Dominik + * 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. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index ec0438048..ba36bd563 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -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 diff --git a/lisp/org.el b/lisp/org.el index ddc03082f..dcbd95c07 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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) -- 2.11.4.GIT