yatex

changeset 576:70bb775b481c

Trial of removing .log/.dvi file when PDF successfully generated
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 25 Nov 2019 21:09:06 +0900
parents 637d152145d7
children 117a846879bc 89a13c59674f
files yatexprc.el
diffstat 1 files changed, 18 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/yatexprc.el	Wed Dec 26 08:11:24 2018 +0900
     1.2 +++ b/yatexprc.el	Mon Nov 25 21:09:06 2019 +0900
     1.3 @@ -1,7 +1,7 @@
     1.4  ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*-
     1.5  ;;; 
     1.6  ;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Wed May 30 08:32:30 2018 on firestorm
     1.8 +;;; Last modified Mon Nov 25 21:01:57 2019 on monster
     1.9  ;;; $Id$
    1.10  
    1.11  ;;; Code:
    1.12 @@ -168,6 +168,8 @@
    1.13  (defvar YaTeX-typeset-rerun-msg "Rerun to get cross-references right.")
    1.14  (defvar YaTeX-typeset-citation-msg
    1.15    "Warning: Citation \`")
    1.16 +(defvar YaTeX-typeset-remove-dvi-when-pdf t
    1.17 +  "*Non-nil means removing dvi file which has same rootname as PDF output")
    1.18  (defun YaTeX-typeset-sentinel (proc mes)
    1.19    (cond ((null (buffer-name (process-buffer proc)))
    1.20           ;; buffer killed
    1.21 @@ -303,12 +305,22 @@
    1.22  			 (if (save-excursion
    1.23  			       (re-search-backward
    1.24  				(concat
    1.25 -				 "^Output written on .*\\.pdf (.*page,"
    1.26 -				 "\\|\\.dvi -> .*\\.pdf$")
    1.27 +				 "^Output written on \\(.*\\.pdf\\) (.*page,"
    1.28 +				 "\\|.* -> \\(.*\\.pdf\\)$")
    1.29  				nil t))
    1.30 -			     ;; If PDF output log found in buffer,
    1.31 -			     ;; set next default previewer to 'pdf viewer
    1.32 -			     (put 'dvi2-command 'format 'pdf))
    1.33 +			     (let*((pdf (or (YaTeX-match-string 1)
    1.34 +					    (YaTeX-match-string 2)))
    1.35 +				   (rootname (substring
    1.36 +					      pdf 0 (rindex pdf ?.)))
    1.37 +				   (dvi (format "%s.dvi" rootname))
    1.38 +				   (log (format "%s.log" rootname)))
    1.39 +			       ;; If PDF output log found in buffer,
    1.40 +			       ;; set next default previewer to 'pdf viewer
    1.41 +			       (put 'dvi2-command 'format 'pdf)
    1.42 +			       (if YaTeX-typeset-remove-dvi-when-pdf
    1.43 +				   (progn
    1.44 +				     (delete-file log) ;Ugly, should not do here
    1.45 +				     (delete-file dvi)))))
    1.46  		       ;;Confirm process buffer to be shown when error
    1.47  		       (YaTeX-showup-buffer
    1.48  			pbuf 'YaTeX-showup-buffer-bottom-most)