emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to


From: Tassilo Horn
Subject: Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks
Date: Sat, 27 Aug 2022 09:25:44 +0200
User-agent: mu4e 1.9.0; emacs 29.0.50

Arash Esbati <arash@gnu.org> writes:

> So take fancyvrb.el for example which has a variable
> `LaTeX-fancyvrb-key-val-options'[1] (which can declared by defconst now)
> and a function `LaTeX-fancyvrb-key-val-options'[2] which returns the
> current keyvals.
>
> So my last requirement was to be able to do something like this:
>
> (TeX-add-style-hook
>  "foo"
>  (lambda ()
>    (TeX-add-symbols
>     '("bar" (TeX-arg-key-val
>              (append (func1-returning-keyval-alist)
>                      (func2-returning-keyval-alist)))))))
>
> And this didn't work with the (apply head tail) version.  Any other
> suggestion how to implement this in `TeX-arg-key-val' is highly
> welcome.

So what's wrong with this one?

(TeX-add-style-hook
 "foo"
 (lambda ()
   (TeX-add-symbols
    `("bar" (TeX-arg-key-val
             ,(lambda ()
               (append (func1-returning-keyval-alist)
                       (func2-returning-keyval-alist))))))))

That's again caught by the functionp case and can simply be funcalled.
I'd rather prefer to keep the DSL simple, e.g., TeX-arg-key-val
arguments can either be a literal alist, a function of no args
delivering an alist, or a symbol denoting an alist variable (checked in
that order).  That is, I wouldn't even distinguish functions from
variables syntactically but prefer functions in general, e.g.,

  (TeX-arg-key-val (LaTeX-enumitem-key-val-options))

would become

  (TeX-arg-key-val LaTeX-enumitem-key-val-options)

where LaTeX-enumitem-key-val-options is funcalled and takes precedence
of the variable of the same name.

Sorry, I know we had a discussion back then where I haven't been
explicit enough or haven't had an informed opinion yet. :-(

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]