emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problems with templates and ID in properties
@ 2024-02-02 11:15 Uwe Brauer
  2024-02-02 13:48 ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Brauer @ 2024-02-02 11:15 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi

I have the following setting 

--8<---------------cut here---------------start------------->8---

(setq org-capture-templates
      '(
        ("mk" "Grupos Ejercicios" entry (file "~/grupos2024.org")
         "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
         :Link:  %a   
         :Email: %(org-contacts-template-email)
         :Grp:     %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
         :Usuario1: %:fromname
         :Email1: %:fromaddress
         :Usuario2: %(my-extract-cc)
         :Email2:  %(my-extract-cc)
         :Status:   [ ]
         :Hoja:     
         :Ej:       
         :End:")))
--8<---------------cut here---------------end--------------->8---

and I am facing two problems.
When I call org-capture and select this template the corresponding buffer 
    1) the corresponding CAPTURE buffer looks like 
--8<---------------cut here---------------start------------->8---

* TODO G13 <2024-02-02 12:06> :Annu24: Joe Foo
         :Link:  [[gnus:nnimap+UCMgmail:INBOX#CAN8doTNDx_v0cTCpRfN3kA0+W0o0=ry=EK6t+AtcMZaOUDTmbQ@mail.gmail.com][Email from Joe Foo: [Annu24] formar Grupo]]   
         :Email: pabcue01@ucm.es
         :Grp:     G13
         :Usuario1: Joe Foo
         :Email1: user1@gmail.com
         :Usuario2: Jane Tarzan
         :Email2:  jane@gmail.com
         :Status:   [ ]
         :Hoja:     
         :Ej:       
         :End:
--8<---------------cut here---------------end--------------->8---

In other words ** has been replaced by * which I don't understand.


The second problem is concerns the ID
the resulting entry looks
--8<---------------cut here---------------start------------->8---
* TODO G13 <2024-02-02 12:06> :Annu24: Joe Foo
  :PROPERTIES:
  :ID:       298f63f5-b67c-4c21-a820-2c8a6501b48c
  :END:
         :Link:  [[gnus:nnimap+UCMgmail:INBOX#CAN8doTNDx_v0cTCpRfN3kA0+W0o0=ry=EK6t+AtcMZaOUDTmbQ@mail.gmail.com][Email from Joe Foo: [Annu24] formar Grupo]]   
         :Email: pabcue01@ucm.es
         :Grp:     G13
         :Usuario1: Joe Foo
         :Email1: user1@gmail.com
         :Usuario2: Jane Tarzan
         :Email2:  jane@gmail.com
         :Status:   [ ]
         :Hoja:     
         :Ej:       
         :End:
--8<---------------cut here---------------end--------------->8---


So automatically an ID has been inserted, that is fine but now there are
two ENDS which I have manually to repair (and the indentation is wrong)

Any idea how to solve this problem

Regards

Uwe Brauer 



-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-02 11:15 problems with templates and ID in properties Uwe Brauer
@ 2024-02-02 13:48 ` Ihor Radchenko
  2024-02-02 14:03   ` Uwe Brauer via General discussions about Org-mode.
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-02 13:48 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

> I have the following setting 
>
> (setq org-capture-templates
> ...
>          "** TODO ...
>
> and I am facing two problems.
> When I call org-capture and select this template the corresponding buffer 
>     1) the corresponding CAPTURE buffer looks like 
> ...
> * TODO G13 <2024-02-02 12:06> :Annu24: Joe Foo
> ....
> In other words ** has been replaced by * which I don't understand.

This is expected. As per `org-capture-templates' docstring, "entry"
capture type inserts top-level entries into files:

               entry       an Org node, with a headline.  Will be filed
                           as the child of the target entry or as a
                           top-level entry.  Its default template is:
                             "* %?

> The second problem is concerns the ID
> the resulting entry looks
> --8<---------------cut here---------------start------------->8---
> * TODO G13 <2024-02-02 12:06> :Annu24: Joe Foo
>   :PROPERTIES:
>   :ID:       298f63f5-b67c-4c21-a820-2c8a6501b48c
>   :END:
> ...
>          :Email2:  jane@gmail.com
>          :Status:   [ ]
>          :Hoja:     
>          :Ej:       
>          :End:
> ...
> So automatically an ID has been inserted, that is fine but now there are
> two ENDS which I have manually to repair (and the indentation is wrong)

I am unable to reproduce this problem.
May you please simplify the example, so that it can be reproduced
starting from emacs -Q?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-02 13:48 ` Ihor Radchenko
@ 2024-02-02 14:03   ` Uwe Brauer via General discussions about Org-mode.
  2024-02-02 15:13     ` Uwe Brauer via General discussions about Org-mode.
  2024-02-02 16:50     ` Ihor Radchenko
  0 siblings, 2 replies; 19+ messages in thread
From: Uwe Brauer via General discussions about Org-mode. @ 2024-02-02 14:03 UTC (permalink / raw)
  To: emacs-orgmode

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


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

Thanks for you answer
> This is expected. As per `org-capture-templates' docstring, "entry"
> capture type inserts top-level entries into files:

>                entry       an Org node, with a headline.  Will be filed
>                            as the child of the target entry or as a
>                            top-level entry.  Its default template is:
>                              "* %?

So that cannot be changed, do I understand correctly.


> I am unable to reproduce this problem.
> May you please simplify the example, so that it can be reproduced
> starting from emacs -Q?

Thanks for trying it out, I suspect it is then my setting, I just looked
up the org-mode-hook

And I can't find any suspicious. I will try to eyeball my org-add-ons
files.

What command/variable could org-mode force to have always an UUID in the
ID property?

I also will try to debug org-capture and org-capture-finalize
I tried it once and cannot see when the UUID is automatically inserted.

hm


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-02 14:03   ` Uwe Brauer via General discussions about Org-mode.
@ 2024-02-02 15:13     ` Uwe Brauer via General discussions about Org-mode.
  2024-02-02 16:50     ` Ihor Radchenko
  1 sibling, 0 replies; 19+ messages in thread
From: Uwe Brauer via General discussions about Org-mode. @ 2024-02-02 15:13 UTC (permalink / raw)
  To: emacs-orgmode

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



> Thanks for you answer


> So that cannot be changed, do I understand correctly.



> Thanks for trying it out, I suspect it is then my setting, I just looked
> up the org-mode-hook

> And I can't find any suspicious. I will try to eyeball my org-add-ons
> files.

> What command/variable could org-mode force to have always an UUID in the
> ID property?

> I also will try to debug org-capture and org-capture-finalize
> I tried it once and cannot see when the UUID is automatically inserted.

Ok, I debugged it again, the function org-caputre-finalize adds the
property with the UUID more specifically the line

(run-hooks 'org-capture-prepare-finalize-hook)

Hm I will investigate this further 

> hm

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-02 14:03   ` Uwe Brauer via General discussions about Org-mode.
  2024-02-02 15:13     ` Uwe Brauer via General discussions about Org-mode.
@ 2024-02-02 16:50     ` Ihor Radchenko
  2024-02-03 19:40       ` Uwe Brauer
  1 sibling, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-02 16:50 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

Uwe Brauer via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:

>> Uwe Brauer <oub@mat.ucm.es> writes:
>
> Thanks for you answer
>> This is expected. As per `org-capture-templates' docstring, "entry"
>> capture type inserts top-level entries into files:
>
>>                entry       an Org node, with a headline.  Will be filed
>>                            as the child of the target entry or as a
>>                            top-level entry.  Its default template is:
>>                              "* %?
>
> So that cannot be changed, do I understand correctly.

It might be changed. Currently, we mimic the behavior of
org-yank-subtree, so that we always insert captured entry under the
correct level regardless of the capture target. For example, when you
use OLP, the level will be adjusted.

May you please explain more why you need to use level 2 heading specifically?

> What command/variable could org-mode force to have always an UUID in the
> ID property?

`org-id-method' I think.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-02 16:50     ` Ihor Radchenko
@ 2024-02-03 19:40       ` Uwe Brauer
  2024-02-03 21:52         ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Brauer @ 2024-02-03 19:40 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:

> Uwe Brauer via "General discussions about Org-mode."
> <emacs-orgmode@gnu.org> writes:

>>> Uwe Brauer <oub@mat.ucm.es> writes:
>> 
>> Thanks for you answer
>>> This is expected. As per `org-capture-templates' docstring, "entry"
>>> capture type inserts top-level entries into files:
>> 
>>> entry       an Org node, with a headline.  Will be filed
>>> as the child of the target entry or as a
>>> top-level entry.  Its default template is:
>>> "* %?
>> 
>> So that cannot be changed, do I understand correctly.

> It might be changed. Currently, we mimic the behavior of
> org-yank-subtree, so that we always insert captured entry under the
> correct level regardless of the capture target. For example, when you
> use OLP, the level will be adjusted.

> May you please explain more why you need to use level 2 heading specifically?


Sure. I use this template for extracting from emails sent by my students
their names and email addresses to have entries like this
--8<---------------cut here---------------start------------->8---
* Grupos                                                           :noexport:
     :PROPERTIES:
     :EXPORT_OPTIONS: num:t
     :COLUMNS:  %10GRP(Grupos) %10HOJA(Hoja Nr) %10EJ(Ejericio Nr) %17DATE(Date) %7STATUS(Status){X/}
     :ID:       Grupos
     :END:

** !!TODO!! G1 <2023-01-24 12:51> :Annu24: Paul New
   :PROPERTIES:
   :ID:       0da9c464-74a1-4153-b957-72e6b562bb0a
   :Link:     [[gnus:nnimap+UCMgmail:INBOX#CAMZEOZ24BUfHRj3_XaF6kxyPBZ4vY4G=Qvb2iuJz4zENAPOFsw@mail.gmail.com][Email from User1: [Annu23] formar Grupo]]
   :Email:    user1@gmail.com
   :Grp:      Gr1
   :Usuario1: User1
   :Email1:   user1@gmail.com
   :Usuario2: User2
   :Email2:   user2@gmail.com
   :H2:       1 (Función implícita)
   :P2:       25
   :STHAB2:   [ ]
   :StEnv2:   [ ]
   :H4:       2 (Convergencia adaptativo)
   :P4:       50
   :STHAB4:   [X]
   :StEnv4:   [X]
   :End:
** !!TODO!! G2 <2023-01-29 19:11> :Annu24: John Doe
   :PROPERTIES:
   :ID:       57aed14b-6790-43de-9440-af082d555800
   :Link:     [[gnus:nnimap+UCMgmail:INBOX#CANpraWwp91vH=-N2y3A5pm7hwuRt-Qzq_Gy7ZyYp7jc5uZ=4AA@mail.gmail.com][Email from User2: [Annu23] formar Grupo]]
   :Email:    user3@gmail.com
   :Grp:      Gr2
   :Usuario1: User3
   :Email1:   user3@gmail.com
   :Usuario2: User4
   :Email2:   user@gmail.com
   :H1:       4 (Método \theta)
   :P1:       10
   :STHAB1:   [X]
   :StEnv1:   [X]
   :SUMMARY:  ok
   :H2:       1
   :P2:       10
   :STHAB2:   [X]
   :StEnv2:   [X]
   :H5:       6 (Func Ampli RK)
   :P5:       5
   :STHAB5:   [X]
   :StEnv5:   [X]
   :End:
--8<---------------cut here---------------end--------------->8---

** Sheet     
so I can use now columnview to generate a table
--8<---------------cut here---------------start------------->8---


#+TBLNAME: sheets
#+BEGIN: columnview :maxlevel 2  :skip-empty-rows t  :indent nil :hlines 2  :format "%10Grp(Grupo) %7H1(Hoja1-Ej) %10P1(\%) %7H2(Hoja2-Ej) %10P2(\%) %7H3(Hoja3-Ej) %10P3(\%)  %7H4(Hoja4-Ej)  %10P4(\%) %7H5(Hoja5-Ej) %10P5(\%) %7H6(Hoja6-Ej) %10P6(\%)"
| <10>  | <7>          | <10> | <7>                   | <10> | <7>      | <10> | <7>                         | <10> | <7>               | <10> | <7>      | <10> |
| Grupo | Hoja1-Ej     | %    | Hoja2-Ej              |    % | Hoja3-Ej | %    | Hoja4-Ej                    | %    | Hoja5-Ej          | %    | Hoja6-Ej | %    |
|-------+--------------+------+-----------------------+------+----------+------+-----------------------------+------+-------------------+------+----------+------|
| Gr1   |              |      | 1 (Función implícita) |   25 |          |      | 2 (Convergencia adaptativo) | 50   |                   |      |          |      |
|-------+--------------+------+-----------------------+------+----------+------+-----------------------------+------+-------------------+------+----------+------|
| Gr2   | 4 (Método \theta) | 10   | 1                     |   10 |          |      |                             |      | 6 (Func Ampli RK) | 5    |          |      |
#+END:

--8<---------------cut here---------------end--------------->8---

That however only works if the entries have level **

It my workflow now clearer?

>> What command/variable could org-mode force to have always an UUID in the
>> ID property?

> `org-id-method' I think.

This variable sets the format, but as far as I can see, is not
reasonable for adding an ID.

regards

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



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

* Re: problems with templates and ID in properties
  2024-02-03 19:40       ` Uwe Brauer
@ 2024-02-03 21:52         ` Ihor Radchenko
  2024-02-04  7:20           ` Uwe Brauer
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-03 21:52 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>> It might be changed. Currently, we mimic the behavior of
>> org-yank-subtree, so that we always insert captured entry under the
>> correct level regardless of the capture target. For example, when you
>> use OLP, the level will be adjusted.
>
>> May you please explain more why you need to use level 2 heading specifically?
>
> Sure. I use this template for extracting from emails sent by my students
> their names and email addresses to have entries like this
> --8<---------------cut here---------------start------------->8---
> * Grupos                                                           :noexport:
> ...
> ** !!TODO!! G1 <2023-01-24 12:51> :Annu24: Paul New
> ...
> #+TBLNAME: sheets
> #+BEGIN: columnview :maxlevel 2...
> ...
> That however only works if the entries have level **
>
> It my workflow now clearer?

Yup.
I recommend changing your capture template to
(file+olp "~/grupos2024.org" "Grupos")

>>> What command/variable could org-mode force to have always an UUID in the
>>> ID property?
>
>> `org-id-method' I think.
>
> This variable sets the format, but as far as I can see, is not
> reasonable for adding an ID.

Do you mean that you want IDs to be always added any time your create a
heading? If so, the common method is to add `org-insert-heading-hook'.

However, this hook will not work for templates. You may add
:ID: %(org-id-new)
to your template to generate an ID.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-03 21:52         ` Ihor Radchenko
@ 2024-02-04  7:20           ` Uwe Brauer
  2024-02-04 13:38             ` Ihor Radchenko
  2024-02-04 13:49             ` Ihor Radchenko
  0 siblings, 2 replies; 19+ messages in thread
From: Uwe Brauer @ 2024-02-04  7:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

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

>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>>> It might be changed. Currently, we mimic the behavior of
>>> org-yank-subtree, so that we always insert captured entry under the
>>> correct level regardless of the capture target. For example, when you
>>> use OLP, the level will be adjusted.
>> 
>>> May you please explain more why you need to use level 2 heading specifically?
>> 
>> Sure. I use this template for extracting from emails sent by my students
>> their names and email addresses to have entries like this
>> --8<---------------cut here---------------start------------->8---
>> * Grupos                                                           :noexport:
>> ...
>> ** !!TODO!! G1 <2023-01-24 12:51> :Annu24: Paul New
>> ...
>> #+TBLNAME: sheets
>> #+BEGIN: columnview :maxlevel 2...
>> ...
>> That however only works if the entries have level **
>> 
>> It my workflow now clearer?

> Yup.
> I recommend changing your capture template to
> (file+olp "~/grupos2024.org" "Grupos")

That gives an error, as gives file+headline
so this part 

(setq org-capture-templates
      '(
        ("m" "Mail options")
        ("mk" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
         "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
         :ID: %(org-id-new)
         :Link:  %a   
         :Email: %(org-contacts-template-email)
         :Grp:     %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
         :Usuario1: %:fromname
         :Email1: %:fromaddress
         :Usuario2: %(my-extract-cc)
         :Email2:  %(my-extract-cc)
         :Usuario3: %(my-extract-cc)
         :Email3:  %(my-extract-cc)
         :Usuario4: %(my-extract-cc)
         :Email4: %(my-extract-cc)
         :Status:   [ ]
         :Hoja:     
         :Ej:       
         :End:")))

Gives the error 
Deprecated date/weektree capture templates changed to ‘file+olp+datetree’.
org-capture-set-target-location: Wrong type argument: markerp, nil
Updating buffer list...done
        



>>> What command/variable could org-mode force to have always an UUID in the
>>> ID property?
>> 
>>> `org-id-method' I think.
>> 
>> This variable sets the format, but as far as I can see, is not
>> reasonable for adding an ID.

> Do you mean that you want IDs to be always added any time your create a
> heading? If so, the common method is to add `org-insert-heading-hook'.

That hook is empty, nevertheless and ID with an annoying END is inserted
in the middle of the template
> However, this hook will not work for templates. You may add
> :ID: %(org-id-new)
> to your template to generate an ID.

I will try that.

Thanks 


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-04  7:20           ` Uwe Brauer
@ 2024-02-04 13:38             ` Ihor Radchenko
  2024-02-04 18:24               ` Uwe Brauer
  2024-02-04 18:29               ` Uwe Brauer
  2024-02-04 13:49             ` Ihor Radchenko
  1 sibling, 2 replies; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-04 13:38 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>> I recommend changing your capture template to
>> (file+olp "~/grupos2024.org" "Grupos")
>
> That gives an error, as gives file+headline
> so this part 
>
> (setq org-capture-templates
>       '(
>         ("m" "Mail options")
>         ("mk" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")

You forgot "Grupos". Should be

(file+olp
"~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
"Grupos")

>> Do you mean that you want IDs to be always added any time your create a
>> heading? If so, the common method is to add `org-insert-heading-hook'.
>
> That hook is empty, nevertheless and ID with an annoying END is inserted
> in the middle of the template

You can try M-x debug-on-entry <RET> org-id-new <RET> to trigger
backtrace when `org-id-new' is called and see what is calling it.
Then, M-x cancel-debug-on-entry to disable the debugger.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-04  7:20           ` Uwe Brauer
  2024-02-04 13:38             ` Ihor Radchenko
@ 2024-02-04 13:49             ` Ihor Radchenko
  2024-02-04 18:20               ` Uwe Brauer
  1 sibling, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-04 13:49 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>         ("mk" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
> ...
> Gives the error 
> ...
> org-capture-set-target-location: Wrong type argument: markerp, nil

I tightened the template target location reader to produce less cryptic
error in similar cases.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a58a53ed

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-04 13:49             ` Ihor Radchenko
@ 2024-02-04 18:20               ` Uwe Brauer
  2024-02-04 18:26                 ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Brauer @ 2024-02-04 18:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

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

>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> ("mk" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
>> ...
>> Gives the error 
>> ...
>> org-capture-set-target-location: Wrong type argument: markerp, nil

> I tightened the template target location reader to produce less cryptic
> error in similar cases.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a58a53ed
shall I the pull and reinstall?


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-04 13:38             ` Ihor Radchenko
@ 2024-02-04 18:24               ` Uwe Brauer
  2024-02-04 18:30                 ` Ihor Radchenko
  2024-02-04 18:29               ` Uwe Brauer
  1 sibling, 1 reply; 19+ messages in thread
From: Uwe Brauer @ 2024-02-04 18:24 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

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

>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>>> I recommend changing your capture template to
>>> (file+olp "~/grupos2024.org" "Grupos")
>> 
>> That gives an error, as gives file+headline
>> so this part 
>> 
>> (setq org-capture-templates
>> '(
>> ("m" "Mail options")
>> ("mk" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")

> You forgot "Grupos". Should be

> (file+olp
> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
> "Grupos")

Ah, ok this solves that issue

>>> Do you mean that you want IDs to be always added any time your create a
>>> heading? If so, the common method is to add `org-insert-heading-hook'.
>> 
>> That hook is empty, nevertheless and ID with an annoying END is inserted
>> in the middle of the template

> You can try M-x debug-on-entry <RET> org-id-new <RET> to trigger
> backtrace when `org-id-new' is called and see what is calling it.
> Then, M-x cancel-debug-on-entry to disable the debugger.

Here is the result 

Debugger entered--entering a function:
* org-id-new()
  eval((org-id-new) t)
  org-eval((org-id-new))
  org-capture-expand-embedded-elisp()
  org-capture-fill-template()
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)




-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-04 18:20               ` Uwe Brauer
@ 2024-02-04 18:26                 ` Ihor Radchenko
  0 siblings, 0 replies; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-04 18:26 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>> I tightened the template target location reader to produce less cryptic
>> error in similar cases.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a58a53ed
> shall I the pull and reinstall?

You do not have to. My commit will just change the
org-capture-set-target-location: Wrong type argument: markerp, nil
to
Invalid capture target specification: ...

You still need to fix your template as I suggested.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-04 13:38             ` Ihor Radchenko
  2024-02-04 18:24               ` Uwe Brauer
@ 2024-02-04 18:29               ` Uwe Brauer
  2024-02-04 18:36                 ` Ihor Radchenko
  1 sibling, 1 reply; 19+ messages in thread
From: Uwe Brauer @ 2024-02-04 18:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

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



> You can try M-x debug-on-entry <RET> org-id-new <RET> to trigger
> backtrace when `org-id-new' is called and see what is calling it.
> Then, M-x cancel-debug-on-entry to disable the debugger.

Here are some news:

--8<---------------cut here---------------start------------->8---
(setq org-capture-templates
      '(
  ("mk" "Annu Grupos Ejercicios" entry (file "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
         "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
         :ID: %(org-id-new)
         :Link:  %a   
         :Email: %(org-contacts-template-email)
         :Grp:     %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
         :Usuario1: %:fromname
         :Email1: %:fromaddress
         :Usuario2: %(my-extract-cc)
         :Email2:  %(my-extract-cc)
         :Usuario3: %(my-extract-cc)
         :Email3:  %(my-extract-cc)
         :Usuario4: %(my-extract-cc)
         :Email4: %(my-extract-cc)
         :Status:   [ ]
         :Hoja:     
         :Ej:       
         :END:")))
--8<---------------cut here---------------end--------------->8---

Works save the ** Problem, but the org-id-new works

Now 

--8<---------------cut here---------------start------------->8---
(setq org-capture-templates
      '(

        ("my" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org" "Grupos")
         "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
         :ID: %(org-id-new)
         :Link:  %a   
         :Email: %(org-contacts-template-email)
         :Grp:     %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
         :Usuario1: %:fromname
         :Email1: %:fromaddress
         :Usuario2: %(my-extract-cc)
         :Email2:  %(my-extract-cc)
         :Usuario3: %(my-extract-cc)
         :Email3:  %(my-extract-cc)
         :Usuario4: %(my-extract-cc)
         :Email4: %(my-extract-cc)
         :Status:   [ ]
         :Hoja:     
         :Ej:       
         :END:")))

--8<---------------cut here---------------end--------------->8---

Works concerning the ** entry but inserts the unwanted END after 
org-id-new.

I can live with solution 1 but still wonder..

Thanks

Uwe Brauer 

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-04 18:24               ` Uwe Brauer
@ 2024-02-04 18:30                 ` Ihor Radchenko
  0 siblings, 0 replies; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-04 18:30 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>> You can try M-x debug-on-entry <RET> org-id-new <RET> to trigger
>> backtrace when `org-id-new' is called and see what is calling it.
>> Then, M-x cancel-debug-on-entry to disable the debugger.
>
> Here is the result 
>
> Debugger entered--entering a function:
> * org-id-new()
>   eval((org-id-new) t)
>   org-eval((org-id-new))
>   org-capture-expand-embedded-elisp()

This is coming from a template with %(org-id-new).
Is it where you are seeing the unwanted :END: inserted?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-04 18:29               ` Uwe Brauer
@ 2024-02-04 18:36                 ` Ihor Radchenko
  2024-02-04 18:38                   ` Uwe Brauer
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-04 18:36 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>         ("my" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org" "Grupos")
>          "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
>          :ID: %(org-id-new)
>          :Link:  %a   
>          :Email: %(org-contacts-template-email)
>          :Grp:     %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
>          :Usuario1: %:fromname
>          :Email1: %:fromaddress
>          :Usuario2: %(my-extract-cc)
>          :Email2:  %(my-extract-cc)
>          :Usuario3: %(my-extract-cc)
>          :Email3:  %(my-extract-cc)
>          :Usuario4: %(my-extract-cc)
>          :Email4: %(my-extract-cc)
>          :Status:   [ ]
>          :Hoja:     
>          :Ej:       
>          :END:")))
> ...
> Works concerning the ** entry but inserts the unwanted END after 
> org-id-new.

Try to remove
:ID: %(org-id-new)
temporarily and do M-x debug-on-entry ...

That should reveal where else org-id-new is called.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-04 18:36                 ` Ihor Radchenko
@ 2024-02-04 18:38                   ` Uwe Brauer
  2024-02-04 18:57                     ` Ihor Radchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Brauer @ 2024-02-04 18:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

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

>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> ("my" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org" "Grupos")
>> "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
>> :ID: %(org-id-new)
>> :Link:  %a   
>> :Email: %(org-contacts-template-email)
>> :Grp:     %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
>> :Usuario1: %:fromname
>> :Email1: %:fromaddress
>> :Usuario2: %(my-extract-cc)
>> :Email2:  %(my-extract-cc)
>> :Usuario3: %(my-extract-cc)
>> :Email3:  %(my-extract-cc)
>> :Usuario4: %(my-extract-cc)
>> :Email4: %(my-extract-cc)
>> :Status:   [ ]
>> :Hoja:     
>> :Ej:       
>> :END:")))
>> ...
>> Works concerning the ** entry but inserts the unwanted END after 
>> org-id-new.

> Try to remove
> :ID: %(org-id-new)
> temporarily and do M-x debug-on-entry ...



> That should reveal where else org-id-new is called.

Aha, thanks, the temporal buffer does not contain an ID, but when running  org-capture-finalize

I obtain.

  gnorb-registry-capture() is this the culprit?


Debugger entered--entering a function:
* org-id-new(nil)
  org-id-get(12826 create)
  org-id-get-create()
  gnorb-registry-capture()
  run-hooks(org-capture-prepare-finalize-hook)
  org-capture-finalize(nil)
  funcall-interactively(org-capture-finalize nil)
  call-interactively(org-capture-finalize nil nil)
  command-execute(org-capture-finalize)
  recursive-edit()
  debug(error (error "Capture abort: Quit"))
  signal(error ("Capture abort: Quit"))
  error("Capture abort: %s" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

* Re: problems with templates and ID in properties
  2024-02-04 18:38                   ` Uwe Brauer
@ 2024-02-04 18:57                     ` Ihor Radchenko
  2024-02-04 18:58                       ` Uwe Brauer
  0 siblings, 1 reply; 19+ messages in thread
From: Ihor Radchenko @ 2024-02-04 18:57 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

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

>>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Uwe Brauer <oub@mat.ucm.es> writes:
>>> ("my" "Annu Grupos Ejercicios" entry (file+olp "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org" "Grupos")
>>> "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
>>> :ID: %(org-id-new)
>>> :Link:  %a   
>>> :Email: %(org-contacts-template-email)
>>> ...
>>> Works concerning the ** entry but inserts the unwanted END after 
>>> org-id-new.
>
> I obtain.
>
>   gnorb-registry-capture() is this the culprit?
>
>
> Debugger entered--entering a function:
> * org-id-new(nil)
>   org-id-get(12826 create)
>   org-id-get-create()

It is actually not the culprit. The problem is much simpler.
You forgot :PROPERTIES: line in your capture template.

So, what Org sees is

* Heading
:ID:
...
:END:

And it is not considered a property drawer :)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: problems with templates and ID in properties
  2024-02-04 18:57                     ` Ihor Radchenko
@ 2024-02-04 18:58                       ` Uwe Brauer
  0 siblings, 0 replies; 19+ messages in thread
From: Uwe Brauer @ 2024-02-04 18:58 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, emacs-orgmode

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


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

   > It is actually not the culprit. The problem is much simpler.
   > You forgot :PROPERTIES: line in your capture template.

   > So, what Org sees is

   > * Heading
   > :ID:
   > ...
   > :END:

😱 😨

I am very sorry. Thanks for you patience and help!!!

Regards

Uwe 

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


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

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

end of thread, other threads:[~2024-02-04 18:59 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02 11:15 problems with templates and ID in properties Uwe Brauer
2024-02-02 13:48 ` Ihor Radchenko
2024-02-02 14:03   ` Uwe Brauer via General discussions about Org-mode.
2024-02-02 15:13     ` Uwe Brauer via General discussions about Org-mode.
2024-02-02 16:50     ` Ihor Radchenko
2024-02-03 19:40       ` Uwe Brauer
2024-02-03 21:52         ` Ihor Radchenko
2024-02-04  7:20           ` Uwe Brauer
2024-02-04 13:38             ` Ihor Radchenko
2024-02-04 18:24               ` Uwe Brauer
2024-02-04 18:30                 ` Ihor Radchenko
2024-02-04 18:29               ` Uwe Brauer
2024-02-04 18:36                 ` Ihor Radchenko
2024-02-04 18:38                   ` Uwe Brauer
2024-02-04 18:57                     ` Ihor Radchenko
2024-02-04 18:58                       ` Uwe Brauer
2024-02-04 13:49             ` Ihor Radchenko
2024-02-04 18:20               ` Uwe Brauer
2024-02-04 18:26                 ` Ihor Radchenko

Code repositories for project(s) associated with this public 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).