Index: context.el =================================================================== RCS file: /cvsroot/auctex/auctex/context.el,v retrieving revision 1.53 diff -u -r1.53 context.el --- context.el 21 Jun 2005 18:54:52 -0000 1.53 +++ context.el 5 Feb 2006 14:48:25 -0000 @@ -1406,6 +1406,14 @@ ConTeXt-section-block-list ConTeXt-section-list ConTeXt-text ConTeXt-item-list)) +(defcustom ConTeXt-clean-suffix-regexp + ;; See *suffixes in texutil.pl. + "\\(\\.\\(tui\\|tup\\|ted\\|tes\\|top\\|log\\|tmp\\|run\\|bck\\|rlg\\|\ +mpt\\|mpx\\|mpd\\|mpo\\|dvi\\|pdf\\|ps\\|tuo\\|tub\\|top\\)\\|\ +-\\(mpgraph\\.mp[doy]?\\|mprun\\.mp[doy]?\\)\\)\\'" + "Regexp matching the suffixes of generated files to be cleaned." + :type 'regexp + :group 'TeX-command) (defun ConTeXt-mode-common-initialization () "Initialization code that is common for all ConTeXt interfaces." Index: latex.el =================================================================== RCS file: /cvsroot/auctex/auctex/latex.el,v retrieving revision 5.398 diff -u -r5.398 latex.el --- latex.el 3 Feb 2006 15:37:14 -0000 5.398 +++ latex.el 5 Feb 2006 14:48:26 -0000 @@ -4725,6 +4725,11 @@ ;;;###autoload (defalias 'TeX-doctex-mode 'docTeX-mode) +(defcustom docTeX-clean-suffix-regexp TeX-clean-default-suffix-regexp + "Regexp matching the suffixes of generated files to be cleaned." + :type 'regexp + :group 'TeX-command) + (defvar LaTeX-header-end (concat "^[^%\n]*" (regexp-quote TeX-esc) "begin *" TeX-grop "document" TeX-grcl) @@ -4735,6 +4740,11 @@ TeX-grop "document" TeX-grcl) "Default start of trailer marker for LaTeX documents.") +(defcustom LaTeX-clean-suffix-regexp TeX-clean-default-suffix-regexp + "Regexp matching the suffixes of generated files to be cleaned." + :type 'regexp + :group 'TeX-command) + (defun LaTeX-common-initialization () "Common initialization for LaTeX derived modes." (VirTeX-common-initialization) Index: tex-buf.el =================================================================== RCS file: /cvsroot/auctex/auctex/tex-buf.el,v retrieving revision 1.244 diff -u -r1.244 tex-buf.el --- tex-buf.el 28 Jan 2006 12:50:53 -0000 1.244 +++ tex-buf.el 5 Feb 2006 14:48:26 -0000 @@ -757,6 +757,11 @@ ;; use the sentinel-function that the major mode sets, not the LaTeX one (setq TeX-sentinel-function sentinel-function))) +(defun TeX-run-clean (&rest ignored) + "Wrapper function for `TeX-clean' to be called via `TeX-command-*'." + (TeX-clean)) + + ;;; Command Sentinels (defun TeX-synchronous-sentinel (name file result) Index: tex-info.el =================================================================== RCS file: /cvsroot/auctex/auctex/tex-info.el,v retrieving revision 5.151 diff -u -r5.151 tex-info.el --- tex-info.el 5 Dec 2005 10:51:03 -0000 5.151 +++ tex-info.el 5 Feb 2006 14:48:26 -0000 @@ -535,6 +535,14 @@ (TeX-run-mode-hooks 'text-mode-hook 'Texinfo-mode-hook) (TeX-set-mode-name)) + +(defcustom Texinfo-clean-suffix-regexp + ;; See `man texi2html' for the HTML stuff. + "\\(\\.\\(info\\(-[0-9]+\\)?\\|dvi\\|html\\|pdf\\|ps\\)\\|\ +_\\(\\(toc\\|fot\\|abt\\|[0-9]+\\)\\.html\\|l2h_img.+\\)\\)\\'" + "Regexp matching the suffixes of generated files to be cleaned." + :type 'regexp + :group 'TeX-command) (provide 'tex-info) Index: tex.el =================================================================== RCS file: /cvsroot/auctex/auctex/tex.el,v retrieving revision 5.557 diff -u -r5.557 tex.el --- tex.el 28 Jan 2006 12:50:35 -0000 5.557 +++ tex.el 5 Feb 2006 14:48:26 -0000 @@ -178,10 +178,6 @@ ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") - ;; --purge %s does not work on unix systems with current texutil - ;; check again october 2003 --pg - ("ConTeXt Clean" "texutil --purgeall" TeX-run-interactive nil - (context-mode) :help "Clean temporary ConTeXt files") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ,(if (or window-system (getenv "DISPLAY")) '("View" "%V" TeX-run-discard t t :help "Run Viewer") @@ -197,6 +193,7 @@ :help "Check LaTeX file for correctness") ("Spell" "" TeX-run-ispell-on-document nil t :help "Spell-check the document") + ("Clean" "" TeX-run-clean nil t :help "Remove generated files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command")) "List of commands to execute on the current document. @@ -1182,6 +1179,29 @@ (make-variable-buffer-local 'TeX-command-default) +(defvar TeX-clean-default-suffix-regexp + "\\.\\(aux\\|bbl\\|blg\\|dvi\\|fot\\|glo\\|gls\\|lof\\|idx\\|ilg\\|ind\\|\ +log\\|lot\\|pdf\\|ps\\|toc\\|url\\)\\'" + "Regexp matching the suffixes of files to be cleaned. +Used as a default in TeX, LaTeX and docTeX mode.") + +(defun TeX-clean () + "Delete generated files associated with current master file." + (interactive) + (when (y-or-n-p "Delete generated files? ") + (let* ((mode-prefixes '((plain-tex-mode . "plain-TeX") + (latex-mode . "LaTeX") + (doctex-mode . "docTeX") + (texinfo-mode . "Texinfo") + (context-mode . "ConTeXt"))) + (regexp (symbol-value (intern (concat (cdr (assoc major-mode + mode-prefixes)) + "-clean-suffix-regexp")))) + (files (directory-files "." nil (concat (TeX-active-master nil t) + regexp)))) + (dolist (file files) + (delete-file file))))) + ;;; Master File