From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: question about capture templates Date: Mon, 21 Feb 2011 10:08:56 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0103055543==" Return-path: Received: from [140.186.70.92] (port=55145 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrXPW-0006O3-8V for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 10:10:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrXPV-0000XT-Bm for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 10:10:50 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:55615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrXPV-0000XH-7W for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 10:10:49 -0500 Received: by wwb17 with SMTP id 17so6322760wwb.30 for ; Mon, 21 Feb 2011 07:10:47 -0800 (PST) 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 --===============0103055543== Content-Type: multipart/alternative; boundary=0016e6471836251391049ccc3e00 --0016e6471836251391049ccc3e00 Content-Type: text/plain; charset=ISO-8859-1 Hi, 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? Cheers. Fil Salustri -- Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --0016e6471836251391049ccc3e00 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I would really like to be able to vary the file into= which a captured item goes. =A0Specifically, I'd like to insert the it= em into whatever file I was visiting when I started the capture.

I've been trying something like this:
("m" "Message" entry=A0(file+datetree (buffer-file-name= (buffer-base-buffer)))=A0"* MSG @ %U %?\n=A0%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?

Cheers.
Fil Salustri

--
Filippo A. Salustri, = Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson Universit= y
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5000 ext 77= 49
Fax: 416/979-5265
Email: sa= lustri@ryerson.ca
http://= deseng.ryerson.ca/~fil/
--0016e6471836251391049ccc3e00-- --===============0103055543== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0103055543==-- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Sauer Subject: Re: question about capture templates Date: Mon, 21 Feb 2011 09:32:50 -0600 Message-ID: <84tyfxjtct.fsf@imap.gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=55861 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrXly-0007sa-Gj for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 10:34:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrXlx-0006oy-8G for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 10:34:02 -0500 Received: from mail-yw0-f41.google.com ([209.85.213.41]:59686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrXlw-0006of-RF for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 10:34:01 -0500 Received: by yws5 with SMTP id 5so944279yws.0 for ; Mon, 21 Feb 2011 07:33:59 -0800 (PST) In-Reply-To: (Filippo A. Salustri's message of "Mon, 21 Feb 2011 10:08:56 -0500") 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: "Filippo A. Salustri" Cc: emacs-orgmode@gnu.org I use remember and I set the org-remember-interactive-interface variable to refile. Now if I C-c it prompts me for my refile location I want to send the item to land at. If I C-u C-c C-c it goes to the default listed in the capture template. Handy since I have one TODO template but it could land in one of four files, one Homework Template for school and two files (taking two classes) that it could land in. Especially handy since I can't seem to have more than 5 remember templates causing it to become more about style of capture going to any destination I choose than style and destination for the templates. Oh, and I made my default destination a Refile bucket that then has to be sorted to the appropriate location. Matthew Sauer Sent From GNUS in emacs "Did I mention I love this thing?" From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Sauer Subject: Re: question about capture templates Date: Mon, 21 Feb 2011 10:01:57 -0600 Message-ID: <84pqqljs0a.fsf@imap.gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=50792 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrYE9-0001jZ-Ei for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 11:03:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrYE8-00069N-Km for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 11:03:09 -0500 Received: from mail-yx0-f169.google.com ([209.85.213.169]:37770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrYE8-000698-Hf for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 11:03:08 -0500 Received: by yxt33 with SMTP id 33so740736yxt.0 for ; Mon, 21 Feb 2011 08:03:08 -0800 (PST) In-Reply-To: (Filippo A. Salustri's message of "Mon, 21 Feb 2011 10:08:56 -0500") 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: "Filippo A. Salustri" Cc: emacs-orgmode@gnu.org Correction , it is C-1 C-c C-c to go to the default location. C-u C-c C-c goes into the interactive mode and then visits the location stored. Matt 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 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 23:14:22 +0100 Message-ID: <80bp255935.fsf@missioncriticalit.com> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> 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 Richard, Richard Lawrence wrote: > S=C3=A9bastien Vauban writes: >> "Filippo A. Salustri" wrote: >>> I would really like to be able to vary the file into which a captured i= tem >>> 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. You're definitely right. I missed the distinction "at Org launch time" vs "= at execution time"... Pull my answer off the records=C2=A0;-) 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: Re: question about capture templates Date: Mon, 21 Feb 2011 19:39:25 -0500 Message-ID: References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1554752657==" Return-path: Received: from [140.186.70.92] (port=53917 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrgHu-00055X-0o for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 19:39:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrgHo-0006WV-1R for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 19:39:33 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:50354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrgHn-0006WR-OU for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 19:39:28 -0500 Received: by wwb17 with SMTP id 17so6871523wwb.30 for ; Mon, 21 Feb 2011 16:39:26 -0800 (PST) In-Reply-To: <80bp255935.fsf@missioncriticalit.com> 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: =?ISO-8859-1?Q?S=E9bastien_Vauban?= Cc: emacs-orgmode@gnu.org --===============1554752657== Content-Type: multipart/alternative; boundary=001485f775525911e4049cd43681 --001485f775525911e4049cd43681 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks to everyone for the varied and thoughtful responses. I didn't think of backquotes, but I know about them from Scheme, and no, they shouldn't work in this case. Very frustrating. org-capture clearly has the original buffer handy (for %= a stuff) yet I can't get it out of there without hacking the org code, which = I am loathe to do. Hmmm. I'll think some more. If I come up with anything; I'll report it. Cheers. Fil 2011/2/21 S=E9bastien Vauban > Hi Richard, > > Richard Lawrence wrote: > > S=E9bastien 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 (set= q > > 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. > > You're definitely right. I missed the distinction "at Org launch time" vs > "at > execution time"... Pull my answer off the records ;-) > > Best regards, > Seb > > -- > S=E9bastien 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 > --=20 Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --001485f775525911e4049cd43681 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks to everyone for the varied and thoughtful responses. =A0I didn't= think of backquotes, but I know about them from Scheme, and no, they shoul= dn't work in this case.

Very frustrating. =A0org-cap= ture clearly has the original buffer handy (for %a stuff) yet I can't g= et it out of there without hacking the org code, which I am loathe to do. = =A0Hmmm. =A0I'll think some more. =A0If I come up with anything; I'= ll report it.

Cheers.
Fil

2011/2/21 S=E9bastien Vauban <wxhgmqzgwmuf@spammotel.com>
Hi Richard,

Richard Lawrence wrote:
> S=E9bastien Vauban <w= xhgmqzgwmuf@spammotel.com> writes:
>> "Filippo A. Salustri" wrote:
>>> I would really like to be able to vary the file into which a c= aptured item
>>> goes. Specifically, I'd like to insert the item into whate= ver file I was
>>> visiting when I started the capture.
>
>> You have to use backquotes so that expressions are considered as c= ode 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 (se= tq
> 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.

You're definitely right. I missed the distinction "at Org la= unch time" vs "at
execution time"... Pull my answer off the records=A0;-)

Best regards,
=A0Seb

--
S=E9bastien 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



--
Filippo A. = Salustri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson= University
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/= 979-5000 ext 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--001485f775525911e4049cd43681-- --===============1554752657== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1554752657==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: question about capture templates Date: Mon, 21 Feb 2011 20:59:21 -0800 Message-ID: <87r5b0d5qu.fsf@berkeley.edu> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=59021 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrkH6-0006zz-Gf for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 23:55:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrkH5-0004Qa-3x for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 23:55:00 -0500 Received: from lo.gmane.org ([80.91.229.12]:33981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrkH4-0004Q2-Ll for emacs-orgmode@gnu.org; Mon, 21 Feb 2011 23:54:59 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PrkH2-0004MG-Vm for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 05:54:56 +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 ; Tue, 22 Feb 2011 05:54:56 +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 ; Tue, 22 Feb 2011 05:54:56 +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 "Filippo A. Salustri" writes: > org-capture clearly has the original buffer handy (for %a > stuff) yet I can't get it out of there without hacking the org code, which I > am loathe to do. I too was in a situation just today where I was calling org-capture programatically, and needed access to stuff in the calling environment. My solution (which may not be very good, and may not work for you) is to dynamically scope the calling environment stuff that I need into the org-capture call, like so: #+begin_src emacs-lisp ; in the calling code, I scope some val I need into `foo...' (let ((foo some-val-I-need)) (org-capture nil "tm")) #+end_src Then, in the template identified by "tm", I have S-expression expansion that operates on foo, even though it wasn't explicitly passed as a parameter, e.g.: * My capture template The car of foo is %(car foo). The cdr of foo is %(cdr foo). %a etc. ... This works well enough for me, though it may feel kind of icky, since from the template writer's perspective, `foo' looks like a global variable whose value could be coming from anywhere. Accordingly, then, this solution is mostly useful if you know that you're going to be using the template via custom Elisp calls to org-capture, and not via the usual capture interface, so that you can guarantee that `foo' has a useful value when the template is expanded. One gotcha: S-expressions in templates are apparently always evaluated as function calls -- you can't just directly access a string value, like %(foo). Hope that's helpful! Richard P.S. Since you say you have Scheme experience: note that this solution would NOT work in Scheme, since Scheme, unlike Emacs Lisp, is lexically scoped. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Re: question about capture templates Date: Tue, 22 Feb 2011 02:43:07 -0500 Message-ID: <15599.1298360587@alphaville> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=39585 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Prmu4-0002gE-W2 for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 02:43:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Prmu3-0000iD-Jg for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 02:43:24 -0500 Received: from vms173001pub.verizon.net ([206.46.173.1]:63343) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Prmu3-0000hh-GR for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 02:43:23 -0500 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LH0003VRDFVOBL1@vms173001.mailsrvcs.net> for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 01:43:08 -0600 (CST) In-reply-to: Message from "Filippo A. Salustri" of "Mon, 21 Feb 2011 19:39:25 EST." 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: "Filippo A. Salustri" Cc: =?ISO-8859-1?Q?S=E9bastien_Vauban?= , nicholas.dokos@hp.com, emacs-orgmode@gnu.org Filippo A. Salustri wrote: > Very frustrating. org-capture clearly has the original buffer handy (for %= > a > stuff) yet I can't get it out of there without hacking the org code, which = > I > am loathe to do. Hmmm. I'll think some more. If I come up with anything; > I'll report it. > The original buffer is accessible in the capture context using (org-capture-get :original-buffer) as Carsten pointed out in the following post: http://thread.gmane.org/gmane.emacs.orgmode/35759/focus=35799 HTH, Nick From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: question about capture templates Date: Tue, 22 Feb 2011 10:15:15 +0100 Message-ID: <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=55832 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ProL3-0004bS-8P for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 04:15:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ProL1-0003Vs-Vd for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 04:15:21 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:64228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ProL1-0003Vg-Q7 for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 04:15:19 -0500 Received: by wwb17 with SMTP id 17so7176626wwb.30 for ; Tue, 22 Feb 2011 01:15:18 -0800 (PST) In-Reply-To: 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: "Filippo A. Salustri" Cc: =?iso-8859-1?Q?S=E9bastien_Vauban?= , emacs-orgmode@gnu.org On Feb 22, 2011, at 1:39 AM, Filippo A. Salustri wrote: > Thanks to everyone for the varied and thoughtful responses. I didn't = think of backquotes, but I know about them from Scheme, and no, they = shouldn't work in this case. >=20 > Very frustrating. org-capture clearly has the original buffer handy = (for %a stuff) yet I can't get it out of there without hacking the org = code, which I am loathe to do. Hmmm. I'll think some more. If I come = up with anything; I'll report it. I have just implemented that whenever you mean a file name in capture templates, you can instead give a function, a variable, or a lisp form. So your original attempt >> ("m" "Message" entry (file+datetree (buffer-file-name >> (buffer-base-buffer))) "* MSG @ %U %?\n %a") should now work. Hope this helps - Carsten >=20 > Cheers. > Fil >=20 > 2011/2/21 S=E9bastien Vauban > Hi Richard, >=20 > Richard Lawrence wrote: > > S=E9bastien 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. >=20 > You're definitely right. I missed the distinction "at Org launch time" = vs "at > execution time"... Pull my answer off the records ;-) >=20 > Best regards, > Seb >=20 > -- > S=E9bastien Vauban >=20 >=20 > _______________________________________________ > 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 >=20 >=20 >=20 > --=20 > Filippo A. Salustri, Ph.D., P.Eng. > Mechanical and Industrial Engineering > Ryerson University > 350 Victoria St, Toronto, ON > M5B 2K3, Canada > Tel: 416/979-5000 ext 7749 > Fax: 416/979-5265 > Email: salustri@ryerson.ca > http://deseng.ryerson.ca/~fil/=20 > _______________________________________________ > 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 - Carsten From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: question about capture templates Date: Tue, 22 Feb 2011 10:19:35 +0100 Message-ID: <546EF11C-2E76-4802-A0D6-1584BDDAB550@gmail.com> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> <87r5b0d5qu.fsf@berkeley.edu> Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=46659 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ProPO-0006Vk-DE for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 04:19:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ProPC-0004CJ-Ko for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 04:19:39 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:65194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ProPC-0004C6-EW for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 04:19:38 -0500 Received: by wwb17 with SMTP id 17so7180331wwb.30 for ; Tue, 22 Feb 2011 01:19:37 -0800 (PST) In-Reply-To: <87r5b0d5qu.fsf@berkeley.edu> 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: Richard Lawrence Cc: emacs-orgmode@gnu.org On Feb 22, 2011, at 5:59 AM, Richard Lawrence wrote: > "Filippo A. Salustri" writes: >=20 >> org-capture clearly has the original buffer handy (for %a >> stuff) yet I can't get it out of there without hacking the org code, = which I >> am loathe to do. >=20 > I too was in a situation just today where I was calling org-capture > programatically, and needed access to stuff in the calling = environment. > My solution (which may not be very good, and may not work for you) is = to > dynamically scope the calling environment stuff that I need into the > org-capture call, like so: >=20 > #+begin_src emacs-lisp > ; in the calling code, I scope some val I need into `foo...' > (let ((foo some-val-I-need)) > (org-capture nil "tm")) > #+end_src >=20 > Then, in the template identified by "tm", I have S-expression = expansion > that operates on foo, even though it wasn't explicitly passed as a > parameter, e.g.: >=20 > * My capture template > The car of foo is %(car foo). > The cdr of foo is %(cdr foo). > %a > etc. ... >=20 > This works well enough for me, though it may feel kind of icky, since > from the template writer's perspective, `foo' looks like a global > variable whose value could be coming from anywhere. I do love dynamic scoping, this give a lot of power in Emacs. Org-mode internals use that power often. > Accordingly, then, > this solution is mostly useful if you know that you're going to be = using > the template via custom Elisp calls to org-capture, and not via the > usual capture interface, so that you can guarantee that `foo' has a > useful value when the template is expanded. >=20 > One gotcha: S-expressions in templates are apparently always evaluated > as function calls -- you can't just directly access a string value, = like > %(foo). I guess you mean a variable value? The shortest form may be %(symbol-value foo) if you want to access the value of a variable in a template. Kind regards - Carsten= From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Re: question about capture templates Date: Tue, 22 Feb 2011 12:37:31 +0100 Message-ID: <87ei70uwp0.fsf@gnu.org> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=49068 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrqYc-0007iR-T3 for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 06:37:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrqYb-0003Oz-Qy for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 06:37:30 -0500 Received: from mail-bw0-f51.google.com ([209.85.214.51]:39210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrqYb-0003Ov-H1 for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 06:37:29 -0500 Received: by bwz10 with SMTP id 10so3210756bwz.38 for ; Tue, 22 Feb 2011 03:37:28 -0800 (PST) In-Reply-To: <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> (Carsten Dominik's message of "Tue, 22 Feb 2011 10:15:15 +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: Carsten Dominik Cc: Vauban , "Filippo A. Salustri" , emacs-orgmode@gnu.org, =?iso-8859-1?Q?S=E9bastien?= Hi Carsten, Carsten Dominik writes: > I have just implemented that whenever you mean a file name > in capture templates, you can instead give a function, a > variable, or a lisp form. So your original attempt > >>> ("m" "Message" entry (file+datetree (buffer-file-name >>> (buffer-base-buffer))) "* MSG @ %U %?\n %a") > > should now work. Neat, thanks! -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: question about capture templates Date: Tue, 22 Feb 2011 08:06:17 -0800 Message-ID: <87bp24awau.fsf@berkeley.edu> References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> <87r5b0d5qu.fsf@berkeley.edu> <546EF11C-2E76-4802-A0D6-1584BDDAB550@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=60304 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrugQ-0003N0-BP for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 11:01:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrugP-00077j-BT for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 11:01:50 -0500 Received: from lo.gmane.org ([80.91.229.12]:58532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrugP-00077M-3i for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 11:01:49 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PrugN-0005H7-8W for emacs-orgmode@gnu.org; Tue, 22 Feb 2011 17:01:47 +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 ; Tue, 22 Feb 2011 17:01:47 +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 ; Tue, 22 Feb 2011 17:01:47 +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 Carsten Dominik writes: > I do love dynamic scoping, this give a lot of power in Emacs. > Org-mode internals use that power often. This is venturing a bit far afield, at least for this thread, but I'm curious if anyone knows: does the recent work on supporting Elisp in Guile mean that Elisp applications are eventually expected to be ported to Scheme? And if so, what does that mean for Org development? >> One gotcha: S-expressions in templates are apparently always evaluated >> as function calls -- you can't just directly access a string value, like >> %(foo). > > I guess you mean a variable value? Right, yes, a variable with a string value. I guess my point is more properly stated by saying there doesn't seem to be a way to evaluate an atomic S-expression in a template. But this seems like a fair trade for not having to write a second set of parentheses around every non-atomic expression. > The shortest form may be %(symbol-value foo) if you want to access the > value of a variable in a template. That's handy -- thanks! Richard From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: Re: question about capture templates Date: Wed, 23 Feb 2011 09:49:45 -0500 Message-ID: References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0811157945==" Return-path: Received: from [140.186.70.92] (port=47677 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsG2Q-0003eA-Ao for emacs-orgmode@gnu.org; Wed, 23 Feb 2011 09:50:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsG2M-0008KA-He for emacs-orgmode@gnu.org; Wed, 23 Feb 2011 09:49:56 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:47040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsG2M-0008Jt-4t for emacs-orgmode@gnu.org; Wed, 23 Feb 2011 09:49:54 -0500 Received: by wwb29 with SMTP id 29so517546wwb.30 for ; Wed, 23 Feb 2011 06:49:52 -0800 (PST) In-Reply-To: <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> 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: Carsten Dominik Cc: =?ISO-8859-1?Q?S=E9bastien_Vauban?= , emacs-orgmode@gnu.org --===============0811157945== Content-Type: multipart/alternative; boundary=001636499a4b3bcf5b049cf43525 --001636499a4b3bcf5b049cf43525 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Carsten, Would your mod be implemented in the git build of 22 Feb? Cheers. Fil On 22 February 2011 04:15, Carsten Dominik wrote= : > > On Feb 22, 2011, at 1:39 AM, Filippo A. Salustri wrote: > > > Thanks to everyone for the varied and thoughtful responses. I didn't > think of backquotes, but I know about them from Scheme, and no, they > shouldn't work in this case. > > > > Very frustrating. org-capture clearly has the original buffer handy (f= or > %a stuff) yet I can't get it out of there without hacking the org code, > which I am loathe to do. Hmmm. I'll think some more. If I come up with > anything; I'll report it. > > I have just implemented that whenever you mean a file name > in capture templates, you can instead give a function, a > variable, or a lisp form. So your original attempt > > >> ("m" "Message" entry (file+datetree (buffer-file-name > >> (buffer-base-buffer))) "* MSG @ %U %?\n %a") > > should now work. > > Hope this helps > > - Carsten > > > > > Cheers. > > Fil > > > > 2011/2/21 S=E9bastien Vauban > > Hi Richard, > > > > Richard Lawrence wrote: > > > S=E9bastien Vauban writes: > > >> "Filippo A. Salustri" wrote: > > >>> I would really like to be able to vary the file into which a captur= ed > 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 cod= e > to > > >> execute, instead of data. See Emacs manual. > > > > > > I'm not sure that backquotes will do what the OP wants. Backquotes wi= ll > > > 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. > > > > You're definitely right. I missed the distinction "at Org launch time" = vs > "at > > execution time"... Pull my answer off the records ;-) > > > > Best regards, > > Seb > > > > -- > > S=E9bastien 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 > > > > > > > > -- > > Filippo A. Salustri, Ph.D., P.Eng. > > Mechanical and Industrial Engineering > > Ryerson University > > 350 Victoria St, Toronto, ON > > M5B 2K3, Canada > > Tel: 416/979-5000 ext 7749 > > Fax: 416/979-5265 > > Email: salustri@ryerson.ca > > http://deseng.ryerson.ca/~fil/ > > _______________________________________________ > > 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 > > - Carsten > > > > --=20 Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --001636499a4b3bcf5b049cf43525 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Carsten,
Would your mod be implemented in the git build of 22 Feb?
Cheers.
Fil

On 22 Februar= y 2011 04:15, Carsten Dominik <carsten.dominik@gmail.com> wrote:

On Feb 22, 2011, at 1:39 AM, Filippo A. Salustri wrote:

> Thanks to everyone for the varied and thoughtful responses. =A0I didn&= #39;t think of backquotes, but I know about them from Scheme, and no, they = shouldn't work in this case.
>
> Very frustrating. =A0org-capture clearly has the original buffer handy= (for %a stuff) yet I can't get it out of there without hacking the org= code, which I am loathe to do. =A0Hmmm. =A0I'll think some more. =A0If= I come up with anything; I'll report it.

I have just implemented that whenever you mean a file name
in capture templates, you can instead give a function, a
variable, or a lisp form. =A0So your original attempt

>> ("m" "Message" entry (file+datetree (buffer-fi= le-name
>> (buffer-base-buffer))) "* MSG @ %U %?\n %a")

should now work.

Hope this helps

- Carsten

>
> Cheers.
> Fil
>
> 2011/2/21 S=E9bastien Vauban <wxhgmqzgwmuf@spammotel.com>
> Hi Richard,
>
> Richard Lawrence wrote:
> > S=E9bastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> >> "Filippo A. Salustri" wrote:
> >>> I would really like to be able to vary the file into whic= h 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. Backq= uotes will
> > allow the OP to compute the value of a target file at the time th= e (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.
>
> You're definitely right. I missed the distinction "at Org lau= nch time" vs "at
> execution time"... Pull my answer off the records ;-)
>
> Best regards,
> =A0Seb
>
> --
> S=E9bastien 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
>
>
>
> --
> Filippo A. Salustri, Ph.D., P.Eng.
> Mechanical and Industrial Engineering
> Ryerson University
> 350 Victoria St, Toronto, ON
> M5B 2K3, Canada
> Tel: 416/979-5000 ext 7749
> Fax: 416/979-5265
> Email: salustri@ryerson.ca<= br> > http://de= seng.ryerson.ca/~fil/
> _______________________________________________
> 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

- Carsten






--
Filippo A. Salus= tri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson Univ= ersity
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5= 000 ext 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--001636499a4b3bcf5b049cf43525-- --===============0811157945== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0811157945==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: Re: question about capture templates Date: Wed, 23 Feb 2011 12:28:25 -0500 Message-ID: References: <80ei71o17z.fsf@missioncriticalit.com> <87k4gtpcvp.fsf@berkeley.edu> <80bp255935.fsf@missioncriticalit.com> <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0219596589==" Return-path: Received: from [140.186.70.92] (port=35770 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsIVp-000721-BN for emacs-orgmode@gnu.org; Wed, 23 Feb 2011 12:28:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsIVn-0007z5-N7 for emacs-orgmode@gnu.org; Wed, 23 Feb 2011 12:28:29 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:56558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsIVn-0007yr-CI for emacs-orgmode@gnu.org; Wed, 23 Feb 2011 12:28:27 -0500 Received: by wwb29 with SMTP id 29so711834wwb.30 for ; Wed, 23 Feb 2011 09:28:26 -0800 (PST) In-Reply-To: <0973A1B4-5892-4685-A2F6-D34C66ECAB67@gmail.com> 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: Carsten Dominik Cc: =?ISO-8859-1?Q?S=E9bastien_Vauban?= , emacs-orgmode@gnu.org --===============0219596589== Content-Type: multipart/alternative; boundary=0016e64c1c4ea452e0049cf66cf0 --0016e64c1c4ea452e0049cf66cf0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yup; I just tried the git snapshot of 23 Feb and it's working. Thanks!! Cheers. Fil On 22 February 2011 04:15, Carsten Dominik wrote= : > > On Feb 22, 2011, at 1:39 AM, Filippo A. Salustri wrote: > > > Thanks to everyone for the varied and thoughtful responses. I didn't > think of backquotes, but I know about them from Scheme, and no, they > shouldn't work in this case. > > > > Very frustrating. org-capture clearly has the original buffer handy (f= or > %a stuff) yet I can't get it out of there without hacking the org code, > which I am loathe to do. Hmmm. I'll think some more. If I come up with > anything; I'll report it. > > I have just implemented that whenever you mean a file name > in capture templates, you can instead give a function, a > variable, or a lisp form. So your original attempt > > >> ("m" "Message" entry (file+datetree (buffer-file-name > >> (buffer-base-buffer))) "* MSG @ %U %?\n %a") > > should now work. > > Hope this helps > > - Carsten > > > > > Cheers. > > Fil > > > > 2011/2/21 S=E9bastien Vauban > > Hi Richard, > > > > Richard Lawrence wrote: > > > S=E9bastien Vauban writes: > > >> "Filippo A. Salustri" wrote: > > >>> I would really like to be able to vary the file into which a captur= ed > 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 cod= e > to > > >> execute, instead of data. See Emacs manual. > > > > > > I'm not sure that backquotes will do what the OP wants. Backquotes wi= ll > > > 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. > > > > You're definitely right. I missed the distinction "at Org launch time" = vs > "at > > execution time"... Pull my answer off the records ;-) > > > > Best regards, > > Seb > > > > -- > > S=E9bastien 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 > > > > > > > > -- > > Filippo A. Salustri, Ph.D., P.Eng. > > Mechanical and Industrial Engineering > > Ryerson University > > 350 Victoria St, Toronto, ON > > M5B 2K3, Canada > > Tel: 416/979-5000 ext 7749 > > Fax: 416/979-5265 > > Email: salustri@ryerson.ca > > http://deseng.ryerson.ca/~fil/ > > _______________________________________________ > > 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 > > - Carsten > > > > --=20 Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --0016e64c1c4ea452e0049cf66cf0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yup; I just tried the git snapshot of 23 Feb and it's working.
Than= ks!!
Cheers.
Fil

On 22 February 2011 04:15, Carsten Dominik <carsten.dominik@gmail.com> wrote:

On Feb 22, 2011, at 1:39 AM, Filippo A. Salustri wrote:

> Thanks to everyone for the varied and thoughtful responses. =A0I didn&= #39;t think of backquotes, but I know about them from Scheme, and no, they = shouldn't work in this case.
>
> Very frustrating. =A0org-capture clearly has the original buffer handy= (for %a stuff) yet I can't get it out of there without hacking the org= code, which I am loathe to do. =A0Hmmm. =A0I'll think some more. =A0If= I come up with anything; I'll report it.

I have just implemented that whenever you mean a file name
in capture templates, you can instead give a function, a
variable, or a lisp form. =A0So your original attempt

>> ("m" "Message" entry (file+datetree (buffer-fi= le-name
>> (buffer-base-buffer))) "* MSG @ %U %?\n %a")

should now work.

Hope this helps

- Carsten

>
> Cheers.
> Fil
>
> 2011/2/21 S=E9bastien Vauban <wxhgmqzgwmuf@spammotel.com>
> Hi Richard,
>
> Richard Lawrence wrote:
> > S=E9bastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> >> "Filippo A. Salustri" wrote:
> >>> I would really like to be able to vary the file into whic= h 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. Backq= uotes will
> > allow the OP to compute the value of a target file at the time th= e (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.
>
> You're definitely right. I missed the distinction "at Org lau= nch time" vs "at
> execution time"... Pull my answer off the records ;-)
>
> Best regards,
> =A0Seb
>
> --
> S=E9bastien 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
>
>
>
> --
> Filippo A. Salustri, Ph.D., P.Eng.
> Mechanical and Industrial Engineering
> Ryerson University
> 350 Victoria St, Toronto, ON
> M5B 2K3, Canada
> Tel: 416/979-5000 ext 7749
> Fax: 416/979-5265
> Email: salustri@ryerson.ca<= br> > http://de= seng.ryerson.ca/~fil/
> _______________________________________________
> 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

- Carsten






--
Filippo A. Salus= tri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson Univ= ersity
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5= 000 ext 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--0016e64c1c4ea452e0049cf66cf0-- --===============0219596589== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0219596589==--