Mercurial > hgrepos > hgweb.cgi > yatex
annotate yatexprc.el @ 72:0aaebd07dad0
Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
Support Emacs-21.
author | yuuji |
---|---|
date | Mon, 25 Dec 2000 10:19:28 +0000 |
parents | 44e3a5e1e883 |
children | f41b01fef5d6 |
rev | line source |
---|---|
51 | 1 ;;; -*- Emacs-Lisp -*- |
2 ;;; YaTeX process handler. | |
3 ;;; yatexprc.el | |
72 | 4 ;;; (c )1993-2000 by HIROSE Yuuji.[yuuji@yatex.org] |
5 ;;; Last modified Mon Dec 25 19:18:19 2000 on firestorm | |
51 | 6 ;;; $Id$ |
7 | |
64 | 8 ;(require 'yatex) |
9 (require 'yatexlib) | |
51 | 10 |
11 (defvar YaTeX-typeset-process nil | |
69 | 12 "Process identifier for jlatex") |
13 | |
51 | 14 (defvar YaTeX-typeset-buffer "*YaTeX-typesetting*" |
15 "Process buffer for jlatex") | |
16 | |
17 (defvar YaTeX-typeset-buffer-syntax nil | |
18 "*Syntax table for typesetting buffer") | |
19 | |
20 (defvar YaTeX-current-TeX-buffer nil | |
21 "Keeps the buffer on which recently typeset run.") | |
22 | |
23 (defvar YaTeX-shell-command-option | |
24 (or (and (boundp 'shell-command-option) shell-command-option) | |
68 | 25 (and (boundp 'shell-command-switch) shell-command-switch) |
51 | 26 (if YaTeX-dos "/c" "-c")) |
27 "Shell option for command execution.") | |
28 | |
64 | 29 (defvar YaTeX-latex-message-code |
30 (cond | |
31 (YaTeX-dos (cdr (assq 1 YaTeX-kanji-code-alist))) | |
32 ((and YaTeX-emacs-20 (member 'undecided (coding-system-list)) | |
33 'undecided)) | |
34 ((featurep 'mule) | |
35 (or (and (boundp '*autoconv*) *autoconv*) | |
36 (and (fboundp 'coding-system-list) 'automatic-conversion))) | |
37 ((boundp 'NEMACS) | |
38 (cdr (assq (if YaTeX-dos 1 2) YaTeX-kanji-code-alist)))) | |
39 "Process coding system for LaTeX.") | |
40 | |
51 | 41 (if YaTeX-typeset-buffer-syntax nil |
42 (setq YaTeX-typeset-buffer-syntax | |
43 (make-syntax-table (standard-syntax-table))) | |
44 (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax) | |
45 (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax) | |
46 (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax) | |
69 | 47 (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax)) |
51 | 48 |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
49 (defun YaTeX-typeset (command buffer &optional prcname modename) |
51 | 50 "Execute jlatex (or other) to LaTeX typeset." |
51 (interactive) | |
52 (save-excursion | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
53 (let ((p (point)) (window (selected-window)) execdir (cb (current-buffer)) |
64 | 54 (map YaTeX-typesetting-mode-map) |
55 (outcode | |
56 (cond ((eq major-mode 'yatex-mode) YaTeX-coding-system) | |
69 | 57 ((eq major-mode 'yahtml-mode) yahtml-kanji-code)))) |
51 | 58 (if (and YaTeX-typeset-process |
59 (eq (process-status YaTeX-typeset-process) 'run)) | |
60 ;; if tex command is halting. | |
61 (YaTeX-kill-typeset-process YaTeX-typeset-process)) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
62 (YaTeX-put-nonstopmode) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
63 (setq prcname (or prcname "LaTeX") |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
64 modename (or modename "typeset")) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
65 (if (eq major-mode 'yatex-mode) (YaTeX-visit-main t)) ;;execution dir |
51 | 66 (setq execdir default-directory) |
67 ;;Select lower-most window if there are more than 2 windows and | |
68 ;;typeset buffer not seen. | |
69 (YaTeX-showup-buffer | |
70 buffer (function (lambda (x) (nth 3 (window-edges x))))) | |
71 (set-buffer (get-buffer-create buffer)) | |
72 (setq default-directory execdir) | |
73 (cd execdir) | |
74 (erase-buffer) | |
75 (cond | |
64 | 76 ((not (fboundp 'start-process)) ;YaTeX-dos;if MS-DOS |
51 | 77 (call-process |
64 | 78 shell-file-name nil buffer nil YaTeX-shell-command-option command)) |
51 | 79 (t ;if UNIX |
80 (set-process-buffer | |
81 (setq YaTeX-typeset-process | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
82 (start-process prcname buffer shell-file-name |
51 | 83 YaTeX-shell-command-option command)) |
84 (get-buffer buffer)) | |
85 (set-process-sentinel YaTeX-typeset-process 'YaTeX-typeset-sentinel))) | |
86 (message (format "Calling `%s'..." command)) | |
87 (setq YaTeX-current-TeX-buffer (buffer-name)) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
88 (use-local-map map) ;map may be localized |
51 | 89 (set-syntax-table YaTeX-typeset-buffer-syntax) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
90 (setq mode-name modename) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
91 (if YaTeX-typeset-process ;if process is running (maybe on UNIX) |
64 | 92 (cond ((fboundp 'set-current-process-coding-system) |
51 | 93 (set-current-process-coding-system |
64 | 94 YaTeX-latex-message-code outcode)) |
95 ((fboundp 'set-process-coding-system) | |
96 (set-process-coding-system | |
97 YaTeX-typeset-process YaTeX-latex-message-code outcode)) | |
98 (YaTeX-emacs-20 | |
99 (set-buffer-process-coding-system | |
100 YaTeX-latex-message-code outcode)) | |
51 | 101 ((boundp 'NEMACS) |
102 (set-kanji-process-code YaTeX-latex-message-code)))) | |
103 (if YaTeX-dos (message "Done.") | |
104 (insert " ") | |
105 (set-marker (process-mark YaTeX-typeset-process) (1- (point)))) | |
106 (if (bolp) (forward-line -1)) ;what for? | |
107 (if (and YaTeX-emacs-19 window-system) | |
108 (let ((win (get-buffer-window buffer t)) owin) | |
109 (select-frame (window-frame win)) | |
110 (setq owin (selected-window)) | |
111 (select-window win) | |
112 (goto-char (point-max)) | |
113 (recenter -1) | |
114 (select-window owin)) | |
115 (select-window (get-buffer-window buffer)) | |
116 (goto-char (point-max)) | |
117 (recenter -1)) | |
118 (select-window window) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
119 (switch-to-buffer cb) |
69 | 120 (YaTeX-remove-nonstopmode)))) |
51 | 121 |
122 (defun YaTeX-typeset-sentinel (proc mes) | |
123 (cond ((null (buffer-name (process-buffer proc))) | |
124 ;; buffer killed | |
125 (set-process-buffer proc nil)) | |
126 ((memq (process-status proc) '(signal exit)) | |
127 (let* ((obuf (current-buffer)) (pbuf (process-buffer proc)) | |
128 (pwin (get-buffer-window pbuf)) | |
129 (owin (selected-window)) win) | |
130 ;; save-excursion isn't the right thing if | |
131 ;; process-buffer is current-buffer | |
132 (unwind-protect | |
133 (progn | |
134 ;; Write something in *typesetting* and hack its mode line | |
135 (if pwin | |
136 (select-window pwin) | |
137 (set-buffer pbuf)) | |
138 ;;(YaTeX-showup-buffer pbuf nil t) | |
139 (goto-char (point-max)) | |
140 (if pwin (recenter -3)) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
141 (insert ?\n mode-name " " mes) |
51 | 142 (forward-char -1) |
143 (insert " at " (substring (current-time-string) 0 -5) "\n") | |
144 (forward-char 1) | |
145 (setq mode-line-process | |
146 (concat ": " | |
147 (symbol-name (process-status proc)))) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
148 (message mode-name " %s." |
51 | 149 (if (eq (process-status proc) 'exit) |
150 "done" "ceased")) | |
151 ;; If buffer and mode line shows that the process | |
152 ;; is dead, we can delete it now. Otherwise it | |
153 ;; will stay around until M-x list-processes. | |
154 (delete-process proc) | |
155 ) | |
156 (setq YaTeX-typeset-process nil) | |
157 ;; Force mode line redisplay soon | |
158 (set-buffer-modified-p (buffer-modified-p)) | |
159 ) | |
160 (select-window owin) | |
69 | 161 (set-buffer obuf))))) |
51 | 162 |
163 (defvar YaTeX-texput-file "texput.tex" | |
69 | 164 "*File name for temporary file of typeset-region.") |
51 | 165 |
166 (defun YaTeX-typeset-region () | |
52 | 167 "Paste the region to the file `texput.tex' and execute typesetter. |
168 The region is specified by the rule: | |
51 | 169 (1)If keyword `%#BEGIN' is found in the upper direction from (point). |
170 (1-1)if the keyword `%#END' is found after `%#BEGIN', | |
171 ->Assume the text between `%#BEGIN' and `%#END' as region. | |
172 (1-2)if the keyword `%#END' is not found anywhere after `%#BEGIN', | |
173 ->Assume the text after `%#BEGIN' as region. | |
174 (2)If no `%#BEGIN' usage is found before the (point), | |
175 ->Assume the text between current (point) and (mark) as region. | |
176 DON'T forget to eliminate the `%#BEGIN/%#END' notation after editing | |
177 operation to the region." | |
178 (interactive) | |
179 (save-excursion | |
180 (let* | |
181 ((end "") typeout ;Type out message that tells the method of cutting. | |
182 (texput YaTeX-texput-file) | |
183 (cmd (concat (YaTeX-get-latex-command nil) " " texput)) | |
184 (buffer (current-buffer)) opoint preamble (subpreamble "") main | |
185 (hilit-auto-highlight nil) ;for Emacs19 with hilit19 | |
52 | 186 reg-begin reg-end lineinfo) |
51 | 187 |
188 (save-excursion | |
189 (if (search-backward "%#BEGIN" nil t) | |
190 (progn | |
191 (setq typeout "--- Region from BEGIN to " | |
192 end "the end of the buffer ---" | |
193 reg-begin (match-end 0)) | |
194 (if (search-forward "%#END" nil t) | |
195 (setq reg-end (match-beginning 0) | |
196 end "END ---") | |
197 (setq reg-end (point-max)))) | |
52 | 198 (setq typeout "=== Region from (point) to (mark) ===" |
199 reg-begin (point) reg-end (mark))) | |
200 (goto-char (min reg-begin reg-end)) | |
201 (setq lineinfo (count-lines (point-min) (point-end-of-line))) | |
51 | 202 (goto-char (point-min)) |
203 (while (search-forward "%#REQUIRE" nil t) | |
204 (setq subpreamble | |
205 (concat subpreamble | |
206 (cond | |
207 ((eolp) | |
208 (buffer-substring | |
209 (match-beginning 0) | |
210 (point-beginning-of-line))) | |
211 (t (buffer-substring | |
212 (match-end 0) | |
213 (point-end-of-line)))) | |
214 "\n")) | |
215 (goto-char (match-end 0)))) | |
216 (YaTeX-visit-main t) | |
217 (setq main (current-buffer)) | |
218 (setq opoint (point)) | |
219 (goto-char (point-min)) | |
220 (setq | |
221 preamble | |
222 (if (re-search-forward "^[ ]*\\\\begin.*{document}" nil t) | |
223 (buffer-substring (point-min) (match-end 0)) | |
224 (concat "\\documentstyle{" YaTeX-default-document-style "}\n" | |
225 "\\begin{document}"))) | |
226 (goto-char opoint) | |
227 ;;(set-buffer buffer) ;for clarity | |
52 | 228 (let ((hilit-auto-highlight nil)) |
229 (set-buffer (find-file-noselect texput))) | |
51 | 230 ;;(find-file YaTeX-texput-file) |
231 (erase-buffer) | |
64 | 232 (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) |
51 | 233 (insert "\\nonstopmode{}\n")) |
234 (insert preamble "\n" subpreamble "\n") | |
52 | 235 (setq lineinfo (list (count-lines 1 (point-end-of-line)) lineinfo)) |
51 | 236 (insert-buffer-substring buffer reg-begin reg-end) |
237 (insert "\\typeout{" typeout end "}\n") ;Notice the selected method. | |
238 (insert "\n\\end{document}\n") | |
239 (basic-save-buffer) | |
240 (kill-buffer (current-buffer)) | |
241 (set-buffer main) ;return to parent file or itself. | |
242 (YaTeX-typeset cmd YaTeX-typeset-buffer) | |
243 (switch-to-buffer buffer) ;for Emacs-19 | |
52 | 244 (put 'dvi2-command 'region t) |
245 (put 'dvi2-command 'file buffer) | |
69 | 246 (put 'dvi2-command 'offset lineinfo)))) |
51 | 247 |
248 (defun YaTeX-typeset-buffer () | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
249 "Typeset whole buffer. |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
250 If %#! usage says other buffer is main text, |
51 | 251 visit main buffer to confirm if its includeonly list contains current |
252 buffer's file. And if it doesn't contain editing text, ask user which | |
253 action wants to be done, A:Add list, R:Replace list, %:comment-out list." | |
254 (interactive) | |
255 (YaTeX-save-buffers) | |
256 (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.))) | |
257 (mydir (file-name-directory (buffer-file-name))) | |
258 (cmd (YaTeX-get-latex-command t)) (cb (current-buffer))) | |
259 (if (YaTeX-main-file-p) nil | |
260 (save-excursion | |
261 (YaTeX-visit-main t) ;search into main buffer | |
262 (save-excursion | |
263 (push-mark (point) t) | |
264 (goto-char (point-min)) | |
265 (if (and (re-search-forward "^[ ]*\\\\begin{document}" nil t) | |
266 (re-search-backward "^[ ]*\\\\includeonly{" nil t)) | |
267 (let* | |
268 ((b (progn (skip-chars-forward "^{") (point))) | |
269 (e (progn (skip-chars-forward "^}") (1+ (point)))) | |
270 (s (buffer-substring b e)) c | |
271 (pardir (file-name-directory (buffer-file-name)))) | |
272 (if (string-match (concat "[{,/]" me "[,}]") s) | |
273 nil ; Nothing to do when it's already in includeonly. | |
274 (ding) | |
275 (switch-to-buffer (current-buffer));Display this buffer. | |
276 (setq | |
277 me ;;Rewrite my name(me) to contain sub directory name. | |
278 (concat | |
279 (if (string-match pardir mydir) ;if mydir is child of main | |
280 (substring mydir (length pardir)) ;cut absolute path | |
281 mydir) ;else concat absolute path name. | |
282 me)) | |
283 (message | |
284 "`%s' is not in \\includeonly. A)dd R)eplace %%)comment? " | |
285 me) | |
286 (setq c (read-char)) | |
287 (cond | |
288 ((= c ?a) | |
289 (goto-char (1+ b)) | |
290 (insert me (if (string= s "{}") "" ","))) | |
291 ((= c ?r) | |
292 (delete-region (1+ b) (1- e)) (insert me)) | |
293 ((= c ?%) | |
294 (beginning-of-line) (insert "%")) | |
295 (t nil)) | |
296 (basic-save-buffer)))) | |
297 (exchange-point-and-mark))) | |
298 (switch-to-buffer cb)) ;for 19 | |
299 (YaTeX-typeset cmd YaTeX-typeset-buffer) | |
69 | 300 (put 'dvi2-command 'region nil))) |
51 | 301 |
302 (defvar YaTeX-call-command-history nil | |
303 "Holds history list of YaTeX-call-command-on-file.") | |
304 (put 'YaTeX-call-command-history 'no-default t) | |
305 (defun YaTeX-call-command-on-file (base-cmd buffer) | |
306 (YaTeX-save-buffers) | |
307 (YaTeX-typeset | |
308 (read-string-with-history | |
309 "Call command: " | |
310 (concat base-cmd " " (YaTeX-get-preview-file-name)) | |
311 'YaTeX-call-command-history) | |
69 | 312 buffer)) |
51 | 313 |
314 (defun YaTeX-bibtex-buffer (cmd) | |
315 "Pass the bibliography data of editing file to bibtex." | |
316 (interactive) | |
317 (YaTeX-save-buffers) | |
69 | 318 (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" )) |
51 | 319 |
320 (defun YaTeX-kill-typeset-process (proc) | |
321 "Kill process PROC after sending signal to PROC. | |
322 PROC should be process identifier." | |
323 (cond | |
68 | 324 ((not (fboundp 'start-process)) |
325 (error "This system can't have concurrent process.")) | |
51 | 326 ((or (null proc) (not (eq (process-status proc) 'run))) |
327 (message "Typesetting process is not running.")) | |
328 (t | |
329 (save-excursion | |
330 (set-buffer (process-buffer proc)) | |
331 (save-excursion | |
332 (goto-char (point-max)) | |
333 (beginning-of-line) | |
334 (if (looking-at "\\? +$") | |
335 (let ((mp (point-max))) | |
336 (process-send-string proc "x\n") | |
337 (while (= mp (point-max)) (sit-for 1)))))) | |
338 (if (eq (process-status proc) 'run) | |
339 (progn | |
340 (interrupt-process proc) | |
69 | 341 (delete-process proc)))))) |
51 | 342 |
343 (defun YaTeX-system (command buffer) | |
344 "Execute some command on buffer. Not a official function." | |
345 (save-excursion | |
346 (YaTeX-showup-buffer | |
347 buffer (function (lambda (x) (nth 3 (window-edges x))))) | |
59 | 348 (let ((df default-directory)) ;preserve current buf's pwd |
349 (set-buffer (get-buffer-create buffer)) ;1.61.3 | |
350 (setq default-directory df) | |
351 (cd df)) | |
51 | 352 (erase-buffer) |
64 | 353 (if (not (fboundp 'start-process)) |
51 | 354 (call-process |
355 shell-file-name nil buffer nil YaTeX-shell-command-option command) | |
59 | 356 (if (and (get-buffer-process buffer) |
357 (eq (process-status (get-buffer-process buffer)) 'run) | |
358 (not | |
359 (y-or-n-p (format "Process %s is running. Continue?" buffer)))) | |
360 nil | |
361 (set-process-buffer | |
362 (start-process | |
363 "system" buffer shell-file-name YaTeX-shell-command-option command) | |
69 | 364 (get-buffer buffer)))))) |
51 | 365 |
72 | 366 (defvar YaTeX-default-paper-type "a4" |
367 "*Default paper type.") | |
368 (defconst YaTeX-paper-type-alist | |
369 '(("a4paper" . "a4") | |
370 ("a5paper" . "a5") | |
371 ("b4paper" . "b4") | |
372 ("b5paper" . "b5")) | |
373 "Holds map of options and paper types.") | |
374 (defconst YaTeX-dvips-paper-option-alist | |
375 '(("a4" . "-t a4") | |
376 ("a5" . "-t a5") | |
377 ("b4" . "-t b4") | |
378 ("b5" . "-t b5") | |
379 ("a4r" . "-t landscape"); Can't specify options, `-t a4' and `-t landscape', at the same time. | |
380 ("a5r" . "-t landscape") | |
381 ("b4r" . "-t landscape") | |
382 ("b5r" . "-t landscape")) | |
383 "Holds map of dvips options and paper types.") | |
384 (defun YaTeX-get-paper-type () | |
385 "Search options in header and return a paper type, such as \"a4\", \"a4r\", etc." | |
386 (save-excursion | |
387 (goto-char (point-min)) | |
388 (if (re-search-forward | |
389 "^[ \t]*\\\\document\\(style\\|class\\)[ \t]*\\[\\([^]]*\\)\\]" nil t) | |
390 (let ((opts (YaTeX-split-string (YaTeX-match-string 2) "[ \t]*,[ \t]*"))) | |
391 (concat | |
392 (catch 'found-paper | |
393 (mapcar (lambda (pair) | |
394 (if (member (car pair) opts) | |
395 (throw 'found-paper (cdr pair)))) | |
396 YaTeX-paper-type-alist) | |
397 YaTeX-default-paper-type) | |
398 (if (member "landscape" opts) "r" "")))))) | |
399 | |
51 | 400 (defvar YaTeX-preview-command-history nil |
401 "Holds minibuffer history of preview command.") | |
402 (put 'YaTeX-preview-command-history 'no-default t) | |
403 (defvar YaTeX-preview-file-history nil | |
404 "Holds minibuffer history of file to preview.") | |
405 (put 'YaTeX-preview-file-history 'no-default t) | |
406 (defun YaTeX-preview (preview-command preview-file) | |
407 "Execute xdvi (or other) to tex-preview." | |
408 (interactive | |
409 (list | |
410 (read-string-with-history | |
58
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
411 "Preview command: " |
72 | 412 (YaTeX-replace-format |
413 (or (YaTeX-get-builtin "PREVIEW") dvi2-command) | |
414 "p" (concat "-paper " (YaTeX-get-paper-type))) | |
58
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
415 'YaTeX-preview-command-history) |
51 | 416 (read-string-with-history |
417 "Preview file[.dvi]: " | |
418 (if (get 'dvi2-command 'region) | |
419 (substring YaTeX-texput-file | |
420 0 (rindex YaTeX-texput-file ?.)) | |
421 (YaTeX-get-preview-file-name)) | |
422 'YaTeX-preview-file-history))) | |
423 (setq dvi2-command preview-command) ;`dvi2command' is buffer local | |
424 (save-excursion | |
425 (YaTeX-visit-main t) | |
426 (let ((pbuffer "*dvi-preview*") (dir default-directory)) | |
427 (YaTeX-showup-buffer | |
428 pbuffer (function (lambda (x) (nth 3 (window-edges x))))) | |
429 (set-buffer (get-buffer-create pbuffer)) | |
430 (erase-buffer) | |
431 (setq default-directory dir) ;for 18 | |
432 (cd dir) ;for 19 | |
433 (cond | |
64 | 434 ((not (fboundp 'start-process)) ;if MS-DOS |
51 | 435 (send-string-to-terminal "\e[2J\e[>5h") ;CLS & hide cursor |
436 (call-process shell-file-name "con" "*dvi-preview*" nil | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
437 YaTeX-shell-command-option |
61 | 438 (concat preview-command " " preview-file)) |
51 | 439 (send-string-to-terminal "\e[>5l") ;show cursor |
440 (redraw-display)) | |
69 | 441 ((and (string-match "dviout" preview-command) ;maybe on `kon' |
442 (stringp (getenv "TERM")) | |
443 (string-match "^kon" (getenv "TERM"))) | |
444 (call-process shell-file-name "con" "*dvi-preview*" nil | |
445 YaTeX-shell-command-option | |
446 (concat preview-command " " preview-file))) | |
51 | 447 (t ;if UNIX |
448 (set-process-buffer | |
449 (start-process "preview" "*dvi-preview*" shell-file-name | |
450 YaTeX-shell-command-option | |
451 (concat preview-command " " preview-file)) | |
452 (get-buffer pbuffer)) | |
453 (message | |
454 (concat "Starting " preview-command | |
69 | 455 " to preview " preview-file))))))) |
51 | 456 |
58
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
457 (defvar YaTeX-xdvi-remote-program "xdvi") |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
458 (defun YaTeX-xdvi-remote-search (&optional region-mode) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
459 "Search string at the point on xdvi -remote window. |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
460 Non-nil for optional argument REGION-MODE specifies the search string |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
461 by region." |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
462 (interactive "P") |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
463 (let ((pb " *xdvi*") str proc) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
464 (save-excursion |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
465 (if region-mode |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
466 (setq str (buffer-substring (region-beginning) (region-end))) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
467 (setq str (buffer-substring |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
468 (point) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
469 (progn (skip-chars-forward "^\n\\\\}") (point))))) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
470 (message "Searching `%s'..." str) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
471 (if (boundp 'MULE) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
472 (define-program-coding-system |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
473 (regexp-quote pb) (regexp-quote YaTeX-xdvi-remote-program) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
474 *euc-japan*)) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
475 (setq proc |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
476 (start-process |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
477 "xdvi" pb YaTeX-xdvi-remote-program |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
478 "-remote" (format "SloppySearch(%s) " str) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
479 (concat (YaTeX-get-preview-file-name) ".dvi"))) |
69 | 480 (message "Searching `%s'...Done" str)))) |
58
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
481 |
52 | 482 (defun YaTeX-set-virtual-error-position (file-sym line-sym) |
483 "Replace the value of FILE-SYM, LINE-SYM by virtual error position." | |
484 (cond | |
485 ((and (get 'dvi2-command 'region) | |
486 (> (symbol-value line-sym) (car (get 'dvi2-command 'offset)))) | |
487 (set file-sym (get 'dvi2-command 'file)) | |
488 (set line-sym | |
489 (+ (- (apply '- (get 'dvi2-command 'offset))) | |
490 (symbol-value line-sym) | |
491 -1))))) | |
492 | |
51 | 493 (defun YaTeX-prev-error () |
494 "Visit previous typeset error. | |
495 To avoid making confliction of line numbers by editing, jump to | |
496 error or warning lines in reverse order." | |
497 (interactive) | |
498 (let ((cur-buf (buffer-name)) (cur-win (selected-window)) | |
499 error-line typeset-win error-buffer error-win) | |
500 (if (null (get-buffer YaTeX-typeset-buffer)) | |
501 (error "There is no typesetting buffer.")) | |
502 (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) | |
503 (setq typeset-win (selected-window)) | |
504 (if (re-search-backward | |
505 (concat "\\(" latex-error-regexp "\\)\\|\\(" | |
506 latex-warning-regexp "\\)") | |
507 nil t) | |
508 nil | |
509 (select-window cur-win) | |
68 | 510 (error "No more errors on %s" cur-buf)) |
51 | 511 (goto-char (match-beginning 0)) |
512 (skip-chars-forward "^0-9" (match-end 0)) | |
513 (setq error-line | |
514 (string-to-int | |
515 (buffer-substring | |
516 (point) | |
517 (progn (skip-chars-forward "0-9" (match-end 0)) (point)))) | |
70 | 518 error-buffer (expand-file-name (YaTeX-get-error-file cur-buf))) |
51 | 519 (if (or (null error-line) (equal 0 error-line)) |
520 (error "Can't detect error position.")) | |
52 | 521 (YaTeX-set-virtual-error-position 'error-buffer 'error-line) |
522 (setq error-win (get-buffer-window error-buffer)) | |
51 | 523 (select-window cur-win) |
524 (cond | |
525 (error-win (select-window error-win)) | |
526 ((eq (get-lru-window) typeset-win) | |
527 (YaTeX-switch-to-buffer error-buffer)) | |
528 (t (select-window (get-lru-window)) | |
529 (YaTeX-switch-to-buffer error-buffer))) | |
530 (setq error-win (selected-window)) | |
531 (goto-line error-line) | |
532 (message "LaTeX %s in `%s' on line: %d." | |
533 (if (match-beginning 1) "error" "warning") | |
534 error-buffer error-line) | |
535 (select-window typeset-win) | |
536 (skip-chars-backward "0-9") | |
537 (recenter (/ (window-height) 2)) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
538 (sit-for 1) |
51 | 539 (goto-char (match-beginning 0)) |
69 | 540 (select-window error-win))) |
51 | 541 |
542 (defun YaTeX-jump-error-line () | |
543 "Jump to corresponding line on latex command's error message." | |
544 (interactive) | |
545 (let (error-line error-file error-buf) | |
546 (save-excursion | |
547 (beginning-of-line) | |
548 (setq error-line (re-search-forward "l[ ines]*\\.?\\([1-9][0-9]*\\)" | |
549 (point-end-of-line) t))) | |
550 (if (null error-line) | |
551 (if (eobp) (insert (this-command-keys)) | |
552 (error "No line number expression.")) | |
553 (goto-char (match-beginning 0)) | |
554 (setq error-line (string-to-int | |
555 (buffer-substring (match-beginning 1) (match-end 1))) | |
70 | 556 error-file (expand-file-name |
557 (YaTeX-get-error-file YaTeX-current-TeX-buffer))) | |
52 | 558 (YaTeX-set-virtual-error-position 'error-file 'error-line) |
559 (setq error-buf (YaTeX-switch-to-buffer error-file t))) | |
51 | 560 (if (null error-buf) |
561 (error "`%s' is not found in this directory." error-file)) | |
562 (YaTeX-showup-buffer error-buf nil t) | |
69 | 563 (goto-line error-line))) |
51 | 564 |
565 (defun YaTeX-send-string () | |
566 "Send string to current typeset process." | |
567 (interactive) | |
568 (if (and (eq (process-status YaTeX-typeset-process) 'run) | |
569 (>= (point) (process-mark YaTeX-typeset-process))) | |
570 (let ((b (process-mark YaTeX-typeset-process)) | |
571 (e (point-end-of-line))) | |
572 (goto-char b) | |
573 (skip-chars-forward " \t" e) | |
574 (setq b (point)) | |
575 (process-send-string | |
576 YaTeX-typeset-process (concat (buffer-substring b e) "\n")) | |
577 (goto-char e) | |
578 (insert "\n") | |
579 (set-marker (process-mark YaTeX-typeset-process) (point)) | |
580 (insert " ")) | |
69 | 581 (ding))) |
51 | 582 |
583 (defun YaTeX-view-error () | |
584 (interactive) | |
585 (if (null (get-buffer YaTeX-typeset-buffer)) | |
586 (message "No typeset buffer found.") | |
587 (let ((win (selected-window))) | |
588 (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) | |
589 ;; Next 3 lines are obsolete because YaTeX-typesetting-buffer is | |
590 ;; automatically scrolled up at typesetting. | |
591 ;;(goto-char (point-max)) | |
592 ;;(forward-line -1) | |
593 ;;(recenter -1) | |
69 | 594 (select-window win)))) |
51 | 595 |
596 (defun YaTeX-get-error-file (default) | |
597 "Get current processing file from typesetting log." | |
598 (save-excursion | |
599 (let(s) | |
600 (condition-case () (up-list -1) | |
601 (error | |
602 (let ((list 0) found) | |
603 (while | |
604 (and (<= list 0) (not found) | |
605 (re-search-backward "\\((\\)\\|\\()\\)" nil t)) | |
606 (if (equal (match-beginning 0) (match-beginning 2)) ;close paren. | |
607 (setq list (1- list)) ;open paren | |
608 (setq list (1+ list)) | |
609 (if (= list 1) | |
610 (if (looking-at "\\([^,{}%]+\.\\)tex\\|sty") | |
611 (setq found t) | |
612 (setq list (1- list))))))))) | |
613 (setq s | |
614 (buffer-substring | |
615 (progn (forward-char 1) (point)) | |
616 (progn (skip-chars-forward "^ \n" (point-end-of-line)) | |
617 (point)))) | |
69 | 618 (if (string= "" s) default s)))) |
51 | 619 |
620 (defun YaTeX-put-nonstopmode () | |
64 | 621 (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) |
51 | 622 (if (re-search-backward "\\\\nonstopmode{}" (point-min) t) |
623 nil ;if already written in text then do nothing | |
624 (save-excursion | |
625 (YaTeX-visit-main t) | |
626 (goto-char (point-min)) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
627 (insert "\\nonstopmode{}%_YaTeX_%\n") |
69 | 628 (if (buffer-file-name) (basic-save-buffer)))))) |
51 | 629 |
630 (defun YaTeX-remove-nonstopmode () | |
64 | 631 (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) ;for speed |
51 | 632 (save-excursion |
633 (YaTeX-visit-main t) | |
634 (goto-char (point-min)) | |
635 (forward-line 1) | |
636 (narrow-to-region (point-min) (point)) | |
637 (goto-char (point-min)) | |
638 (delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$") | |
69 | 639 (widen)))) |
51 | 640 |
641 (defun YaTeX-get-preview-file-name () | |
642 "Get file name to preview by inquiring YaTeX-get-latex-command" | |
643 (let* ((latex-cmd (YaTeX-get-latex-command t)) | |
644 (rin (rindex latex-cmd ? )) | |
645 (fname (if (> rin -1) (substring latex-cmd (1+ rin)) "")) | |
646 (period)) | |
647 (if (string= fname "") | |
648 (setq fname (substring (file-name-nondirectory | |
649 (buffer-file-name)) | |
650 0 -4)) | |
651 (setq period (rindex fname ?.)) | |
69 | 652 (setq fname (substring fname 0 (if (eq -1 period) nil period)))))) |
51 | 653 |
654 (defun YaTeX-get-latex-command (&optional switch) | |
655 "Specify the latex-command name and its argument. | |
656 If there is a line which begins with string: \"%#!\", the following | |
657 strings are assumed to be the latex-command and arguments. The | |
658 default value of latex-command is: | |
659 tex-command FileName | |
660 and if you write \"%#!jlatex\" in the beginning of certain line. | |
661 \"jlatex \" FileName | |
662 will be the latex-command, | |
663 and you write \"%#!jlatex main.tex\" on some line and argument SWITCH | |
664 is non-nil, then | |
665 \"jlatex main.tex\" | |
666 | |
667 will be given to the shell." | |
668 (let (magic command target) | |
669 (setq parent | |
670 (cond | |
671 (YaTeX-parent-file YaTeX-parent-file) | |
672 (t (save-excursion | |
673 (YaTeX-visit-main t) | |
674 (file-name-nondirectory (buffer-file-name))))) | |
675 magic (YaTeX-get-builtin "!")) | |
676 (cond | |
677 (magic | |
678 (cond | |
679 (switch (if (string-match "\\s " magic) magic | |
680 (concat magic " " parent))) | |
681 (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) | |
69 | 682 (t (concat tex-command " " (if switch parent)))))) |
51 | 683 |
684 (defvar YaTeX-lpr-command-history nil | |
685 "Holds command line history of YaTeX-lpr.") | |
686 (put 'YaTeX-lpr-command-history 'no-default t) | |
687 (defun YaTeX-lpr (arg) | |
688 "Print out. If prefix arg ARG is non nil, call print driver without | |
689 page range description." | |
690 (interactive "P") | |
691 (let*((cmd (or (YaTeX-get-builtin "LPR") dviprint-command-format)) | |
52 | 692 from to (lbuffer "*dvi-printing*") dir) |
51 | 693 (setq |
694 cmd | |
695 (YaTeX-replace-format | |
696 cmd "f" | |
697 (if (or arg (not (string-match "%f" cmd))) | |
698 "" | |
699 (YaTeX-replace-format | |
700 dviprint-from-format | |
701 "b" | |
702 (if (string= | |
703 (setq from (read-string "From page(default 1): ")) "") | |
704 "1" from)))) | |
705 ) | |
706 (setq | |
707 cmd | |
708 (YaTeX-replace-format | |
709 cmd "t" | |
710 (if (or arg (not (string-match "%t" cmd)) | |
711 (string= | |
712 (setq to (read-string "To page(default none): ")) "")) | |
713 "" | |
714 (YaTeX-replace-format dviprint-to-format "e" to))) | |
715 ) | |
72 | 716 (setq |
717 cmd | |
718 (YaTeX-replace-format | |
719 cmd "p" | |
720 (cdr (assoc (YaTeX-get-paper-type) YaTeX-dvips-paper-option-alist)))) | |
51 | 721 (setq cmd |
722 (read-string-with-history | |
723 "Edit command line: " | |
53
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
724 (format cmd |
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
725 (if (get 'dvi2-command 'region) |
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
726 (substring YaTeX-texput-file |
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
727 0 (rindex YaTeX-texput-file ?.)) |
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
728 (YaTeX-get-preview-file-name))) |
51 | 729 'YaTeX-lpr-command-history)) |
730 (save-excursion | |
731 (YaTeX-visit-main t) ;;change execution directory | |
52 | 732 (setq dir default-directory) |
51 | 733 (YaTeX-showup-buffer |
734 lbuffer (function (lambda (x) (nth 3 (window-edges x))))) | |
735 (set-buffer (get-buffer-create lbuffer)) | |
736 (erase-buffer) | |
52 | 737 (cd dir) ;for 19 |
51 | 738 (cond |
64 | 739 ((not (fboundp 'start-process)) |
51 | 740 (call-process shell-file-name "con" "*dvi-printing*" nil |
741 YaTeX-shell-command-option cmd)) | |
742 (t | |
743 (set-process-buffer | |
744 (start-process "print" "*dvi-printing*" shell-file-name | |
745 YaTeX-shell-command-option cmd) | |
746 (get-buffer lbuffer)) | |
69 | 747 (message "Starting printing command: %s..." cmd)))))) |
51 | 748 |
749 (defun YaTeX-main-file-p () | |
750 "Return if current buffer is main LaTeX source." | |
751 (cond | |
52 | 752 (YaTeX-parent-file |
753 (eq (get-file-buffer YaTeX-parent-file) (current-buffer))) | |
51 | 754 ((YaTeX-get-builtin "!") |
70 | 755 (string-match |
756 (concat "^" (YaTeX-guess-parent (YaTeX-get-builtin "!"))) | |
757 (buffer-name))) | |
51 | 758 (t |
759 (save-excursion | |
57 | 760 (let ((latex-main-id |
761 (concat "^\\s *" YaTeX-ec-regexp "document\\(style\\|class\\)"))) | |
51 | 762 (or (re-search-backward latex-main-id nil t) |
69 | 763 (re-search-forward latex-main-id nil t))))))) |
51 | 764 |
765 (defun YaTeX-visit-main (&optional setbuf) | |
766 "Switch buffer to main LaTeX source. | |
767 Use set-buffer instead of switch-to-buffer if the optional second argument | |
768 SETBUF is t(Use it only from Emacs-Lisp program)." | |
769 (interactive "P") | |
770 (if (and (interactive-p) setbuf) (setq YaTeX-parent-file nil)) | |
70 | 771 (let ((ff (function (lambda (f) |
772 (if setbuf (set-buffer (find-file-noselect f)) | |
773 (find-file f))))) | |
774 b-in main-file YaTeX-create-file-prefix-g | |
775 (hilit-auto-highlight (not setbuf))) | |
51 | 776 (if (setq b-in (YaTeX-get-builtin "!")) |
777 (setq main-file (YaTeX-guess-parent b-in))) | |
778 (if YaTeX-parent-file | |
779 (setq main-file ;;(get-file-buffer YaTeX-parent-file) | |
780 YaTeX-parent-file)) | |
781 (if (YaTeX-main-file-p) | |
782 (if (interactive-p) (message "I think this is main LaTeX source.") nil) | |
783 (cond | |
70 | 784 ((and ;;(interactive-p) |
785 main-file | |
786 (cond ((get-file-buffer main-file) | |
787 (cond | |
788 (setbuf (set-buffer (get-file-buffer main-file))) | |
789 ((get-buffer-window (get-file-buffer main-file)) | |
790 (select-window | |
791 (get-buffer-window (get-file-buffer main-file)))) | |
792 (t (switch-to-buffer (get-file-buffer main-file))))) | |
793 ((file-exists-p main-file) | |
794 (funcall ff main-file))))) | |
795 ;;((and main-file (YaTeX-switch-to-buffer main-file setbuf))) | |
51 | 796 ((and main-file |
797 (file-exists-p (setq main-file (concat "../" main-file))) | |
798 (y-or-n-p (concat (expand-file-name main-file) | |
799 " is main file?:"))) | |
800 (setq YaTeX-parent-file main-file) | |
70 | 801 ;(YaTeX-switch-to-buffer main-file setbuf) |
802 (funcall ff main-file) | |
803 ) | |
51 | 804 (t (setq main-file (read-file-name "Enter your main text: " nil nil 1)) |
805 (setq YaTeX-parent-file main-file) | |
70 | 806 ; (YaTeX-switch-to-buffer main-file setbuf)) |
807 (funcall ff main-file)) | |
51 | 808 ))) |
69 | 809 nil) |
51 | 810 |
811 (defun YaTeX-guess-parent (command-line) | |
812 (setq command-line | |
813 (if (string-match ".*\\s " command-line) | |
814 (substring command-line (match-end 0)) | |
815 (file-name-nondirectory (buffer-file-name))) | |
816 command-line | |
817 (concat (if (string-match "\\(.*\\)\\." command-line) | |
818 (substring command-line (match-beginning 1) (match-end 1)) | |
819 command-line) | |
69 | 820 ".tex"))) |
51 | 821 |
822 (defun YaTeX-visit-main-other-window () | |
823 "Switch to buffer main LaTeX source in other window." | |
824 (interactive) | |
825 (if (YaTeX-main-file-p) (message "I think this is main LaTeX source.") | |
826 (YaTeX-switch-to-buffer-other-window | |
69 | 827 (concat (YaTeX-get-preview-file-name) ".tex")))) |
51 | 828 |
829 (defun YaTeX-get-builtin (key) | |
830 "Read source built-in command of %# usage." | |
831 (save-excursion | |
832 (goto-char (point-min)) | |
833 (if (and (re-search-forward | |
834 (concat "^" (regexp-quote (concat "%#" key))) nil t) | |
835 (not (eolp))) | |
836 (buffer-substring | |
837 (progn (skip-chars-forward " " (point-end-of-line))(point)) | |
838 (point-end-of-line)) | |
69 | 839 nil))) |
51 | 840 |
841 (defun YaTeX-save-buffers () | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
842 "Save buffers whose major-mode is equal to current major-mode." |
51 | 843 (basic-save-buffer) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
844 (let ((cmm major-mode)) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
845 (save-excursion |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
846 (mapcar '(lambda (buf) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
847 (set-buffer buf) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
848 (if (and (buffer-file-name buf) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
849 (eq major-mode cmm) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
850 (buffer-modified-p buf) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
851 (y-or-n-p (format "Save %s" (buffer-name buf)))) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
852 (save-buffer buf))) |
69 | 853 (buffer-list))))) |
51 | 854 |
855 (provide 'yatexprc) |