auctex-devel
[Top][All Lists]
Advanced

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

Re: some problems with label inserting for enumerate


From: Tassilo Horn
Subject: Re: some problems with label inserting for enumerate
Date: Mon, 23 Aug 2021 21:50:35 +0200
User-agent: mu4e 1.6.4; emacs 28.0.50

Uwe Brauer <oub@mat.ucm.es> writes:

Hi Uwe,

> Uwe> (defun ub/LaTeX-item-enumerate ()
> Uwe>   (TeX-insert-macro "item")
> Uwe>   (save-excursion
> Uwe>     (LaTeX-label environment 'environment)))
> Uwe> 
> Uwe> (with-eval-after-load "latex"
> Uwe> (TeX-add-style-hook
> Uwe>  "pfsimple"                             ;just for the pfsimple style
> Uwe>  (lambda ()
> Uwe>    (TeX-run-style-hooks "enumitem")
> Uwe>    (add-to-list 'LaTeX-label-alist
> Uwe>          '("enumerate" . "item:")
> Uwe>          t)
> Uwe>    (add-to-list 'LaTeX-item-list
> Uwe>          '("enumerate" . ub/LaTeX-item-enumerate)
> Uwe>          t))))
> Uwe> 
> Uwe> And that worked nicely thanks!
>
> However in recent auctex version, when I open a file that contains
> \usepackage{pfsimple}
> and running LaTeX-insert-item  I obtain an error:
> ,----
> | 
> | Debugger entered--Lisp error: (void-variable environment)
> |   (LaTeX-label environment 'environment)
> |   (save-excursion (LaTeX-label environment 'environment))
> |   ub/LaTeX-item-enumerate()
> |   LaTeX-insert-item()
> |   funcall-interactively(LaTeX-insert-item)
> |   call-interactively(LaTeX-insert-item nil nil)
> |   command-execute(LaTeX-insert-item)
> `----
>
> What has changed?

A lot!  (In the current case, we're using lexical binding now so you
can't access local variables of the calling function in the called
function anymore.)

So use (LaTeX-current-environment) instead of the undefined variable
`environment'.

Bye,
Tassilo



reply via email to

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