From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?S=C3=A9bastien_Vauban?= Subject: Re: question about capture templates Date: Mon, 21 Feb 2011 16:29:20 +0100 Message-ID: <80ei71o17z.fsf@missioncriticalit.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org 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 =3Dbuffer-base-buffer=3D. Best regards, Seb --=20 S=C3=A9bastien Vauban _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode