On 04/01/2026 9:33 pm, Ihor Radchenko wrote:
Max Nikulin writes:

For others, if we are at it, I think it is much better to type
(princ default-directory) than (eval default-directory)
[...]
Maybe simply identity? (although it feels long)

I would avoid `eval' besides cases where it is strictly necessary. That
is why I think `identity' or its shorter alias limited to template
expansion will be better.

Why? %(...) is passed through org-eval anyway.

I believe, we should not encourage unnecessary calls of `eval' by using it in docs. Users may add this dangerous function to their code just because they see it too often.

By the way, what about `or'? Overhead in comparison to `identity' should not be noticeable for capture templates.

    (org-capture-fill-template "System name %(or system-name)")

For me 3 extra characters for variables is better than nested parenthesis for function call. Of course, it is a kind of hack and it signals error for non-string values (just like `eval'). Perhaps %(format "%s" system-type) should be mentioned as well.

What I do not like is that error is not signaled in the case of

(org-capture-fill-template "Non-existing function %(sometypo 10)")
"Non-existing function %![Error: (void-function sometypo)]
"

Reply via email to