emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* question about capture templates
@ 2011-02-21 15:08 Filippo A. Salustri
  2011-02-21 15:29 ` Sébastien Vauban
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Filippo A. Salustri @ 2011-02-21 15:08 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 764 bytes --]

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/

[-- Attachment #1.2: Type: text/html, Size: 1311 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-21 15:08 question about capture templates Filippo A. Salustri
@ 2011-02-21 15:29 ` Sébastien Vauban
  2011-02-21 16:32   ` Richard Lawrence
  2011-02-21 15:32 ` Matthew Sauer
  2011-02-21 16:01 ` Matthew Sauer
  2 siblings, 1 reply; 15+ messages in thread
From: Sébastien Vauban @ 2011-02-21 15:29 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-21 15:08 question about capture templates Filippo A. Salustri
  2011-02-21 15:29 ` Sébastien Vauban
@ 2011-02-21 15:32 ` Matthew Sauer
  2011-02-21 16:01 ` Matthew Sauer
  2 siblings, 0 replies; 15+ messages in thread
From: Matthew Sauer @ 2011-02-21 15:32 UTC (permalink / raw)
  To: Filippo A. Salustri; +Cc: emacs-orgmode

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?"

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-21 15:08 question about capture templates Filippo A. Salustri
  2011-02-21 15:29 ` Sébastien Vauban
  2011-02-21 15:32 ` Matthew Sauer
@ 2011-02-21 16:01 ` Matthew Sauer
  2 siblings, 0 replies; 15+ messages in thread
From: Matthew Sauer @ 2011-02-21 16:01 UTC (permalink / raw)
  To: Filippo A. Salustri; +Cc: emacs-orgmode



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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-21 15:29 ` Sébastien Vauban
@ 2011-02-21 16:32   ` Richard Lawrence
  2011-02-21 22:14     ` Sébastien Vauban
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Lawrence @ 2011-02-21 16:32 UTC (permalink / raw)
  To: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com>
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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-21 16:32   ` Richard Lawrence
@ 2011-02-21 22:14     ` Sébastien Vauban
  2011-02-22  0:39       ` Filippo A. Salustri
  0 siblings, 1 reply; 15+ messages in thread
From: Sébastien Vauban @ 2011-02-21 22:14 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Richard,

Richard Lawrence wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> 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.

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ébastien 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-21 22:14     ` Sébastien Vauban
@ 2011-02-22  0:39       ` Filippo A. Salustri
  2011-02-22  4:59         ` Richard Lawrence
                           ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Filippo A. Salustri @ 2011-02-22  0:39 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2013 bytes --]

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ébastien Vauban <wxhgmqzgwmuf@spammotel.com>

> Hi Richard,
>
> Richard Lawrence wrote:
> > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> 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.
>
> 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é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
>



-- 
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/

