yatex
changeset 1:912f6e258cba
Support %#! usage to specify latex command.
Change default fill-prefix to "".
author | yuuji |
---|---|
date | Wed, 22 Jul 1992 19:43:36 +0000 |
parents | 9c72144baf95 |
children | a61027172238 |
files | yatex.el |
diffstat | 1 files changed, 84 insertions(+), 19 deletions(-) [+] |
line diff
1.1 --- a/yatex.el Mon Jul 20 14:41:40 1992 +0000 1.2 +++ b/yatex.el Wed Jul 22 19:43:36 1992 +0000 1.3 @@ -1,11 +1,11 @@ 1.4 ;;; -*- Emacs-Lisp -*- 1.5 ;;; Yet Another tex-mode for emacs. 1.6 -;;; yatex.el rev.1.27 1.7 +;;; yatex.el rev.1.28 1.8 ;;; (c)1991 by Hirose Yuuji.[yuuji@ae.keio.ac.jp] 1.9 -;;; Last modified Thu Jun 4 20:03:06 1992 on figaro 1.10 +;;; Last modified Mon Jul 20 21:46:13 1992 on figaro 1.11 1.12 (provide 'yatex-mode) 1.13 -(defconst YaTeX-revision-number "1.27" 1.14 +(defconst YaTeX-revision-number "1.28" 1.15 "Revision number of running yatex.el" 1.16 ) 1.17 1.18 @@ -24,7 +24,7 @@ 1.19 (defvar YaTeX-open-lines 1 1.20 "Blank lines between text and \??{??}" 1.21 ) 1.22 -(defvar YaTeX-fill-prefix "\t" 1.23 +(defvar YaTeX-fill-prefix "" 1.24 "fill-prefix used for auto-fill-mode. 1.25 The defalut value is single TAB." 1.26 ) 1.27 @@ -50,7 +50,9 @@ 1.28 "Regular expression of line number of latex error. Perhaps your latex 1.29 command stops at this error message with line number of LaTeX source text." 1.30 ) 1.31 -(defvar latex-dos-emergency-message "Emergency stop" 1.32 +(defvar latex-dos-emergency-message 1.33 + ;;"Emergency stop" ;<- for Micro tex, ASCII-pTeX 1.6 1.34 + "No pages of output." ;<- for ASCII-pTeX 1.7 1.35 "Because Demacs (GNU Emacs on DOS) cannot have pararell process, the 1.36 latex command which is stopping on a LaTeX error, is terminated by Demacs. 1.37 Many latex command on DOS display some message when it is terminated by 1.38 @@ -240,13 +242,6 @@ 1.39 1.40 ;---------- Customize as you like above ---------- 1.41 1.42 -;---------- Kanji code selection ---------- 1.43 -(if (eq system-type 'ms-dos) 1.44 - (setq YaTeX-kanji-code 1) 1.45 - (setq YaTeX-kanji-code 2)) 1.46 - 1.47 -(setq kanji-display-code YaTeX-kanji-code 1.48 - kanji-fileio-code YaTeX-kanji-code) 1.49 ;---------- Define other variable ---------- 1.50 (defvar env-name "document") ;Initial tex-environment completion 1.51 (defvar section-name "documentstyle[12pt]") ;Initial tex-section completion 1.52 @@ -267,8 +262,15 @@ 1.53 (interactive) 1.54 (kill-all-local-variables) 1.55 (setq major-mode 'YaTeX-mode) 1.56 - (setq mode-name "$@$d$F$U$b!<$I(J") 1.57 + (setq mode-name "やてふもーど") 1.58 (turn-on-auto-fill) 1.59 + (make-local-variable 'kanji-display-code) 1.60 + (make-local-variable 'kanji-fileio-code) 1.61 + (if (eq system-type 'ms-dos) 1.62 + (setq YaTeX-kanji-code 1) 1.63 + (defvar YaTeX-kanji-code 2)) 1.64 + (setq kanji-display-code YaTeX-kanji-code 1.65 + kanji-fileio-code YaTeX-kanji-code) 1.66 (make-local-variable 'fill-column) 1.67 (make-local-variable 'fill-prefix) 1.68 (setq fill-column 72 1.69 @@ -541,7 +543,7 @@ 1.70 "Return string of the version of running YaTeX." 1.71 (interactive) 1.72 (message 1.73 - (concat "Yet Another TeX mode $@!VLnD;!W(J Revision " 1.74 + (concat "Yet Another TeX mode 「野鳥」 Revision " 1.75 YaTeX-revision-number)) 1.76 ) 1.77 1.78 @@ -587,7 +589,6 @@ 1.79 (defun YaTeX-compile () 1.80 "Execute jlatex (or other) to LaTeX compile." 1.81 (interactive) 1.82 - (basic-save-buffer) 1.83 (if YaTeX-compilation-process 1.84 (if (eq (process-status YaTeX-compilation-process) 'run) 1.85 (progn (interrupt-process YaTeX-compilation-process) 1.86 @@ -600,12 +601,20 @@ 1.87 (if (eq system-type 'ms-dos) ;if MS-DOS 1.88 (with-output-to-temp-buffer "*YaTeX-compilation*" 1.89 (message (concat "Compiling " (buffer-name) "...")) 1.90 - (call-process shell-file-name nil "*YaTeX-compilation*" nil 1.91 - "/c " tex-command (buffer-name) )) 1.92 + (YaTeX-put-nonstopmode) 1.93 + (basic-save-buffer) 1.94 + (call-process shell-file-name 1.95 + nil 1.96 + "*YaTeX-compilation*" nil 1.97 + "/c" (YaTeX-get-latex-command)) 1.98 + ;;;"/c " tex-command (buffer-name) ) 1.99 + (YaTeX-remove-nonstopmode)) 1.100 (setq YaTeX-compilation-process ;if UNIX 1.101 (with-output-to-temp-buffer "*YaTeX-compilation*" 1.102 + (basic-save-buffer) 1.103 (start-process "LaTeX" "*YaTeX-compilation*" shell-file-name "-c" 1.104 - (concat tex-command " "(buffer-name) "")) 1.105 + (YaTeX-get-latex-command)) 1.106 + ;;;tex-command (buffer-name) "") 1.107 )) 1.108 (set-process-sentinel YaTeX-compilation-process 'YaTeX-compile-sentinel)) 1.109 (setq current-TeX-buffer (buffer-name)) 1.110 @@ -671,7 +680,7 @@ 1.111 (re-search-forward "[0-9]") 1.112 (forward-char -1) 1.113 (set-mark (point)) 1.114 - (skip-chars-forward "[0-9]") 1.115 + (skip-chars-forward "0-9") 1.116 (narrow-to-region (point) (mark)) 1.117 (goto-char (point-min)) 1.118 (setq YaTeX-error-line (read (current-buffer)))) 1.119 @@ -718,6 +727,60 @@ 1.120 (other-window -1) 1.121 ) 1.122 1.123 +(defun YaTeX-put-nonstopmode () 1.124 + (if (boundp 'YaTeX-need-nonstop) 1.125 + (if (re-search-backward "\\nonstopmode{}" (point-min) t) 1.126 + nil ;if already written in text then do nothing 1.127 + (save-excursion 1.128 + (goto-char (point-min)) 1.129 + (insert "\\nonstopmode{}%_YaTeX_%\n"))) 1.130 + ) 1.131 +) 1.132 + 1.133 +(defun YaTeX-remove-nonstopmode () 1.134 + (if (boundp 'YaTeX-need-nonstop) ;for speed 1.135 + (save-excursion 1.136 + (goto-char (point-min)) 1.137 + (forward-line 1) 1.138 + (narrow-to-region (point-min) (point)) 1.139 + (goto-char (point-min)) 1.140 + (delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$") 1.141 + (widen))) 1.142 +) 1.143 + 1.144 +(defun YaTeX-get-latex-command () 1.145 + "Specify the latex-command name and its argument. 1.146 +If there is a line which begins by string: \"%#!\", the following 1.147 +strings are assumed to be the latex-command and arguments. The 1.148 +default value of latex-command is: 1.149 + tex-command (buffer-name) 1.150 +and if you write \"%#!jlatex\" in the beginning of certain line. 1.151 + \"jlatex \" (buffer-name) 1.152 +will be the latex-command, 1.153 +and you write \"%#!jlatex main.tex\" 1.154 + \"jlatex main.tex\" 1.155 +will be given to the shell." 1.156 + (let* 1.157 + ((default-command 1.158 + (concat tex-command " " (buffer-name)))) ;default value 1.159 + (save-excursion 1.160 + (goto-char (point-min)) 1.161 + (if (null (re-search-forward "^%#!" (point-max) t)) 1.162 + default-command 1.163 + (skip-chars-forward "%#! ") 1.164 + (if (eolp) 1.165 + default-command 1.166 + (let ((s (point))) 1.167 + (skip-chars-forward "A-z") ;Skip command name 1.168 + ;(setq YaTeX-latex-command (buffer-substring s (point))) 1.169 + (if (eolp) ;Only change command name 1.170 + (concat (buffer-substring s (point)) " " (buffer-name)) 1.171 + (end-of-line) ;Change entire command name 1.172 + (buffer-substring s (point)) ;including arguments. 1.173 + )) 1.174 + )))) 1.175 +) 1.176 + 1.177 (defun YaTeX-read-user-completion-table () 1.178 "Append user completion table of LaTeX word" 1.179 (message "Loading personal completion table") 1.180 @@ -825,6 +888,8 @@ 1.181 ; | | append-kill-emacs-hook was revised to append-to-hook. 1.182 ; 1.26 | 1/18 | Region mode is added to {\large }. Default fontsize. 1.183 ; 1.27 | 1/21 | Default name on completing-read, 1.184 +; 1.28 | 7/ 2 | Add \nonstopmode{} automatically on DOS. 1.185 +; | 7/20 | %#! usage to specify latex command and its arguments. 1.186 ;------+----------+--------------------------------------------------------- 1.187 ; 1.188 ;----------------------------- End of yatex.el -----------------------------