After investigating further <2011-10-17 >--<2011-10-30 > works but not <2011-10-17>--<2011-10-30>. The regexp for a timestamp is defined in org-ts-regexp : "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>" Shouldn't the trailing space be optional? -- Ivan Kanis http://kanis.fr When you're looking at life In a strange new room Maybe drowning soon Is this the start of it all? -- Ian Curtis
Ivan Kanis <ivan.kanis@googlemail.com> writes:
Hi!
> After investigating further <2011-10-17 >--<2011-10-30 > works but not
> <2011-10-17>--<2011-10-30>. The regexp for a timestamp is defined in
> org-ts-regexp :
>
> "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>"
>
> Shouldn't the trailing space be optional?
In your regex, there is no trailing whitespace, but are right that it is
in the original definition.
,----[ C-h v org-ts-regexp RET ]
| org-ts-regexp is a variable defined in `org.el'.
| Its value is
| "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>"
| ^
`----
Strangely, that timestamp regex didn't change for 3 years...
Oh, now I see what's wrong. All time stamps consist of the date and
then the day's name abbreviation, which is missing with your example.
Correct would be
<2011-10-17 Mon>--<2011-10-30 Sun>
Bye,
Tassilo
Tassilo Horn <tassilo@member.fsf.org> writes:
> Ivan Kanis <ivan.kanis@googlemail.com> writes:
>
> Hi!
>
>> After investigating further <2011-10-17 >--<2011-10-30 > works but not
>> <2011-10-17>--<2011-10-30>. The regexp for a timestamp is defined in
>> org-ts-regexp :
>>
>> "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>"
>>
>> Shouldn't the trailing space be optional?
>
> In your regex, there is no trailing whitespace, but are right that it is
> in the original definition.
>
> ,----[ C-h v org-ts-regexp RET ]
> | org-ts-regexp is a variable defined in `org.el'.
> | Its value is
> | "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>"
> | ^
> `----
>
> Strangely, that timestamp regex didn't change for 3 years...
>
> Oh, now I see what's wrong. All time stamps consist of the date and
> then the day's name abbreviation, which is missing with your example.
> Correct would be
>
> <2011-10-17 Mon>--<2011-10-30 Sun>
>
> Bye,
> Tassilo
Although the day is optional according to the regexp. I would
definitely like to have the regexp with the space optional as well as
there are cases where I want to type the date in directly (not in org
mode for whatever reason). In those cases, it is easy to type
2011-01-01 or whatever but it's not necessarily trivial to determine the
day of the week...
Actually, interesting thought experiment: does org actually do any
consistency checks, comparing the date and the day of the week?
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1
: using Org-mode version 7.7 (release_7.7.380.g54d7df)
Eric S Fraga <e.fraga@ucl.ac.uk> writes: Hi Eric, >> Oh, now I see what's wrong. All time stamps consist of the date and >> then the day's name abbreviation, which is missing with your example. >> Correct would be >> >> <2011-10-17 Mon>--<2011-10-30 Sun> > > Although the day is optional according to the regexp. I would > definitely like to have the regexp with the space optional as well as > there are cases where I want to type the date in directly (not in org > mode for whatever reason). In those cases, it is easy to type > 2011-01-01 or whatever but it's not necessarily trivial to determine > the day of the week... Yes, I agree, although you can use org-time-stamp everywhere (in emacs). And you can actually insert timestamps simply by writing <2011-10-13 > with the whitespace to make it a valid timestamp. That will be shown as day entry in the agenda, and you might have typed it in using some non-emacs text editor on you phone. Now, back in org-mode, simply S-<up> and S-<down> on any number, and et voila, the missing day name abbrev is added automatically. > Actually, interesting thought experiment: does org actually do any > consistency checks, comparing the date and the day of the week? No, I don't think so. Manipulating and creating timestamps using the provided commands ensures their correctness, but for actual calculation the day names are ignored. It's just for humans. Bye, Tassilo
On 13.10.2011, at 09:57, Tassilo Horn wrote: > Eric S Fraga <e.fraga@ucl.ac.uk> writes: > > Hi Eric, > >>> Oh, now I see what's wrong. All time stamps consist of the date and >>> then the day's name abbreviation, which is missing with your example. >>> Correct would be >>> >>> <2011-10-17 Mon>--<2011-10-30 Sun> >> >> Although the day is optional according to the regexp. I would >> definitely like to have the regexp with the space optional as well as >> there are cases where I want to type the date in directly (not in org >> mode for whatever reason). In those cases, it is easy to type >> 2011-01-01 or whatever but it's not necessarily trivial to determine >> the day of the week... > > Yes, I agree, although you can use org-time-stamp everywhere (in emacs). > And you can actually insert timestamps simply by writing > > <2011-10-13 > > > with the whitespace to make it a valid timestamp. That will be shown as > day entry in the agenda, and you might have typed it in using some > non-emacs text editor on you phone. > > Now, back in org-mode, simply S-<up> and S-<down> on any number, and et > voila, the missing day name abbrev is added automatically. > >> Actually, interesting thought experiment: does org actually do any >> consistency checks, comparing the date and the day of the week? > > No, I don't think so. Manipulating and creating timestamps using the > provided commands ensures their correctness, but for actual calculation > the day names are ignored. It's just for humans. Just to confirm, this is correct. - Carsten
[-- Attachment #1: Type: text/plain, Size: 1763 bytes --] On 13.10.2011, at 09:48, Eric S Fraga wrote: > Tassilo Horn <tassilo@member.fsf.org> writes: > >> Ivan Kanis <ivan.kanis@googlemail.com> writes: >> >> Hi! >> >>> After investigating further <2011-10-17 >--<2011-10-30 > works but not >>> <2011-10-17>--<2011-10-30>. The regexp for a timestamp is defined in >>> org-ts-regexp : >>> >>> "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>" >>> >>> Shouldn't the trailing space be optional? >> >> In your regex, there is no trailing whitespace, but are right that it is >> in the original definition. >> >> ,----[ C-h v org-ts-regexp RET ] >> | org-ts-regexp is a variable defined in `org.el'. >> | Its value is >> | "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>" >> | ^ >> `---- >> >> Strangely, that timestamp regex didn't change for 3 years... >> >> Oh, now I see what's wrong. All time stamps consist of the date and >> then the day's name abbreviation, which is missing with your example. >> Correct would be >> >> <2011-10-17 Mon>--<2011-10-30 Sun> >> >> Bye, >> Tassilo > > Although the day is optional according to the regexp. I would > definitely like to have the regexp with the space optional as well as > there are cases where I want to type the date in directly (not in org > mode for whatever reason). I am attaching a patch which will make time stamps without a day name like <2011-10-12> work correctly. Furthermore, pressing C-c C-c on a time stamp will fill in or fix the day name. However, I am not sure if this patch is complete, or if it has side effects. So it would be good if a few people could apply it and test it during their daily work for a few weeks, and then report problems in this thread. - Carsten [-- Attachment #2: time-stamp-no-space.patch --] [-- Type: application/octet-stream, Size: 3415 bytes --] diff --git a/lisp/org-clock.el b/lisp/org-clock.el index e026d93..5dbe4dc 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1117,7 +1117,7 @@ the clocking selection, associated with the letter `d'." (looking-at (concat "^[ \t]* " org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" - " +\\sw+\.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) + " *\\sw+\.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) (message "Matched %s" (match-string 1)) (setq ts (concat "[" (match-string 1) "]")) (goto-char (match-end 1)) @@ -1249,7 +1249,7 @@ line and position cursor in that line." (re-search-forward (concat "^[ \t]* " org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" - " +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$") + " *\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$") end t)) (beginning-of-line 1) (throw 'exit t)) diff --git a/lisp/org.el b/lisp/org.el index b26e1a3..83cf4c3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4645,7 +4645,7 @@ means to push this value onto the list in the variable.") "\\|" org-deadline-string "\\|" org-closed-string "\\|" org-clock-string "\\)\\)?" - " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") + " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") org-planning-or-clock-line-re (concat "\\(?:^[ \t]*\\(" org-scheduled-string "\\|" org-deadline-string @@ -5094,15 +5094,15 @@ This should be called after the variable `org-link-types' has changed." (org-make-link-regexps) -(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>" +(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)>" "Regular expression for fast time stamp matching.") -(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?\\)[]>]" +(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?\\)[]>]" "Regular expression for fast time stamp matching.") (defconst org-ts-regexp0 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" "Regular expression matching time strings for analysis. This one does not require the space after the date, so it can be used on a string that terminates immediately after the date.") -(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) +\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" +(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" "Regular expression matching time strings for analysis.") (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>") "Regular expression matching time stamps, with groups.") @@ -17931,6 +17931,8 @@ This command does many different things, depending on context: (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) + ((org-in-regexp org-ts-regexp-both) + (org-timestamp-change 0 'day)) ((or (looking-at org-property-start-re) (org-at-property-p)) (call-interactively 'org-property-action)) [-- Attachment #3: Type: text/plain, Size: 409 bytes --] > In those cases, it is easy to type > 2011-01-01 or whatever but it's not necessarily trivial to determine the > day of the week... > > Actually, interesting thought experiment: does org actually do any > consistency checks, comparing the date and the day of the week? > > -- > : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1 > : using Org-mode version 7.7 (release_7.7.380.g54d7df) >
Carsten Dominik <carsten.dominik@gmail.com> writes: > On 13.10.2011, at 09:48, Eric S Fraga wrote: >> Although the day is optional according to the regexp. I would >> definitely like to have the regexp with the space optional as well as >> there are cases where I want to type the date in directly (not in org >> mode for whatever reason). > > I am attaching a patch which will make time stamps without a day name > like <2011-10-12> work correctly. Furthermore, pressing C-c C-c on > a time stamp will fill in or fix the day name. > > However, I am not sure if this patch is complete, or if it > has side effects. So it would be good if a few people could > apply it and test it during their daily work for a few weeks, > and then report problems in this thread. Excellent. Thanks. I've applied the patch and will let you know if anything strange happens! Silence should be taken as indicating no problems encountered :-) -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1 : using Org-mode version 7.7 (release_7.7.380.g54d7df.dirty)
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On 13.10.2011, at 09:57, Tassilo Horn wrote:
>
>> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>>
>> Hi Eric,
>>
>>>> Oh, now I see what's wrong. All time stamps consist of the date and
>>>> then the day's name abbreviation, which is missing with your example.
>>>> Correct would be
>>>>
>>>> <2011-10-17 Mon>--<2011-10-30 Sun>
>>>
>>> Although the day is optional according to the regexp. I would
>>> definitely like to have the regexp with the space optional as well as
>>> there are cases where I want to type the date in directly (not in org
>>> mode for whatever reason). In those cases, it is easy to type
>>> 2011-01-01 or whatever but it's not necessarily trivial to determine
>>> the day of the week...
>>
>> Yes, I agree, although you can use org-time-stamp everywhere (in emacs).
>> And you can actually insert timestamps simply by writing
>>
>> <2011-10-13 >
>>
>> with the whitespace to make it a valid timestamp. That will be shown as
>> day entry in the agenda, and you might have typed it in using some
>> non-emacs text editor on you phone.
>
>
>>
>> Now, back in org-mode, simply S-<up> and S-<down> on any number, and et
>> voila, the missing day name abbrev is added automatically.
>>
>>> Actually, interesting thought experiment: does org actually do any
>>> consistency checks, comparing the date and the day of the week?
>>
>> No, I don't think so. Manipulating and creating timestamps using the
>> provided commands ensures their correctness, but for actual calculation
>> the day names are ignored. It's just for humans.
>
> Just to confirm, this is correct.
>
> - Carsten
>
so, in that case, it does make sense to allow date stamps without the
day!
(and I see that Carsten has already provided a patch for this :-)
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1
: using Org-mode version 7.7 (release_7.7.380.g54d7df.dirty)
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>> I am attaching a patch which will make time stamps without a day name
>> like <2011-10-12> work correctly. Furthermore, pressing C-c C-c on a
>> time stamp will fill in or fix the day name.
>>
>> However, I am not sure if this patch is complete, or if it has side
>> effects. So it would be good if a few people could apply it and test
>> it during their daily work for a few weeks, and then report problems
>> in this thread.
>
> Excellent. Thanks. I've applied the patch and will let you know if
> anything strange happens! Silence should be taken as indicating no
> problems encountered :-)
Ditto.
Bye,
Tassilo
Hi Carsten On Thu, Oct 13, 2011 at 10:27, Carsten Dominik <carsten.dominik@gmail.com> wrote: > Furthermore, pressing C-c C-c on > a time stamp will fill in or fix the day name. Thank you, this is something I always wanted to have for convenience instead of using S-<up> + S-<down>. > However, I am not sure if this patch is complete, or if it > has side effects. So it would be good if a few people could > apply it and test it during their daily work for a few weeks, > and then report problems in this thread. I started to use this patch too. Michael
Hi Carsten
On Thu, Oct 13, 2011 at 10:27, Carsten Dominik
<carsten.dominik@gmail.com> wrote:
> I am attaching a patch which will make time stamps without a day name
> like <2011-10-12> work correctly. Furthermore, pressing C-c C-c on
> a time stamp will fill in or fix the day name.
>
> However, I am not sure if this patch is complete, or if it
> has side effects. So it would be good if a few people could
> apply it and test it during their daily work for a few weeks,
> and then report problems in this thread.
I wonder how C-c C-c with a prefix (supported are one to three C-u) on
a time stamp in a table field is expected to behave. In my opinion it
should not only adjust the day name but like before also evaluate the
table formula which it does not now. If the user does not expect and
check the missing logs of the table calculation update he might
wrongly assume that it happened and assume that there has been just no
change.
Michael
I have now merged this patch, a big thanks to the testers
Michael, Eric, and Tassilo.
- Carsten
On 16.10.2011, at 15:45, Michael Brand wrote:
> Hi Carsten
>
> On Thu, Oct 13, 2011 at 10:27, Carsten Dominik
> <carsten.dominik@gmail.com> wrote:
>> Furthermore, pressing C-c C-c on
>> a time stamp will fill in or fix the day name.
>
> Thank you, this is something I always wanted to have for convenience
> instead of using S-<up> + S-<down>.
>
>> However, I am not sure if this patch is complete, or if it
>> has side effects. So it would be good if a few people could
>> apply it and test it during their daily work for a few weeks,
>> and then report problems in this thread.
>
> I started to use this patch too.
>
> Michael
Hi Carsten On Wed, Nov 9, 2011 at 19:18, Carsten Dominik <carsten.dominik@gmail.com> wrote: > I have now merged this patch, Thank you. I have still concerns about this, did I somehow miss the answer?: On Thu, Nov 3, 2011 at 18:22, Michael Brand <michael.ch.brand@gmail.com> wrote: > I wonder how C-c C-c with a prefix (supported are one to three C-u) on > a time stamp in a table field is expected to behave. In my opinion it > should not only adjust the day name but like before also evaluate the > table formula which it does not now. If the user does not expect and > check the missing logs of the table calculation update he might > wrongly assume that it happened and assume that there has been just no > change. Michael
Version: 24.1 Seems to have been fixed, but this bug was never closed, nor included on the discussion. Ref thread http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg00439.html