arthur miller <[email protected]> writes:

>> I am actually ok with :keyword to be outside the template.
>> My problem with :full-lisp is mostly that the *meaning* of the template
>> will subtly change depending on that keyword.
>
> The point is to change the meaning of the template; actually to replace
> it with a different parser, and it is an explicit opt-in, so I don't see
> it as problematic. I understand what you say, and I agree if it was
> something not as explicit it would be problematic for the unaware user,
> but in an _explicit_ opt-in, I would be fine with it. Anyway, tomatos -
> tomatoes :). I wasn't happy with :full-lisp either, but I needed to
> somehow switch between parsers.

If introducing a custom parser is something you really want, a possible
semantics could be something like

(yasnippet-template "...")
(org-template "...")
(tempel-template "...")

Then, the format is announced right at the beginning - we are used to
this kind of semantics in (format ...) or in other languages - think of
python f-strings.

> Now when I think of it, I like the %:keyword, something like this:
>
> (... "some %:foo template %:here" :foo "FOO" :here "THERE" ...)
>
> => "some FOO template THERE"
>
> However, the problem with the notation is the same one why I couldn't
> use just %symbol-name as expander for globally defined symbol
> vaules. Org-capture already reserves a big number of keywords for the
> (in)conveience. For example, %user-full-name would clash with predefined
> %u which includes a timestamp. Similarly %:name or %:group would clash
> with globally defined symbols with the same name.

%:user-full-name, not %user-full-name - no clash there.

Concern about clash with link info is indeed valid.

> I think %: looks a bit less-intrusive on the eye than {}, but one would
> need some sort of overriding mechanism to set aside link types: That
> would complicate things, so I think {} is the way to go, or perhaps some
> other pair. Pipes perhaps: %|keyword|?

%{...} looks better in my eyes. Mostly because of my experience with
 python f-strings.

> The "local" declaration of a variable could be done within the pair:
>
> (defvar foo "FOO")
> (... "foo could be %{foo} or %{foo :foo "BAR"}, and is %{foo} now!" ...)
>
> => "foo could be FOO or BAR, but is ???" <-- which one?

> The idea is it would be BAR. The reasoning behind is that one does not
> need at all to introduce a keyword if it is going to be used in a single
> template only. If that is the case, one can just type the value
> directly.

I am completely lost in the above example.

> Here the declaration from the first template, would continue to hold in
> consecutive templates, but it does not look very intuitive to me. It is
> probably more intuitive to type:
>
> (... "foo can only be %{foo} and is %{foo}!" :foo "BAR" ...)
>
> "foo can only be BAR and is BAR!"
>
> In other words, it shadows the global value completely in all templates,
> which I think is completely fine. Something like that? Too complicated?
> Too simple? :)

That's what I had in mind, yes.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to