yatex

view yatexprc.el @ 11:390df0e505da

Label completion works.
author yuuji
date Mon, 20 Sep 1993 08:56:09 +0000
parents 9a56acb6c287
children a7f397790cdc
line source
1 ;;; -*- Emacs-Lisp -*-
2 ;;; YaTeX process handler.
3 ;;; yatexprc.el rev.1.43
4 ;;; (c)1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
5 ;;; Last modified Sat Sep 18 04:12:18 1993 on 98fa
6 ;;; $Id$
8 (require 'yatex)
10 (defvar YaTeX-typeset-process nil
11 "Process identifier for jlatex"
12 )
13 (defvar YaTeX-typeset-buffer "*YaTeX-typesetting*"
14 "Process buffer for jlatex")
16 (defvar YaTeX-typeset-buffer-syntax nil
17 "*Syntax table for typesetting buffer")
19 (if YaTeX-typeset-buffer-syntax nil
20 (setq YaTeX-typeset-buffer-syntax
21 (make-syntax-table (standard-syntax-table)))
22 (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax)
23 (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax)
24 (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax)
25 (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax)
26 )
28 (defun YaTeX-typeset (command buffer)
29 "Execute jlatex (or other) to LaTeX typeset."
30 (interactive)
31 (if (and YaTeX-typeset-process
32 (eq (process-status YaTeX-typeset-process) 'run))
33 ;; if tex command is halting.
34 (YaTeX-kill-typeset-process YaTeX-typeset-process))
35 (YaTeX-visit-main t) ;;execution directory
36 (with-output-to-temp-buffer buffer
37 (if (eq system-type 'ms-dos) ;if MS-DOS
38 (progn
39 (message (concat "Typesetting " (buffer-name) "..."))
40 (YaTeX-put-nonstopmode)
41 (call-process shell-file-name
42 nil buffer nil "/c" command)
43 (YaTeX-remove-nonstopmode))
44 (setq YaTeX-typeset-process ;if UNIX
45 (start-process "LaTeX" buffer shell-file-name "-c"
46 command))
47 (set-process-sentinel YaTeX-typeset-process 'YaTeX-typeset-sentinel)))
48 (setq current-TeX-buffer (buffer-name))
49 (let ((window (selected-window)))
50 (select-window (get-buffer-window buffer))
51 ;;(other-window 1)
52 (use-local-map YaTeX-typesetting-mode-map)
53 (set-syntax-table YaTeX-typeset-buffer-syntax)
54 (setq mode-name "typeset")
55 (if YaTeX-typeset-process ; if process is running (maybe on UNIX)
56 (cond ((boundp 'MULE)
57 (set-current-process-coding-system
58 YaTeX-latex-message-code YaTeX-coding-system))
59 ((boundp 'NEMACS)
60 (set-kanji-process-code YaTeX-latex-message-code))))
61 (message "Type SPC to continue.")
62 (goto-char (point-max))
63 (if (eq system-type 'ms-dos) (message "Done.")
64 (while (bobp) (message "Invoking process. wait...") (sleep-for 1))
65 (insert (message " ")))
66 (if (bolp) (forward-line -1))
67 (recenter -1)
68 (select-window window)
69 ;;(other-window -1)
70 )
71 )
73 (defun YaTeX-typeset-sentinel (proc mes)
74 (cond ((null (buffer-name (process-buffer proc)))
75 ;; buffer killed
76 (set-process-buffer proc nil))
77 ((memq (process-status proc) '(signal exit))
78 (let* ((obuf (current-buffer)) (pbuf (process-buffer proc))
79 (owin (selected-window)) win)
80 ;; save-excursion isn't the right thing if
81 ;; process-buffer is current-buffer
82 (unwind-protect
83 (progn
84 ;; Write something in *typesetting* and hack its mode line
85 (YaTeX-pop-to-buffer pbuf)
86 (set-buffer (process-buffer proc))
87 (goto-char (point-max))
88 (recenter -3)
89 (insert ?\n "latex typesetting " mes)
90 (forward-char -1)
91 (insert " at " (substring (current-time-string) 0 -5) "\n")
92 (forward-char 1)
93 (setq mode-line-process
94 (concat ": "
95 (symbol-name (process-status proc))))
96 (message "latex typesetting done.")
97 ;; If buffer and mode line will show that the process
98 ;; is dead, we can delete it now. Otherwise it
99 ;; will stay around until M-x list-processes.
100 (delete-process proc)
101 )
102 (setq YaTeX-typesetting-process nil)
103 ;; Force mode line redisplay soon
104 (set-buffer-modified-p (buffer-modified-p))
105 )
106 (select-window owin)
107 (set-buffer obuf))))
108 )
110 (defvar YaTeX-texput-file "texput.tex"
111 "*File name for temporary file of typeset-region."
112 )
114 (defun YaTeX-typeset-region ()
115 "Paste the region to the file `texput.tex' and execute jlatex (or other)
116 to LaTeX typeset. The region is specified by the rule:
117 (1)If keyword `%#BEGIN' is found in the upper direction from (point).
118 (1-1)if the keyword `%#END' is found after `%#BEGIN',
119 ->Assume the text between `%#BEGIN' and `%#END' as region.
120 (1-2)if the keyword `%#END' is not found anywhere after `%#BEGIN',
121 ->Assume the text after `%#BEGIN' as region.
122 (2)If no `%#BEGIN' usage is found before the (point),
123 ->Assume the text between current (point) and (mark) as region.
124 DON'T forget to eliminate the `%#BEGIN/%#END' notation after editing
125 operation to the region."
126 (interactive)
127 (save-excursion
128 (let*
129 ((end "") typeout ;Type out message that tells the method of cutting.
130 (cmd (concat (YaTeX-get-latex-command nil) " " YaTeX-texput-file))
131 (buffer (current-buffer)) opoint preamble
132 (region
133 (if (re-search-backward
134 "%#BEGIN" nil t)
135 (progn
136 (setq typeout "--- Region from BEGIN to " end "END ---")
137 (buffer-substring
138 (match-end 0)
139 (if (re-search-forward "%#END" nil t)
140 (match-beginning 0)
141 (setq end "end of buffer ---")
142 (point-max))))
143 (setq typeout "=== Region from (point) to (mark) ===")
144 (buffer-substring (point) (mark)))))
145 (YaTeX-visit-main t)
146 (setq opoint (point))
147 (goto-char (point-min))
148 (setq
149 preamble
150 (if (re-search-forward "^[ ]*\\\\begin.*{document}" nil t)
151 (buffer-substring (point-min) (match-end 0))
152 (concat "\\documentstyle{" YaTeX-default-document-style "}\n"
153 "\\begin{document}")))
154 (goto-char opoint)
155 ;;(set-buffer buffer) ;for clarity
156 (find-file YaTeX-texput-file)
157 (erase-buffer)
158 (if YaTeX-need-nonstop
159 (insert "\\nonstopmode{}\n"))
160 (insert preamble "\n")
161 (insert region)
162 (insert "\\typeout{" typeout end "}\n") ;Notice the selected method.
163 (insert "\n\\end{document}\n")
164 (basic-save-buffer)
165 (kill-buffer (current-buffer))
166 (YaTeX-visit-main t)
167 (YaTeX-typeset cmd YaTeX-typeset-buffer)
168 (put 'dvi2-command 'region t)))
169 )
171 (defun YaTeX-typeset-buffer ()
172 "Typeset whole buffer. If %#! usage says other buffer is main text,
173 visit main buffer to confirm if its includeonly list contains current
174 buffer's file. And if it doesn't contain editing text, ask user which
175 action want to be done, A:Add list, R:Replace list, %:comment-out list."
176 (interactive)
177 (YaTeX-save-buffers)
178 (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.)))
179 (mydir (file-name-directory (buffer-file-name)))
180 (cmd (YaTeX-get-latex-command t)))
181 (if (YaTeX-main-file-p) nil
182 (save-excursion
183 (YaTeX-visit-main t) ;search into main buffer
184 (save-excursion
185 (push-mark (point) t)
186 (goto-char (point-min))
187 (if (and (re-search-forward "^[ ]*\\\\begin{document}" nil t)
188 (re-search-backward "^[ ]*\\\\includeonly{" nil t))
189 (let*
190 ((b (progn (skip-chars-forward "^{") (point)))
191 (e (progn (skip-chars-forward "^}") (1+ (point))))
192 (s (buffer-substring b e)) c
193 (pardir (file-name-directory (buffer-file-name))))
194 (if (string-match (concat "[{,/]" me "[,}]") s)
195 nil ; Nothing to do when it's already in includeonly.
196 (ding)
197 (switch-to-buffer (current-buffer));Display this buffer.
198 (setq
199 me ;;Rewrite my name(me) to contain sub directory name.
200 (concat
201 (if (string-match pardir mydir) ;if mydir is child of main
202 (substring mydir (length pardir)) ;cut absolute path
203 mydir) ;else concat absolute path name.
204 me))
205 (message
206 "`%s' is not in \\includeonly. A)dd R)eplace %%)comment? "
207 me)
208 (setq c (read-char))
209 (cond
210 ((= c ?a)
211 (goto-char (1+ b))
212 (insert me (if (string= s "{}") "" ",")))
213 ((= c ?r)
214 (delete-region (1+ b) (1- e)) (insert me))
215 ((= c ?%)
216 (beginning-of-line) (insert "%"))
217 (t nil))
218 (basic-save-buffer))))
219 (exchange-point-and-mark))
220 ))
221 (YaTeX-typeset cmd YaTeX-typeset-buffer)
222 (put 'dvi2-command 'region nil))
223 )
225 (defun YaTeX-call-command-on-file (base-cmd buffer)
226 (YaTeX-save-buffers)
227 (YaTeX-typeset
228 (read-string "Call command: "
229 (concat base-cmd " " (YaTeX-get-preview-file-name)))
230 buffer)
231 )
233 (defun YaTeX-bibtex-buffer (cmd)
234 "Pass the bibliography data of editing file to bibtex."
235 (interactive)
236 (YaTeX-save-buffers)
237 (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" )
238 )
240 (defun YaTeX-kill-typeset-process (proc)
241 "Kill process PROC after sending signal to PROC.
242 PROC should be process identifier."
243 (cond
244 ((eq system-type 'ms-dos)
245 (error "MS-DOS can't have concurrent process."))
246 ((or (null proc) (not (eq (process-status proc) 'run)))
247 (error "No typesetting process."))
248 (t (interrupt-process proc)
249 (delete-process proc)))
250 )
252 (defun YaTeX-system (command buffer)
253 "Execute some command on buffer. Not a official function."
254 (save-excursion
255 (with-output-to-temp-buffer buffer
256 (if (eq system-type 'ms-dos)
257 (call-process shell-file-name nil buffer nil "/c " command)
258 (start-process "system" buffer shell-file-name "-c " command))))
259 )
261 (defun YaTeX-preview (preview-command preview-file)
262 "Execute xdvi (or other) to tex-preview."
263 (interactive
264 (list (read-string "Preview command: " dvi2-command)
265 (read-string "Prefiew file[.dvi]: "
266 ;;(substring (buffer-name) 0 -4)
267 (if (get 'dvi2-command 'region)
268 (substring YaTeX-texput-file
269 0 (rindex YaTeX-texput-file ?.))
270 (YaTeX-get-preview-file-name))
271 )))
272 (setq dvi2-command preview-command)
273 (save-excursion
274 (YaTeX-visit-main t)
275 (with-output-to-temp-buffer "*dvi-preview*"
276 (if (eq system-type 'ms-dos)
277 (progn (send-string-to-terminal "\e[2J") ;if MS-DOS
278 (call-process shell-file-name "con" "*dvi-preview*" nil
279 "/c " dvi2-command preview-file)
280 (redraw-display))
281 (start-process "preview" "*dvi-preview*" shell-file-name "-c"
282 (concat dvi2-command " " preview-file)) ;if UNIX
283 (message
284 (concat "Starting " dvi2-command " to preview " preview-file)))))
285 )
287 (defun YaTeX-prev-error ()
288 "Visit previous error. The reason why not NEXT-error is to
289 avoid make confliction of line numbers by editing."
290 (interactive)
291 (let ((cur-buf (buffer-name)) (cur-win (selected-window))
292 YaTeX-error-line typeset-win error-buffer error-win)
293 (if (null (get-buffer YaTeX-typeset-buffer))
294 (message "There is no output buffer of typesetting.")
295 (YaTeX-pop-to-buffer YaTeX-typeset-buffer)
296 (setq typeset-win (selected-window))
297 (if (eq system-type 'ms-dos)
298 (if (search-backward latex-dos-emergency-message nil t)
299 (progn (goto-char (point-max))
300 (setq error-regexp latex-error-regexp))
301 (beginning-of-line)
302 (forward-char -1)
303 (setq error-regexp latex-warning-regexp))
304 (if YaTeX-typeset-process ; if jlatex on UNIX
305 (if (eq (process-status YaTeX-typeset-process) 'run)
306 (progn
307 (goto-char (point-max))
308 (setq error-regexp latex-error-regexp))
309 (beginning-of-line)
310 (setq error-regexp latex-warning-regexp))))
311 (if (re-search-backward error-regexp nil t)
312 (setq YaTeX-error-line
313 (string-to-int
314 (buffer-substring
315 (progn (goto-char (match-beginning 0))
316 (skip-chars-forward "^0-9")
317 (point))
318 (progn (skip-chars-forward "0-9") (point)))))
319 (message "No more error on %s" cur-buf)
320 (ding))
321 (setq error-buffer (YaTeX-get-error-file cur-buf)); arg. is default buf.
322 (setq error-win (get-buffer-window error-buffer))
323 (select-window cur-win)
324 (if (or (null YaTeX-error-line) (equal 0 YaTeX-error-line))
325 nil
326 ;; if warning or error found
327 (if error-win (select-window error-win)
328 (YaTeX-switch-to-buffer error-buffer)
329 (setq error-win (selected-window)))
330 (goto-line YaTeX-error-line)
331 (message "latex error or warning in '%s' at line: %d"
332 error-buffer YaTeX-error-line)
333 (select-window typeset-win)
334 (skip-chars-backward "[0-9]")
335 (recenter (/ (window-height) 2))
336 (sit-for 3)
337 (forward-char -1)
338 (select-window error-win)
339 )))
340 )
342 (defun YaTeX-jump-error-line ()
343 "Jump corresponding line on latex command's error message."
344 (interactive)
345 (let ((p (point))
346 (end (progn (end-of-line) (point)))
347 (begin (progn (beginning-of-line)(point))))
348 (if (null (re-search-forward "l[ ines]*\\.*[1-9][0-9]*" end t))
349 (if (save-excursion (end-of-line) (eobp))
350 (progn (goto-char p) (insert (this-command-keys)))
351 (message "No line number expression"))
352 (goto-char (match-beginning 0))
353 (re-search-forward "[1-9][0-9]*" end t)
354 (save-restriction
355 (let ((error-line
356 (string-to-int (buffer-substring (match-beginning 0)
357 (match-end 0))))
358 (error-file (YaTeX-get-error-file current-TeX-buffer)))
359 ;;(goto-char (match-beginning 0))
360 (other-window -1)
361 (message "errors in %s" error-file)
362 ;(switch-to-buffer current-TeX-buffer)
363 (if (not (YaTeX-switch-to-buffer error-file))
364 (error "%s is not found in this directory."))
365 (goto-line error-line)))))
366 )
368 (defun YaTeX-send-string ()
369 "Send string to current typeset process."
370 (interactive)
371 (if (and (eq (process-status YaTeX-typeset-process) 'run)
372 (>= (point) (process-mark YaTeX-typeset-process)))
373 (let ((b (process-mark YaTeX-typeset-process))
374 (e (point-end-of-line)))
375 (goto-char b)
376 (skip-chars-forward " \t" e)
377 (setq b (point))
378 (process-send-string
379 YaTeX-typeset-process (concat (buffer-substring b e) "\n"))
380 (goto-char e)
381 (insert "\n")
382 (set-marker (process-mark YaTeX-typeset-process) (point))
383 (insert " "))
384 (ding))
385 )
387 (defun YaTeX-view-error ()
388 (interactive)
389 (if (null (get-buffer YaTeX-typeset-buffer))
390 (message "No typeset buffer found.")
391 (let ((win (selected-window)))
392 (YaTeX-pop-to-buffer YaTeX-typeset-buffer)
393 (goto-char (point-max))
394 (recenter -1)
395 (select-window win)))
396 )
398 (defun YaTeX-get-error-file (default)
399 "Get current processing file from typesetting log."
400 (save-excursion
401 (let(s)
402 (condition-case () (up-list -1)
403 (error
404 (let ((list 0) found)
405 (while
406 (and (<= list 0) (not found)
407 (re-search-backward "\\((\\)\\|\\()\\)" nil t))
408 (if (equal (match-beginning 0) (match-beginning 2)) ;close paren.
409 (setq list (1- list)) ;open paren
410 (setq list (1+ list))
411 (if (= list 1)
412 (if (looking-at "\\([^,{}%]+\.\\)tex\\|sty")
413 (setq found t)
414 (setq list (1- list)))))))))
415 (setq s
416 (buffer-substring
417 (progn (forward-char 1) (point))
418 (progn (skip-chars-forward "-A-Za-z0-9_/\.\\" (point-end-of-line))
419 (point))))
420 (if (string= "" s) default s)))
421 )
423 (defun YaTeX-put-nonstopmode ()
424 (if YaTeX-need-nonstop
425 (if (re-search-backward "\\nonstopmode{}" (point-min) t)
426 nil ;if already written in text then do nothing
427 (save-excursion
428 (YaTeX-visit-main t)
429 (goto-char (point-min))
430 (insert "\\nonstopmode{}%_YaTeX_%\n")))
431 )
432 )
434 (defun YaTeX-remove-nonstopmode ()
435 (if YaTeX-need-nonstop ;for speed
436 (save-excursion
437 (YaTeX-visit-main t)
438 (goto-char (point-min))
439 (forward-line 1)
440 (narrow-to-region (point-min) (point))
441 (goto-char (point-min))
442 (delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$")
443 (widen)))
444 )
446 (defun YaTeX-get-preview-file-name ()
447 "Get file name to preview by inquiring YaTeX-get-latex-command"
448 (let* ((latex-cmd (YaTeX-get-latex-command t))
449 (rin (rindex latex-cmd ? ))
450 (fname (if (> rin -1) (substring latex-cmd (1+ rin)) ""))
451 (period))
452 (if (string= fname "")
453 (setq fname (substring (buffer-name) 0 -4))
454 (setq period (rindex fname ?.))
455 (setq fname (substring fname 0 (if (eq -1 period) nil period)))
456 ))
457 )
459 (defun YaTeX-get-latex-command (&optional switch)
460 "Specify the latex-command name and its argument.
461 If there is a line which begins by string: \"%#!\", the following
462 strings are assumed to be the latex-command and arguments. The
463 default value of latex-command is:
464 tex-command (buffer-name)
465 and if you write \"%#!jlatex\" in the beginning of certain line.
466 \"jlatex \" (buffer-name)
467 will be the latex-command,
468 and you write \"%#!jlatex main.tex\" on some line and argument SWITCH
469 is t, then
470 \"jlatex main.tex\"
471 will be given to the shell."
472 (let*
473 ((default-command
474 (concat tex-command " "
475 (if switch (buffer-name) ""))));default value
476 (save-excursion
477 (goto-char (point-min))
478 (if (null (re-search-forward "^%#!" (point-max) t))
479 default-command
480 (skip-chars-forward "%#! ")
481 (if (eolp)
482 default-command
483 (let ((s (point)))
484 (skip-chars-forward "^ " (point-end-of-line)) ;Skip command
485 (skip-chars-forward " " (point-end-of-line))
486 ;(setq YaTeX-latex-command (buffer-substring s (point)))
487 (cond
488 ((null switch)
489 (buffer-substring s (point)))
490 ((eolp) ;Only return command name
491 (concat (buffer-substring s (point)) " " (buffer-name)))
492 (t(end-of-line) ;Change entire command name
493 (buffer-substring s (point))) ;including arguments.
494 ))
495 ))))
496 )
498 (defun YaTeX-replace-format (string format repl)
499 "In STRING, replace first appearance of FORMAT to REPL as if
500 function `format' does. FORMAT does not contain `%'"
501 (let ((beg (or (string-match (concat "^\\(%" format "\\)") string)
502 (string-match (concat "[^%]\\(%" format "\\)") string)))
503 (len (length format)))
504 (if (null beg) string ;no conversion
505 (concat
506 (substring string 0 (match-beginning 1)) repl
507 (substring string (match-end 1)))))
508 )
510 (defun YaTeX-lpr (arg)
511 "Print out. If prefix arg ARG is non nil, call print driver without
512 page range description."
513 (interactive "P")
514 (let*(from to (cmd (or (YaTeX-get-builtin "LPR") dviprint-command-format)))
515 (setq
516 cmd
517 (YaTeX-replace-format
518 cmd "f"
519 (if (or arg (not (string-match "%f" cmd)))
520 ""
521 (YaTeX-replace-format
522 dviprint-from-format
523 "b"
524 (if (string=
525 (setq from (read-string "From page(default 1): ")) "")
526 "1" from))))
527 )
528 (setq
529 cmd
530 (YaTeX-replace-format
531 cmd "t"
532 (if (or arg (not (string-match "%t" cmd))
533 (string=
534 (setq to (read-string "To page(default none): ")) ""))
535 ""
536 (YaTeX-replace-format dviprint-to-format "e" to)))
537 )
538 (setq cmd (read-string "Edit command line: "
539 (format cmd (YaTeX-get-preview-file-name))))
540 (save-excursion
541 (YaTeX-visit-main t) ;;change execution directory
542 (with-output-to-temp-buffer "*dvi-printing*"
543 (if (eq system-type 'ms-dos)
544 (call-process shell-file-name "con" "*dvi-printing*" nil
545 "/c " cmd)
546 (start-process "print" "*dvi-printing*" shell-file-name "-c" cmd)
547 (message (concat "Starting " cmd " to printing "
548 (YaTeX-get-preview-file-name))))
549 )))
550 )
552 (defun YaTeX-main-file-p ()
553 "Return if current buffer is main LaTeX source."
554 (string-match (concat "^" (YaTeX-get-preview-file-name) ".tex")(buffer-name))
555 )
557 (defun YaTeX-visit-main (&optional setbuf)
558 "Switch to buffer main LaTeX source. Use set-buffer instead of
559 switch-to-buffer if optional second argument SETBUF is t(Use it only
560 in Emacs-Lisp program)."
561 (interactive)
562 (let ((main-file (YaTeX-get-preview-file-name)))
563 (if (string-match (concat "^" main-file ".tex") (buffer-name))
564 (if (interactive-p) (message "I think this is main LaTeX source.") nil)
565 (cond
566 ((YaTeX-switch-to-buffer (setq main-file (concat main-file ".tex"))
567 setbuf))
568 ((and (file-exists-p (setq main-file (concat "../" main-file)))
569 (y-or-n-p (concat (expand-file-name main-file)
570 " is main file?:")))
571 (YaTeX-switch-to-buffer main-file setbuf))
572 (t (find-file (read-file-name "Enter your main text: " nil nil 1)))
573 )))
574 nil
575 )
577 (defun YaTeX-visit-main-other-window ()
578 "Switch to buffer main LaTeX source in other window."
579 (interactive)
580 (if (YaTeX-main-file-p) (message "I think this is main LaTeX source.")
581 (YaTeX-switch-to-buffer-other-window
582 (concat (YaTeX-get-preview-file-name) ".tex")))
583 )
585 (defun YaTeX-get-builtin (key)
586 "Read source built-in command of %# usage."
587 (save-excursion
588 (goto-char (point-min))
589 (if (and (search-forward (concat "%#" key) nil t)
590 (not (eolp)))
591 (buffer-substring
592 (progn (skip-chars-forward " " (point-end-of-line))(point))
593 (point-end-of-line))
594 nil))
595 )
597 (defun YaTeX-save-buffers ()
598 "Save buffers which is in yatex-mode."
599 (basic-save-buffer)
600 (save-excursion
601 (mapcar '(lambda (buf)
602 (set-buffer buf)
603 (if (and (buffer-file-name buf)
604 (eq major-mode 'yatex-mode)
605 (buffer-modified-p buf)
606 (y-or-n-p (format "Save %s" (buffer-name buf))))
607 (save-buffer buf)))
608 (buffer-list)))
609 )
611 (defun YaTeX-pop-to-buffer (buffer &optional win)
612 (if (setq win (get-buffer-window buffer))
613 (select-window win)
614 (pop-to-buffer buffer))
615 )
617 (provide 'yatexprc)