yatex

diff yatexprc.el @ 227:3b2ac4652810

Handling of built-in is changed to use YaTeX-getset-builtin.
author yuuji@gentei.org
date Mon, 23 Jan 2012 01:19:36 +0900
parents 9705855793ca
children 7f4a5db88fbb
line diff
     1.1 --- a/yatexprc.el	Sun Jan 22 21:37:09 2012 +0900
     1.2 +++ b/yatexprc.el	Mon Jan 23 01:19:36 2012 +0900
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; YaTeX process handler.
     1.5  ;;; yatexprc.el
     1.6  ;;; (c)1993-2012 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Sun Jan 22 15:47:53 2012 on firestorm
     1.8 +;;; Last modified Mon Jan 23 00:28:08 2012 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;(require 'yatex)
    1.12 @@ -444,23 +444,33 @@
    1.13        'YaTeX-call-command-history)
    1.14       buffer)))
    1.15  
    1.16 -(defun YaTeX-call-builtin-on-file (builtin-type &optional default)
    1.17 +(defvar YaTeX-call-builtin-on-file)
    1.18 +(make-variable-buffer-local 'YaTeX-call-builtin-on-file)
    1.19 +(defun YaTeX-call-builtin-on-file (builtin-type &optional default update)
    1.20    "Call command on file specified by BUILTIN-TYPE."
    1.21 -  (interactive)
    1.22    (YaTeX-save-buffers)
    1.23    (let*((main (or YaTeX-parent-file
    1.24 -		  (progn (YaTeX-visit-main t) buffer-file-name)))
    1.25 +		  (save-excursion (YaTeX-visit-main t) buffer-file-name)))
    1.26  	(mainroot (file-name-nondirectory (substring main 0 (rindex main ?.))))
    1.27 -	(b-in (YaTeX-get-builtin builtin-type)))
    1.28 -    (cond
    1.29 -     ((null b-in) (setq b-in (format "%s %s" default mainroot)))
    1.30 -     ((string-match (regexp-quote mainroot) b-in) nil)
    1.31 -     (t (setq b-in (concat b-in " " mainroot))))
    1.32 +	(alist YaTeX-call-builtin-on-file)
    1.33 +	(b-in (or (YaTeX-get-builtin builtin-type)
    1.34 +		  (cdr (assoc builtin-type alist))))
    1.35 +	(command b-in))
    1.36 +    (if (or update (null b-in))
    1.37 +	(progn
    1.38 +	  (setq command (read-string-with-history
    1.39 +			 (format "%s command: " builtin-type)
    1.40 +			 (or b-in
    1.41 +			     (format "%s %s" default mainroot))
    1.42 +			 'YaTeX-call-command-history))
    1.43 +	  (if (or update (null b-in))
    1.44 +	      (if (y-or-n-p "Use this command line in the future? ")
    1.45 +		  (YaTeX-getset-builtin builtin-type command) ;keep in a file
    1.46 +		(setq YaTeX-call-builtin-on-file	      ;keep in memory
    1.47 +		      (cons (cons builtin-type command)
    1.48 +			    (delete (assoc builtin-type alist) alist)))))))
    1.49      (YaTeX-typeset
    1.50 -     (read-string-with-history
    1.51 -      "Call command: "
    1.52 -      b-in
    1.53 -      'YaTeX-call-command-history)
    1.54 +     command
    1.55       (format " *YaTeX-%s*" (downcase builtin-type)))))
    1.56  
    1.57  (defun YaTeX-kill-typeset-process (proc)