# HG changeset patch # User yuuji@gentei.org # Date 1327249176 -32400 # Node ID 3b2ac46528107e1ec970ddeb5e87b691dda79b6d # Parent 60844b664f54f59848334a7488c88e4877c11a4c Handling of built-in is changed to use YaTeX-getset-builtin. diff -r 60844b664f54 -r 3b2ac4652810 yatex.el --- a/yatex.el Mon Jan 23 00:11:31 2012 +0900 +++ b/yatex.el Mon Jan 23 01:19:36 2012 +0900 @@ -2,7 +2,7 @@ ;;; Yet Another tex-mode for emacs - //–ì’¹// ;;; yatex.el rev. 1.75.1 ;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Jan 22 15:48:09 2012 on firestorm +;;; Last modified Mon Jan 23 01:11:49 2012 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -1618,9 +1618,9 @@ ((= c ?r) (YaTeX-typeset-region)) ((= c ?e) (YaTeX-typeset-environment)) ((= c ?b) (YaTeX-call-builtin-on-file - "BIBTEX" bibtex-command)) + "BIBTEX" bibtex-command arg)) ((= c ?i) (YaTeX-call-builtin-on-file - "MAKEINDEX" makeindex-command)) + "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*")) @@ -1639,26 +1639,18 @@ "Operate %# notation." ;;Do not use interactive"r" for the functions which require no mark (interactive) - (message "!)Edit-%%#! B)EGIN-END-region L)Edit-%%#LPR") + (message "!)Edit-%%#! B)EGIN-END-region P)review L)Edit-%%#LPR M)akeindex B)ibtex") (let ((c (or char (read-char))) (string "") key (b (make-marker)) (e (make-marker))) (save-excursion (cond - ((or (= c ?!) (= c ?l)) ;Edit `%#!' - (goto-char (point-min)) - (setq key (cond ((= c ?!) "%#!") - ((= c ?l) "%#LPR"))) - (if (re-search-forward key nil t) - (progn - (setq string (YaTeX-buffer-substring - (point) (point-end-of-line))) - (delete-region (point) (progn (end-of-line) (point)))) - (open-line 1) - (delete-region (point) (progn (beginning-of-line)(point)));for 19 :-< - (insert key)) - (unwind-protect - (setq string (read-string (concat key ": ") string)) - (insert string))) + ((rindex "!plmb" c) ;Edit %#xxx + (setq key (cdr (assq c '((?! . "!") + (?p . "PREVIEW") + (?l . "LPR") + (?m . "MAKEINDEX") + (?b . "BIBTEX"))))) + (YaTeX-getset-builtin key t)) ((= c ?b) ;%#BEGIN %#END region (or end (setq beg (min (point) (mark)) end (max (point) (mark)))) diff -r 60844b664f54 -r 3b2ac4652810 yatexprc.el --- a/yatexprc.el Mon Jan 23 00:11:31 2012 +0900 +++ b/yatexprc.el Mon Jan 23 01:19:36 2012 +0900 @@ -2,7 +2,7 @@ ;;; YaTeX process handler. ;;; yatexprc.el ;;; (c)1993-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Jan 22 15:47:53 2012 on firestorm +;;; Last modified Mon Jan 23 00:28:08 2012 on firestorm ;;; $Id$ ;(require 'yatex) @@ -444,23 +444,33 @@ 'YaTeX-call-command-history) buffer))) -(defun YaTeX-call-builtin-on-file (builtin-type &optional default) +(defvar YaTeX-call-builtin-on-file) +(make-variable-buffer-local 'YaTeX-call-builtin-on-file) +(defun YaTeX-call-builtin-on-file (builtin-type &optional default update) "Call command on file specified by BUILTIN-TYPE." - (interactive) (YaTeX-save-buffers) (let*((main (or YaTeX-parent-file - (progn (YaTeX-visit-main t) buffer-file-name))) + (save-excursion (YaTeX-visit-main t) buffer-file-name))) (mainroot (file-name-nondirectory (substring main 0 (rindex main ?.)))) - (b-in (YaTeX-get-builtin builtin-type))) - (cond - ((null b-in) (setq b-in (format "%s %s" default mainroot))) - ((string-match (regexp-quote mainroot) b-in) nil) - (t (setq b-in (concat b-in " " mainroot)))) + (alist YaTeX-call-builtin-on-file) + (b-in (or (YaTeX-get-builtin builtin-type) + (cdr (assoc builtin-type alist)))) + (command b-in)) + (if (or update (null b-in)) + (progn + (setq command (read-string-with-history + (format "%s command: " builtin-type) + (or b-in + (format "%s %s" default mainroot)) + 'YaTeX-call-command-history)) + (if (or update (null b-in)) + (if (y-or-n-p "Use this command line in the future? ") + (YaTeX-getset-builtin builtin-type command) ;keep in a file + (setq YaTeX-call-builtin-on-file ;keep in memory + (cons (cons builtin-type command) + (delete (assoc builtin-type alist) alist))))))) (YaTeX-typeset - (read-string-with-history - "Call command: " - b-in - 'YaTeX-call-command-history) + command (format " *YaTeX-%s*" (downcase builtin-type))))) (defun YaTeX-kill-typeset-process (proc)