diff --git a/yatex.el b/yatex.el index a6031e6..75f744e 100644 --- a/yatex.el +++ b/yatex.el @@ -1,6 +1,6 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //�쒹// -*- coding: sjis -*- ;;; (c)1991-2014 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sat Dec 20 19:43:33 2014 on firestorm +;;; Last modified Sun Dec 21 11:05:59 2014 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -1654,7 +1654,7 @@ "MAKEINDEX" makeindex-command arg)) ((= c ?k) (YaTeX-kill-typeset-process YaTeX-typeset-process)) ((= c ?p) (call-interactively 'YaTeX-preview)) - ((= c ?q) (YaTeX-system "lpq" "*Printer queue*")) + ((= c ?q) (YaTeX-system "lpq" "Printer queue")) ((= c ?d) (YaTeX-typeset-buffer (or (YaTeX-get-builtin "DVIPDF") YaTeX-dvipdf-command)) (put 'dvi2-command 'format 'pdf)) @@ -2006,9 +2006,8 @@ (let ((default-directory basedir)) (cond ((stringp cmd) - (let ((buf (concat "* " cmd " " src " *"))) - (YaTeX-system (concat cmd " " src) buf) - t)) + (YaTeX-system (concat cmd " " src) cmd) + t) ((eq t cmd) (let ((parent buffer-file-name)) (funcall diff --git a/yatexprc.el b/yatexprc.el index 0d6be07..b92c28c 100644 --- a/yatexprc.el +++ b/yatexprc.el @@ -1,7 +1,7 @@ ;;; yatexprc.el --- YaTeX process handler ;;; ;;; (c)1993-2013 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sat Dec 20 20:14:43 2014 on firestorm +;;; Last modified Sun Dec 21 11:36:21 2014 on firestorm ;;; $Id$ ;;; Code: @@ -537,28 +537,36 @@ (interrupt-process proc) (delete-process proc)))))) -(defun YaTeX-system (command buffer) - "Execute some command on buffer. Not a official function." +(defun YaTeX-system (command name &optional noask basedir) + "Execute some COMMAND with process name `NAME'. Not a official function. +Optional second argument NOASK skip query when privious process running. +Optional third argument BASEDIR changes default-directory there." (save-excursion - (YaTeX-showup-buffer - buffer (function (lambda (x) (nth 3 (window-edges x))))) - (let ((df default-directory)) ;preserve current buf's pwd - (set-buffer (get-buffer-create buffer)) ;1.61.3 - (setq default-directory df) - (cd df)) - (erase-buffer) - (if (not (fboundp 'start-process)) - (call-process - shell-file-name nil buffer nil YaTeX-shell-command-option command) - (if (and (get-buffer-process buffer) - (eq (process-status (get-buffer-process buffer)) 'run) - (not - (y-or-n-p (format "Process %s is running. Continue?" buffer)))) - nil - (set-process-buffer - (start-process - "system" buffer shell-file-name YaTeX-shell-command-option command) - (get-buffer buffer)))))) + (let ((df default-directory) + (buffer (get-buffer-create (format " *%s*" name))) + proc status) + (set-buffer buffer) + (setq default-directory (cd (or basedir df))) + (erase-buffer) + (insert (format "Calling `%s'..." command)) + (YaTeX-showup-buffer + buffer (function (lambda (x) (nth 3 (window-edges x))))) + (if (not (fboundp 'start-process)) + (call-process + shell-file-name nil buffer nil YaTeX-shell-command-option command) + (if (and (setq proc (get-buffer-process buffer)) + (setq status (process-status proc)) + (eq status 'run) + (not noask) + (not + (y-or-n-p (format "Process %s is running. Continue?" buffer)))) + nil + (if (eq status 'run) + (progn (interrupt-process proc) (delete-process proc))) + (set-process-buffer + (start-process + name buffer shell-file-name YaTeX-shell-command-option command) + (get-buffer buffer))))))) (defvar YaTeX-default-paper-type "a4" "*Default paper type.") @@ -701,8 +709,7 @@ (defun YaTeX-preview-jlfmt-xdvi () "Call xdvi -sourceposition to DVI corresponding to current main file" - (interactive) -) + (interactive)) (defvar YaTeX-cmd-displayline "/Applications/Skim.app/Contents/SharedSupport/displayline") (defun YaTeX-preview-jump-line () @@ -713,9 +720,9 @@ (widen) (let*((pf (or YaTeX-parent-file (save-excursion (YaTeX-visit-main t) (buffer-file-name)))) - (pd (file-name-directory pf)) + (pdir (file-name-directory pf)) (bnr (substring pf 0 (string-match "\\....$" pf))) - (cf (file-relative-name (buffer-file-name) pd)) + (cf (file-relative-name (buffer-file-name) pdir)) (buffer (get-buffer-create " *preview-jump-line*")) (line (count-lines (point-min) (point-end-of-line))) (previewer (YaTeX-preview-default-previewer)) @@ -733,7 +740,7 @@ ((string-match "evince" previewer) (format "%s %s.pdf %d %s" "fwdevince" bnr line cf))))) - (YaTeX-typeset cmd buffer))))) + (YaTeX-system cmd "jump-line" 'noask pdir))))) (defun YaTeX-goto-corresponding-viewer () (let ((cmd (or (YaTeX-get-builtin "!") tex-command))) @@ -1121,13 +1128,14 @@ (basic-save-buffer) (let ((cmm major-mode)) (save-excursion - (mapcar '(lambda (buf) + (mapcar (function + (lambda (buf) (set-buffer buf) (if (and (buffer-file-name buf) (eq major-mode cmm) (buffer-modified-p buf) (y-or-n-p (format "Save %s" (buffer-name buf)))) - (save-buffer buf))) + (save-buffer buf)))) (buffer-list))))) (provide 'yatexprc)