yatex

changeset 227:3b2ac4652810 dev

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 60844b664f54
children ccc75ecb360f
files yatex.el yatexprc.el
diffstat 2 files changed, 34 insertions(+), 32 deletions(-) [+]
line diff
     1.1 --- a/yatex.el	Mon Jan 23 00:11:31 2012 +0900
     1.2 +++ b/yatex.el	Mon Jan 23 01:19:36 2012 +0900
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; Yet Another tex-mode for emacs - //–ì’¹//
     1.5  ;;; yatex.el rev. 1.75.1
     1.6  ;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Sun Jan 22 15:48:09 2012 on firestorm
     1.8 +;;; Last modified Mon Jan 23 01:11:49 2012 on firestorm
     1.9  ;;; $Id$
    1.10  ;;; The latest version of this software is always available at;
    1.11  ;;; http://www.yatex.org/
    1.12 @@ -1618,9 +1618,9 @@
    1.13       ((= c ?r) (YaTeX-typeset-region))
    1.14       ((= c ?e) (YaTeX-typeset-environment))
    1.15       ((= c ?b) (YaTeX-call-builtin-on-file
    1.16 -		"BIBTEX" bibtex-command))
    1.17 +		"BIBTEX" bibtex-command arg))
    1.18       ((= c ?i) (YaTeX-call-builtin-on-file
    1.19 -		"MAKEINDEX" makeindex-command))
    1.20 +		"MAKEINDEX" makeindex-command arg))
    1.21       ((= c ?k) (YaTeX-kill-typeset-process YaTeX-typeset-process))
    1.22       ((= c ?p) (call-interactively 'YaTeX-preview))
    1.23       ((= c ?q) (YaTeX-system "lpq" "*Printer queue*"))
    1.24 @@ -1639,26 +1639,18 @@
    1.25    "Operate %# notation."
    1.26    ;;Do not use interactive"r" for the functions which require no mark
    1.27    (interactive)
    1.28 -  (message "!)Edit-%%#! B)EGIN-END-region L)Edit-%%#LPR")
    1.29 +  (message "!)Edit-%%#! B)EGIN-END-region P)review L)Edit-%%#LPR M)akeindex B)ibtex")
    1.30    (let ((c (or char (read-char))) (string "") key
    1.31  	(b (make-marker)) (e (make-marker)))
    1.32      (save-excursion
    1.33        (cond
    1.34 -       ((or (= c ?!) (= c ?l))		;Edit `%#!'
    1.35 -	(goto-char (point-min))
    1.36 -	(setq key (cond ((= c ?!) "%#!")
    1.37 -			((= c ?l) "%#LPR")))
    1.38 -	(if (re-search-forward key nil t)
    1.39 -	    (progn
    1.40 -	      (setq string (YaTeX-buffer-substring
    1.41 -			    (point) (point-end-of-line)))
    1.42 -	      (delete-region (point) (progn (end-of-line) (point))))
    1.43 -	  (open-line 1)
    1.44 -	  (delete-region (point) (progn (beginning-of-line)(point)));for 19 :-<
    1.45 -	  (insert key))
    1.46 -	(unwind-protect
    1.47 -	    (setq string (read-string (concat key ": ") string))
    1.48 -	  (insert string)))
    1.49 +       ((rindex "!plmb" c)		;Edit %#xxx
    1.50 +	(setq key (cdr (assq c '((?! . "!")
    1.51 +				 (?p . "PREVIEW")
    1.52 +				 (?l . "LPR")
    1.53 +				 (?m . "MAKEINDEX")
    1.54 +				 (?b . "BIBTEX")))))
    1.55 +	(YaTeX-getset-builtin key t))
    1.56  
    1.57         ((= c ?b)			;%#BEGIN %#END region
    1.58  	(or end (setq beg (min (point) (mark)) end (max (point) (mark))))
     2.1 --- a/yatexprc.el	Mon Jan 23 00:11:31 2012 +0900
     2.2 +++ b/yatexprc.el	Mon Jan 23 01:19:36 2012 +0900
     2.3 @@ -2,7 +2,7 @@
     2.4  ;;; YaTeX process handler.
     2.5  ;;; yatexprc.el
     2.6  ;;; (c)1993-2012 by HIROSE Yuuji.[yuuji@yatex.org]
     2.7 -;;; Last modified Sun Jan 22 15:47:53 2012 on firestorm
     2.8 +;;; Last modified Mon Jan 23 00:28:08 2012 on firestorm
     2.9  ;;; $Id$
    2.10  
    2.11  ;(require 'yatex)
    2.12 @@ -444,23 +444,33 @@
    2.13        'YaTeX-call-command-history)
    2.14       buffer)))
    2.15  
    2.16 -(defun YaTeX-call-builtin-on-file (builtin-type &optional default)
    2.17 +(defvar YaTeX-call-builtin-on-file)
    2.18 +(make-variable-buffer-local 'YaTeX-call-builtin-on-file)
    2.19 +(defun YaTeX-call-builtin-on-file (builtin-type &optional default update)
    2.20    "Call command on file specified by BUILTIN-TYPE."
    2.21 -  (interactive)
    2.22    (YaTeX-save-buffers)
    2.23    (let*((main (or YaTeX-parent-file
    2.24 -		  (progn (YaTeX-visit-main t) buffer-file-name)))
    2.25 +		  (save-excursion (YaTeX-visit-main t) buffer-file-name)))
    2.26  	(mainroot (file-name-nondirectory (substring main 0 (rindex main ?.))))
    2.27 -	(b-in (YaTeX-get-builtin builtin-type)))
    2.28 -    (cond
    2.29 -     ((null b-in) (setq b-in (format "%s %s" default mainroot)))
    2.30 -     ((string-match (regexp-quote mainroot) b-in) nil)
    2.31 -     (t (setq b-in (concat b-in " " mainroot))))
    2.32 +	(alist YaTeX-call-builtin-on-file)
    2.33 +	(b-in (or (YaTeX-get-builtin builtin-type)
    2.34 +		  (cdr (assoc builtin-type alist))))
    2.35 +	(command b-in))
    2.36 +    (if (or update (null b-in))
    2.37 +	(progn
    2.38 +	  (setq command (read-string-with-history
    2.39 +			 (format "%s command: " builtin-type)
    2.40 +			 (or b-in
    2.41 +			     (format "%s %s" default mainroot))
    2.42 +			 'YaTeX-call-command-history))
    2.43 +	  (if (or update (null b-in))
    2.44 +	      (if (y-or-n-p "Use this command line in the future? ")
    2.45 +		  (YaTeX-getset-builtin builtin-type command) ;keep in a file
    2.46 +		(setq YaTeX-call-builtin-on-file	      ;keep in memory
    2.47 +		      (cons (cons builtin-type command)
    2.48 +			    (delete (assoc builtin-type alist) alist)))))))
    2.49      (YaTeX-typeset
    2.50 -     (read-string-with-history
    2.51 -      "Call command: "
    2.52 -      b-in
    2.53 -      'YaTeX-call-command-history)
    2.54 +     command
    2.55       (format " *YaTeX-%s*" (downcase builtin-type)))))
    2.56  
    2.57  (defun YaTeX-kill-typeset-process (proc)