* org-capture-template: file+datetree+prompt not using prompted date in template
@ 2015-11-04 21:22 Shankar Rao
2015-11-04 22:15 ` Nick Dokos
0 siblings, 1 reply; 4+ messages in thread
From: Shankar Rao @ 2015-11-04 21:22 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 456 bytes --]
For the following org capture template:
(setq org-capture-templates
'(("d" "Date Tree Test" plain
(file+datetree+prompt "~/org/testdt.org")
"This date should be the date i picked: %<%y%m%d>")))
Though this is filed under the correct date in the datetree, no matter what
date I select in the prompt, the date displayed in the template is the
current date. Is this a bug or a feature?
How do I use the prompt-selected date in the template?
Shankar
[-- Attachment #2: Type: text/html, Size: 1316 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-capture-template: file+datetree+prompt not using prompted date in template
2015-11-04 21:22 org-capture-template: file+datetree+prompt not using prompted date in template Shankar Rao
@ 2015-11-04 22:15 ` Nick Dokos
2015-11-04 22:54 ` Shankar Rao
0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2015-11-04 22:15 UTC (permalink / raw)
To: emacs-orgmode
Shankar Rao <shankar.rao@gmail.com> writes:
> For the following org capture template:
>
> (setq org-capture-templates
> '(("d" "Date Tree Test" plain
> (file+datetree+prompt "~/org/testdt.org")
> "This date should be the date i picked: %<%y%m%d>")))
>
> Though this is filed under the correct date in the datetree, no matter what date I select in the prompt,
> the date displayed in the template is the current date. Is this a bug or a feature?
>
It's a feature I guess - org-capture.el says:
;; The current time
(goto-char (point-min))
(while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
(replace-match (format-time-string (match-string 1)) t t))
and there is no provision for another time to be given here. I don't
think there is any provision in the template for a time other than the
current time: at least I can't see a %-escape that takes a different
time.
--
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-capture-template: file+datetree+prompt not using prompted date in template
2015-11-04 22:15 ` Nick Dokos
@ 2015-11-04 22:54 ` Shankar Rao
2015-11-05 1:39 ` Shankar Rao
0 siblings, 1 reply; 4+ messages in thread
From: Shankar Rao @ 2015-11-04 22:54 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]
Earlier in org-capture-fill-template, there is the following:
(let* (...
(ct (org-capture-get :default-time))
...
The property :default-time defaults to the current time and is overwritten
by file+datetree+prompt,
If ct was passed as a 2nd argument to format-time-string in your code
snippet:
;; The current time
(goto-char (point-min))
(while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
(replace-match (format-time-string (match-string 1) ct) t t))
this should provide the behavior I'm looking for with file+datetree+prompt,
but still use the current time for other capture types. Will this solution
break anything?
Shankar
On Wed, Nov 4, 2015 at 2:15 PM, Nick Dokos <ndokos@gmail.com> wrote:
> Shankar Rao <shankar.rao@gmail.com> writes:
>
> > For the following org capture template:
> >
> > (setq org-capture-templates
> > '(("d" "Date Tree Test" plain
> > (file+datetree+prompt "~/org/testdt.org")
> > "This date should be the date i picked: %<%y%m%d>")))
> >
> > Though this is filed under the correct date in the datetree, no matter
> what date I select in the prompt,
> > the date displayed in the template is the current date. Is this a bug or
> a feature?
> >
>
> It's a feature I guess - org-capture.el says:
>
> ;; The current time
> (goto-char (point-min))
> (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
> (replace-match (format-time-string (match-string 1)) t t))
>
> and there is no provision for another time to be given here. I don't
> think there is any provision in the template for a time other than the
> current time: at least I can't see a %-escape that takes a different
> time.
>
> --
> Nick
>
>
>
[-- Attachment #2: Type: text/html, Size: 3462 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-capture-template: file+datetree+prompt not using prompted date in template
2015-11-04 22:54 ` Shankar Rao
@ 2015-11-05 1:39 ` Shankar Rao
0 siblings, 0 replies; 4+ messages in thread
From: Shankar Rao @ 2015-11-05 1:39 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]
Looks like a similar issue was addressed earlier here:
http://sachachua.com/blog/2015/02/org-mode-reusing-date-file-datetree-prompt/
Shankar
On Wed, Nov 4, 2015 at 2:54 PM, Shankar Rao <shankar.rao@gmail.com> wrote:
> Earlier in org-capture-fill-template, there is the following:
>
> (let* (...
> (ct (org-capture-get :default-time))
> ...
>
> The property :default-time defaults to the current time and is overwritten
> by file+datetree+prompt,
>
> If ct was passed as a 2nd argument to format-time-string in your code
> snippet:
>
> ;; The current time
> (goto-char (point-min))
> (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
> (replace-match (format-time-string (match-string 1) ct) t t))
>
> this should provide the behavior I'm looking for with
> file+datetree+prompt, but still use the current time for other capture
> types. Will this solution break anything?
>
> Shankar
>
> On Wed, Nov 4, 2015 at 2:15 PM, Nick Dokos <ndokos@gmail.com> wrote:
>
>> Shankar Rao <shankar.rao@gmail.com> writes:
>>
>> > For the following org capture template:
>> >
>> > (setq org-capture-templates
>> > '(("d" "Date Tree Test" plain
>> > (file+datetree+prompt "~/org/testdt.org")
>> > "This date should be the date i picked: %<%y%m%d>")))
>> >
>> > Though this is filed under the correct date in the datetree, no matter
>> what date I select in the prompt,
>> > the date displayed in the template is the current date. Is this a bug
>> or a feature?
>> >
>>
>> It's a feature I guess - org-capture.el says:
>>
>> ;; The current time
>> (goto-char (point-min))
>> (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
>> (replace-match (format-time-string (match-string 1)) t t))
>>
>> and there is no provision for another time to be given here. I don't
>> think there is any provision in the template for a time other than the
>> current time: at least I can't see a %-escape that takes a different
>> time.
>>
>> --
>> Nick
>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 4256 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-05 1:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04 21:22 org-capture-template: file+datetree+prompt not using prompted date in template Shankar Rao
2015-11-04 22:15 ` Nick Dokos
2015-11-04 22:54 ` Shankar Rao
2015-11-05 1:39 ` Shankar Rao
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.