Change relative weekday specifications (ex: fri or -tue) to exclude today

* lisp/org.el (org-read-date-get-relative): Handle positive and
negative weekday specifications so that they don't return today.
If today is Friday, "fri" should mean next Friday. This changes
the previous behavior, which required you to specify "+2fri" in
order to mean next Friday if today was Friday. If you want to
schedule something for today, you can use ".".

* doc/org.texi (The date/time prompt): Update the documentation
to reflect the new way `org-read-date-get-relative' handles
weekdays.

TINYCHANGE
This commit is contained in:
Sacha Chua 2013-04-12 19:19:16 -04:00 committed by Bastien Guerry
parent f594214ac2
commit e82fb4402c
2 changed files with 11 additions and 4 deletions

View File

@ -5875,7 +5875,7 @@ in @b{bold}.
14 @result{} @b{2006}-@b{06}-14 14 @result{} @b{2006}-@b{06}-14
12 @result{} @b{2006}-@b{07}-12 12 @result{} @b{2006}-@b{07}-12
2/5 @result{} @b{2007}-02-05 2/5 @result{} @b{2007}-02-05
Fri @result{} nearest Friday (default date or later) Fri @result{} nearest Friday after the default date
sep 15 @result{} @b{2006}-09-15 sep 15 @result{} @b{2006}-09-15
feb 15 @result{} @b{2007}-02-15 feb 15 @result{} @b{2007}-02-15
sep 12 9 @result{} 2009-09-12 sep 12 9 @result{} 2009-09-12
@ -5900,7 +5900,8 @@ the abbreviation of day name, the date will be the Nth such day, e.g.:
+4 @result{} same as above +4 @result{} same as above
+2w @result{} two weeks from today +2w @result{} two weeks from today
++5 @result{} five days from default date ++5 @result{} five days from default date
+2tue @result{} second Tuesday from now. +2tue @result{} second Tuesday from now
-wed @result{} last Wednesday
@end example @end example
@vindex parse-time-months @vindex parse-time-months

View File

@ -16141,7 +16141,8 @@ mean next year. For details, see the manual. A few examples:
12:45 --> today 12:45 12:45 --> today 12:45
22 sept 0:34 --> currentyear-09-22 0:34 22 sept 0:34 --> currentyear-09-22 0:34
12 --> currentyear-currentmonth-12 12 --> currentyear-currentmonth-12
Fri --> nearest Friday (today or later) Fri --> nearest Friday after today
-Tue --> last Tuesday
etc. etc.
Furthermore you can specify a relative date by giving, as the *first* thing Furthermore you can specify a relative date by giving, as the *first* thing
@ -16529,7 +16530,12 @@ DEF-FLAG is t when a double ++ or -- indicates shift relative to
(if wday1 (if wday1
(progn (progn
(setq delta (mod (+ 7 (- wday1 wday)) 7)) (setq delta (mod (+ 7 (- wday1 wday)) 7))
(if (= dir ?-) (setq delta (- delta 7))) (if (= delta 0) (setq delta 7))
(if (= dir ?-)
(progn
(setq delta (- delta 7))
(if (= delta 0) (setq delta -7))
))
(if (> n 1) (setq delta (+ delta (* (1- n) (if (= dir ?-) -7 7))))) (if (> n 1) (setq delta (+ delta (* (1- n) (if (= dir ?-) -7 7)))))
(list delta "d" rel)) (list delta "d" rel))
(list (* n (if (= dir ?-) -1 1)) what rel))))) (list (* n (if (= dir ?-) -1 1)) what rel)))))