[Top][All Lists]

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

Re: [AUCTeX] Re: TeX-clean on closing buffer

From: Ralf Angeli
Subject: Re: [AUCTeX] Re: TeX-clean on closing buffer
Date: Mon, 08 Nov 2010 21:40:34 +0100

* Stefan Strohmeier (2010-11-08) writes:

>> As mentioned in the post you referenced above, setting the LOCAL
>> argument of `add-hook' should improve the situation.

> It works now the way I wanted with the following code:
> (add-hook 'LaTeX-mode-hook
>         (lambda ()
>           (make-variable-buffer-local 'kill-buffer-hook)
>           (add-hook 'kill-buffer-hook 'TeX-clean)))
> I am not sure if this is good coding. Any improvements are appreciated.

Um, no, this is not really good coding.  More like the opposite. (c:
Like this the hook will always be modified only buffer-locally when you
set it.  This might have unwanted side effects.

As mentioned above you should set the LOCAL argument of `add-hook'.  If
you look at the description of `add-hook' which can be checked with `C-h
f add-hook <RET>' then you'll see that this is the fourth argument.  So
the solution you are looking for would look something like this:

(add-hook 'LaTeX-mode-hook
          (lambda ()
            (add-hook 'kill-buffer-hook 'TeX-clean nil t)))


reply via email to

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