>> >> If we document that (EXP), not EXP should be a valid expression, we are >> >> good. >[...] >> No to be a devils advoce, but I am not sure you do. If we look at: >[...] >> ‘%(EXP)’ >> Evaluate Elisp expression EXP and replace it with the result. The > > I agree with Ihor that using "(EXP)" here should help to avoid ambiguity.
I am sorry, I am not trying to be impolite, but they are both *equally*
ambigous for the same reason I took up in previous two mails.
>> "%( user-full-name )" => your user name if it is defined
>>
>> () **are** part of the expression.
>[...]
> I see you point concerning "%<" vs "%(" discrepancy, but I find double
> parenthesis ugly. Would it help to add an example with "%(identity VAR)"
It is not about being "ugly" or "pretty". It is about being consistent
with Lisp. Double parenthesis arise in other places too, that is not a
big deal in Lisp.
But let's not argue further. I suggest make it explicit in the
documentation, that variables can't be used. If you want. I would
personally appreciate if I didn't need to discover the fact by programm
banging and scratching my head wondering why. Perhaps I am the only one
who attempted to use a variable name in a template? :)
I have attached an example of a little "readme" template, just for the
illustration. I'll switch to another template engine, we are plenty of
those in Emacs or will just cookiecutter as everyone else. It was
actually an example for a little project I wrote on top of org-capture.
As you see, I use 'project-name' in quite many places, which is a variable
which I turned into function to not repeat typing something like
(eval project-name) all over the template.
> parenthesis ugly. Would it help to add an example with "%(identity VAR)"
> as Eduardo suggests?
Yes, that is nice. So was also %(eval VAR), but you should normally not
have to do that. Macros are also off limit, but that is perhaps not
something one needs in a template, so I didn't bring it up. Using
variables straightforward, without workarounds, would be though handy
and natural.
> The only problem is to choose variable and function names that do not
> have counterparts to avoid ambiguity. Preferably examples should not
> look contrived and should illustrate some real use case.
That is not what is problem at all. Problem is that you can't use
variables in those escapes, you can only call functions. It has nothing
to do with ambiguity. '(symbol)' and 'symbol' are not ambiqous in Emacs
Lisp. One will be be called as a function the other one as variable.
It is what it is, a blunt. But since it is in the use we all understand
it won't get changed, since it would affect the existing function
calling users, so it's OK to leave it as is. I am fine, it was just a
question anyway.
You could introduce another markers, %{} (only ones left :)), as Ihor
suggested, but since nobody seem to have discovered they can't
use variables yet, I guess nobody is using those templates for
bigger stuff, so demand is probably not there.
README.org
Description: README.org
