all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-capture-template with changing heading (including a TIMESTAMP)
@ 2021-03-19  8:55 Uwe Brauer
  2021-10-03  6:40 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2021-03-19  8:55 UTC (permalink / raw)
  To: emacs-orgmode


Hi

For an org-capture-template I have a setting of the form

("mg" "Exercicios Annu21: asignados"
table-line (file+headline "~/somefile.org" "Exercicios Annu21: asignados")

However in that file I also want a header of the form 

* Exercicios Annu21: asignados <2021-03-19 vie 09:48>

That is a changing timestamp in the heading. How can I achieve that for
my template?

Thanks

Uwe Brauer 



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

* Re: org-capture-template with changing heading (including a TIMESTAMP)
  2021-03-19  8:55 org-capture-template with changing heading (including a TIMESTAMP) Uwe Brauer
@ 2021-10-03  6:40 ` Ihor Radchenko
  2021-10-03  7:26   ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2021-10-03  6:40 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> ("mg" "Exercicios Annu21: asignados"
> table-line (file+headline "~/somefile.org" "Exercicios Annu21: asignados")
>
> However in that file I also want a header of the form 
>
> * Exercicios Annu21: asignados <2021-03-19 vie 09:48>
>
> That is a changing timestamp in the heading. How can I achieve that for
> my template?

If you want to create a new heading with the timestamp, you can use
file+function as your target in the template (see org-capture-templates
docstring).

If you want to change the existing heading, you can use file+regexp as
target and add a function modifying your heading to
org-capture-before-finalize-hook

You may also try https://github.com/progfolio/doct to make the above a
little simpler.

Hope it helps.

Best,
Ihor


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

* Re: org-capture-template with changing heading (including a TIMESTAMP)
  2021-10-03  6:40 ` Ihor Radchenko
@ 2021-10-03  7:26   ` Uwe Brauer
  2021-10-03  9:19     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2021-10-03  7:26 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1774 bytes --]

>>> "IR" == Ihor Radchenko <yantar92@gmail.com> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> ("mg" "Exercicios Annu21: asignados"
>> table-line (file+headline "~/somefile.org" "Exercicios Annu21: asignados")
>> 
>> However in that file I also want a header of the form 
>> 
>> * Exercicios Annu21: asignados <2021-03-19 vie 09:48>
>> 
>> That is a changing timestamp in the heading. How can I achieve that for
>> my template?

> If you want to create a new heading with the timestamp, you can use
> file+function as your target in the template (see org-capture-templates
> docstring).

Thanks

I tried 

        ("mg" "Ejercicios Annu21: hechos, solicitados y asignados"
         table-line (file+function "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Ejercios-Alumnos-Grupos/2021/Ejercios-Teoria21.org" "Ejercicios Annu21: hechos, solicitados y asignados" (clock))
         "| |%^{Grp|1|2|3|4|5|6|7|8}  |%^{Hj|1|2|3|4|5|6|7} |%^{Ej-As|1|2|3|4|5} |%^{Tit}| | [] | |   | %:fromname| |%:fromaddress |  %(my-extract-cc)  |%:subject | %:date |%a | "  :prepend t :empty-lines 1 :unnarrowed t
         )

But it does not work, I receive the error 


org-capture-set-target-location: Invalid capture target specification: (file+function "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Ejercios-Alumnos-Grupos/2021/Ejercios-Teoria21.org" "Ejercicios Annu21: hechos, solicitados y asignados" (clock))

I also tried clock instead of clock.

I most likely misunderstood you.


> If you want to change the existing heading, you can use file+regexp as
> target and add a function modifying your heading to
> org-capture-before-finalize-hook

> You may also try https://github.com/progfolio/doct to make the above a
> little simpler.

I try that thanks

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: org-capture-template with changing heading (including a TIMESTAMP)
  2021-10-03  7:26   ` Uwe Brauer
@ 2021-10-03  9:19     ` Ihor Radchenko
  2021-10-04 10:51       ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2021-10-03  9:19 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> I tried 
>
>         ("mg" "Ejercicios Annu21: hechos, solicitados y asignados"
>          table-line (file+function "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Ejercios-Alumnos-Grupos/2021/Ejercios-Teoria21.org" "Ejercicios Annu21: hechos, solicitados y asignados" (clock))
>          "| |%^{Grp|1|2|3|4|5|6|7|8}  |%^{Hj|1|2|3|4|5|6|7} |%^{Ej-As|1|2|3|4|5} |%^{Tit}| | [] | |   | %:fromname| |%:fromaddress |  %(my-extract-cc)  |%:subject | %:date |%a | "  :prepend t :empty-lines 1 :unnarrowed t
>          )
>
> But it does not work, I receive the error 

Because you did not supply a function. The docstring says:
(file+function "path/to/file" function-finding-location)

function-finding-location should be a valid Elisp function that will
need to take care about moving point to target heading.  What you have
in your template is
(key description table-line (file+function file-name
!some-string-that-should-not-be-there! !(clock)-which-is-a-third-element-and-also-should-not-be-there!) ...


Best,
Ihor


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

* Re: org-capture-template with changing heading (including a TIMESTAMP)
  2021-10-03  9:19     ` Ihor Radchenko
@ 2021-10-04 10:51       ` Uwe Brauer
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Brauer @ 2021-10-04 10:51 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]


> Uwe Brauer <oub@mat.ucm.es> writes:

> Because you did not supply a function. The docstring says:
> (file+function "path/to/file" function-finding-location)


Oops I read

             (file+function "path/to/file" function-finding-location)
                 A function to find the right location in the file

             (clock)
                File to the entry that is currently being clocked

And took the entry (clock) for that function-finding-location 

My bad.

I have to read and understand the role of that function better.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

end of thread, other threads:[~2021-10-04 10:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-19  8:55 org-capture-template with changing heading (including a TIMESTAMP) Uwe Brauer
2021-10-03  6:40 ` Ihor Radchenko
2021-10-03  7:26   ` Uwe Brauer
2021-10-03  9:19     ` Ihor Radchenko
2021-10-04 10:51       ` Uwe Brauer

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.