org.el: Fix bug in interpreting `org-read-date-prefer-future' for time

* org.el (org-read-date-prefer-future): Fix docstring
formatting.
(org-read-date-analyze): Fix the interpretation of
`org-read-date-prefer-future'.
This commit is contained in:
Bastien Guerry 2012-08-15 11:02:24 +02:00
parent 57166defd1
commit 053d0597e6
1 changed files with 14 additions and 4 deletions

View File

@ -2741,9 +2741,11 @@ Custom commands can set this variable in the options section."
(defcustom org-read-date-prefer-future t (defcustom org-read-date-prefer-future t
"Non-nil means assume future for incomplete date input from user. "Non-nil means assume future for incomplete date input from user.
This affects the following situations: This affects the following situations:
1. The user gives a month but not a year. 1. The user gives a month but not a year.
For example, if it is April and you enter \"feb 2\", this will be read For example, if it is April and you enter \"feb 2\", this will be read
as Feb 2, *next* year. \"May 5\", however, will be this year. as Feb 2, *next* year. \"May 5\", however, will be this year.
2. The user gives a day, but no month. 2. The user gives a day, but no month.
For example, if today is the 15th, and you enter \"3\", Org-mode will For example, if today is the 15th, and you enter \"3\", Org-mode will
read this as the third of *next* month. However, if you enter \"17\", read this as the third of *next* month. However, if you enter \"17\",
@ -2752,8 +2754,8 @@ This affects the following situations:
If you set this variable to the symbol `time', then also the following If you set this variable to the symbol `time', then also the following
will work: will work:
3. If the user gives a time, but no day. If the time is before now, 3. If the user gives a time, but no day.
to will be interpreted as tomorrow. If the time is before now, to will be interpreted as tomorrow.
Currently none of this works for ISO week specifications. Currently none of this works for ISO week specifications.
@ -15651,7 +15653,11 @@ user."
(substring ans (match-end 7)))))) (substring ans (match-end 7))))))
(setq tl (parse-time-string ans) (setq tl (parse-time-string ans)
day (or (nth 3 tl) (nth 3 org-defdecode)) day (or (nth 3 tl)
(if (and (eq org-read-date-prefer-future 'time)
(nth 2 tl) (< (nth 2 tl) (nth 2 nowdecode)))
(prog1 (1+ (nth 3 nowdecode)) (setq futurep t))
(nth 3 org-defdecode)))
month (or (nth 4 tl) month (or (nth 4 tl)
(if (and org-read-date-prefer-future (if (and org-read-date-prefer-future
(nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode))) (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode)))
@ -15662,7 +15668,11 @@ user."
(nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode))) (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode)))
(prog1 (1+ (nth 5 nowdecode)) (setq futurep t)) (prog1 (1+ (nth 5 nowdecode)) (setq futurep t))
(nth 5 org-defdecode))) (nth 5 org-defdecode)))
hour (or (nth 2 tl) (nth 2 org-defdecode)) hour (or (nth 2 tl)
(if (and (eq org-read-date-prefer-future 'time)
(nth 1 tl) (< (nth 1 tl) (nth 1 nowdecode)))
(prog1 (1+ (nth 2 nowdecode)) (setq futurep t))
(nth 2 org-defdecode)))
minute (or (nth 1 tl) (nth 1 org-defdecode)) minute (or (nth 1 tl) (nth 1 org-defdecode))
second (or (nth 0 tl) 0) second (or (nth 0 tl) 0)
wday (nth 6 tl)) wday (nth 6 tl))