[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extending TeX-read-key-val
From: |
Ikumi Keita |
Subject: |
Re: Extending TeX-read-key-val |
Date: |
Mon, 25 Oct 2021 13:14:28 +0900 |
>>>>> Arash Esbati <arash@gnu.org> writes:
>> 2. "KEY-VAL-ALIST can be a symbol or a function call ..."
>> It seems that "function call" is a bit ambiguous to me. How about
>> "KEY-VAL-ALIST can be a variable or a function ..."?
> I wanted to express that something like this would not work:
> (TeX-add-style-hook
> "foo"
> (lambda ()
> (TeX-add-symbols
> '("bar" (TeX-arg-key-val function-returning-key-val)))))
> If you think your suggestion is more clear, I'm happy to adjust the
> docstring.
Ah, sorry. I didn't understand your code well enough.
>> 1. Maybe
>> (symbol-value key-val-alist)
>> is more appropriate than
>> (eval key-val-alist t)
>> for its directness.
> I'm not sure if we get into trouble if a globally defvar'ed key-val list
> is let-bound and changed in a function call using `TeX-read-key-val'.
> WDYT? I haven't checked the occurrence of this within AUCTeX, though.
Do you mean something like this?
----------------------------------------------------------------------
(defvar foo 1)
(defun bar (var)
(symbol-value var))
(defun xyz ()
(let ((foo foo))
(setq foo (1+ foo))
(bar 'foo)))
(xyz) ; => 2
foo ; => 1
----------------------------------------------------------------------
As Tassilo pointed out, my understanding is that:
- Once a variable is marked as special by defvar, its binding is
always dynamic scoped even with `let'.
- Thus `symbol-value' returns its temporal value bound by `let' for such
variable.
I think the result of the above example supports this view.
Regards,
Ikumi Keita
- Extending TeX-read-key-val, Arash Esbati, 2021/10/22
- Re: Extending TeX-read-key-val, Ikumi Keita, 2021/10/23
- Re: Extending TeX-read-key-val, Arash Esbati, 2021/10/24
- Re: Extending TeX-read-key-val, Tassilo Horn, 2021/10/24
- Re: Extending TeX-read-key-val, Arash Esbati, 2021/10/27
- Re: Extending TeX-read-key-val, Tassilo Horn, 2021/10/28
- lexical and dynamic binding, Ikumi Keita, 2021/10/28
- Re: lexical and dynamic binding, Tassilo Horn, 2021/10/28
- Re: lexical and dynamic binding, Ikumi Keita, 2021/10/28
- Re: lexical and dynamic binding, Arash Esbati, 2021/10/28
- Re: Extending TeX-read-key-val,
Ikumi Keita <=