auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] TeX-clean misbehaviour


From: Ralf Angeli
Subject: Re: [AUCTeX] TeX-clean misbehaviour
Date: Sun, 20 Sep 2009 08:58:35 +0200

* FabioL (2009-09-20) writes:

> I defined a shortcut:
> (define-key TeX-mode-map (kbd "<f5>")
>                (lambda ()
>                  (interactive)
>                  (save-buffer)
>                  (TeX-command-menu "LaTeX")
>                  (TeX-command-menu "Clean")))
>
> When using this shortcut there is an error "(void-variable
> -clean-intermediate-suffixes)" in TeX-clean. When I run TeX-clean via M-x
> everything works right. My guess is that in the shortcut case,
> TeX-mode-prefix returns nil and -clean-intermediate-suffixes gets passed
> where it should be prepended by TeX or LaTeX. 
>
> Any hints?

This is not a misbehavior of `TeX-clean' as the subject suggests.  You
are simply calling it in the output buffer of the LaTeX run and not in
the buffer of the LaTeX file.  So you gotta make the latter buffer the
current one before calling `TeX-clean'.

You likely also want to run LaTeX synchronously because otherwise
`TeX-clean' will get called before the LaTeX run is finished.

Something like the following should work:

(define-key TeX-mode-map (kbd "<f5>")
               (lambda ()
                 (interactive)
                 (let ((buf (current-buffer))
                       (TeX-process-asynchronous nil))
                   (save-buffer)
                   (TeX-command-menu "LaTeX")
                   (with-current-buffer buf
                     (TeX-command-menu "Clean")))))

-- 
Ralf




reply via email to

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