From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: question about capture templates Date: Mon, 21 Feb 2011 08:32:10 -0800 Message-ID: <87k4gtpcvp.fsf@berkeley.edu> References: <80ei71o17z.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=35510 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrYbu-00025l-Fp for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 11:27:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrYbt-00034b-AZ for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 11:27:42 -0500 Received: from lo.gmane.org ([80.91.229.12]:50273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrYbt-00034C-3Y for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 11:27:41 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PrYbq-0003kE-OO for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 17:27:38 +0100 Received: from c-67-164-33-170.hsd1.ca.comcast.net ([67.164.33.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Feb 2011 17:27:38 +0100 Received: from richard.lawrence by c-67-164-33-170.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Feb 2011 17:27:38 +0100 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@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Sébastien Vauban writes: > "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. > You have to use backquotes so that expressions are considered as code to > execute, instead of data. See Emacs manual. I'm not sure that backquotes will do what the OP wants. Backquotes will allow the OP to compute the value of a target file at the time the (setq org-capture templates ...) form is evaluated. The OP needs a way to determine the target file at the time of capture (right?), not at the time the variable is set. Unfortunately, I don't have any suggestions on how to hack that. If the target of most captures can be determined based on their type, maybe you can just use the refile mechanism (C-c C-w instead of C-c C-c) to manually handle the exceptions. If not, maybe look into wrapping or replacing org-capture-refile somehow. Best, Richard