[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to
Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks
Mon, 29 Aug 2022 21:34:27 +0200
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50
Tassilo Horn <firstname.lastname@example.org> writes:
> So what's wrong with this one?
> (lambda ()
> `("bar" (TeX-arg-key-val
> ,(lambda ()
> (append (func1-returning-keyval-alist)
If this is the best/only option, well, I'm buying it :)
> That's again caught by the functionp case and can simply be funcalled.
How would you then re-write `TeX-read-key-val'? It currently looks like
(defun TeX-read-key-val (optional key-val-alist &optional prompt)
"Prompt for keys and values in KEY-VAL-ALIST and return them.
If OPTIONAL is non-nil, indicate in the prompt that we are
reading an optional argument. KEY-VAL-ALIST is an alist. The
car of each element should be a string representing a key and the
optional cdr should be a list with strings to be used as values
for the key. KEY-VAL-ALIST can be a symbol or a function call
returning an alist. Use PROMPT as the prompt string."
(TeX-argument-prompt optional prompt "Options (k=v)")
(cond ((and (symbolp key-val-alist)
((and (listp key-val-alist)
(symbolp (car key-val-alist))
(fboundp (car key-val-alist)))
(if (> (length key-val-alist) 1)
(eval key-val-alist t)
(funcall (car key-val-alist))))
And while we're at, what do we do with `TeX-arg-eval'?
> 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.
Hmm, Sorry, but I don't like this. Why taking away the clarity of what
is currently used, the variable or the function? I think having the
function call in () increases the legibility.
> Sorry, I know we had a discussion back then where I haven't been
> explicit enough or haven't had an informed opinion yet. :-(
No problem, you will have to adjust all AUCTeX styles for being late ;-)
Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks, Emanuel Berg, 2022/08/26
Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks, Richard Stallman, 2022/08/28