emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence)
@ 2012-09-23 19:49 Gregor Zattler
  2012-09-24 14:00 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Gregor Zattler @ 2012-09-23 19:49 UTC (permalink / raw)
  To: emacs-orgmode

Dear org-mode users and developers,


* what I want to do
I want to use org-capture instead of Emacs diary (+calendar)
[fn:1] in order to record all kinds of events and appointments.

* how I try to achieve this
I try to use org-capture.  I want to be prompted for the date of
the event or the date and time / time range of the appointment.
I want the event/appointment to be recorded in a date tree under
it's respective date, not under today.  I want a timestamp in the
resulting heading in order to see the date/appointment in the
agenda view and I want to see the respective time (range)
information if there is any.

I tried to achieve this with an file+datetree+prompt template as
such:

(setq org-capture-templates (quote (
 ("d" "diary the Org way" entry (file+datetree+prompt
 "~/org/diary.org") "* %? %T
 noted: %U"))))


* how it works
If using this template I'm prompted for a date and this date is
used as target in the date tree.  That's fine.  The same date is
also used in the timestamp of the captured items heading which is
produced via expansion of the %T exscape.  That#s fine too.  If I
also enter at the same prompt a time for the appointment as
e.g. 19:00 this time information is reused in the time stamp in
the heading.  That's fine too.  This way I'm able to enter
appointments.


* when it does not work
But there are two problems with the time information, which I
consider to be bugs:

1) If I enter a time *range* at the prompt, the %T expands to the
   time when I invoked the capture ("now") while the date is
   still the entered day, not today.  This is a mixture of the
   events date / recording time which I consider to be a bug.
   Instead I expect to see the date and time range of the
   appointment.

2) If I do not enter a time at all, since for instance the date
   is not bound to a time (e.g. holiday, birthday) the %T also
   expands to the time when I invoked the capture ("now") while
   the date is still the entered day, not today.

   Here instead I expect to see no time information at all, since
   I did not enter one.

   At least I also consider the mixture of the events date /
   recording time information a bug.


* how to reproduce the bug
This is with
- Emacs GNU Emacs 24.2.50.1 (i486-pc-linux-gnu, X
  toolkit, Xaw scroll bars) of 2012-09-19 on dex, modified by
  Debian (Emacs-snapshot)
- Org-mode version 7.9.1 (release_7.9.1-316-g66fe32 @
  /home/grfz/src/org-mode/lisp/)


I tested this with Emacs -Q and this minimal setup:

(add-to-list 'load-path (expand-file-name "~/src/org-mode/lisp"))
(setq load-path (cons "~/src/org-mode/contrib/lisp/" load-path))
(setq load-path (cons "~/.Emacs.d/elisp" load-path))
(require 'org-install)
(global-set-key "\C-cc" 'org-capture)

(setq org-capture-templates (quote (
 ("d" "diary the Org way" entry (file+datetree+prompt
 "~/org/diary.org") "* %? %T"))))


* how grateful I am
Thanks for your attention and for org-mode, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-

Footnotes:

[fn:1] Mostly for performance reasons: Building the Agenda is
       slow due to my large diary file.  It's much faster if
       appointment data is stored in org files.

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

* Re: [Bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence)
  2012-09-23 19:49 [Bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence) Gregor Zattler
@ 2012-09-24 14:00 ` Bastien
  2012-09-24 22:08   ` Gregor Zattler
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2012-09-24 14:00 UTC (permalink / raw)
  To: emacs-orgmode

Hi Gregor,

Gregor Zattler <telegraph@gmx.net> writes:

> But there are two problems with the time information, which I
> consider to be bugs:
>
> 1) If I enter a time *range* at the prompt, the %T expands to the
>    time when I invoked the capture ("now") while the date is
>    still the entered day, not today.  This is a mixture of the
>    events date / recording time which I consider to be a bug.
>    Instead I expect to see the date and time range of the
>    appointment.

The %T specifier do not allow ranges.  I've changed the behavior 
here so that, when the user specifies a time range, only the first
time spec is taken into account.

> 2) If I do not enter a time at all, since for instance the date
>    is not bound to a time (e.g. holiday, birthday) the %T also
>    expands to the time when I invoked the capture ("now") while
>    the date is still the entered day, not today.

The %T specifier _requires_ a time to be set (otherwise you would use
%t), but I agree the current time looks wrong here.  So this is now
00:00 instead.  This does not look perfect, but it's better IMHO.

Thanks for reporting these bugs.

Best,

-- 
 Bastien

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

* Re: org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence)
  2012-09-24 14:00 ` Bastien
@ 2012-09-24 22:08   ` Gregor Zattler
  2012-09-26 21:58     ` [FR] capture with one prompt dattree and time range (was: Re: [bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence)) Gregor Zattler
  0 siblings, 1 reply; 5+ messages in thread
From: Gregor Zattler @ 2012-09-24 22:08 UTC (permalink / raw)
  To: Emacs-orgmode

Hi Bastien, org-mode users + developers:
* Bastien <bzg@altern.org> [24. Sep. 2012]:
> Gregor Zattler <telegraph@gmx.net> writes:
> 
>> But there are two problems with the time information, which I
>> consider to be bugs:
>>
>> 1) If I enter a time *range* at the prompt, the %T expands to the
>>    time when I invoked the capture ("now") while the date is
>>    still the entered day, not today.  This is a mixture of the
>>    events date / recording time which I consider to be a bug.
>>    Instead I expect to see the date and time range of the
>>    appointment.
> 
> The %T specifier do not allow ranges.  I've changed the behavior 
> here so that, when the user specifies a time range, only the first
> time spec is taken into account.
> 
>> 2) If I do not enter a time at all, since for instance the date
>>    is not bound to a time (e.g. holiday, birthday) the %T also
>>    expands to the time when I invoked the capture ("now") while
>>    the date is still the entered day, not today.
> 
> The %T specifier _requires_ a time to be set (otherwise you would use
> %t), but I agree the current time looks wrong here.  So this is now
> 00:00 instead.  This does not look perfect, but it's better IMHO.
> 
> Thanks for reporting these bugs.

Thanks for fixing this.

Is this somehow possible with only one prompt:

- to be prompted for the date of the event or the date and time /
  time range of the appointment.
- the event/appointment to be recorded in a date tree under it's
  respective date, not under today.
- having a timestamp in the resulting heading
- to see the respective time (range) information in the agenda if
  there is any.

I managed to to this without the date tree but with one level one
heading for each entry.  That's a bit more like Emacs diary, but
I like the date tree because it's hides more information:

(org-capture-templates (quote ( ("d" "diary the Org way" entry (file "~/org/diary.org") "* %? %^T %^g"))))

Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-

P.S.: sorry to Bastien for first replying to him instead of the
list: user input mistake.

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

* [FR] capture with one prompt dattree and time range (was: Re: [bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence))
  2012-09-24 22:08   ` Gregor Zattler
@ 2012-09-26 21:58     ` Gregor Zattler
  2012-09-26 22:55       ` [FR] capture with one prompt dattree and time range Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Gregor Zattler @ 2012-09-26 21:58 UTC (permalink / raw)
  To: Emacs-orgmode

Hi org-mode users + developers,

this no bug report any more but feature request:
* Gregor Zattler <telegraph@gmx.net> [25. Sep. 2012]:
> Is this somehow possible with only one prompt:
> 
> - to be prompted for the date of the event or the date and time /
>   time range of the appointment.
> - the event/appointment to be recorded in a date tree under it's
>   respective date, not under today.
> - having a timestamp in the resulting heading
> - to see the respective time (range) information in the agenda if
>   there is any.

It's already possible to file the event at it's date in the
datetree, it's also possible to give the starting time and to
expand the date and the starting time in a capture template.

It's not possible to expand a) no time information if none was
given at the prompt or to expand a given time range because the
%T expando family expands unconditionally and not to time ranges.

My feature request is for an additional expando (say %^d)
which does this.

Ciao, Gregor 
P.S.: Thanx to Bastien who proposed to explain in detail what is
already doable and what is not.  This guided me to this feature
request. 

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

* Re: [FR] capture with one prompt dattree and time range
  2012-09-26 21:58     ` [FR] capture with one prompt dattree and time range (was: Re: [bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence)) Gregor Zattler
@ 2012-09-26 22:55       ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2012-09-26 22:55 UTC (permalink / raw)
  To: Emacs-orgmode

Hi Gregor,

Gregor Zattler <telegraph@gmx.net> writes:

> It's not possible to expand a) no time information if none was
> given at the prompt or to expand a given time range because the
> %T expando family expands unconditionally and not to time ranges.

%t and friends take the first element of the time range,
but %^t and friends (%^T %^u %^U) insert the full range.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2012-09-26 22:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-23 19:49 [Bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence) Gregor Zattler
2012-09-24 14:00 ` Bastien
2012-09-24 22:08   ` Gregor Zattler
2012-09-26 21:58     ` [FR] capture with one prompt dattree and time range (was: Re: [bug] org-capture datetree+prompt: wrong time (range) information in timestamp (%T escape sequence)) Gregor Zattler
2012-09-26 22:55       ` [FR] capture with one prompt dattree and time range 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).