[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Allowing closure's in style hooks?
From: |
Tassilo Horn |
Subject: |
Re: Allowing closure's in style hooks? |
Date: |
Thu, 17 Nov 2022 13:30:13 +0100 |
User-agent: |
mu4e 1.9.2; emacs 29.0.50 |
Arash Esbati <arash@gnu.org> writes:
Hi Arash,
> I'd like to install this change in `TeX-parse-argument':
>
> diff --git a/tex.el b/tex.el
> index 7fe8095a..129571ae 100644
> --- a/tex.el
> +++ b/tex.el
> @@ -3554,7 +3554,7 @@ See `TeX-parse-macro' for details."
> (set-marker TeX-exit-mark (point)))
> (insert TeX-arg-closing-brace)
> (setq insert-flag t))
> - ((symbolp arg)
> + ((or (symbolp arg) (functionp arg))
> (funcall arg optional))
> ((listp arg)
> (let ((head (car arg))
>
> With this, we can use things like this:
>
> (TeX-add-symbols
> `("foo" ,(lambda (_) ...)))
>
> in our styles. We're already using this in `TeX-read-key-val' et al.,
> so why not also anywhere else? This could help us getting rid of more
> `TeX-arg-eval' constructs.
Yes, please.
> Any comments welcome.
You can omit the symbolp check or rather replace it with functionp. If
a symbol has a symbol-function, then (functionp symbol) will return t.
But be sure to have a t-case in the cond which signals an error when no
other clause applies.
Bye,
Tassilo