[-- Attachment #1.2: Type: text/html, Size: 2884 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-22  0:39       ` Filippo A. Salustri
@ 2011-02-22  4:59         ` Richard Lawrence
  2011-02-22  9:19           ` Carsten Dominik
  2011-02-22  7:43         ` Nick Dokos
  2011-02-22  9:15         ` Carsten Dominik
  2 siblings, 1 reply; 15+ messages in thread
From: Richard Lawrence @ 2011-02-22  4:59 UTC (permalink / raw)
  To: emacs-orgmode

"Filippo A. Salustri" <salustri@ryerson.ca> 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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-22  0:39       ` Filippo A. Salustri
  2011-02-22  4:59         ` Richard Lawrence
@ 2011-02-22  7:43         ` Nick Dokos
  2011-02-22  9:15         ` Carsten Dominik
  2 siblings, 0 replies; 15+ messages in thread
From: Nick Dokos @ 2011-02-22  7:43 UTC (permalink / raw)
  To: Filippo A. Salustri; +Cc: Sébastien Vauban, nicholas.dokos, emacs-orgmode

Filippo A. Salustri <salustri@ryerson.ca> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-22  0:39       ` Filippo A. Salustri
  2011-02-22  4:59         ` Richard Lawrence
  2011-02-22  7:43         ` Nick Dokos
@ 2011-02-22  9:15         ` Carsten Dominik
  2011-02-22 11:37           ` Bastien
                             ` (2 more replies)
  2 siblings, 3 replies; 15+ messages in thread
From: Carsten Dominik @ 2011-02-22  9:15 UTC (permalink / raw)
  To: Filippo A. Salustri; +Cc: Sébastien Vauban, emacs-orgmode


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 (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

> 
> Cheers.
> Fil
> 
> 2011/2/21 Sébastien Vauban <wxhgmqzgwmuf@spammotel.com>
> Hi Richard,
> 
> Richard Lawrence wrote:
> > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> 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.
> 
> 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é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
> 
> 
> 
> -- 
> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-22  4:59         ` Richard Lawrence
@ 2011-02-22  9:19           ` Carsten Dominik
  2011-02-22 16:06             ` Richard Lawrence
  0 siblings, 1 reply; 15+ messages in thread
From: Carsten Dominik @ 2011-02-22  9:19 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: emacs-orgmode


On Feb 22, 2011, at 5:59 AM, Richard Lawrence wrote:

> "Filippo A. Salustri" <salustri@ryerson.ca> 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.

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.
> 
> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-22  9:15         ` Carsten Dominik
@ 2011-02-22 11:37           ` Bastien
  2011-02-23 14:49           ` Filippo A. Salustri
  2011-02-23 17:28           ` Filippo A. Salustri
  2 siblings, 0 replies; 15+ messages in thread
From: Bastien @ 2011-02-22 11:37 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Vauban, Filippo A. Salustri, emacs-orgmode

Hi Carsten,

Carsten Dominik <carsten.dominik@gmail.com> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: question about capture templates
  2011-02-22  9:19           ` Carsten Dominik
@ 2011-02-22 16:06             ` Richard Lawrence
  0 siblings, 0 replies; 15+ messages in thread
From: Richard Lawrence @ 2011-02-22 16:06 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-22  9:15         ` Carsten Dominik
  2011-02-22 11:37           ` Bastien
@ 2011-02-23 14:49           ` Filippo A. Salustri
  2011-02-23 17:28           ` Filippo A. Salustri
  2 siblings, 0 replies; 15+ messages in thread
From: Filippo A. Salustri @ 2011-02-23 14:49 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Sébastien Vauban, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3267 bytes --]

Carsten,
Would your mod be implemented in the git build of 22 Feb?
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.  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.
>
> 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ébastien Vauban <wxhgmqzgwmuf@spammotel.com>
> > Hi Richard,
> >
> > Richard Lawrence wrote:
> > > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> 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.
> >
> > 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é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
> >
> >
> >
> > --
> > 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
>
>
>
>


-- 
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/

[-- Attachment #1.2: Type: text/html, Size: 4732 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Re: question about capture templates
  2011-02-22  9:15         ` Carsten Dominik
  2011-02-22 11:37           ` Bastien
  2011-02-23 14:49           ` Filippo A. Salustri
@ 2011-02-23 17:28           ` Filippo A. Salustri
  2 siblings, 0 replies; 15+ messages in thread
From: Filippo A. Salustri @ 2011-02-23 17:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Sébastien Vauban, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3272 bytes --]

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 <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.  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.
>
> 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ébastien Vauban <wxhgmqzgwmuf@spammotel.com>
> > Hi Richard,
> >
> > Richard Lawrence wrote:
> > > Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> 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.
> >
> > 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é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
> >
> >
> >
> > --
> > 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
>
>
>
>


-- 
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/

[-- Attachment #1.2: Type: text/html, Size: 4748 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-02-23 17:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-21 15:08 question about capture templates Filippo A. Salustri
2011-02-21 15:29 ` Sébastien Vauban
2011-02-21 16:32   ` Richard Lawrence
2011-02-21 22:14     ` Sébastien Vauban
2011-02-22  0:39       ` Filippo A. Salustri
2011-02-22  4:59         ` Richard Lawrence
2011-02-22  9:19           ` Carsten Dominik
2011-02-22 16:06             ` Richard Lawrence
2011-02-22  7:43         ` Nick Dokos
2011-02-22  9:15         ` Carsten Dominik
2011-02-22 11:37           ` Bastien
2011-02-23 14:49           ` Filippo A. Salustri
2011-02-23 17:28           ` Filippo A. Salustri
2011-02-21 15:32 ` Matthew Sauer
2011-02-21 16:01 ` Matthew Sauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).