[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-capture-templates: %date is too long
From: |
Tim Cross |
Subject: |
Re: org-capture-templates: %date is too long |
Date: |
Fri, 05 Mar 2021 07:37:22 +1100 |
User-agent: |
mu4e 1.5.8; emacs 27.1.91 |
Uwe Brauer <oub@mat.ucm.es> writes:
>>>> "RP" == Robert Pluim <rpluim@gmail.com> writes:
>
> >>>>>> On Thu, 04 Mar 2021 15:22:21 +0100, Uwe Brauer <oub@mat.ucm.es>
> said:
> Uwe> Sorry, you misunderstood me, this time string, inserts the time
> string,
> Uwe> when I execute the capture, but I want to extract the time string,
> when
> Uwe> the message was received. This is why I used
> Uwe> %:date
> Uwe> in my first attempt, that works but inserts
> Uwe> Tue, 2 Mar 2021 19:35:03 +0100
>
> Uwe> Which I find way too long.
>
> Uwe> Just
> Uwe> Tue, 2 Mar 2021
>
> Uwe> Would be fine or 02.03.2021
>
> Uwe> But not the hour, seconds etc
>
> > It looks like the %:date handling respects the
> > 'org-time-stamp-formats' variable, so if you can arrange for that to
> > be let-bound appropriately during the capture process, it might do the
> > right thing.
>
> Hm that variable is set to
>
> Its value is ("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
>
> So if I call with a prefix it inserts
> <2021-03-04 jue 21:19>
>
> But nothing like +0100
>
> I am not acquainted with let-bound (only with let)
>
> So are you saying I should may use defadvice to modify org-capture?
Capture templates allow inclusion of an arbitrary elisp expression with
%(EXP). You could try defining an elisp function which accepts %:date as
an argument (i.e. a string arg) and formats it using normal elisp date/time
functions and
returns the result as a string and then call that function within your
template?
--
Tim Cross