>> Hi, >> >> I have discovered that org-capture templates can't expand Lisp variabels >> with % >> (), only functions. Is that a bug or a feature? >> >> In Emacs -q do: >> >> #+begin_src emacs-lisp >> (require 'org-capture) >> >> (defun test1 () >> (with-temp-buffer >> (org-capture-fill-template "%(default-directory)"))) >> >> ;; => "%![Error: (void-function default-directory)] >> ;; " > > If you just want to insert a variable, why not use eval?:
Because as said, I would expect EXP to be a valid symbolic expression, since that is what manual says. I could have used lambda as well, but why keeping undocumented bug if it can be fixed? Someone else will perhaps in the future also have to discover the same thing I discovered when they notice their code bangs. Then one has to check why, because one thinks the template looks as the manual says until they discover it is the parser that is wrong. > (defun test1 () > (with-temp-buffer > (org-capture-fill-template "%(eval default-directory)"))) > > Changing the current meaning of the form would break configurations that > Salready rely on it. Yeah, I am aware of it myself. Question is how many people use that feature at all? All templates I have seen, use just simple pre-defined escapes and interactive escapes. I don't doubt that someone is using them, question is if it is worth of not being able to use variables %() just to not break few templates, which would be easily fixed (just add a pair of parenthesis around). We could also have it as opt-in, keep the old one as the default, and the new one as the opt-in.
