Hi I try to add a new entry to my org-capture-templates for mails what I read via gnus. I'd like to have a timestamp that reflects when the message was received, not when the entry was created (for that I would to have to use %t) Now I have set "| | %:fromname|%:fromaddress|%^{Sheet|1|2|3|4|5|6|7|8|9} | %:date |[ ] | | %a " :prepend t) Using the description of the org-capture-template ------------------------+------------------------------------------------------ gnus | %:from %:fromname %:fromaddress | %:to %:toname %:toaddress | %:fromto (either "to NAME" or "from NAME") | %:date %:date-timestamp (as active timestamp) | %:date-timestamp-inactive (as inactive timestamp) gnus | %:group, for messages also all email fields The problem is this results in | Number | name | email | sheet | date | status | | | John Doe | footbar@gmail.com | 2 | Tue, 2 Mar 2021 19:35:03 +0100 | [ ] | I don't need the hour, and for sure I don't need +0100 Any idea how to shorten that? regards Uwe Brauer
Hi
What I use is the result of format-time-string (as explained in the Org
Capture Templates help; check also the help for the format-time-string
function).
The string I use is:
%<%Y%m%d-T%H%M%S>
It gives me, for example, 20210304-T095526.
If you don't want the hour just remove "-T%H%M%S"
Best,
Alberto
Uwe Brauer <oub@mat.ucm.es> writes:
> Hi
>
> I try to add a new entry to my org-capture-templates
> for mails what I read via gnus. I'd like to have a timestamp that
> reflects when the message was received, not when the entry was created
> (for that I would to have to use %t)
>
> Now I have set
>
> "| | %:fromname|%:fromaddress|%^{Sheet|1|2|3|4|5|6|7|8|9} | %:date |[ ] | | %a " :prepend t)
>
> Using the description of the org-capture-template
>
> ------------------------+------------------------------------------------------
> gnus | %:from %:fromname %:fromaddress
> | %:to %:toname %:toaddress
> | %:fromto (either "to NAME" or "from NAME")
> | %:date %:date-timestamp (as active timestamp)
> | %:date-timestamp-inactive (as inactive timestamp)
> gnus | %:group, for messages also all email fields
>
> The problem is this results in
>
> | Number | name | email | sheet | date | status |
> | | John Doe | footbar@gmail.com | 2 | Tue, 2 Mar 2021 19:35:03 +0100 | [ ] |
>
> I don't need the hour, and for sure I don't need +0100
>
> Any idea how to shorten that?
>
> regards
>
> Uwe Brauer
[-- Attachment #1: Type: text/plain, Size: 805 bytes --] >>> "AA" == Alberto AP <alberto.arias@gm.uca.es> writes: Hi > Hi > What I use is the result of format-time-string (as explained in the Org > Capture Templates help; check also the help for the format-time-string > function). > The string I use is: > %<%Y%m%d-T%H%M%S> > It gives me, for example, 20210304-T095526. > If you don't want the hour just remove "-T%H%M%S" Sorry, you misunderstood me, this time string, inserts the time string, when I execute the capture, but I want to extract the time string, when the message was received. This is why I used %:date in my first attempt, that works but inserts Tue, 2 Mar 2021 19:35:03 +0100 Which I find way too long. Just Tue, 2 Mar 2021 Would be fine or 02.03.2021 But not the hour, seconds etc Uwe Brauer [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
>>>>> 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.
Robert
--
[-- Attachment #1: Type: text/plain, Size: 1160 bytes --] >>> "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? [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
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
[-- Attachment #1: Type: text/plain, Size: 854 bytes --] > Uwe Brauer <oub@mat.ucm.es> writes: 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 > 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? Ah, ok now I see I will give it a try at the weekend. [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
>>>>> On Thu, 04 Mar 2021 21:24:03 +0100, Uwe Brauer <oub@mat.ucm.es> said:
Uwe> I am not acquainted with let-bound (only with let)
'let-bound' is a shorthand for saying 'binding a value using let'
Uwe> So are you saying I should may use defadvice to modify org-capture?
Well, you have control over how org-capture is invoked, so you could
do:
(defun my-org-capture ()
(let ((org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a>")))
(org-capture)))
although you could do it with advice if you wanted. Untested, of course :-)
Robert
--
[-- Attachment #1: Type: text/plain, Size: 866 bytes --] >>> "RP" == Robert Pluim <rpluim@gmail.com> writes: >>>>>> On Thu, 04 Mar 2021 21:24:03 +0100, Uwe Brauer <oub@mat.ucm.es> said: Uwe> I am not acquainted with let-bound (only with let) > 'let-bound' is a shorthand for saying 'binding a value using let' Uwe> So are you saying I should may use defadvice to modify org-capture? > Well, you have control over how org-capture is invoked, so you could > do: > (defun my-org-capture () > (let ((org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a>"))) > (org-capture))) > although you could do it with advice if you wanted. Untested, of course :-) Well, in order to run it I added an interactive call, but then %:date reminded unimpressed by this setting the result was | user | user@ucm.es | 3 | 3 | [] | Fri, 12 Mar 2021 16:14:35 +0100 | Uwe [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
>>>>> On Fri, 12 Mar 2021 16:58:27 +0100, Uwe Brauer <oub@mat.ucm.es> said:
Uwe> Well, in order to run it I added an interactive call, but then
Uwe> %:date reminded unimpressed by this setting
Uwe> the result was
Uwe> | user | user@ucm.es | 3 | 3 | [] | Fri, 12 Mar 2021 16:14:35 +0100 |
My mistake, itʼs a defconst, not a defvar, so it may well have been
inserted verbatim into the org code.
Robert
--