emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-read-date-prefer-future should prefer next week if the given time is before now
@ 2012-07-12 10:02 Tom
  2012-08-15  9:20 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Tom @ 2012-07-12 10:02 UTC (permalink / raw)
  To: emacs-orgmode

I have

 (setq org-read-date-prefer-future 'time)

in my .emacs, so if I give a time like 8am and it is before now
then it is interpreted as tomorrow. This is good, because I never
want to set times in the past.

However if I give "thu 8am" (it is Thursday 11:50am here, so Thu 8am
is before now) then org interpretes it as 8am today. When 
org-read-date-prefer-future is set then org should also interpret
times given as day+time as future times if the day of week is the same,
but the given time is before now. That is, in this case Thu 8am should
be interpreted as 8am next Thursday.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-read-date-prefer-future should prefer next week if the given time is before now
  2012-07-12 10:02 org-read-date-prefer-future should prefer next week if the given time is before now Tom
@ 2012-08-15  9:20 ` Bastien
  2012-08-15  9:50   ` Tom
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2012-08-15  9:20 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode

Hi Tom,

Tom <adatgyujto@gmail.com> writes:

> I have
>
>  (setq org-read-date-prefer-future 'time)
>
> in my .emacs, so if I give a time like 8am and it is before now
> then it is interpreted as tomorrow. This is good, because I never
> want to set times in the past.
>
> However if I give "thu 8am" (it is Thursday 11:50am here, so Thu 8am
> is before now) then org interpretes it as 8am today. 

You need to enter 8am thu in this case.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-read-date-prefer-future should prefer next week if the given time is before now
  2012-08-15  9:20 ` Bastien
@ 2012-08-15  9:50   ` Tom
  2012-08-15 11:00     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Tom @ 2012-08-15  9:50 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg <at> gnu.org> writes:

> 
> You need to enter 8am thu in this case.
> 

It is a consistency bug then. If thu 8am works in other cases
then it should not be the user's job to know which format to
use to achieve to desired result. Org should treat both
forms in the same way.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-read-date-prefer-future should prefer next week if the given time is before now
  2012-08-15  9:50   ` Tom
@ 2012-08-15 11:00     ` Bastien
  2012-08-16  7:43       ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2012-08-15 11:00 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Tom <adatgyujto@gmail.com> writes:

> It is a consistency bug then. If thu 8am works in other cases
> then it should not be the user's job to know which format to
> use to achieve to desired result. Org should treat both
> forms in the same way.

Please try the attached patch and report other inconsistencies.

Thanks,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-read-date-prefer-futur.patch --]
[-- Type: text/x-patch, Size: 1110 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index f605443..bf9f1f6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15558,10 +15558,11 @@ user."
       (setq ans "+0"))
 
     (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
-      (setq ans (replace-match "" t t ans)
-	    deltan (car delta)
-	    deltaw (nth 1 delta)
-            deltadef (nth 2 delta)))
+      (unless (save-match-data (string-match org-plain-time-of-day-regexp ans))
+	(setq ans (replace-match "" t t ans)
+	      deltan (car delta)
+	      deltaw (nth 1 delta)
+	      deltadef (nth 2 delta))))
 
     ;; Check if there is an iso week date in there
     ;; If yes, store the info and postpone interpreting it until the rest
@@ -15714,7 +15715,6 @@ user."
 	    ((equal deltaw "m") (setq month (+ month deltan)))
 	    ((equal deltaw "y") (setq year (+ year deltan)))))
      ((and wday (not (nth 3 tl)))
-      (setq futurep nil)
       ;; Weekday was given, but no day, so pick that day in the week
       ;; on or after the derived date.
       (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-read-date-prefer-future should prefer next week if the given time is before now
  2012-08-15 11:00     ` Bastien
@ 2012-08-16  7:43       ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2012-08-16  7:43 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Tom <adatgyujto@gmail.com> writes:
>
>> It is a consistency bug then. If thu 8am works in other cases
>> then it should not be the user's job to know which format to
>> use to achieve to desired result. Org should treat both
>> forms in the same way.
>
> Please try the attached patch and report other inconsistencies.

I've now applied this patch.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-16  7:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12 10:02 org-read-date-prefer-future should prefer next week if the given time is before now Tom
2012-08-15  9:20 ` Bastien
2012-08-15  9:50   ` Tom
2012-08-15 11:00     ` Bastien
2012-08-16  7:43       ` Bastien

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).