emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathan Neff <nathan.neff@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Using variables in org-capture-templates
Date: Tue, 12 Nov 2019 09:27:31 -0600	[thread overview]
Message-ID: <CAC=HedAcMQsVw3imBOferK4iH6O9ismGtXdTwWUJdQ3jTWk87A@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2019-11-12 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 15:27 Nathan Neff [this message]
2019-11-12 15:36 ` Using variables in org-capture-templates Josiah Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAC=HedAcMQsVw3imBOferK4iH6O9ismGtXdTwWUJdQ3jTWk87A@mail.gmail.com' \
    --to=nathan.neff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).