yatex

changeset 11:390df0e505da

Label completion works.
author yuuji
date Mon, 20 Sep 1993 08:56:09 +0000
parents 796a929a7b13
children a7f397790cdc
files docs/yatex.ref yatex.el yatex.new yatexadd.el yatexgen.el yatexm-o.el yatexmth.el yatexprc.el
diffstat 8 files changed, 671 insertions(+), 66 deletions(-) [+]
line diff
     1.1 --- a/docs/yatex.ref	Tue May 04 13:02:40 1993 +0000
     1.2 +++ b/docs/yatex.ref	Mon Sep 20 08:56:09 1993 +0000
     1.3 @@ -104,9 +104,13 @@
     1.4  	  \begin{}, \end{} のペア、または %#BEGIN, %#END のペアを一挙に削
     1.5  	除します。
     1.6  
     1.7 +	◆領域を()で括る		[prefix] )
     1.8  	◆領域を{}で括る		[prefix] }
     1.9  	◆領域を[]で括る		[prefix] ]
    1.10  
    1.11 +	◆モード切り替え		[prefix] w
    1.12 +
    1.13 +	  新規作成/更新モード、数式モードの切り替えメニューが出ます。
    1.14  
    1.15  								   広瀬雄二
    1.16  							yuuji@ae.keio.ac.jp
     2.1 Binary file yatex.el has changed
     3.1 --- a/yatex.new	Tue May 04 13:02:40 1993 +0000
     3.2 +++ b/yatex.new	Mon Sep 20 08:56:09 1993 +0000
     3.3 @@ -2,6 +2,13 @@
     3.4  	Yet Another tex-mode for Emacs
     3.5  	yatex.el 各バージョンの変更点について。
     3.6  
     3.7 +1.43:	環境のネストに応じたインデント(変数YaTeX-environment-indentで指定)。
     3.8 +	数式環境記号補完モード(yatexmth)添付。
     3.9 +	modify-mode の値で開き括弧の動作を決定する。
    3.10 +	LaTeX error 発生ファイルの検出の確実化。
    3.11 +	\ref のラベルをバッファ中の\labelを検索してメニュー形式で補完。
    3.12 +	タイプセットなどでウィンドウ利用の最適化。
    3.13 +
    3.14  1.42:	fill-paragraph と、(un)comment-paragraph の適正化。
    3.15  	[prefix] k での削除範囲の適正化。
    3.16  	YaTeX-end-environment などで verb(atim)中のbegin/endは数えない。
     4.1 --- a/yatexadd.el	Tue May 04 13:02:40 1993 +0000
     4.2 +++ b/yatexadd.el	Mon Sep 20 08:56:09 1993 +0000
     4.3 @@ -1,8 +1,8 @@
     4.4  ;;; -*- Emacs-Lisp -*-
     4.5  ;;; YaTeX add-in functions.
     4.6 -;;; yatexadd.el rev.3
     4.7 +;;; yatexadd.el rev.5
     4.8  ;;; (c)1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     4.9 -;;; Last modified Tue May  4 21:50:37 1993 on figaro
    4.10 +;;; Last modified Sat Sep 18 04:13:41 1993 on 98fa
    4.11  ;;; $Id$
    4.12  
    4.13  (provide 'yatexadd)
    4.14 @@ -67,6 +67,12 @@
    4.15  
    4.16  (fset 'YaTeX:enumerate 'YaTeX:itemize)
    4.17  
    4.18 +(defun YaTeX:picture ()
    4.19 +  "Ask the size of coordinates of picture environment."
    4.20 +  (concat (YaTeX:read-coordinates "Picture size")
    4.21 +	  (YaTeX:read-coordinates "Initial position"))
    4.22 +)
    4.23 +
    4.24  ;;;
    4.25  ;;Sample functions for section-type command.
    4.26  ;;;
    4.27 @@ -133,8 +139,9 @@
    4.28  
    4.29  (defun YaTeX:read-boundary (ULchar)
    4.30    "Read boundary usage by _ or ^.  _ or ^ is indicated by argument ULchar."
    4.31 -  (let ((bndry (read-string (concat ULchar "{...}: "))))
    4.32 +  (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): "))))
    4.33      (if (string= bndry "") ""
    4.34 +      (if (string= bndry "$") (setq bndry "\\infty"))
    4.35        (concat ULchar "{" bndry "}")))
    4.36  )
    4.37  
    4.38 @@ -143,3 +150,180 @@
    4.39    (if (not (eq type YaTeX-current-completion-type))
    4.40        (error "This should be completed with %s-type completion." type))
    4.41  )
    4.42 +
    4.43 +
    4.44 +;;;
    4.45 +;;;		[[Add-in functions for reading section arguments]]
    4.46 +;;;
    4.47 +;; All of add-in functions for reading sections arguments should
    4.48 +;; take an argument ARGP that specify the argument position.
    4.49 +;; If argument position is out of range, nil should be returned,
    4.50 +;; else nil should NOT be returned.
    4.51 +(defvar YaTeX-label-menu-other
    4.52 +  (if YaTeX-japan "':他のバッファのラベル\n" "':LABEL IN OTHER BUFFER.\n"))
    4.53 +(defvar YaTeX-label-menu-any
    4.54 +  (if YaTeX-japan "*:任意の文字列\n" "*:ANY STRING.\n"))
    4.55 +(defvar YaTeX-label-buffer "*Label completions*")
    4.56 +(defvar YaTeX-label-guide-msg "Select label and hit RETURN.")
    4.57 +(defvar YaTeX-label-select-map nil
    4.58 +  "Key map used in label selection buffer.")
    4.59 +(defun YaTeX::label-setup-key-map ()
    4.60 +  (if YaTeX-label-select-map nil
    4.61 +    (message "Setting up label selection mode map...")
    4.62 +    (setq YaTeX-label-select-map (copy-keymap global-map))
    4.63 +    (suppress-keymap YaTeX-label-select-map)
    4.64 +    (substitute-all-key-definition
    4.65 +     'previous-line 'YaTeX::label-previous YaTeX-label-select-map)
    4.66 +    (substitute-all-key-definition
    4.67 +     'next-line 'YaTeX::label-next YaTeX-label-select-map)
    4.68 +    (define-key YaTeX-label-select-map "\C-n"	'YaTeX::label-next)
    4.69 +    (define-key YaTeX-label-select-map "\C-p"	'YaTeX::label-previous)
    4.70 +    (define-key YaTeX-label-select-map "<"	'beginning-of-buffer)
    4.71 +    (define-key YaTeX-label-select-map ">"	'end-of-buffer)
    4.72 +    (define-key YaTeX-label-select-map "\C-m"	'exit-recursive-edit)
    4.73 +    (define-key YaTeX-label-select-map "\C-j"	'exit-recursive-edit)
    4.74 +    (define-key YaTeX-label-select-map " "	'exit-recursive-edit)
    4.75 +    (define-key YaTeX-label-select-map "\C-g"	'abort-recursive-edit)
    4.76 +    (define-key YaTeX-label-select-map "/"	'isearch-forward)
    4.77 +    (define-key YaTeX-label-select-map "?"	'isearch-backward)
    4.78 +    (define-key YaTeX-label-select-map "'"	'YaTeX::label-search-tag)
    4.79 +    (define-key YaTeX-label-select-map "*"	'YaTeX::label-search-tag)
    4.80 +    (message "Setting up label selection mode map...Done")
    4.81 +    (let ((key ?A))
    4.82 +      (while (<= key ?Z)
    4.83 +	(define-key YaTeX-label-select-map (char-to-string key)
    4.84 +	  'YaTeX::label-search-tag)
    4.85 +	(define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A)))
    4.86 +	  'YaTeX::label-search-tag)
    4.87 +	(setq key (1+ key)))))
    4.88 +)
    4.89 +(defun YaTeX::label-next ()
    4.90 +  (interactive) (forward-line 1) (message YaTeX-label-guide-msg))
    4.91 +(defun YaTeX::label-previous ()
    4.92 +  (interactive) (forward-line -1) (message YaTeX-label-guide-msg))
    4.93 +(defun YaTeX::label-search-tag ()
    4.94 +  (interactive)
    4.95 +  (let ((case-fold-search t))
    4.96 +    (cond
    4.97 +     ((save-excursion
    4.98 +	(forward-char 1)
    4.99 +	(re-search-forward (concat "^" (this-command-keys)) nil t))
   4.100 +      (goto-char (match-beginning 0)))
   4.101 +     ((save-excursion
   4.102 +	(goto-char (point-min))
   4.103 +	(re-search-forward (concat "^" (this-command-keys)) nil t))
   4.104 +      (goto-char (match-beginning 0))))
   4.105 +    (message YaTeX-label-guide-msg))
   4.106 +)
   4.107 +(defun YaTeX::ref (argp)
   4.108 +  (cond
   4.109 +   ((= argp 1)
   4.110 +    (save-excursion
   4.111 +      (let ((lnum 0) e0 m1 e1 label label-list (buf (current-buffer))
   4.112 +	    (p (point)) initl line)
   4.113 +	(goto-char (point-min))
   4.114 +	(message "Collecting labels...")
   4.115 +	(save-window-excursion
   4.116 +	  (with-output-to-temp-buffer YaTeX-label-buffer
   4.117 +	    (while (re-search-forward "\\label{\\([^}]+\\)}" nil t)
   4.118 +	      (setq e0 (match-end 0) m1 (match-beginning 1) e1 (match-end 1))
   4.119 +	      (if (search-backward
   4.120 +		   YaTeX-comment-prefix (point-beginning-of-line) t) nil
   4.121 +		(setq label (buffer-substring m1 e1)
   4.122 +		      label-list (cons label label-list))
   4.123 +		(or initl
   4.124 +		    (if (< p (point)) (setq initl lnum)))
   4.125 +		(beginning-of-line)
   4.126 +		(skip-chars-forward " \t\n" nil)
   4.127 +		(princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
   4.128 +			       (buffer-substring (point) (point-end-of-line))))
   4.129 +		(setq lnum (1+ lnum))
   4.130 +		(message "Collecting \\label{}... %d" lnum))
   4.131 +	      (goto-char e0))
   4.132 +	    (princ YaTeX-label-menu-other)
   4.133 +	    (princ YaTeX-label-menu-any)
   4.134 +	    );with
   4.135 +	  (goto-char p)
   4.136 +	  (message "Collecting labels...Done")
   4.137 +	  (pop-to-buffer YaTeX-label-buffer)
   4.138 +	  (YaTeX::label-setup-key-map)
   4.139 +	  (setq truncate-lines t)
   4.140 +	  (setq buffer-read-only t)
   4.141 +	  (use-local-map YaTeX-label-select-map)
   4.142 +	  (message YaTeX-label-guide-msg)
   4.143 +	  (goto-line (or initl lnum))	;goto recently defined label line
   4.144 +	  (unwind-protect
   4.145 +	      (progn
   4.146 +		(recursive-edit)
   4.147 +		(set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
   4.148 +		(beginning-of-line)
   4.149 +		(setq line (count-lines (point-min)(point)))
   4.150 +		(cond
   4.151 +		 ((= line lnum) (setq label (YaTeX-label-other)))
   4.152 +		 ((>= line (1+ lnum ))
   4.153 +		  (setq label (read-string "\\ref{???}: ")))
   4.154 +		 (t (setq label (nth (- lnum line 1) label-list)))))
   4.155 +	    (bury-buffer YaTeX-label-buffer)))
   4.156 +	label
   4.157 +	))
   4.158 +    ))
   4.159 +)
   4.160 +
   4.161 +(defun YaTeX-label-other ()
   4.162 +  (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv
   4.163 +	(ff "**find-file**"))
   4.164 +    (with-output-to-temp-buffer lbuf
   4.165 +      (while blist
   4.166 +	(if (and (buffer-file-name (setq buf (car blist)))
   4.167 +		 (progn (set-buffer buf) (eq major-mode 'yatex-mode)))
   4.168 +	    (princ
   4.169 +	     (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
   4.170 +		     (buffer-name buf))))
   4.171 +	(setq blist (cdr blist)))
   4.172 +      (princ (format "':{%s}" ff)))
   4.173 +    (pop-to-buffer lbuf)
   4.174 +    (YaTeX::label-setup-key-map)
   4.175 +    (setq buffer-read-only t)
   4.176 +    (use-local-map YaTeX-label-select-map)
   4.177 +    (message YaTeX-label-guide-msg)
   4.178 +    (unwind-protect
   4.179 +	(progn
   4.180 +	  (recursive-edit)
   4.181 +	  (set-buffer lbuf)
   4.182 +	  (beginning-of-line)
   4.183 +	  (setq rv
   4.184 +		(if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t)
   4.185 +		    (buffer-substring (match-beginning 1) (match-end 1)) nil)))
   4.186 +      (kill-buffer lbuf))
   4.187 +    (cond
   4.188 +     ((null rv) "")
   4.189 +     ((string= rv ff)
   4.190 +      (call-interactively 'find-file)
   4.191 +      (YaTeX::ref argp))
   4.192 +     (t
   4.193 +      (set-buffer rv)
   4.194 +      (YaTeX::ref argp)))
   4.195 +    )
   4.196 +)
   4.197 +
   4.198 +;;;
   4.199 +;; global subroutines
   4.200 +;;;
   4.201 +(defun substitute-all-key-definition (olddef newdef keymap)
   4.202 +  "Replace recursively OLDDEF with NEWDEF for any keys in KEYMAP now
   4.203 +defined as OLDDEF. In other words, OLDDEF is replaced with NEWDEF
   4.204 +where ever it appears."
   4.205 +  (if (arrayp keymap)
   4.206 +      (let ((len (length keymap))
   4.207 +	    (i 0))
   4.208 +	(while (< i len)
   4.209 +	  (let ((map (aref keymap i)))
   4.210 +	    (cond
   4.211 +	     ((arrayp map) (substitute-key-definition olddef newdef map))
   4.212 +	     ((equal map olddef)
   4.213 +	      (aset keymap i newdef)))
   4.214 +	    (setq i (1+ i)))))
   4.215 +    (while keymap
   4.216 +      (if (equal (cdr-safe (car-safe keymap)) olddef)
   4.217 +	  (setcdr (car keymap) newdef))
   4.218 +      (setq keymap (cdr keymap)))))
     5.1 --- a/yatexgen.el	Tue May 04 13:02:40 1993 +0000
     5.2 +++ b/yatexgen.el	Mon Sep 20 08:56:09 1993 +0000
     5.3 @@ -2,7 +2,7 @@
     5.4  ;;; Generate add-in functions for YaTeX.
     5.5  ;;; yatexgen.el rev.1(beta2)
     5.6  ;;; (c)1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     5.7 -;;; Last modified Tue May  4 21:51:23 1993 on figaro
     5.8 +;;; Last modified Mon Sep 20 17:55:13 1993 on gloria
     5.9  ;;; $Id$
    5.10  
    5.11  (require 'yatex)
     6.1 --- a/yatexm-o.el	Tue May 04 13:02:40 1993 +0000
     6.2 +++ b/yatexm-o.el	Mon Sep 20 08:56:09 1993 +0000
     6.3 @@ -1,8 +1,7 @@
     6.4  ;;; -*- Emacs-Lisp -*-
     6.5  ;;; Sample startup file to invoke yatex-mode with outline-minor mode.
     6.6  ;;; (C)1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
     6.7 -;;; Last modified Tue May  4 22:02:41 1993 on figaro
     6.8 -;;; $Id$
     6.9 +;;; Last modified Wed Apr 28 04:25:16 1993 on 98fa
    6.10  
    6.11  ;;;
    6.12  ;; outline-minor-mode(使用しない場合は不要です)
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/yatexmth.el	Mon Sep 20 08:56:09 1993 +0000
     7.3 @@ -0,0 +1,388 @@
     7.4 +;;; -*- Emacs-Lisp -*-
     7.5 +;;; YaTeX interface for math-mode.
     7.6 +;;; yatexmth.el rev.0
     7.7 +;;; (C)1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
     7.8 +;;; Last modified Tue Aug  3 23:37:07 1993 on 98fa
     7.9 +;;; $Id$
    7.10 +
    7.11 +(setq
    7.12 + YaTeX-math-key-alist-default
    7.13 + '(
    7.14 +   ;frequently used
    7.15 +   ("||"	"|"		("||"		"‖"))
    7.16 +   ("sum"	"sum"		("\\-+\n >\n/-+" "Σ"))
    7.17 +   ("sigma"	"sum"		("\\-+\n >\n/-+" "Σ"))
    7.18 +   ("integral"	"int"		" /\\\n \\\n\\/")
    7.19 +   ("ointegral"	"oint"		" /\\\n(\\)\n\\/")
    7.20 +   ("A"		"forall"	"|_|\nV")
    7.21 +   ("E"		"exists"	"-+\n-+\n-+")
    7.22 +   ("!"		"neg"		"--+\n  |")
    7.23 +   ("oo"	"infty"		("oo"		"∞"))
    7.24 +   ("\\"	"backslash"	("\\"		"\"))
    7.25 +
    7.26 +   ;;binary operators
    7.27 +   ("+-"	"pm"		("+\n-" "±"))
    7.28 +   ("-+"	"mp"		"-\n+")
    7.29 +   ("x"		"times"		("x" "×"))
    7.30 +   ("/"		"div"		(",\n-\n'" "÷"))
    7.31 +   ("*"		"ast"		"*")
    7.32 +   ("#"		"star"		("_/\\_\n\\  /\n//\\\\" "★"))
    7.33 +   ("o"		"circ"		"o")
    7.34 +   ("o*"	"bullet"	" _\n(*)\n ~")
    7.35 +   ("."		"cdot"		".")
    7.36 +   ("cap"	"cap"		"/-\\\n| |")
    7.37 +   ("cup"	"cup"		"| |\n\\-/")
    7.38 +   ("u+"	"uplus"		"|+|\n\\-/")
    7.39 +   ("|~|"	"sqcap"		"|~|")
    7.40 +   ("|_|"	"sqcup"		"|_|")
    7.41 +   ("v"		"vee"		"v")
    7.42 +   ("^"		"wedge"		"^")
    7.43 +   ("\\\\"	"setminus"	"\\")
    7.44 +   (")("	"wr"		" )\n(")
    7.45 +   ("<>"	"diamond"	"<>")
    7.46 +   ("/\-"	"bigtriangleup"	("/\\\n~~" "△"))
    7.47 +   ("-\\/"	"bigtriangledown" ("__\n\\/" "▽"))
    7.48 +   ("<|"	"triangleleft"	"<|")
    7.49 +   ("|>"	"triangleright"	"|>")
    7.50 +   ("<||"	"lhd"		"/|\n\\|")
    7.51 +   ("||>"	"rhd"		"|\\\n|/")
    7.52 +   ("<|-"	"unlhd"		"<|\n~~")
    7.53 +   ("|>-"	"unrhd"		"|>\n~~")
    7.54 +   ("o+"	"oplus"		" _\n(+)\n ~")
    7.55 +   ("o-"	"ominus"	" _\n(-)\n ~")
    7.56 +   ("ox"	"otimes"	" _\n(x)\n ~")
    7.57 +   ("o/"	"oslash"	" _\n(/)\n ~")
    7.58 +   ("o."	"odot"		"(.)")
    7.59 +   ("O"		"bigcirc"	"O")
    7.60 +   ("t"		"dagger"	"+\n|")
    7.61 +   ("tt"	"ddagger"	"+\n+\n|")
    7.62 +   ("II"	"amalg"		"II")
    7.63 +   ;	:
    7.64 +   ;;relational operators
    7.65 +   ("<"		"leq"		("<\n-"		"≦"))
    7.66 +   (">"		"geq"		(">\n-"		"≧"))
    7.67 +   ("-="	"equiv"		"=\n-")
    7.68 +   ("=-"	"equiv"		"=\n-")
    7.69 +   ("---"	"equiv"		"=\n-")
    7.70 +   ("("		"subset"	" _\n(\n ~")
    7.71 +   ("(-"	"subseteq"	" _\n(_\n~")
    7.72 +   (")"		"supset"	"_\n )\n~")
    7.73 +   (")-"	"supseteq"	"_\n_)\n~")
    7.74 +   ("["		"sqsubset"	"[")
    7.75 +   ("[-"	"sqsubseteq"	"[\n~")
    7.76 +   ("]"		"sqsupset"	"]")
    7.77 +   ("]-"	"sqsupseteq"	"]\n~")
    7.78 +   ("{"		"in"		"(-")
    7.79 +   ("}"		"ni"		"-)")
    7.80 +   ("|-"	"vdash"		"|-")
    7.81 +   ("-|"	"dashv"		"-|")
    7.82 +   ("~"		"sim"		"~(tild)")
    7.83 +   ("~-"	"simeq"		"~\n-")
    7.84 +   ("asymp"	"asymp"		"v\n^")
    7.85 +   ("~~"	"approx"	"~\n~")
    7.86 +   ("~="	"cong"		"~\n=")
    7.87 +   ("=/"	"neq"		("=/="		"≠"))
    7.88 +   (".="	"doteq"		".\n=")
    7.89 +   ("o<"	"propto"	"o<")
    7.90 +   ("|="	"models"	"|=")
    7.91 +   ("_|_"	"perp"		"_|_")
    7.92 +   ("|"		"mid"		"|")
    7.93 +   ("||"	"parallel"	"||")
    7.94 +   ("bowtie"	"bowtie"	"|><|(wide)")
    7.95 +   ("|><|"	"join"		"|><|")
    7.96 +   ("\\_/"	"smile"		"\\_/")
    7.97 +   ("/~\\"	"frown"		"/~~\\")
    7.98 +   ("-<"	"prec"		("-<"		"く"))
    7.99 +   ("-<="	"preceq"	("-<\n-"	"く\n="))
   7.100 +   ("<<"	"ll"		("<<"		"《"))
   7.101 +   ;	:
   7.102 +   ;;arrows
   7.103 +   ("<-"	"leftarrow"	("<-"		"←"))
   7.104 +   ("<--"	"longleftarrow"	("<-"		"←--"))
   7.105 +   ("<="	"Leftarrow"	"<=")
   7.106 +   ("<=="	"Longleftarrow"	"<==")
   7.107 +   ("->"	"rightarrow"	("->"		"→"))
   7.108 +   ("-->"	"longrightarrow" ("-->"		"--→"))
   7.109 +   ("==>"	"Longrightarrow" "==>")
   7.110 +   ("<->"	"leftrightarrow" ("<->"		"←→"))
   7.111 +   ("<-->"	"longleftrightarrow" ("<---->"	"←--→"))
   7.112 +   ("<=>"	"leftrightarrow" "<=>")
   7.113 +   ("<==>"	"Longleftrightarrow" "<==>")
   7.114 +   ("^|"	"uparrow"	("^\n|" "↑"))
   7.115 +   ("^||"	"Uparrow"	"/\\\n||")
   7.116 +   ("\C-n"	"downarrow"	("|\nv" "↓"))
   7.117 +   ("^|"	"uparrow"	("^\n|" "↑"))
   7.118 +   ("|->"	"mapsto"	("|->"		"|→"))
   7.119 +   ("<-)"	"hookleftarrow"	("   ,\n<--+"	"   ヽ\n<--/"))
   7.120 +   ("/-"	"leftharpoonup"	"/\n~~~")
   7.121 +   ("\\-"	"leftharpoondown" "__\n\\")
   7.122 +   ("-/"	"rightharpoondown"  "__\n/")
   7.123 +   ("-\\"	"rightharpoonup" "~~\n\\")
   7.124 +   ;other marks
   7.125 +   ("Z"		"aleph"		"|\\|")
   7.126 +   ("|\\|"	"aleph"		"|\\|")
   7.127 +   ("h-"	"hbar"		"_\nh")
   7.128 +   ("i"		"imath"		"i")
   7.129 +   ("j"		"jmath"		"j")
   7.130 +   ("l"		"ell"		"l")
   7.131 +   ("wp"	"wp"		"???")
   7.132 +   ("R"		"Re"		")R")
   7.133 +   ("Im"	"Im"		"???")
   7.134 +   ("mho"	"mho"		"~|_|~")
   7.135 +   ("'"		"prime"		"'")
   7.136 +   ("0"		"emptyset"	"0")
   7.137 +   ("nabla"	"nabla"		"___\n\\\\/")
   7.138 +   ("\\/"	"surd"		"-\\/")
   7.139 +   ("surd"	"surd"		"-\\/")
   7.140 +   ("top"	"top"		"T")
   7.141 +   ("bot"	"bot"		"_|_")
   7.142 +   ("b"		"flat"		"b")
   7.143 +   ("LT"	"natural"	"|\nLT\n |")
   7.144 +   ("6"		"partial"	" -+\n+-+\n+-+")
   7.145 +   ("partial"	"partial"	" -+\n+-+\n+-+")
   7.146 +   ("round"	"partial"	" -+\n+-+\n+-+")
   7.147 +   ("[]"	"box"		"[]")
   7.148 +   ("Diamond"	"Diamond"	"/\\\n\\/")
   7.149 +   ("3"		"triangle"	"/\\\n~~")
   7.150 +   ("C"		"clubsuit"	" o\no+o\n |")
   7.151 +   ("D"		"diamondsuit"	"/\\\n\\/")
   7.152 +   ("H"		"heartsuit"	"<^^>\n \\/")
   7.153 +   ("S"		"spadesuit"	" /\\\n<++>\n /\\")
   7.154 +
   7.155 +   ))
   7.156 +
   7.157 +(defvar YaTeX-math-key-alist-private nil
   7.158 +  "*User definable key vs LaTeX-math-command alist.")
   7.159 +
   7.160 +(defvar YaTeX-math-quit-with-strict-match nil
   7.161 +  "*T for quitting completion as soon as strict-match is found.")
   7.162 +(setq YaTeX-math-key-alist
   7.163 +      (append YaTeX-math-key-alist-private YaTeX-math-key-alist-default))
   7.164 +
   7.165 +(setq YaTeX-math-key-array
   7.166 +  (let ((array (make-vector (length YaTeX-math-key-alist) ""))
   7.167 +	(list YaTeX-math-key-alist) (i 0))
   7.168 +    (while list
   7.169 +      (aset array i (car (car list)))
   7.170 +      (setq i (1+ i) list (cdr list)))
   7.171 +    array))
   7.172 +
   7.173 +(defvar YaTeX-ec "\\" "Escape character of mark-up language.")
   7.174 +(setq YaTeX-math-indicator
   7.175 +  "KEY\tLaTeX sequence\t\tsign")
   7.176 +
   7.177 +(defvar YaTeX-math-need-image t
   7.178 +  "*T for displaying pseudo image momentarily.")
   7.179 +(defvar YaTeX-math-max-key 8)
   7.180 +(defvar YaTeX-math-max-seq
   7.181 +  (* 8 (1+ (/ (length "\\longleftrightarrow") 8))))
   7.182 +(defvar YaTeX-math-max-sign 5)
   7.183 +(defvar YaTeX-math-sign-width
   7.184 +  (+ YaTeX-math-max-key YaTeX-math-max-seq YaTeX-math-max-sign))
   7.185 +(defvar YaTeX-math-display-width
   7.186 +  (* 8 (1+ (/ YaTeX-math-sign-width 8))))
   7.187 +(defvar YaTeX-math-menu-map nil
   7.188 +  "Keymap used in YaTeX mathematical sign menu mode."
   7.189 +)
   7.190 +(if YaTeX-math-menu-map nil
   7.191 +  (setq YaTeX-math-menu-map (make-sparse-keymap))
   7.192 +  (define-key YaTeX-math-menu-map "n"	'next-line)
   7.193 +  (define-key YaTeX-math-menu-map "p"	'previous-line)
   7.194 +  (define-key YaTeX-math-menu-map "f"	'YaTeX-math-forward)
   7.195 +  (define-key YaTeX-math-menu-map "b"	'YaTeX-math-backward)
   7.196 +  (define-key YaTeX-math-menu-map "v"	'scroll-up)
   7.197 +  (define-key YaTeX-math-menu-map " "	'scroll-up)
   7.198 +  (define-key YaTeX-math-menu-map "c"	'scroll-up)
   7.199 +  (define-key YaTeX-math-menu-map "V"	'scroll-down)
   7.200 +  (define-key YaTeX-math-menu-map "r"	'scroll-down)
   7.201 +  (define-key YaTeX-math-menu-map "\^h"	'scroll-down)
   7.202 +  (define-key YaTeX-math-menu-map "<"	'beginning-of-buffer)
   7.203 +  (define-key YaTeX-math-menu-map ">"	'end-of-buffer)
   7.204 +  (define-key YaTeX-math-menu-map "\^m"	'exit-recursive-edit)
   7.205 +  (define-key YaTeX-math-menu-map "q"	'abort-recursive-edit))
   7.206 +
   7.207 +(defmacro YaTeX-math-japanese-sign (list)
   7.208 +  (list 'nth 1 list))
   7.209 +
   7.210 +(defvar YaTeX-math-cmd-regexp (concat (regexp-quote YaTeX-ec) "[A-z]"))
   7.211 +
   7.212 +(defun YaTeX-math-forward (arg)
   7.213 +  (interactive "p")
   7.214 +  (re-search-forward YaTeX-math-cmd-regexp nil t arg))
   7.215 +
   7.216 +(defun YaTeX-math-backward (arg)
   7.217 +  (interactive "p")
   7.218 +  (re-search-backward YaTeX-math-cmd-regexp nil t arg))
   7.219 +
   7.220 +(defun YaTeX-math-get-sign (list)
   7.221 +  (let ((sign (car (cdr (cdr list)))))
   7.222 +    (if (listp sign)
   7.223 +	(setq sign (cond
   7.224 +		    (YaTeX-japan (YaTeX-math-japanese-sign sign))
   7.225 +		    (t (car sign)))))
   7.226 +    sign)
   7.227 +)
   7.228 +
   7.229 +(defun YaTeX-math-display-list (list cols)
   7.230 +  (goto-char (point-max))
   7.231 +  (if (= cols 0) (if (not (eolp)) (newline 1))
   7.232 +    (forward-line -1)
   7.233 +    (while (looking-at "[ \t\n]") (forward-line -1)))
   7.234 +  (end-of-line)
   7.235 +  (let ((indent (* YaTeX-math-display-width cols)) sign str to)
   7.236 +    (indent-to indent)
   7.237 +    (insert (car list))
   7.238 +    (indent-to (setq indent (+ indent YaTeX-math-max-key)))
   7.239 +    (insert "\\" (car (cdr list)))
   7.240 +    (setq indent (+ indent YaTeX-math-max-seq))
   7.241 +    (setq sign (YaTeX-math-get-sign list))
   7.242 +    (while (not (string= "" sign))
   7.243 +      (setq to (string-match "\n" sign)
   7.244 +	    str (if to (substring sign 0 to) sign))
   7.245 +      (end-of-line)
   7.246 +      (indent-to indent)
   7.247 +      (insert str)
   7.248 +      (cond ((eobp) (newline 1))
   7.249 +	    ((> cols 0) (forward-line 1)))
   7.250 +      (setq sign (if to (substring sign (1+ to)) "")))))
   7.251 +
   7.252 +(defvar YaTeX-math-menu-buffer "*math-mode-signs*")
   7.253 +
   7.254 +(defun YaTeX-math-show-menu (match-str)
   7.255 +  (save-window-excursion
   7.256 +    (pop-to-buffer YaTeX-math-menu-buffer)
   7.257 +    (let ((maxcols (max 1 (/ (screen-width) YaTeX-math-sign-width)))
   7.258 +	  (case-fold-search nil)
   7.259 +	  (cols 0) (list YaTeX-math-key-alist) command)
   7.260 +      (erase-buffer)
   7.261 +      (insert YaTeX-math-indicator "\t")
   7.262 +      (insert YaTeX-math-indicator)
   7.263 +      (newline 1)
   7.264 +      (insert-char ?- (1- (screen-width)))
   7.265 +      (newline 1)
   7.266 +      (while list
   7.267 +	(if (string-match match-str (car (car list)))
   7.268 +	    (progn (YaTeX-math-display-list (car list) cols)
   7.269 +		   (setq cols (% (1+ cols) maxcols))))
   7.270 +	(setq list (cdr list)))
   7.271 +      (goto-char (point-min))
   7.272 +      (use-local-map YaTeX-math-menu-map)
   7.273 +      (unwind-protect
   7.274 +	  (recursive-edit)
   7.275 +	(skip-chars-backward "^ \t\n")
   7.276 +	(setq command
   7.277 +	      (if (re-search-forward YaTeX-math-cmd-regexp nil t)
   7.278 +		  (buffer-substring
   7.279 +		   (match-beginning 0)
   7.280 +		   (prog2 (skip-chars-forward "^ \t\n") (point)))
   7.281 +		nil))
   7.282 +	(kill-buffer YaTeX-math-menu-buffer))
   7.283 +      command))
   7.284 +)
   7.285 +
   7.286 +;
   7.287 +(defun YaTeX-math-show-image (image &optional exit-char)
   7.288 +  "Momentarily display IMAGE at the beginning of the next line;
   7.289 +erase it on the next keystroke.  The window is recentered if necessary
   7.290 +to make the whole string visible.  If the window isn't large enough,
   7.291 +at least you get to read the beginning."
   7.292 +  (let ((buffer-read-only nil)
   7.293 +	(modified (buffer-modified-p))
   7.294 +	(name buffer-file-name)
   7.295 +	insert-start
   7.296 +	insert-end)
   7.297 +    (unwind-protect
   7.298 +	(progn
   7.299 +	  (save-excursion
   7.300 +	    ;; defeat file locking... don't try this at home, kids!
   7.301 +	    (setq buffer-file-name nil)
   7.302 +	    (forward-line 1)
   7.303 +	    (setq insert-start (point))
   7.304 +	    (if (eobp) (newline))
   7.305 +	    (insert image)
   7.306 +	    (setq insert-end (point)))
   7.307 +	  ; make sure the whole string is visible
   7.308 +	  (if (not (pos-visible-in-window-p insert-end))
   7.309 +	      (recenter (max 0
   7.310 +			     (- (window-height)
   7.311 +				(count-lines insert-start insert-end)
   7.312 +				2))))
   7.313 +	  (let ((char (read-char)))
   7.314 +	    (or (eq char exit-char)
   7.315 +		(setq unread-command-char char))))
   7.316 +      (if insert-end
   7.317 +	  (save-excursion
   7.318 +	    (delete-region insert-start insert-end)))
   7.319 +      (setq buffer-file-name name)
   7.320 +      (set-buffer-modified-p modified))))
   7.321 +
   7.322 +(defun YaTeX-math-insert-sequence ()
   7.323 +  (interactive)
   7.324 +  (let ((key "") regkey str  last-char list i
   7.325 +	(case-fold-search nil) match
   7.326 +	(n (length YaTeX-math-key-array)) (beg (point)) result)
   7.327 +    (setq result
   7.328 +	  (catch 'complete
   7.329 +	    (while t
   7.330 +	      (setq last-char (read-char)
   7.331 +		    key (concat key (char-to-string last-char))
   7.332 +		    regkey (concat "^" (regexp-quote key)) i 0)
   7.333 +	      (cond
   7.334 +	       ((string= key YaTeX-math-invoke-key)	;;invoke key itself
   7.335 +		(throw 'complete 'escape))
   7.336 +	       ((string-match "[\C-g\C-c]" key) (throw 'complete 'abort))
   7.337 +	       ((string-match "[\n\r]" key) (throw 'complete 'menu)))
   7.338 +	      (if
   7.339 +		  (catch 'found
   7.340 +		    ;;(1)input string strictly matches with alist
   7.341 +		    (setq single-command (car (cdr match))
   7.342 +			  ;;remember previous match
   7.343 +			  match (assoc key YaTeX-math-key-alist))
   7.344 +		    ;;(2)search partial match into alist
   7.345 +		    (while (< i n)
   7.346 +		      (if (string-match
   7.347 +			   regkey (aref YaTeX-math-key-array i))
   7.348 +			  (progn
   7.349 +			    (or match
   7.350 +				(setq match (nth i YaTeX-math-key-alist)))
   7.351 +			    (throw 'found t)))
   7.352 +		      (setq i (1+ i)))) 		;catch 'found
   7.353 +		  nil ;;if any match, continue reading
   7.354 +		;;else reading of sequence has been done.
   7.355 +		(message "complete.")
   7.356 +		(throw 'complete t)
   7.357 +		)
   7.358 +	      (if match
   7.359 +		  (progn (delete-region beg (point))
   7.360 +			 (insert YaTeX-ec (car (cdr match)))
   7.361 +			 (if YaTeX-math-need-image
   7.362 +			     (YaTeX-math-show-image
   7.363 +			      (concat (YaTeX-math-get-sign match) "\n")))
   7.364 +			 )
   7.365 +		nil)
   7.366 +	      )))
   7.367 +    (cond
   7.368 +     ((eq result t)
   7.369 +      (setq YaTeX-current-completion-type 'maketitle)
   7.370 +      (if t nil
   7.371 +	(delete-region beg (point))
   7.372 +	(setq single-command (car (cdr match)))
   7.373 +	;;(recursive-edit)
   7.374 +	(insert YaTeX-ec single-command)
   7.375 +	)
   7.376 +      (sit-for 1)
   7.377 +      (setq unread-command-char last-char)
   7.378 +      (insert (YaTeX-addin single-command)))
   7.379 +     ((eq result 'abort)
   7.380 +      (delete-region beg (point))
   7.381 +      (message "Abort."))
   7.382 +     ((eq result 'escape)
   7.383 +      (delete-region beg (point))
   7.384 +      (insert YaTeX-math-invoke-key))
   7.385 +     ((eq result 'menu)
   7.386 +      (delete-region beg (point))
   7.387 +      (setq key (concat "^" (regexp-quote (substring key 0 -1))))
   7.388 +      (insert (YaTeX-math-show-menu key)))))
   7.389 +)
   7.390 +;;
   7.391 +(provide 'yatexmth)
     8.1 --- a/yatexprc.el	Tue May 04 13:02:40 1993 +0000
     8.2 +++ b/yatexprc.el	Mon Sep 20 08:56:09 1993 +0000
     8.3 @@ -1,8 +1,8 @@
     8.4  ;;; -*- Emacs-Lisp -*-
     8.5  ;;; YaTeX process handler.
     8.6 -;;; yatexprc.el rev.1.42
     8.7 +;;; yatexprc.el rev.1.43
     8.8  ;;; (c)1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     8.9 -;;; Last modified Tue May  4 21:49:59 1993 on figaro
    8.10 +;;; Last modified Sat Sep 18 04:12:18 1993 on 98fa
    8.11  ;;; $Id$
    8.12  
    8.13  (require 'yatex)
    8.14 @@ -13,6 +13,18 @@
    8.15  (defvar YaTeX-typeset-buffer "*YaTeX-typesetting*"
    8.16    "Process buffer for jlatex")
    8.17  
    8.18 +(defvar YaTeX-typeset-buffer-syntax nil
    8.19 +  "*Syntax table for typesetting buffer")
    8.20 +
    8.21 +(if YaTeX-typeset-buffer-syntax nil
    8.22 +  (setq YaTeX-typeset-buffer-syntax
    8.23 +	(make-syntax-table (standard-syntax-table)))
    8.24 +  (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax)
    8.25 +  (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax)
    8.26 +  (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax)
    8.27 +  (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax)
    8.28 +)
    8.29 +
    8.30  (defun YaTeX-typeset (command buffer)
    8.31    "Execute jlatex (or other) to LaTeX typeset."
    8.32    (interactive)
    8.33 @@ -34,23 +46,28 @@
    8.34  			     command))
    8.35        (set-process-sentinel YaTeX-typeset-process 'YaTeX-typeset-sentinel)))
    8.36    (setq current-TeX-buffer (buffer-name))
    8.37 -  (other-window 1)
    8.38 -  (use-local-map YaTeX-typesetting-mode-map)
    8.39 -  (setq mode-name "typeset")
    8.40 -  (if YaTeX-typeset-process ; if process is running (maybe on UNIX)
    8.41 -      (cond ((boundp 'MULE)
    8.42 -	     (set-current-process-coding-system
    8.43 -	      YaTeX-latex-message-code YaTeX-coding-system))
    8.44 -	    ((boundp 'NEMACS)
    8.45 -	     (set-kanji-process-code YaTeX-latex-message-code))))
    8.46 -  (message "Type SPC to continue.")
    8.47 -  (goto-char (point-max))
    8.48 -  (if (eq system-type 'ms-dos) (message "Done.")
    8.49 -    (while (bobp) (message "Invoking process. wait...") (sleep-for 1))
    8.50 -    (insert (message " ")))
    8.51 -  (if (bolp) (forward-line -1))
    8.52 -  (recenter -1)
    8.53 -  (other-window -1)
    8.54 +  (let ((window (selected-window)))
    8.55 +    (select-window (get-buffer-window buffer))
    8.56 +    ;;(other-window 1)
    8.57 +    (use-local-map YaTeX-typesetting-mode-map)
    8.58 +    (set-syntax-table YaTeX-typeset-buffer-syntax)
    8.59 +    (setq mode-name "typeset")
    8.60 +    (if YaTeX-typeset-process ; if process is running (maybe on UNIX)
    8.61 +	(cond ((boundp 'MULE)
    8.62 +	       (set-current-process-coding-system
    8.63 +		YaTeX-latex-message-code YaTeX-coding-system))
    8.64 +	      ((boundp 'NEMACS)
    8.65 +	       (set-kanji-process-code YaTeX-latex-message-code))))
    8.66 +    (message "Type SPC to continue.")
    8.67 +    (goto-char (point-max))
    8.68 +    (if (eq system-type 'ms-dos) (message "Done.")
    8.69 +      (while (bobp) (message "Invoking process. wait...") (sleep-for 1))
    8.70 +      (insert (message " ")))
    8.71 +    (if (bolp) (forward-line -1))
    8.72 +    (recenter -1)
    8.73 +    (select-window window)
    8.74 +  ;;(other-window -1)
    8.75 +    )
    8.76  )
    8.77  
    8.78  (defun YaTeX-typeset-sentinel (proc mes)
    8.79 @@ -58,21 +75,17 @@
    8.80           ;; buffer killed
    8.81           (set-process-buffer proc nil))
    8.82          ((memq (process-status proc) '(signal exit))
    8.83 -         (let* ((obuf (current-buffer)))
    8.84 +         (let* ((obuf (current-buffer)) (pbuf (process-buffer proc))
    8.85 +		(owin (selected-window)) win)
    8.86             ;; save-excursion isn't the right thing if
    8.87             ;;  process-buffer is current-buffer
    8.88             (unwind-protect
    8.89                 (progn
    8.90                   ;; Write something in *typesetting* and hack its mode line
    8.91 -		 (if (equal (current-buffer) (process-buffer proc))
    8.92 -		     nil
    8.93 -		   (other-window 1)
    8.94 -		   (switch-to-buffer (process-buffer proc))
    8.95 -		   (goto-char (point-max))
    8.96 -		   (recenter -3)
    8.97 -		   (other-window -1))
    8.98 +		 (YaTeX-pop-to-buffer pbuf)
    8.99  		 (set-buffer (process-buffer proc))
   8.100                   (goto-char (point-max))
   8.101 +		 (recenter -3)
   8.102                   (insert ?\n "latex typesetting " mes)
   8.103                   (forward-char -1)
   8.104                   (insert " at " (substring (current-time-string) 0 -5) "\n")
   8.105 @@ -90,6 +103,7 @@
   8.106               ;; Force mode line redisplay soon
   8.107               (set-buffer-modified-p (buffer-modified-p))
   8.108  	     )
   8.109 +	   (select-window owin)
   8.110  	   (set-buffer obuf))))
   8.111  )
   8.112  
   8.113 @@ -208,14 +222,19 @@
   8.114      (put 'dvi2-command 'region nil))
   8.115  )
   8.116  
   8.117 -(defun YaTeX-bibtex-buffer ()
   8.118 +(defun YaTeX-call-command-on-file (base-cmd buffer)
   8.119 +  (YaTeX-save-buffers)
   8.120 +  (YaTeX-typeset
   8.121 +   (read-string "Call command: "
   8.122 +		(concat base-cmd " " (YaTeX-get-preview-file-name)))
   8.123 +   buffer)
   8.124 +)
   8.125 +
   8.126 +(defun YaTeX-bibtex-buffer (cmd)
   8.127    "Pass the bibliography data of editing file to bibtex."
   8.128    (interactive)
   8.129    (YaTeX-save-buffers)
   8.130 -  (YaTeX-typeset
   8.131 -   (read-string "BibTeX command: "
   8.132 -		(concat bibtex-command " " (YaTeX-get-preview-file-name)))
   8.133 -   "*YaTeX-bibtex*" )
   8.134 +  (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" )
   8.135  )
   8.136  
   8.137  (defun YaTeX-kill-typeset-process (proc)
   8.138 @@ -269,11 +288,12 @@
   8.139    "Visit previous error.  The reason why not NEXT-error is to
   8.140  avoid make confliction of line numbers by editing."
   8.141    (interactive)
   8.142 -  (let ((cur-buf (buffer-name))
   8.143 -	YaTeX-error-line error-buffer)
   8.144 +  (let ((cur-buf (buffer-name)) (cur-win (selected-window))
   8.145 +	YaTeX-error-line typeset-win error-buffer error-win)
   8.146      (if (null (get-buffer YaTeX-typeset-buffer))
   8.147  	(message "There is no output buffer of typesetting.")
   8.148 -      (pop-to-buffer YaTeX-typeset-buffer)
   8.149 +      (YaTeX-pop-to-buffer YaTeX-typeset-buffer)
   8.150 +      (setq typeset-win (selected-window))
   8.151        (if (eq system-type 'ms-dos)
   8.152  	  (if (search-backward latex-dos-emergency-message nil t)
   8.153  	      (progn (goto-char (point-max))
   8.154 @@ -289,37 +309,33 @@
   8.155  	      (beginning-of-line)
   8.156  	      (setq error-regexp latex-warning-regexp))))
   8.157        (if (re-search-backward error-regexp nil t)
   8.158 -	  (save-restriction
   8.159 -	    (set-mark-command nil)
   8.160 -	    (end-of-line)
   8.161 -	    (narrow-to-region (point) (mark))
   8.162 -	    (goto-char (point-min))
   8.163 -	    (re-search-forward "[0-9]")
   8.164 -	    (forward-char -1)
   8.165 -	    (set-mark (point))
   8.166 -	    (skip-chars-forward "0-9")
   8.167 -	    (narrow-to-region (point) (mark))
   8.168 -	    (goto-char (point-min))
   8.169 -	    (setq YaTeX-error-line (read (current-buffer))))
   8.170 +	  (setq YaTeX-error-line
   8.171 +		(string-to-int
   8.172 +		 (buffer-substring
   8.173 +		  (progn (goto-char (match-beginning 0))
   8.174 +			 (skip-chars-forward "^0-9")
   8.175 +			 (point))
   8.176 +		  (progn (skip-chars-forward "0-9") (point)))))
   8.177  	(message "No more error on %s" cur-buf)
   8.178 -	(ding)
   8.179 -	)
   8.180 -      (setq error-buffer (YaTeX-get-error-file cur-buf))
   8.181 -      (other-window -1)
   8.182 -      (switch-to-buffer cur-buf)
   8.183 -      (if (null YaTeX-error-line)
   8.184 +	(ding))
   8.185 +      (setq error-buffer (YaTeX-get-error-file cur-buf)); arg. is default buf.
   8.186 +      (setq error-win (get-buffer-window error-buffer))
   8.187 +      (select-window cur-win)
   8.188 +      (if (or (null YaTeX-error-line) (equal 0 YaTeX-error-line))
   8.189  	  nil
   8.190  	;; if warning or error found
   8.191 -	(YaTeX-switch-to-buffer error-buffer)
   8.192 +	(if error-win (select-window error-win)
   8.193 +	  (YaTeX-switch-to-buffer error-buffer)
   8.194 +	  (setq error-win (selected-window)))
   8.195  	(goto-line YaTeX-error-line)
   8.196  	(message "latex error or warning in '%s' at line: %d"
   8.197  		 error-buffer YaTeX-error-line)
   8.198 -	(other-window 1)
   8.199 +	(select-window typeset-win)
   8.200  	(skip-chars-backward "[0-9]")
   8.201  	(recenter (/ (window-height) 2))
   8.202  	(sit-for 3)
   8.203  	(forward-char -1)
   8.204 -	(other-window -1)
   8.205 +	(select-window error-win)
   8.206  	)))
   8.207  )
   8.208  
   8.209 @@ -372,10 +388,11 @@
   8.210    (interactive)
   8.211    (if (null (get-buffer YaTeX-typeset-buffer))
   8.212        (message "No typeset buffer found.")
   8.213 -    (pop-to-buffer YaTeX-typeset-buffer)
   8.214 -    (goto-char (point-max))
   8.215 -    (recenter -1)
   8.216 -    (other-window -1))
   8.217 +    (let ((win (selected-window)))
   8.218 +      (YaTeX-pop-to-buffer YaTeX-typeset-buffer)
   8.219 +      (goto-char (point-max))
   8.220 +      (recenter -1)
   8.221 +      (select-window win)))
   8.222  )
   8.223  
   8.224  (defun YaTeX-get-error-file (default)
   8.225 @@ -591,4 +608,10 @@
   8.226  	    (buffer-list)))
   8.227  )
   8.228  
   8.229 +(defun YaTeX-pop-to-buffer (buffer &optional win)
   8.230 +  (if (setq win (get-buffer-window buffer))
   8.231 +      (select-window win)
   8.232 +    (pop-to-buffer buffer))
   8.233 +)
   8.234 +
   8.235  (provide 'yatexprc)