org.el: Allow both "8am Wed" and "Wed 8am" to be parsed correctly

* org.el (org-read-date-analyze): Allow both "8am Wed" and
"Wed 8am" to be parsed correctly with respect to possible
values of `org-read-date-prefer-future'.
(org-read-date-prefer-future): Update docstring to remove the
restriction about inserting only the time.  The user can now
insert the time and the day.
This commit is contained in:
Bastien Guerry 2012-08-16 09:42:55 +02:00
parent 76b0d582b8
commit d2200b2bed
1 changed files with 7 additions and 7 deletions

View File

@ -2752,8 +2752,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.
to will be interpreted as tomorrow. If the time is before now, it will be interpreted as tomorrow.
Currently none of this works for ISO week specifications. Currently none of this works for ISO week specifications.
@ -15557,10 +15557,11 @@ user."
(setq ans "+0")) (setq ans "+0"))
(when (setq delta (org-read-date-get-relative ans (current-time) org-def)) (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
(setq ans (replace-match "" t t ans) (unless (save-match-data (string-match org-plain-time-of-day-regexp ans))
deltan (car delta) (setq ans (replace-match "" t t ans)
deltaw (nth 1 delta) deltan (car delta)
deltadef (nth 2 delta))) deltaw (nth 1 delta)
deltadef (nth 2 delta))))
;; Check if there is an iso week date in there ;; Check if there is an iso week date in there
;; If yes, store the info and postpone interpreting it until the rest ;; If yes, store the info and postpone interpreting it until the rest
@ -15713,7 +15714,6 @@ user."
((equal deltaw "m") (setq month (+ month deltan))) ((equal deltaw "m") (setq month (+ month deltan)))
((equal deltaw "y") (setq year (+ year deltan))))) ((equal deltaw "y") (setq year (+ year deltan)))))
((and wday (not (nth 3 tl))) ((and wday (not (nth 3 tl)))
(setq futurep nil)
;; Weekday was given, but no day, so pick that day in the week ;; Weekday was given, but no day, so pick that day in the week
;; on or after the derived date. ;; on or after the derived date.
(setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year)))) (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))