Function: TeX-clean
TeX-clean is an interactive and byte-compiled function defined in
tex.el.
Signature
(TeX-clean &optional ARG)
Documentation
Delete generated files associated with current master and region files.
If prefix ARG is non-nil, not only remove intermediate but also output files.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-clean (&optional arg)
"Delete generated files associated with current master and region files.
If prefix ARG is non-nil, not only remove intermediate but also
output files."
(interactive "P")
(let* (;; Call with output extension then remove it, to make sure we
;; get the correct directory in cases TeX-output-dir is
;; non-nil
(master (file-name-sans-extension (TeX-active-master (TeX-output-extension))))
(master-dir (file-name-directory master))
(regexp (concat "\\("
(regexp-quote (file-name-nondirectory master)) "\\|"
(regexp-quote (file-name-nondirectory (TeX-region-file nil t)))
"\\)"
"\\("
(TeX--clean-extensions-regexp arg)
"\\)\\'"
"\\|" (regexp-quote (file-name-nondirectory (TeX-region-file t t)))))
(files (when (and regexp (or (not master-dir) (file-exists-p master-dir)))
(directory-files (or master-dir ".") nil regexp))))
(if files
(when (or (not TeX-clean-confirm)
(dired-mark-pop-up " *Deletions*" 'delete
(if (> (length files) 1)
files
(cons t files))
'y-or-n-p "Delete files? "))
(dolist (file files)
(delete-file (concat master-dir file))))
(message "No files to be deleted"))))