summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-03-02 11:24:30 +0100
committerBastien Guerry <bzg@altern.org>2013-03-02 11:24:30 +0100
commitfc8824791d447e5e6f9ddbb9f4de054243eac70a (patch)
tree27ed52bf9d40e1f4a346da2efa56c85f1691a8a7
parentee3b3eb421e74339119d730a5bf896a070b2ed60 (diff)
downloadorg-mode-fc8824791d447e5e6f9ddbb9f4de054243eac70a.tar.gz
org.el (org-deadline, org-schedule): Set the warning/delay relatively to the timestamp
* org.el (org-deadline, org-schedule): When called with two universal prefix arguments, set the warning time or the delay relatively to the current timestamp, not to today's date. Thanks to Sébastien Vauban for reporting this.
-rw-r--r--lisp/org.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 64f1bd5..ca615e7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12605,7 +12605,7 @@ of `org-todo-keywords-1'."
(message "%d TODO entries found"
(org-occur (concat "^" org-outline-regexp " *" kwd-re )))))
-(defun org-deadline (&optional arg time)
+(defun org-deadline (arg &optional time)
"Insert the \"DEADLINE:\" string with a timestamp to make a deadline.
With one universal prefix argument, remove any deadline from the item.
With two universal prefix arguments, prompt for a warning delay.
@@ -12621,6 +12621,7 @@ can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
org-loop-over-headlines-in-active-region
cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
(let* ((old-date (org-entry-get nil "DEADLINE"))
+ (old-date-time (org-time-string-to-time old-date))
(repeater (and old-date
(string-match
"\\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?"
@@ -12643,11 +12644,12 @@ can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
(replace-match
(concat org-deadline-string
" <" rpl
- (format " -%dd" (abs
- (- (time-to-days
- (save-match-data
- (org-read-date nil t nil "Warn starting from")))
- (time-to-days nil))))
+ (format " -%dd"
+ (abs
+ (- (time-to-days
+ (save-match-data
+ (org-read-date nil t nil "Warn starting from" old-date-time)))
+ (time-to-days old-date-time))))
">") t t))
(user-error "No deadline information to update"))))
(t
@@ -12672,7 +12674,7 @@ can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
(substring org-last-inserted-timestamp -1))))))
(message "Deadline on %s" org-last-inserted-timestamp))))))
-(defun org-schedule (&optional arg time)
+(defun org-schedule (arg &optional time)
"Insert the SCHEDULED: string with a timestamp to schedule a TODO item.
With one universal prefix argument, remove any scheduling date from the item.
With two universal prefix arguments, prompt for a delay cookie.
@@ -12688,6 +12690,7 @@ either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
org-loop-over-headlines-in-active-region
cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
(let* ((old-date (org-entry-get nil "SCHEDULED"))
+ (old-date-time (org-time-string-to-time old-date))
(repeater (and old-date
(string-match
"\\([.+-]+[0-9]+[hdwmy]\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\) ?"
@@ -12711,11 +12714,12 @@ either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
(replace-match
(concat org-scheduled-string
" <" rpl
- (format " -%dd" (abs
- (- (time-to-days
- (save-match-data
- (org-read-date nil t nil "Delay until")))
- (time-to-days nil))))
+ (format " -%dd"
+ (abs
+ (- (time-to-days
+ (save-match-data
+ (org-read-date nil t nil "Delay until" old-date-time)))
+ (time-to-days old-date-time))))
">") t t))
(user-error "No scheduled information to update"))))
(t