summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-03-01 10:53:35 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-03-01 10:53:35 +0100
commit428ab7942a1d7ea377b2c747484a39c9714a73a4 (patch)
tree72846104af1a5123b8ca5046cd3b9d30247ed15a
parentf400694165b08aec5a63e1d61873bae444212e7e (diff)
downloadorg-mode-428ab7942a1d7ea377b2c747484a39c9714a73a4.tar.gz
org-agenda: Obey to "++" prefix when bulk rescheduling/resetting deadline
* lisp/org-agenda.el (org-agenda-bulk-action): When date starts with "++", shift every marked entry. Reported-by: Michael Hoffman <gmane4-hoffman@sneakemail.com> <http://lists.gnu.org/archive/html/emacs-orgmode/2018-03/msg00001.html>
-rw-r--r--lisp/org-agenda.el49
1 files changed, 25 insertions, 24 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 1436ac9..34a897e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9897,32 +9897,33 @@ The prefix arg is passed through to the command if possible."
(org-agenda-set-tags ,tag
,(if (eq action ?+) ''on ''off))))))
- (?s
- (let ((time
- (and (not arg)
- (org-read-date nil nil nil "(Re)Schedule to"
- org-overriding-default-time))))
+ ((and (or ?s ?d) c)
+ (let* ((schedule? (eq c ?s))
+ (prompt (if schedule? "(Re)Schedule to" "(Re)Set Deadline to"))
+ (time
+ (and (not arg)
+ (let ((new (org-read-date
+ nil nil nil prompt org-overriding-default-time)))
+ ;; A "double plus" answer applies to every
+ ;; scheduled time. Do not turn it into
+ ;; a fixed date yet.
+ (if (string-match-p "\\`[ \t]*\\+\\+"
+ org-read-date-final-answer)
+ org-read-date-final-answer
+ new)))))
;; Make sure to not prompt for a note when bulk
- ;; rescheduling as Org cannot cope with simultaneous notes.
- ;; Besides, it could be annoying depending on the number of
- ;; items re-scheduled.
+ ;; rescheduling/resetting deadline as Org cannot cope with
+ ;; simultaneous notes. Besides, it could be annoying
+ ;; depending on the number of marked items.
(setq cmd
- `(lambda ()
- (let ((org-log-reschedule (and org-log-reschedule 'time)))
- (org-agenda-schedule arg ,time))))))
- (?d
- (let ((time
- (and (not arg)
- (org-read-date nil nil nil "(Re)Set Deadline to"
- org-overriding-default-time))))
- ;; Make sure to not prompt for a note when bulk
- ;; rescheduling as Org cannot cope with simultaneous
- ;; notes. Besides, it could be annoying depending on the
- ;; number of items re-scheduled.
- (setq cmd
- `(lambda ()
- (let ((org-log-redeadline (and org-log-redeadline 'time)))
- (org-agenda-deadline arg ,time))))))
+ (if schedule?
+ `(lambda ()
+ (let ((org-log-reschedule
+ (and org-log-reschedule 'time)))
+ (org-agenda-schedule arg ,time)))
+ `(lambda ()
+ (let ((org-log-redeadline (and org-log-redeadline 'time)))
+ (org-agenda-deadline arg ,time)))))))
(?S
(unless (org-agenda-check-type nil 'agenda 'todo)