From: Richard Lawrence <richard.lawrence@uni-tuebingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: incorrect timestamps with :time-prompt and datetrees
Date: Thu, 24 Dec 2020 13:07:41 +0100 [thread overview]
Message-ID: <87eejfh0fm.fsf@aquinas> (raw)
In-Reply-To: <87h7obh4ct.fsf@aquinas>
Richard Lawrence <richard.lawrence@uni-tuebingen.de> writes:
> This is org 9.4 running from maint (commit ab00524fc). I spent a while
> stepping through org-capture and org-read-date but haven't found the
> problem yet. I suspect this snippet from a cond form in the middle of
> org-capture-set-target-location:
>
> #+begin_src
> ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)"
> org-read-date-final-answer)
> ;; Replace any time range by its start.
> (apply #'encode-time
> (org-read-date-analyze
> ;; it looks to me like this is maybe sending the wrong value
> ;; into org-read-date-analyze:
> (replace-match "\\1 \\2" nil nil
> org-read-date-final-answer)
>
> #+end_src
I can now confirm that this is the problem. It looks like what is happening here
is that the regex is meant to match a time range, but ends up matching
the date: thus a string like "12-31 13:00" gets mangled to "12 13:00"
and sent into org-read-date-analyze. If I comment out this branch of
the cond form, and enter "12-31 13:00" at the org-read-date-prompt, then
both the timestamp and the location in the datetree are correct.
So I guess the solution is...a better regex is needed to cause this
branch to fire only in the intended case, namely, a time range. Should
it be checking for "am"/"pm" or ":" or similar? Otherwise it seems
impossible to distinguish a date specification like "11-12" from a time
range.
--
Best,
Richard
next prev parent reply other threads:[~2020-12-24 12:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-24 10:42 Bug: incorrect timestamps with :time-prompt and datetrees Richard Lawrence
2020-12-24 12:07 ` Richard Lawrence [this message]
2021-01-06 12:16 ` Richard Lawrence
2021-01-12 8:41 ` [PATCH] " Richard Lawrence
2021-01-18 6:35 ` Bug: " Kyle Meyer
2021-01-19 2:25 ` [PATCH] capture: Fix handling of time range for :time-prompt Kyle Meyer
2021-01-31 11:15 ` Richard Lawrence
2021-02-02 4:42 ` Kyle Meyer
2021-02-02 16:59 ` Richard Lawrence
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eejfh0fm.fsf@aquinas \
--to=richard.lawrence@uni-tuebingen.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).