Uwe Brauer <[email protected]> writes:
>>>> "TH" == Tassilo Horn <[email protected]> writes:
>
>> So use (LaTeX-current-environment) instead of the undefined variable
>> `environment'.
>
> Ah, lexical binding is a concept, that I should study more in detail for sure.
>
> So I tried
>
> (defun ub/LaTeX-item-enumerate ()
> (TeX-insert-macro "item")
> (save-excursion
> ; (LaTeX-label environment 'environment))) change to lexical binding
> (LaTeX-label LaTeX-current-environment 'LaTeX-current-environment)))
>
> Or
>
> (defun ub/LaTeX-item-enumerate ()
> (TeX-insert-macro "item")
> (save-excursion
> ; (LaTeX-label environment 'environment))) change to lexical binding
> (LaTeX-label LaTeX-current-environment 'environment)))
>
> Both worked in the sense that they inserted a item and did not return
> an error. However, no label was inserted, so the original functionality
> does not really work.
See the parentheses in Tassilo's message? Try:
(defun ub/LaTeX-item-enumerate ()
(TeX-insert-macro "item")
(save-excursion
;; (LaTeX-label environment 'environment))) change to lexical binding
(LaTeX-label (LaTeX-current-environment) 'environment)))
Best, Arash