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 _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode