emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: question about capture templates


From: Sébastien Vauban
Subject: [Orgmode] Re: question about capture templates
Date: Mon, 21 Feb 2011 16:29:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

Hi Filippo,

"Filippo A. Salustri" wrote:
> I would really like to be able to vary the file into which a captured item
> goes.  Specifically, I'd like to insert the item into whatever file I was
> visiting when I started the capture.
>
> I've been trying something like this:
>
>> ("m" "Message" entry (file+datetree (buffer-file-name
>> (buffer-base-buffer))) "* MSG @ %U %?\n %a")
>
> But the (buffer-file-name (buffer-base-buffer)) doesn't work because the
> item keeps ending up in the default capture file.
>
> Can anyone suggest a way to do this?

You have to use backquotes so that expressions are considered as code to
execute, instead of data. See Emacs manual.

In your case, something like this should do it (untested):

#+begin_src emacs-lisp
(setq org-capture-templates
 `(("m" "Message" entry (file+datetree
   ,(buffer-file-name (buffer-base-buffer))) "* MSG @ %U %?\n %a")))
#+end_src

See backquote used instead of quote.
See comma in front of functions and variables.

Here, though, I'm not sure whether another comma is needed or not in front of
=buffer-base-buffer=.

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

[Prev in Thread] Current Thread [Next in Thread]