From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Vorobiev Subject: Re: Capture with org-directory not working? Date: Tue, 29 Nov 2016 23:15:14 -0600 Message-ID: References: <87vaxr51t3.fsf@gmail.com> <87zin2ty3f.fsf@alphapapa.net> <87vaxqts75.fsf@alphapapa.net> <9E0BD070-F074-4524-8204-8CD840CDFE8C@gmail.com> <87fuotsc7b.fsf@alphapapa.net> <87lgw2ro7j.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114409b205a24505427dcc5f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBxFC-0006bA-LG for emacs-orgmode@gnu.org; Wed, 30 Nov 2016 00:15:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBxFB-00014a-Ha for emacs-orgmode@gnu.org; Wed, 30 Nov 2016 00:15:46 -0500 Received: from mail-vk0-x22e.google.com ([2607:f8b0:400c:c05::22e]:36491) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBxFB-00014Q-CR for emacs-orgmode@gnu.org; Wed, 30 Nov 2016 00:15:45 -0500 Received: by mail-vk0-x22e.google.com with SMTP id p9so104359759vkd.3 for ; Tue, 29 Nov 2016 21:15:45 -0800 (PST) In-Reply-To: <87lgw2ro7j.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nick Dokos Cc: emacs-orgmode --001a114409b205a24505427dcc5f Content-Type: text/plain; charset=UTF-8 The workaround with lambda worked, thanks a lot! As I mentioned I didn't have any problems with the templates in years but they stopped working after a recent update. Alex On Tue, Nov 29, 2016 at 3:05 PM, Nick Dokos wrote: > Alexander Vorobiev writes: > > > I have recently started having this issue with my capture templates. In > my case I want to ask the user > > (me) which file should be used to store the note, so I have a bunch of > templates like this > > > > (setq org-capture-templates > > '(("o" "Project todo" entry (file+headline > (av/choose-agenda-file) "Tasks") )) > > > > where av/choose-agenda-file uses completing-read to ask the user to > choose a file from a list it > > constructs on the fly. This approach has worked for years and now it > results in the "invalid file > > location" message. The backquote does not help because the function > needs to be called at run time, not > > when the variable is defined. > > > > IIUC, you cannot use arbitrary sexps, but you *can* use > > ("o" "Project todo" entry (file+headline (lambda () > (av/choose-agenda-file)) "Tasks")) > > Other plausible forms (e.g. (function av/choose-agenda-file) or (quote > av/choose-agenda-file) ) > run afoul of the abritrary sexp exception and do not work AFAICS. > > -- > Nick > > > --001a114409b205a24505427dcc5f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The workaround with lambda worked, thanks a lot! As I ment= ioned I didn't have any problems with the templates in years but they s= topped working after a recent update.

Alex

On Tue, Nov 29, 201= 6 at 3:05 PM, Nick Dokos <ndokos@gmail.com> wrote:
Alexander Vorobiev <alexander.vorobiev@gmail.com> w= rites:

> I have recently started having this issue with my capture templates. I= n my case I want to ask the user
> (me) which file should be used to store the note, so I have a bunch of= templates like this
>
> (setq org-capture-templates
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'(("o" &= quot;Project todo" entry (file+headline (av/choose-agenda-file) "= Tasks") ))
>
> where av/choose-agenda-file uses completing-read to ask the user to ch= oose a file from a list it
> constructs on the fly. This approach has worked for years and now it r= esults in the "invalid file
> location" message. The backquote does not help because the functi= on needs to be called at run time, not
> when the variable is defined.
>

IIUC, you cannot use arbitrary sexps, but you *can* use

("o" "Project todo" entry (file+headline (lambda () (av= /choose-agenda-file)) "Tasks"))

Other plausible forms (e.g. (function av/choose-agenda-file) or (quote av/c= hoose-agenda-file) )
run afoul of the abritrary sexp exception and do not work AFAICS.

--
Nick



--001a114409b205a24505427dcc5f--