emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Capture template using variable
@ 2016-05-05 20:36 Karl Voit
  2016-05-05 20:45 ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Voit @ 2016-05-05 20:36 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

Why is capture template 2 not working ("Invalid capture template")
and how can I fix it?

Thanks!


  (setq my-capture-template-next "* NEXT %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")

  (setq org-capture-templates
    '(
      ("1" "first version with string" entry (file+headline "~/share/all/org-mode/misc.org" "shorts")
       "* NEXT %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
      ("2" "second version with variable" entry (file+headline "~/share/all/org-mode/misc.org" "shorts")
       my-capture-template-next :empty-lines 1)
          ))


-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: Capture template using variable
  2016-05-05 20:36 Capture template using variable Karl Voit
@ 2016-05-05 20:45 ` Kaushal Modi
  2016-05-05 21:11   ` Karl Voit
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2016-05-05 20:45 UTC (permalink / raw)
  To: Karl Voit, emacs-orgmode

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

Try

(setq my-capture-template-next "* NEXT %?\n:PROPERTIES:\n:CREATED:
%U\n:END:\n\n")

(setq org-capture-templates
      `(  ; Note the backquote here!!
        ("1" "first version with string" entry (file+headline
"~/share/all/org-mode/misc.org" "shorts")
         "* NEXT %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
        ("2" "second version with variable" entry (file+headline
"~/share/all/org-mode/misc.org" "shorts")
         ,my-capture-template-next :empty-lines 1) ; and comma before
my-capture-..
        ))

My guess is you need to evaluate my-capture-template-next before putting it
in org-capture-templates and the backquote/comma above do that.
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1095 bytes --]

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

* Re: Capture template using variable
  2016-05-05 20:45 ` Kaushal Modi
@ 2016-05-05 21:11   ` Karl Voit
  2016-05-05 21:27     ` Karl Voit
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Voit @ 2016-05-05 21:11 UTC (permalink / raw)
  To: emacs-orgmode

Hi Kaushal!

* Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> Try
>
> (setq my-capture-template-next "* NEXT %?\n:PROPERTIES:\n:CREATED:
> %U\n:END:\n\n")
>
> (setq org-capture-templates
>       `(  ; Note the backquote here!!
>         ("1" "first version with string" entry (file+headline
> "~/share/all/org-mode/misc.org" "shorts")
>          "* NEXT %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
>         ("2" "second version with variable" entry (file+headline
> "~/share/all/org-mode/misc.org" "shorts")
>          ,my-capture-template-next :empty-lines 1) ; and comma before
> my-capture-..
>        ))
>
> My guess is you need to evaluate my-capture-template-next before putting it
> in org-capture-templates and the backquote/comma above do that.

Oh, I see. I'm not that good with Elisp yet.

Unfortunately, adding the comma did not make the "Invalid capture
template" go away :-( This does not seem to be my (only) issue here...

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: Capture template using variable
  2016-05-05 21:11   ` Karl Voit
@ 2016-05-05 21:27     ` Karl Voit
  0 siblings, 0 replies; 4+ messages in thread
From: Karl Voit @ 2016-05-05 21:27 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
> Hi Kaushal!
>
> * Kaushal Modi <kaushal.modi@gmail.com> wrote:
>>
>> Try
>>
>> (setq my-capture-template-next "* NEXT %?\n:PROPERTIES:\n:CREATED:
>> %U\n:END:\n\n")
>>
>> (setq org-capture-templates
>>       `(  ; Note the backquote here!!
>>         ("1" "first version with string" entry (file+headline
>> "~/share/all/org-mode/misc.org" "shorts")
>>          "* NEXT %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
>>         ("2" "second version with variable" entry (file+headline
>> "~/share/all/org-mode/misc.org" "shorts")
>>          ,my-capture-template-next :empty-lines 1) ; and comma before
>> my-capture-..
>>        ))
>>
>> My guess is you need to evaluate my-capture-template-next before putting it
>> in org-capture-templates and the backquote/comma above do that.
>
> Unfortunately, adding the comma did not make the "Invalid capture
> template" go away :-( This does not seem to be my (only) issue here...

I missed, that you replaced the single quote with a back quote. With
it, it works like charm.

Thank you for your help!

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

end of thread, other threads:[~2016-05-05 21:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 20:36 Capture template using variable Karl Voit
2016-05-05 20:45 ` Kaushal Modi
2016-05-05 21:11   ` Karl Voit
2016-05-05 21:27     ` Karl Voit

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).