changeset 577:117a846879bc dev

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 26 Nov 2019 08:26:49 +0900
parents 777d17c07759 (current diff) 70bb775b481c (diff)
children 4dad5f91b26c
files yatexprc.el
diffstat 2 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Oct 17 09:52:31 2019 +0900
+++ b/.hgtags	Tue Nov 26 08:26:49 2019 +0900
@@ -19,4 +19,5 @@
 0e37ced833ef9388295be594da9bc91ff6eae037 yatex-1.80
 0e37ced833ef9388295be594da9bc91ff6eae037 yatex-1.80
 a2bb2426a15410438d5e5917ce939bd4bbbe8194 yatex-1.80
+ca7cf34e959cc35960081f25b0f903b1bd2a191f master-beginning
 fbb636ff0fe3fd784af7697db5805a20d33b04d2 yatex-1.81
--- a/yatexprc.el	Thu Oct 17 09:52:31 2019 +0900
+++ b/yatexprc.el	Tue Nov 26 08:26:49 2019 +0900
@@ -1,7 +1,7 @@
 ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*-
 ;;; 
 ;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Sat Oct  5 12:44:16 2019 on firestorm
+;;; Last modified Mon Nov 25 21:01:57 2019 on monster
 ;;; $Id$
 
 ;;; Code:
@@ -168,6 +168,8 @@
 (defvar YaTeX-typeset-rerun-msg "Rerun to get cross-references right.")
 (defvar YaTeX-typeset-citation-msg
   "Warning: Citation \`")
+(defvar YaTeX-typeset-remove-dvi-when-pdf t
+  "*Non-nil means removing dvi file which has same rootname as PDF output")
 (defun YaTeX-typeset-sentinel (proc mes)
   (cond ((null (buffer-name (process-buffer proc)))
          ;; buffer killed
@@ -303,12 +305,22 @@
 			 (if (save-excursion
 			       (re-search-backward
 				(concat
-				 "^Output written on .*\\.pdf (.*page,"
-				 "\\|\\.dvi -> .*\\.pdf$")
+				 "^Output written on \\(.*\\.pdf\\) (.*page,"
+				 "\\|.* -> \\(.*\\.pdf\\)$")
 				nil t))
-			     ;; If PDF output log found in buffer,
-			     ;; set next default previewer to 'pdf viewer
-			     (put 'dvi2-command 'format 'pdf))
+			     (let*((pdf (or (YaTeX-match-string 1)
+					    (YaTeX-match-string 2)))
+				   (rootname (substring
+					      pdf 0 (rindex pdf ?.)))
+				   (dvi (format "%s.dvi" rootname))
+				   (log (format "%s.log" rootname)))
+			       ;; If PDF output log found in buffer,
+			       ;; set next default previewer to 'pdf viewer
+			       (put 'dvi2-command 'format 'pdf)
+			       (if YaTeX-typeset-remove-dvi-when-pdf
+				   (progn
+				     (delete-file log) ;Ugly, should not do here
+				     (delete-file dvi)))))
 		       ;;Confirm process buffer to be shown when error
 		       (YaTeX-showup-buffer
 			pbuf 'YaTeX-showup-buffer-bottom-most)

yatex.org