emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Darlan Cavalcante Moreira <darcamo@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to use org-capture with "dynamic ID" targets?
Date: Thu, 24 Jan 2013 20:01:47 +0100	[thread overview]
Message-ID: <87pq0u1k2s.fsf@bzg.ath.cx> (raw)
In-Reply-To: <50f72bf5.669dec0a.7b79.ffffdcb0@mx.google.com> (Darlan Cavalcante Moreira's message of "Wed, 16 Jan 2013 19:38:42 -0300")

Hi Darlan,

Darlan Cavalcante Moreira <darcamo@gmail.com> writes:

> everything works as expected and a table in the headline with ID
> "someIDstring" is used. However, if I try
>
> ("f" "The template description" table-line
>     (id some_variable)
>     "this is the template content"
>     :table-line-pos "II-1"
>     :immediate-finish t)

Can you provide the full (setq org-capture-templates ...)
s-expression?

Did you tried this?

(setq org-capture-templates
 `(("f" "The template description" table-line
        (id ,some_variable)
        "this is the template content"
        :table-line-pos "II-1"
        :immediate-finish t)))

> then it does not work even if some_variable or (some_function) provides the
> correct ID value. It seems that
> (id something)
> will always interpret "something" as a string (no matter if I put it inside
> quotes or not).

Yes, it expects a string.

> Is it possible to achieve what I want with the current org-capture
> implementation? 

See above.  The problem being, of course, that the capture template
for "f" will use some_variable *statically* -- if the value of the
some_variable variable changed after you evaluated the s-expression
(setq org-capture-templates ...) then the new value will not be
known.

> If not, consider this as a feature request.

What feature exactly?  To allow a function here that would dynamically
set the id? 

> The reason behind this is that each month I want a different target table
> for this capture template and I already implemented a function that returns
> the correct ID. If I can somehow make the ID target type use the return
> value of this function then this capture template will use the correct
> table each month. If not, I would be forced to manually change the capture
> template in the beginning of each month (something I will definitely
> forget).

If you want to use a function ,some_variable will not work, check 
,@ constructs in the Elisp manual.

Thanks,

-- 
 Bastien

  reply	other threads:[~2013-01-24 19:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 22:38 How to use org-capture with "dynamic ID" targets? Darlan Cavalcante Moreira
2013-01-24 19:01 ` Bastien [this message]
2013-01-28 18:05   ` Darlan Cavalcante Moreira
2013-01-29  5:26     ` Eric Abrahamsen
2013-01-29 14:20       ` Darlan Cavalcante Moreira

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=87pq0u1k2s.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=darcamo@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).