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