emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using variables in org-capture-templates
@ 2019-11-12 15:27 Nathan Neff
  2019-11-12 15:36 ` Josiah Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Neff @ 2019-11-12 15:27 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello all,

I'm sure this is a basic elisp thing but I'd like some help:

I wanted to abstract the "sprintf-like" formats of the template expansion
into readable variables that I can reuse in my templates.  However, upon
substituting variable for the formats, I am getting "Invalid capture
template"
for the capture template "T" below -- for comparison the "t" template works.

What am I doing wrong?  I'm sure it has to do with the '() value of
org-capture templates,
and the fact that the (concat) is not evaluated.  What is the "correct" way
to do this
in elisp?

Here's my code:

#+begin_src emacs-lisp
(setq org-capture-templates '())
(setq njn-clocked-entry "\nclocked: %K\n")
(setq njn-from-entry "\nfrom: %a\n")
(setq njn-capture-trailer "\n--\n")

(setq org-capture-templates '(
    ("T" "Todo: Detailed" entry (file+headline "" "Tasks")
        (concat "* todo %^{Heading}\n%U\n%?" njn-from-entry
njn-clocked-entry njn-capture-trailer) :prepend t)
    ("t" "Todo: Basic" entry (file+headline "" "Tasks") "* todo
%^{Heading}\n%U\n%?\nclocked: %K\n" :prepend t)))

Thanks,
--Nate

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

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

* Re: Using variables in org-capture-templates
  2019-11-12 15:27 Using variables in org-capture-templates Nathan Neff
@ 2019-11-12 15:36 ` Josiah Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Josiah Schwab @ 2019-11-12 15:36 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

> What is the "correct" way to do this in elisp?

I believe you want to use backquote - comma

https://www.gnu.org/software/emacs/manual/html_node/elisp/Backquote.html

Josiah

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

end of thread, other threads:[~2019-11-12 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-12 15:27 Using variables in org-capture-templates Nathan Neff
2019-11-12 15:36 ` Josiah Schwab

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