yatex
changeset 64:36a48185b95a
Changes are listed in yatex.new.
Major one is supporing GNU Emacs20 and XEmacs.
author | yuuji |
---|---|
date | Tue, 16 Dec 1997 13:28:38 +0000 |
parents | 6ad4a2399731 |
children | df0bf1465254 |
files | docs/htmlqa docs/yatexj.tex yahtml.el yatex.el yatex.new yatex19.el yatexadd.el yatexenv.el yatexlib.el yatexmth.el yatexprc.el yatexsec.el |
diffstat | 12 files changed, 1418 insertions(+), 882 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docs/htmlqa Tue Dec 16 13:28:38 1997 +0000 1.3 @@ -0,0 +1,98 @@ 1.4 +%% 1.5 +%% Q and A on yahtml 1.6 +%% 1.7 +%% C-u C-x $ とすると質問項目だけ表示されます。C-x $ で元に戻ります。 1.8 +%% 1.9 + 1.10 + 1.11 +■インストール関連 1.12 +・LaTeX使わないんだけど野鳥も入れなきゃダメですか? 1.13 + 1.14 + そうなにょ。野鳥のライブラリ関数を使っているので野鳥も棲まわせて 1.15 + やって下さいまし。 1.16 + 1.17 +■カスタマイズ関連 1.18 +・いつもは EUC にしてたまに JIS コードのファイルを作りたいんだけど。 1.19 + 1.20 + ~/.emacs で 1.21 + (setq yahtml-kanji-code 3) ;3はEUC 1.22 + しておけば普段のhtmlコードはEUCになります。JISにしたいときは、 1.23 + htmlソースのお尻に、 1.24 + 1.25 + <!-- Local Variables: --> 1.26 + <!-- file-coding-system: *junet* --> 1.27 + <!-- End: --> 1.28 + 1.29 + と書いておけばそのファイルだけJISになります。 1.30 + 1.31 +■どうにかならんかなあ関連 1.32 +・長い文書の下の方だとインデントがめちゃ遅いんだけど。 1.33 + 1.34 + 今は直ってるはずです…。 1.35 + 1.36 +・いつも雛型として使っている template.html を簡単に入れたい 1.37 + 1.38 + autoinsert.el (Emacs19/Mule2付属)を使いましょう。もしくは、それ 1.39 + の機能強化版 auto-insert-tkld を使いましょう。後者は、 1.40 + ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/auto-inset-tkld.tar.Z 1.41 + で入手できます。 1.42 + http://www-nagao.kuee.kyoto-u.ac.jp/member/tsuchiya/elisp-tips.html#yahtml-mode-hook 1.43 + に設定例が書いてあります。 1.44 + 1.45 +■その他 1.46 +・yahtmlってなんてよむの? 1.47 + 1.48 + がーん、良く聞かれます。 1.49 + 作者も良く分かってません。えへん。 1.50 + というかかちょいい読み方が思い浮かばないもので。 1.51 + なんかいい読み方ないすか? 1.52 + 突然思い付きました。正しい呼称は 1.53 + 1.54 + 『HTML屋』 1.55 + 1.56 + とします。 1.57 + 1.58 +・メイリングリストはないんですか? 1.59 + 1.60 + っていう質問項目があるくらいだからあります。「yahtml」およびそのVz 1.61 + への移植版「laihtml」(by katsura@prc.tsukuba.ac.jp)、Wzへの移植版 1.62 + 「hackhtml」(by lh57024@hongo.ecc.u-tokyo.ac.jp) に関する情報交換の 1.63 + ためのメイリングリスト「fj野鳥の会」がそれです。 1.64 + 1.65 + To: yatex-control@jaist.ac.jp 1.66 + Subject: append 1.67 + ----- 1.68 + たぐでーし。明けましておめでとうございまーす。 1.69 + 1.70 + のようにメイルを送れば加入できます。この時本文に書いた内容がプロ 1.71 + フィールとして登録されます(変更可)。手続きは全て自動で行われ、登 1.72 + 録が完了すると確認とともに、参加/休止/脱会等の制御コマンドの利用 1.73 + 方法が返送されます。是非参加して一緒に野鳥/雷鳥/白鳥を育ててくだ 1.74 + さい。 1.75 + 1.76 +・yahtmlの最新情報は? 1.77 + 1.78 + もしあなたが、WWWにアクセスできるなら、 1.79 + http://www.comp.ae.keio.ac.jp/~yuuji/yatex/ 1.80 + を覗いてみて下さい。このなかの、「yatex-current」というリンクを 1.81 + たどると最新版の野鳥を入手することができます。ただし、正式リリー 1.82 + ス版ではなく、作者がデバッグ中だったりして正常に動作しない可能性 1.83 + があるので、current版に関する問い合わせは受けかねますのでご注意 1.84 + 下さい。 1.85 + 1.86 +・とにかくわかりませーん! 1.87 + 1.88 + 回答を得るまでの早い順に 1.89 + 1.90 + ・近くにいる詳しい人に聞く 1.91 + ・メイリングリストに質問を出す 1.92 + ・yuuji@ae.keio.ac.jp に質問を出す 1.93 + 1.94 + でしょうか。お好きな方法でどうぞ。 1.95 + 1.96 + 1.97 +Local Variables: 1.98 +mode: indented-text 1.99 +fill-column: 72 1.100 +fill-prefix: " " 1.101 +End:
2.1 --- a/docs/yatexj.tex Sat Dec 13 12:41:43 1997 +0000 2.2 +++ b/docs/yatexj.tex Tue Dec 16 13:28:38 1997 +0000 2.3 @@ -5,6 +5,9 @@ 2.4 2.5 @iftex 2.6 @c @syncodeindex fn cp 2.7 +@c いつも忘れるのでここに書いとくか。 2.8 +@c ノードいじったら C-l C-u C-e 2.9 +@c メニュー増やしたら C-l C-u C-m 2.10 @syncodeindex vr cp 2.11 @end iftex 2.12 2.13 @@ -14,7 +17,7 @@ 2.14 @subtitle Yet Another tex-mode for emacs 2.15 @title 『野鳥』 2.16 @subtitle // YaTeX // 2.17 -@author @copyright{} 1991-1996 by HIROSE, Yuuji [yuuji@@ae.keio.ac.jp] 2.18 +@author @copyright{} 1991-1997 by HIROSE, Yuuji [yuuji@@ae.keio.ac.jp] 2.19 @end titlepage 2.20 2.21 @node Top, Intro, (dir), (dir) 2.22 @@ -227,7 +230,9 @@ 2.23 @item dvi2-command 2.24 @dots{} 起動するプレヴューアのコマンド名 2.25 @item NTT-jTeX 2.26 - @dots{} NTT jTeX を使用するなら t 2.27 + @dots{} 改行+インデントによって、タイプセット後の字間が空いてしま 2.28 + うのを抑制する場合にtにする(古いNTT-jTeXで顕著に現れる)。具体的には、 2.29 + fillするときに各行の終わりに%を付加するようになる。 2.30 @item YaTeX-kanji-code 2.31 @dots{} 文書を作成する時の漢字コード 2.32 @item dviprint-command-format 2.33 @@ -1247,7 +1252,7 @@ 2.34 いる拡張子を「ファイル名」の後ろに足したファイルが存在するか順次調べて、存 2.35 在した場合car部に入っているコマンドを起動する。 2.36 @item 2.37 -以上どれかにマッチしなければあきる。 2.38 +以上どれかにマッチしなければあきらめる。 2.39 @end enumerate 2.40 2.41 2.42 @@ -1865,7 +1870,9 @@ 2.43 @end defvar 2.44 2.45 @defvar NTT-jTeX 2.46 -NTT-j@TeX{}使用時は@code{t}にする (@code{nil}) 2.47 +古いNTT-j@TeX{}使用時のようにインデントした行の先頭と前の行の 2.48 +(タイプセット後の)字間が空いてしまうのを嫌う場合は@code{t}にする 2.49 +(@code{nil}) 2.50 @end defvar 2.51 2.52 @defvar YaTeX-item-regexp 2.53 @@ -1976,6 +1983,10 @@ 2.54 AMS-LaTeX を使用する場合は @code{t} に設定する (@code{nil}) 2.55 @end defvar 2.56 2.57 +@defvar YaTeX-template-file 2.58 +新規ファイル作成時に自動挿入するファイル名 (@code{~/work/template.tex}) 2.59 +@end defvar 2.60 + 2.61 @node Sample definitions, Hook variables, All customizable variables, Lisp variables 2.62 @comment node-name, next, previous, up 2.63 @subsection カスタマイズ変数設定例
3.1 --- a/yahtml.el Sat Dec 13 12:41:43 1997 +0000 3.2 +++ b/yahtml.el Tue Dec 16 13:28:38 1997 +0000 3.3 @@ -1,6 +1,6 @@ 3.4 ;;; -*- Emacs-Lisp -*- 3.5 ;;; (c ) 1994-1997 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 3.6 -;;; Last modified Mon Apr 7 16:58:32 1997 on crx 3.7 +;;; Last modified Tue Dec 16 21:10:05 1997 on crx 3.8 ;;; $Id$ 3.9 3.10 ;;;[Installation] 3.11 @@ -18,6 +18,22 @@ 3.12 ;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji"))) 3.13 ;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path. 3.14 ;;; 3.15 +;;;[インストール方法] 3.16 +;;; 3.17 +;;; yahtml.el, yatexlib.el, yatexprc.el を load-path の通ったディレクト 3.18 +;;; リにインストールしてください。その後、以下を参考に ~/.emacs に設定を 3.19 +;;; 追加して下さい。 3.20 +;;; 3.21 +;;; (setq auto-mode-alist 3.22 +;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) 3.23 +;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) 3.24 +;;; (setq yahtml-www-browser "netscape") 3.25 +;;; ;お気に入りのブラウザを書いて下さい。netscapeが便利です。 3.26 +;;; (setq yahtml-path-url-alist 3.27 +;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji") 3.28 +;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji"))) 3.29 +;;; ;UNIXの絶対パスと対応するURLのリストを書いて下さい。 3.30 +;;; 3.31 ;;;[Commentary] 3.32 ;;; 3.33 ;;; It is assumed you are already familiar with YaTeX. The following 3.34 @@ -29,15 +45,16 @@ 3.35 ;;; this group 3.36 ;;; When input `href=...', you can complete file 3.37 ;;; name or label(href="#foo") by typing TAB. 3.38 -;;; * [prefix] s Complete declarative notations such as 3.39 -;;; `<img src="foo.gif">' 3.40 -;;; `<input name="var" ...>' 3.41 ;;; * [prefix] l Complete typeface-changing commands such as 3.42 ;;; `<i> ... </i>' or `<samp> ... </samp>' 3.43 ;;; This completion can be used to make in-line 3.44 ;;; tags which is normally completed with [prefix] b. 3.45 +;;; * [prefix] s Complete declarative notations such as 3.46 +;;; `<img src="foo.gif">' 3.47 +;;; `<input name="var" ...>' 3.48 ;;; * [prefix] m Complete single commands such as 3.49 ;;; `<br>' or `<hr> or <li>...' 3.50 +;;; * [prefix] p Insert <p></p> on the point 3.51 ;;; * M-RET Intelligent newline; if current TAG is one of 3.52 ;;; ul, ol, or dl. insert newline and <li> or 3.53 ;;; <dt> or <dd> suitable for current condition. 3.54 @@ -59,35 +76,116 @@ 3.55 ;;; * [prefix] a YaTeX's accent mark's equivalent of yahtml. 3.56 ;;; This function can input $lt, $gt or so. 3.57 ;;; 3.58 +;;;[キーの説明] 3.59 +;;; 3.60 +;;; 以下の説明において、特にカスタマイズをしていない限り、[prefix] は 3.61 +;;; C-c キーを意味します。 3.62 +;;; 3.63 +;;; * [prefix] b X `</H1>' といった終了タグが必要となる`H1'のよう 3.64 +;;; な環境を補完入力します。<a href=foo> ... </a> 3.65 +;;; もこのグループです。 3.66 +;;; `href=...' と入力した後、TABキーを押すことで、 3.67 +;;; ファイル名や (href="#foo") のようなラベルも補完 3.68 +;;; できます。 3.69 +;;; * [prefix] s 以下のような宣言の補完を行います。 3.70 +;;; `<img src="foo.gif">' 3.71 +;;; `<input name="var" ...>' 3.72 +;;; * [prefix] l `<i> ... </i>' や `<samp> ... </samp>' のよう 3.73 +;;; なテキストスタイル指定のタグを補完します。 3.74 +;;; この補完機能は通常 [prefix] b で補完できるものを 3.75 +;;; 一行内で書きたいときにも用いることが出来ます。 3.76 +;;; * [prefix] m `<br>' や `<hr> '、`<li>' 等の単体タグの補完 3.77 +;;; を行います。 3.78 +;;; * [prefix] p カーソル位置に<p></p>を挿入します。 3.79 +;;; * M-RET おまかせ改行; もしul、ol、dl等のタグ(リスト)を 3.80 +;;; 使っている場合に、環境に合わせて改行と <li>、 3.81 +;;; <dt>、<dd>を入力します。 3.82 +;;; * menu-bar yahtml 選択したアイテムをメニューより補完できます。 3.83 +;;; (私はメニューが嫌いなんですが、htmlに関してはメ 3.84 +;;; ニューは一番ありがたいかも) 3.85 +;;; * [prefix] g 対応するタグ、<dl> <-> </dl> や href="xxx" の 3.86 +;;; ような TAG にジャンプします。 3.87 +;;; <img src=...> の場合はイメージビューワを呼び出 3.88 +;;; します。href=hoge.html の場合はhoge.htmlに飛びま 3.89 +;;; す。 3.90 +;;; * [prefix] k ポイント上の HTML タグを消去します。 3.91 +;;; もし universal-argument を付けた場合(C-uを先に押 3.92 +;;; す)HTMLタグで囲まれた内容も同時に消去します。 3.93 +;;; * [prefix] c ポイント上のタグを変更します。 3.94 +;;; `href="xxx"'の上で [prefix] c を利用した場合は、 3.95 +;;; 参照しているリンクを補完機能を使いながら変更で 3.96 +;;; きます。 3.97 +;;; * [prefix] t j カレントファイルに対して jweblint を呼び出しま 3.98 +;;; す。 3.99 +;;; * [prefix] t p WWW ブラウザでカレントファイルを表示します。 3.100 +;;; (lisp変数 yahtml-www-browser の設定をお忘れな 3.101 +;;; く。お推めは "netscape" で、ねすけの場合既にねす 3.102 +;;; けが起動されていた場合そのねすけに Reload 命令を 3.103 +;;; 送るという芸当が出来ます。ただし今のところX版の 3.104 +;;; ねすけちゃんだけ) 3.105 +;;; * [prefix] a YaTeX のアクセント記号補完と同じです。 3.106 +;;; < > 等が入力できます。 3.107 +;;; 3.108 +;;; [謝辞] 3.109 +;;; 3.110 +;;; fj野鳥の会の皆さんには貴重な助言を頂きました。また、下に示す方々には 3.111 +;;; 特に大きな協力を頂きました。あわせてここに感謝申し上げます。 3.112 +;;; 3.113 +;;; * 横田和也さん(マツダ) 3.114 +;;; マニュアルの和訳をして頂きました。 3.115 +;;; * 吉田尚志さん(NTT Data) 3.116 +;;; Mule for Win32 での動作のさせ方を教えて頂きました。 3.117 +;;; (というかほとんどやってもらった ^^;) 3.118 +;;; 3.119 3.120 3.121 -(require 'yatex) 3.122 +;(require 'yatex) 3.123 +(require 'yatexlib) 3.124 ;;; --- customizable variable starts here --- 3.125 +(defvar yahtml-prefix "\C-c" 3.126 + "*Prefix key stroke of yahtml functions.") 3.127 (defvar yahtml-image-viewer "xv" "*Image viewer program") 3.128 (defvar yahtml-www-browser "netscape" 3.129 "*WWW Browser command") 3.130 (defvar yahtml-kanji-code 2 3.131 - "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc") 3.132 + "*Kanji coding system number of html file; 1=sjis, 2=jis, 3=euc") 3.133 +(defvar yahtml-coding-system 3.134 + (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)) 3.135 + "Kanji coding system") 3.136 +(defvar yahtml-fill-column 72 "*fill culumn used for yahtml-mode") 3.137 +(defvar yahtml-fill-prefix nil "*fill prefix for yahtml-mode") 3.138 + 3.139 ;;(defvar yahtml-www-server "www" "*Host name of your domain's WWW server") 3.140 (defvar yahtml-path-url-alist nil 3.141 "*Alist of unix path name vs. URL name of WWW server. 3.142 Ex. 3.143 '((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\") 3.144 - (\"/usr/home/yuuji/darts/http\" . \"http://inspire.comp.ae.keio.ac.jp/~darts\"))") 3.145 + (\"/usr/home/yuuji/darts/http\" . \"http://darts.comp.ae.keio.ac.jp/~darts\"))") 3.146 (defvar yahtml-directory-index "index.html" 3.147 "*Directory index file name; 3.148 Consult your site's WWW administrator.") 3.149 3.150 -(defvar yahtml-environment-indent YaTeX-environment-indent 3.151 +(defvar yahtml-environment-indent 1 3.152 "*Indentation depth of HTML's listing environment") 3.153 3.154 +(defvar YaTeX-japan (or (boundp 'NEMACS) (boundp 'MULE) YaTeX-emacs-20) 3.155 + "Whether yatex mode is running on Japanese environment or not.") 3.156 + 3.157 (defvar yahtml-lint-program (if YaTeX-japan "jweblint" "weblint") 3.158 "*Program name to lint HTML file") 3.159 (defvar yahtml-hate-too-deep-indentation nil 3.160 "*Non-nil for this variable suppress deep indentation in listing environments.") 3.161 3.162 +(defvar yahtml-always-/p nil 3.163 + "*Those who always use <p> with </p> set this to t.") 3.164 + 3.165 +(defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\)" 3.166 + "*Regexp of envs where paragraphed sentences are prefered.") 3.167 + 3.168 +(defvar yahtml-template-file "~/http/template.html" 3.169 + "*Template HTML file. It'll be inserted to empty file.") 3.170 + 3.171 ;;; --- customizable variable ends here --- 3.172 - 3.173 (defvar yahtml-prefix-map nil) 3.174 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") 3.175 (defvar yahtml-lint-buffer-map nil "Keymap used in lint buffer.") 3.176 @@ -121,7 +219,7 @@ 3.177 (if yahtml-mode-map nil 3.178 (setq yahtml-mode-map (make-sparse-keymap) 3.179 yahtml-prefix-map (make-sparse-keymap)) 3.180 - (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) 3.181 + (define-key yahtml-mode-map yahtml-prefix yahtml-prefix-map) 3.182 (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend) 3.183 (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19) 3.184 (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend)) 3.185 @@ -129,7 +227,6 @@ 3.186 (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment) 3.187 (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline) 3.188 (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line) 3.189 - (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) 3.190 (let ((map yahtml-prefix-map)) 3.191 (YaTeX-define-key "^" 'yahtml-visit-main map) 3.192 (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map) 3.193 @@ -150,6 +247,7 @@ 3.194 (YaTeX-define-key "m" 'yahtml-insert-single map) 3.195 (YaTeX-define-key "n" '(lambda () (interactive) (insert (if yahtml-prefer-upcases "<BR>" "<br>"))) map) 3.196 (YaTeX-define-key "-" '(lambda () (interactive) (insert (if yahtml-prefer-upcases "<HR>" "<hr>") "\n")) map) 3.197 + (YaTeX-define-key "p" 'yahtml-insert-p map) 3.198 (if YaTeX-no-begend-shortcut 3.199 (progn 3.200 (YaTeX-define-key "B" 'yahtml-insert-begend-region map) 3.201 @@ -197,7 +295,7 @@ 3.202 "^$\\|<!--\\|^[ \t]*</?\\(h[1-6]\\|p\\|[bhtd][ldt]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\|table\\|center\\|blockquote\\|!--\\)\\b") 3.203 "*Regexp of html paragraph separater") 3.204 (defvar yahtml-syntax-table nil 3.205 - "*Syntax table for typesetting buffer") 3.206 + "*Syntax table for yahtml-mode") 3.207 3.208 (if yahtml-syntax-table nil 3.209 (setq yahtml-syntax-table 3.210 @@ -214,6 +312,7 @@ 3.211 '(("img") ("input"))) 3.212 (defvar yahtml-user-form-table nil) 3.213 (defvar yahtml-tmp-form-table nil) 3.214 +(defvar yahtml-last-form "img") 3.215 3.216 (defvar yahtml-env-table 3.217 '(("html") ("head") ("title") ("body") ("dl") ("ul") ("ol") ("pre") 3.218 @@ -224,7 +323,8 @@ 3.219 ("Preformatted" . "pre") 3.220 ("table") ("tr") ("th") ("td") 3.221 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") 3.222 - ("p"))) 3.223 + ;; ("p") ;This makes indentation screwed up! 3.224 + )) 3.225 3.226 (defvar yahtml-itemizing-regexp 3.227 "\\(ul\\|ul\\|dl\\)" 3.228 @@ -234,15 +334,19 @@ 3.229 (defvar yahtml-tmp-env-table nil) 3.230 3.231 ;;; Completion tables for typeface designator 3.232 +(and yahtml-always-/p 3.233 + (or (assoc "p" yahtml-env-table) 3.234 + (setq yahtml-env-table (cons '("p") yahtml-env-table)))) 3.235 + 3.236 (defvar yahtml-typeface-table 3.237 (append 3.238 '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") 3.239 - ("strong") ("var") ("b") ("i") ("tt") ("u") ("address")) 3.240 + ("strong") ("var") ("b") ("i") ("tt") ("u") ("address") ("font")) 3.241 yahtml-env-table) 3.242 "Default completion table of typeface designator") 3.243 (defvar yahtml-user-typeface-table nil) 3.244 (defvar yahtml-tmp-typeface-table nil) 3.245 -(defvar yahtml-last-typeface-cmd "address") 3.246 +(defvar yahtml-last-typeface-cmd "a") 3.247 3.248 (defvar yahtml-single-cmd-table 3.249 '(("hr") ("br") ("option") ("p") 3.250 @@ -269,57 +373,80 @@ 3.251 (mapconcat (function (lambda (x) (car x))) yahtml-typeface-table "\\|") 3.252 "\\)\\b") 3.253 "Regexp of structure beginning.") 3.254 +(or (assoc "p" yahtml-env-table) 3.255 + (setq yahtml-env-table (cons '("p") yahtml-env-table))) 3.256 3.257 (defun yahtml-mode () 3.258 (interactive) 3.259 - (yatex-mode) 3.260 (cond 3.261 - ((boundp 'MULE) 3.262 - (set-file-coding-system 3.263 - (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)))) 3.264 + ((and YaTeX-emacs-20 (fboundp 'coding-system-equal)) 3.265 + (if t (or (coding-system-equal 3.266 + yahtml-coding-system buffer-file-coding-system) 3.267 + (set-buffer-file-coding-system yahtml-coding-system)) 3.268 + ;;^v which is better? 3.269 + (let ((bmp (buffer-modified-p))) 3.270 + (set-buffer-file-coding-system yahtml-coding-system) 3.271 + (set-buffer-modified-p bmp)))) 3.272 + ((featurep 'mule) 3.273 + (set-file-coding-system yahtml-coding-system)) 3.274 ((boundp 'NEMACS) 3.275 (make-local-variable 'kanji-fileio-code) 3.276 (setq kanji-fileio-code yahtml-kanji-code))) 3.277 (setq major-mode 'yahtml-mode 3.278 mode-name "yahtml") 3.279 - (make-local-variable 'YaTeX-kanji-code) 3.280 - (make-local-variable 'YaTeX-ec) (setq YaTeX-ec "") 3.281 - (make-local-variable 'YaTeX-struct-begin) 3.282 - (setq YaTeX-struct-begin "<%1%2") 3.283 - (make-local-variable 'YaTeX-struct-end) (setq YaTeX-struct-end "</%1>") 3.284 - (make-local-variable 'YaTeX-struct-name-regexp) 3.285 - (setq YaTeX-struct-name-regexp yahtml-struct-name-regexp) 3.286 - (make-local-variable 'YaTeX-prefix-map) 3.287 - (make-local-variable 'YaTeX-command-token-regexp) 3.288 - (setq YaTeX-command-token-regexp yahtml-command-regexp) 3.289 - (make-local-variable 'YaTeX-comment-prefix) 3.290 - (setq YaTeX-comment-prefix "<!--") 3.291 - ;;(make-local-variable 'YaTeX-environment-indent) 3.292 - ;;(setq YaTeX-environment-indent 0) 3.293 - (make-local-variable 'fill-prefix) 3.294 - (setq fill-prefix nil) 3.295 - (make-local-variable 'paragraph-separate) 3.296 - (setq paragraph-start yahtml-paragraph-start 3.297 - paragraph-separate yahtml-paragraph-separate) 3.298 - (make-local-variable 'comment-start) 3.299 - (make-local-variable 'comment-end) 3.300 - (setq comment-start "<!-- " comment-end " -->") 3.301 - (make-local-variable 'indent-line-function) 3.302 - (setq indent-line-function 'yahtml-indent-line) 3.303 - (make-local-variable 'YaTeX-item-regexp) 3.304 - (setq YaTeX-item-regexp "<\\(li\\|d[td]\\)>") 3.305 - (make-local-variable 'YaTeX-typesetting-mode-map) 3.306 - (setq YaTeX-typesetting-mode-map yahtml-lint-buffer-map) 3.307 + (mapcar 3.308 + (function (lambda (x) 3.309 + (make-local-variable (car x)) 3.310 + (set (car x) (if (and (symbolp (cdr x)) 3.311 + (boundp (cdr x))) 3.312 + (symbol-value (cdr x)) 3.313 + (cdr x))))) 3.314 + '((YaTeX-ec . "") 3.315 + (YaTeX-struct-begin . "<%1%2") 3.316 + (YaTeX-struct-end . "</%1>") 3.317 + (YaTeX-struct-name-regexp . yahtml-struct-name-regexp) 3.318 + (YaTeX-comment-prefix . "<!--") 3.319 + (YaTeX-coding-system . yahtml-coding-system) 3.320 + (YaTeX-typesetting-mode-map . yahtml-lint-buffer-map) 3.321 + (fill-prefix . yahtml-fill-prefix) (fill-column . yahtml-fill-column) 3.322 + (paragraph-start . yahtml-paragraph-start) 3.323 + (paragraph-separate . yahtml-paragraph-separate) 3.324 + (comment-start . "<!-- ") (comment-end . " -->") 3.325 + (comment-start-skip . comment-start) 3.326 + (indent-line-function . yahtml-indent-line))) 3.327 + 3.328 (set-syntax-table yahtml-syntax-table) 3.329 (use-local-map yahtml-mode-map) 3.330 - (run-hooks 'yahtml-mode-hook)) 3.331 + (YaTeX-read-user-completion-table) 3.332 + (turn-on-auto-fill) ;Sorry, this is prerequisite 3.333 + (and (= 0 (buffer-size)) (file-exists-p yahtml-template-file) 3.334 + (y-or-n-p (format "Insert %s?" yahtml-template-file)) 3.335 + (insert-file-contents (expand-file-name yahtml-template-file))) 3.336 + (run-hooks 'text-mode-hook 'yahtml-mode-hook)) 3.337 3.338 (defun yahtml-define-menu (keymap bindlist) 3.339 - (mapcar 3.340 - (function 3.341 - (lambda (bind) 3.342 - (define-key keymap (vector (car bind)) (cdr bind)))) 3.343 - bindlist)) 3.344 + (cond 3.345 + ((featurep 'xemacs) 3.346 + (let ((name (keymap-name (symbol-value keymap)))) 3.347 + (set keymap nil) 3.348 + (mapcar 3.349 + (function 3.350 + (lambda (bind) 3.351 + (setq bind (cdr bind)) 3.352 + (if (eq (car (cdr bind)) 'lambda) 3.353 + (setcar (cdr bind) 'progn)) 3.354 + (if (stringp (car (cdr bind))) 3.355 + (set keymap (cons (cdr bind) (symbol-value keymap))) 3.356 + (set keymap (cons (vector (car bind) (cdr bind) t) 3.357 + (symbol-value keymap)))))) 3.358 + bindlist) 3.359 + (set keymap (cons name (symbol-value keymap))))) 3.360 + (t 3.361 + (mapcar 3.362 + (function 3.363 + (lambda (bind) 3.364 + (define-key (symbol-value keymap) (vector (car bind)) (cdr bind)))) 3.365 + bindlist)))) 3.366 3.367 (defvar yahtml-menu-map nil "Menu map of yahtml") 3.368 (defvar yahtml-menu-map-sectioning nil "Menu map of yahtml(sectioning)") 3.369 @@ -329,15 +456,15 @@ 3.370 3.371 ;;; Variables for mosaic url history 3.372 (defvar yahtml-urls nil "Alist of global history") 3.373 -(defvar yahtml-url-history-file "~/.mosaic-global-history" 3.374 - "File name of url history") 3.375 +(defvar yahtml-urls-private nil) 3.376 +(defvar yahtml-urls-local nil) 3.377 3.378 (cond 3.379 ((and YaTeX-emacs-19 (null yahtml-menu-map)) 3.380 - (setq yahtml-menu-map (make-sparse-keymap "yahtml menu")) 3.381 + (setq yahtml-menu-map (make-sparse-keymap "yahtml")) 3.382 (setq yahtml-menu-map-sectioning (make-sparse-keymap "sectioning menu")) 3.383 - (yahtml-define-menu 3.384 - yahtml-menu-map-sectioning 3.385 + (YaTeX-define-menu 3.386 + 'yahtml-menu-map-sectioning 3.387 (nreverse 3.388 '((1 "H1" . (lambda () (interactive) (yahtml-insert-begend nil "H1"))) 3.389 (2 "H2" . (lambda () (interactive) (yahtml-insert-begend nil "H2"))) 3.390 @@ -347,8 +474,8 @@ 3.391 (6 "H6" . (lambda () (interactive) (yahtml-insert-begend nil "H6"))) 3.392 ))) 3.393 (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags")) 3.394 - (yahtml-define-menu 3.395 - yahtml-menu-map-logical 3.396 + (YaTeX-define-menu 3.397 + 'yahtml-menu-map-logical 3.398 (nreverse 3.399 '((em "Embolden" . 3.400 (lambda () (interactive) (yahtml-insert-tag nil "EM"))) 3.401 @@ -368,8 +495,8 @@ 3.402 (lambda () (interactive) (yahtml-insert-tag nil "VAR"))) 3.403 ))) 3.404 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags")) 3.405 - (yahtml-define-menu 3.406 - yahtml-menu-map-typeface 3.407 + (YaTeX-define-menu 3.408 + 'yahtml-menu-map-typeface 3.409 (nreverse 3.410 '((b "Bold" . 3.411 (lambda () (interactive) (yahtml-insert-tag nil "B"))) 3.412 @@ -381,8 +508,8 @@ 3.413 (lambda () (interactive) (yahtml-insert-tag nil "U"))) 3.414 ))) 3.415 (setq yahtml-menu-map-listing (make-sparse-keymap "listing")) 3.416 - (yahtml-define-menu 3.417 - yahtml-menu-map-listing 3.418 + (YaTeX-define-menu 3.419 + 'yahtml-menu-map-listing 3.420 (nreverse 3.421 '((ul "Unordered" . 3.422 (lambda () (interactive) (yahtml-insert-begend nil "UL"))) 3.423 @@ -392,8 +519,8 @@ 3.424 (lambda () (interactive) (yahtml-insert-begend nil "DL"))) 3.425 ))) 3.426 (setq yahtml-menu-map-item (make-sparse-keymap "item")) 3.427 - (yahtml-define-menu 3.428 - yahtml-menu-map-item 3.429 + (YaTeX-define-menu 3.430 + 'yahtml-menu-map-item 3.431 (nreverse 3.432 '((li "Simple item" . 3.433 (lambda () (interactive) (yahtml-insert-single "li"))) 3.434 @@ -408,8 +535,8 @@ 3.435 (while keys 3.436 (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph) 3.437 (setq keys (cdr keys)))) 3.438 - (yahtml-define-menu 3.439 - yahtml-menu-map 3.440 + (YaTeX-define-menu 3.441 + 'yahtml-menu-map 3.442 (nreverse 3.443 (list 3.444 (cons (list 'sect "Sectioning") 3.445 @@ -423,26 +550,15 @@ 3.446 (cons (list 'type "Typeface tags") 3.447 (cons "typeface" yahtml-menu-map-typeface)) 3.448 ))) 3.449 + (if (featurep 'xemacs) 3.450 + (add-hook 'yahtml-mode-hook 3.451 + '(lambda () 3.452 + (or (assoc "yahtml" current-menubar) 3.453 + (progn 3.454 + (set-buffer-menubar (copy-sequence current-menubar)) 3.455 + (add-submenu nil yahtml-menu-map)))))) 3.456 )) 3.457 3.458 -(defun yahtml-collect-url-history () 3.459 - "Collect urls from global history file." 3.460 - (interactive) 3.461 - (save-excursion 3.462 - (set-buffer 3.463 - (find-file-noselect (expand-file-name yahtml-url-history-file))) 3.464 - (goto-char (point-min)) 3.465 - (setq yahtml-urls) 3.466 - (message "Collecting global history...") 3.467 - (while (re-search-forward "^[A-Za-z]+:" nil t) 3.468 - (setq yahtml-urls 3.469 - (cons (list 3.470 - (buffer-substring 3.471 - (progn (beginning-of-line) (point)) 3.472 - (progn (skip-chars-forward "^ ") (point)))) 3.473 - yahtml-urls))) 3.474 - (message "Collecting global history...Done"))) 3.475 - 3.476 ;;; ----------- Completion ---------- 3.477 (defvar yahtml-last-begend "html") 3.478 (defun yahtml-insert-begend (&optional region env) 3.479 @@ -476,7 +592,10 @@ 3.480 (insert "\n") 3.481 (indent-to-column cc) 3.482 (insert (format "</%s>" cmd))) 3.483 - (yahtml-intelligent-newline nil)))) 3.484 + (if (string-match "^a\\|p$" cmd) ;aとp決め打ちってのが美しくない… 3.485 + (newline) 3.486 + (yahtml-intelligent-newline nil)) 3.487 + (yahtml-indent-line)))) 3.488 3.489 (defun yahtml-insert-begend-region () 3.490 "Call yahtml-insert-begend in the region mode." 3.491 @@ -491,10 +610,12 @@ 3.492 (let ((completion-ignore-case t)) 3.493 (setq form 3.494 (YaTeX-cplread-with-learning 3.495 - "Form: " 3.496 + (format "Form(default %s): " yahtml-last-form) 3.497 'yahtml-form-table 'yahtml-user-form-table 3.498 'yahtml-tmp-form-table)))) 3.499 (let ((p (point)) q) 3.500 + (if (string= form "") (setq form yahtml-last-form)) 3.501 + (setq yahtml-last-form form) 3.502 (if yahtml-prefer-upcases (setq form (upcase form))) 3.503 (insert (format "<%s%s>" form (yahtml-addin form))) 3.504 ;;(indent-relative-maybe) 3.505 @@ -509,7 +630,7 @@ 3.506 (if (and (intern-soft addin) (fboundp (intern-soft addin)) 3.507 (stringp (setq s (funcall (intern addin)))) 3.508 (string< "" s)) 3.509 - (concat " " s) 3.510 + (if (eq (aref s 0) ? ) s (concat " " s)) 3.511 ""))) 3.512 3.513 3.514 @@ -528,9 +649,10 @@ 3.515 (setq bound (match-end 0)) 3.516 (search-forward ">" nil t) 3.517 (if (and (re-search-backward "\\(name\\|id\\)=" bound t) 3.518 - (goto-char (match-end 0)) 3.519 - (skip-chars-forward " \t\n") 3.520 - (looking-at "\"?#?\\([^\">]+\\)\"?\\b")) 3.521 + (progn 3.522 + (goto-char (match-end 0)) 3.523 + (skip-chars-forward " \t\n") 3.524 + (looking-at "\"?#?\\([^\">]+\\)\"?\\b"))) 3.525 (setq list (cons 3.526 (list (concat "#" (YaTeX-match-string 1))) 3.527 list)))) 3.528 @@ -548,7 +670,7 @@ 3.529 (defun yahtml-complete-url () 3.530 "Complete external URL from history or local file name." 3.531 (interactive) 3.532 - (let (initial i2 cmpl path dir file listfunc beg labels (p (point))) 3.533 + (let ((p (point)) initial i2 cmpl path dir file listfunc beg labels) 3.534 (setq initial (buffer-string)) 3.535 (cond 3.536 ((string-match "^http:" initial) 3.537 @@ -571,7 +693,7 @@ 3.538 beg (+ (point-min) beg))) 3.539 (t 3.540 (setq path (if (string-match "^/" initial) 3.541 - (yahtml-url-to-path initial) 3.542 + (or (yahtml-url-to-path initial) initial) 3.543 initial)) 3.544 (setq dir (or (file-name-directory path) ".") 3.545 file (file-name-nondirectory path) 3.546 @@ -602,20 +724,23 @@ 3.547 3.548 (defun yahtml:a () 3.549 "Add-in function for <a>" 3.550 - (let ((l yahtml-prefer-upcases)) 3.551 - (or yahtml-urls (yahtml-collect-url-history)) 3.552 - (setq yahtml-completing-buffer (current-buffer)) 3.553 -; (concat "href=\"" 3.554 -; (completing-read "href: " yahtml-urls) 3.555 -; "\"") 3.556 - (message "(H)ref (N)ame?") 3.557 - (cond 3.558 - ((string-match "[nN]" (char-to-string (read-char))) 3.559 - (concat (if l "NAME" "name") "=\"" (read-string "name: ") "\"")) 3.560 - (t 3.561 - (concat (if l "HREF" "href") "=\"" 3.562 - (read-from-minibuffer "href: " "" yahtml-url-completion-map) 3.563 - "\""))))) 3.564 + (let ((href "")) 3.565 + (setq yahtml-completing-buffer (current-buffer) 3.566 + href (read-from-minibuffer "href: " "" yahtml-url-completion-map) 3.567 + ;; yahtml-urls-local is buffer-local, so we must put 3.568 + ;; that into yahtml-urls here 3.569 + yahtml-urls (append yahtml-urls-private yahtml-urls-local)) 3.570 + (prog1 3.571 + (concat (yahtml-make-optional-argument 3.572 + "href" href) 3.573 + (yahtml-make-optional-argument 3.574 + "name" (read-string "name: "))) 3.575 + (if (and (string-match "^http://" href) 3.576 + (null (assoc href yahtml-urls))) 3.577 + (YaTeX-update-table 3.578 + (list href) 3.579 + 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local)) 3.580 + ))) 3.581 3.582 (defvar yahtml-parameters-completion-alist 3.583 '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center")) 3.584 @@ -635,19 +760,37 @@ 3.585 (t 3.586 (read-string prompt))))) 3.587 3.588 - 3.589 +(defun yahtml-make-optional-argument (opt arg) 3.590 + "Make optional argument string." 3.591 + (if (string= "" arg) 3.592 + "" 3.593 + (concat " " (if yahtml-prefer-upcases (upcase opt) (downcase opt)) 3.594 + "=\"" arg "\""))) 3.595 + 3.596 +(defun yahtml:body () 3.597 + "Add-in function for <body>" 3.598 + (let ((b (read-string "bgcolor=")) 3.599 + (x (read-string "text color=")) 3.600 + (l (read-string "link color=")) 3.601 + (v (read-string "vlink color="))) 3.602 + (concat 3.603 + (yahtml-make-optional-argument "bgcolor" b) 3.604 + (yahtml-make-optional-argument "text" x) 3.605 + (yahtml-make-optional-argument "link" l) 3.606 + (yahtml-make-optional-argument "vlink" v)))) 3.607 + 3.608 + 3.609 (defun yahtml:img () 3.610 "Add-in function for <img>" 3.611 - (or yahtml-urls (yahtml-collect-url-history)) 3.612 (let ((src (yahtml-read-parameter "src")) 3.613 (alg (yahtml-read-parameter "align")) 3.614 (alt (yahtml-read-parameter "alt")) 3.615 + (brd (read-string "border=")) 3.616 (l yahtml-prefer-upcases)) 3.617 (concat (if l "SRC" "src") "=\"" src "\"" 3.618 - (if (string< "" alg) 3.619 - (concat " " (if l "ALIGN" "align") "=\"" alg "\"")) 3.620 - (if (string< "" alt) 3.621 - (concat " " (if l "ALT" "alt") "=\"" alt "\""))))) 3.622 + (yahtml-make-optional-argument "align" alg) 3.623 + (yahtml-make-optional-argument "alt" alt) 3.624 + (yahtml-make-optional-argument "border" brd)))) 3.625 3.626 (defun yahtml:form () 3.627 "Add-in function `form' input format" 3.628 @@ -675,10 +818,8 @@ 3.629 3.630 (defun yahtml:p () 3.631 (let ((alg (yahtml-read-parameter "align"))) 3.632 - (if (string< "" alg) 3.633 - (setq alg (concat "align=" alg) 3.634 - alg (if yahtml-prefer-upcases (upcase alg) (downcase alg))) 3.635 - ""))) 3.636 + (yahtml-make-optional-argument "align" alg) 3.637 +)) 3.638 3.639 (defvar yahtml-input-types 3.640 '(("text") ("password") ("checkbox") ("radio") ("submit") 3.641 @@ -697,14 +838,10 @@ 3.642 maxlength (read-string "maxlength: "))) 3.643 (concat 3.644 (if l "NAME" "name") "=\"" name "\"" 3.645 - (if (string< "" type) 3.646 - (concat " " (if l "TYPE" "type") "=\"" type "\"")) 3.647 - (if (string< "" value) 3.648 - (concat " " (if l "VALUE" "value") "=\"" value "\"")) 3.649 - (if (string< "" size) 3.650 - (concat " " (if l "SIZE" "size") "=\"" size "\"")) 3.651 - (if (string< "" maxlength) 3.652 - (concat " " (if l "MAXLENGTH" "maxlength") "=\"" maxlength "\"")) 3.653 + (yahtml-make-optional-argument "type" type) 3.654 + (yahtml-make-optional-argument "value" value) 3.655 + (yahtml-make-optional-argument "size" size) 3.656 + (yahtml-make-optional-argument "maxlength" maxlength) 3.657 ))) 3.658 3.659 (defun yahtml:textarea () 3.660 @@ -717,11 +854,16 @@ 3.661 (concat 3.662 (concat (if yahtml-prefer-upcases "NAME=" "name=") 3.663 "\"" name "\"") 3.664 - (if (string< "" cols) 3.665 - (concat " " (if yahtml-prefer-upcases "COLS" "cols") "=" cols)) 3.666 - (if (string< "" rows) 3.667 - (concat " " (if yahtml-prefer-upcases "ROWS" "rows") "=" rows))))) 3.668 + (yahtml-make-optional-argument "cols" cols) 3.669 + (yahtml-make-optional-argument "rows" rows)))) 3.670 3.671 +(defun yahtml:table () 3.672 + "Add-in function for `table'" 3.673 + (yahtml-make-optional-argument "border" (read-string "border="))) 3.674 + 3.675 +(defun yahtml:font () 3.676 + "Add-in function for `font'" 3.677 + (yahtml-make-optional-argument "color" (read-string "color="))) 3.678 3.679 ;;; ---------- Simple tag ---------- 3.680 (defun yahtml-insert-tag (region-mode &optional tag) 3.681 @@ -731,7 +873,7 @@ 3.682 (let ((completion-ignore-case t)) 3.683 (setq tag 3.684 (YaTeX-cplread-with-learning 3.685 - (format "Tag %s(default %s): " 3.686 + (format "Tag %s(default %s): " 3.687 (if region-mode "region: " "") yahtml-last-typeface-cmd) 3.688 'yahtml-typeface-table 'yahtml-user-typeface-table 3.689 'yahtml-tmp-typeface-table)))) 3.690 @@ -755,6 +897,7 @@ 3.691 (interactive) 3.692 (yahtml-insert-tag t tag)) 3.693 3.694 + 3.695 (defun yahtml-insert-single (cmd) 3.696 "Insert <CMD>." 3.697 (interactive 3.698 @@ -773,6 +916,14 @@ 3.699 yahtml-last-single-cmd)) 3.700 (insert (format "<%s>" cmd))) 3.701 3.702 +(defun yahtml-insert-p (&optional arg) 3.703 + "Convenient function to insert <p></p>" 3.704 + (interactive "P") 3.705 + (if arg (yahtml-insert-tag nil "p") 3.706 + (insert "<p>") 3.707 + (save-excursion 3.708 + (insert "</p>")))) 3.709 + 3.710 ;;; ---------- Jump ---------- 3.711 (defun yahtml-on-href-p () 3.712 "Check if point is on href clause." 3.713 @@ -785,8 +936,9 @@ 3.714 (goto-char (get 'YaTeX-inner-environment 'point)) 3.715 (search-forward "href" e t) 3.716 (search-forward "=" e t) 3.717 - (skip-chars-forward " \t\n") 3.718 - (looking-at "\"?\\([^\"> \t\n]+\\)\"?") 3.719 + (progn 3.720 + (skip-chars-forward " \t\n") 3.721 + (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) 3.722 (< p (match-end 0)) 3.723 (YaTeX-match-string 1) 3.724 )))) 3.725 @@ -816,6 +968,16 @@ 3.726 "Call WWW Browser to see HREF." 3.727 (let ((pb "* WWW Browser *") (cb (current-buffer))) 3.728 (cond 3.729 + ((string-match "^start\\>" yahtml-www-browser) 3.730 + (if (get-buffer pb) 3.731 + (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) 3.732 + (put 'yahtml-netscape-sentinel 'url href) 3.733 + (set-process-sentinel 3.734 + (setq yahtml-browser-process 3.735 + (start-process 3.736 + "browser" pb shell-file-name yahtml-shell-command-option 3.737 + (format "%s \"%s\"" yahtml-www-browser href))) 3.738 + 'yahtml-netscape-sentinel)) 3.739 ((and (string-match "[Nn]etscape" yahtml-www-browser) 3.740 (not (eq system-type 'windows-nt))) 3.741 (if (get-buffer pb) 3.742 @@ -843,7 +1005,7 @@ 3.743 3.744 (defun yahtml-goto-corresponding-href (&optional other) 3.745 "Go to corresponding name." 3.746 - (let ((href (yahtml-on-href-p)) file name) 3.747 + (let ((href (yahtml-on-href-p)) file name (parent buffer-file-name)) 3.748 (if href 3.749 (cond 3.750 ((string-match "^\\(ht\\|f\\)tp:" href) 3.751 @@ -858,7 +1020,8 @@ 3.752 (if (string-match "^/" file) 3.753 (setq file (yahtml-url-to-path file))) 3.754 (if other (YaTeX-switch-to-buffer-other-window file) 3.755 - (YaTeX-switch-to-buffer file)))) 3.756 + (YaTeX-switch-to-buffer file)) 3.757 + (or YaTeX-parent-file (setq YaTeX-parent-file parent)))) 3.758 (if name 3.759 (progn (set-mark-command nil) (yahtml-jump-to-name name))) 3.760 t))))) 3.761 @@ -954,6 +1117,7 @@ 3.762 ((yahtml-goto-corresponding-href other)) 3.763 ((yahtml-goto-corresponding-img)) 3.764 ((yahtml-goto-corresponding-begend)) 3.765 + (t (message "I don't know where to go.")) 3.766 )) 3.767 3.768 (defun yahtml-goto-corresponding-*-other-window () 3.769 @@ -961,27 +1125,54 @@ 3.770 (interactive) 3.771 (yahtml-goto-corresponding-* t)) 3.772 3.773 +(defun yahtml-visit-main () 3.774 + "Go to parent file from where you visit current file." 3.775 + (interactive) 3.776 + (if YaTeX-parent-file (YaTeX-switch-to-buffer YaTeX-parent-file))) 3.777 + 3.778 ;;; ---------- killing ---------- 3.779 (defun yahtml-kill-begend (&optional whole) 3.780 - (let ((tag (yahtml-on-begend-p)) (p (make-marker)) (q (make-marker))) 3.781 + (let ((tag (yahtml-on-begend-p)) p q r) 3.782 (if tag 3.783 - (progn 3.784 + (save-excursion 3.785 (or (looking-at "<") 3.786 (progn (skip-chars-backward "^<") (forward-char -1))) 3.787 - (set-marker p (point)) 3.788 + (setq p (point)) 3.789 (yahtml-goto-corresponding-begend) 3.790 (or (looking-at "<") 3.791 (progn (skip-chars-backward "^<") (forward-char -1))) 3.792 - (delete-region (point) (progn (forward-list 1) (point))) 3.793 - (set-marker q (point)) 3.794 - (beginning-of-line) 3.795 - (if (looking-at "^\\s *$") 3.796 - (delete-region (point) (progn (forward-line 1) (point)))) 3.797 + (if (< (point) p) ;if on the opening tag 3.798 + (progn (setq q p p (point)) 3.799 + (goto-char q)) 3.800 + (setq q (point))) ;now q has end-line's (point) 3.801 + (if (not whole) 3.802 + (kill-region 3.803 + (progn (skip-chars-backward " \t") (if (bolp) (point) q)) 3.804 + (progn (forward-list 1) 3.805 + (setq r (point)) 3.806 + (skip-chars-forward " \t") 3.807 + (if (and (eolp) (not (eobp))) (1+ (point)) r)))) 3.808 (goto-char p) 3.809 - (delete-region (point) (progn (forward-list 1) (point))) 3.810 - (if (looking-at "^\\s *$") 3.811 - (delete-region (point) (progn (forward-line 1) (point)))) 3.812 - (if whole (delete-region p q)) 3.813 + (skip-chars-backward " \t") 3.814 + (if (not whole) 3.815 + (progn 3.816 + (kill-append 3.817 + (buffer-substring 3.818 + (setq p (if (bolp) (point) p)) 3.819 + (setq q (progn 3.820 + (forward-list 1) 3.821 + (setq r (point)) 3.822 + (skip-chars-forward " \t") 3.823 + (if (and (eolp) (not (eobp))) (1+ (point)) r)))) 3.824 + t) 3.825 + (delete-region p q)) 3.826 + (kill-region 3.827 + (if (bolp) (point) p) 3.828 + (progn (goto-char q) 3.829 + (forward-list 1) 3.830 + (setq r (point)) 3.831 + (skip-chars-forward " \t") 3.832 + (if (and (eolp) (not (eobp))) (1+ (point)) r)))) 3.833 tag)))) 3.834 3.835 (defun yahtml-kill-* (whole) 3.836 @@ -1024,20 +1215,25 @@ 3.837 (save-excursion 3.838 (and 3.839 (re-search-backward "<a\\b" nil t) 3.840 - (goto-char (match-end 0)) 3.841 - (skip-chars-forward " \t\n") 3.842 - (setq b1 (point)) 3.843 - (search-forward ">" nil t) 3.844 + (progn 3.845 + (goto-char (match-end 0)) 3.846 + (skip-chars-forward " \t\n") 3.847 + (setq b1 (point)) 3.848 + (search-forward ">" nil t)) 3.849 (setq e1 (match-beginning 0)) 3.850 (goto-char b1) 3.851 (re-search-forward "href\\s *=" e1 t) 3.852 (>= p (point)) 3.853 - (goto-char (match-end 0)) 3.854 - (skip-chars-forward " \t\n") 3.855 - (looking-at "\"?\\([^\"> \t\n]+\\)\"?") 3.856 + (progn 3.857 + (goto-char (match-end 0)) 3.858 + (skip-chars-forward " \t\n") 3.859 + (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) 3.860 (< p (match-end 0))))) 3.861 (setq b1 (match-beginning 1) e1 (match-end 1) 3.862 yahtml-completing-buffer (current-buffer) 3.863 + ;; yahtml-urls-local is buffer-local, so we must put 3.864 + ;; that into yahtml-urls here 3.865 + yahtml-urls (append yahtml-urls-private yahtml-urls-local) 3.866 href (read-from-minibuffer 3.867 "Change href to: " "" yahtml-url-completion-map)) 3.868 (if (string< "" href) 3.869 @@ -1123,19 +1319,35 @@ 3.870 )) 3.871 3.872 ;;; ---------- commenting ---------- 3.873 -(defun yahtml-comment-region (beg end) 3.874 - (interactive "r") 3.875 - (comment-region beg end nil)) 3.876 +(defun yahtml-comment-region (&optional uncom) 3.877 + "Comment out region or environment." 3.878 + (interactive) 3.879 + (let (e beg p) 3.880 + (cond 3.881 + ((setq e (yahtml-on-begend-p)) 3.882 + (save-excursion 3.883 + (setq p (point)) 3.884 + (if (string-match "^/" e) 3.885 + (setq beg (progn (forward-line 1) (point))) 3.886 + (setq beg (progn (beginning-of-line) (point)))) 3.887 + (goto-char p) 3.888 + (yahtml-goto-corresponding-begend) 3.889 + (if (string-match "^/" e) 3.890 + (beginning-of-line) 3.891 + (forward-line 1)) 3.892 + (comment-region beg (point) (if uncom (list 4))))) 3.893 + (t (comment-region (region-beginning) (region-end) 3.894 + (if uncom (list 4))))))) 3.895 3.896 -(defun yahtml-uncomment-region (beg end) 3.897 - (interactive "r") 3.898 - (comment-region beg end '(4))) 3.899 +(defun yahtml-uncomment-region () 3.900 + (interactive) 3.901 + (yahtml-comment-region t)) 3.902 3.903 3.904 3.905 (defun yahtml-inner-environment-but (exclude &optional quick) 3.906 "Return the inner environment but matches with EXCLUDE tag." 3.907 - (let (e) 3.908 + (let (e (case-fold-search t)) 3.909 (save-excursion 3.910 (while (and (setq e (YaTeX-inner-environment quick)) 3.911 (string-match exclude e)) 3.912 @@ -1192,8 +1404,11 @@ 3.913 (fill-region-as-paragraph 3.914 (progn (re-search-backward paragraph-start nil t) 3.915 (or (save-excursion 3.916 - (goto-char (match-end 0)) 3.917 - (skip-chars-forward " \t>") 3.918 + (goto-char (match-beginning 0)) 3.919 + (if (looking-at "<") 3.920 + (forward-list) 3.921 + (goto-char (match-end 0)) 3.922 + (skip-chars-forward " \t>")) 3.923 (if (looking-at "[ \t]*$") 3.924 (progn (forward-line 1) (point)))) 3.925 (point))) 3.926 @@ -1213,8 +1428,32 @@ 3.927 ;;; ---------- indentation ---------- 3.928 ;;; 3.929 (defun yahtml-indent-line () 3.930 + "Indent a line (faster wrapper)" 3.931 (interactive) 3.932 - (let ((envs "[uod]l\\|table\\|t[rhd]\\|select\\|blockquote") 3.933 + (let (indent) 3.934 + (if (and (save-excursion 3.935 + (beginning-of-line) (skip-chars-forward "\t ") 3.936 + (not (looking-at "<"))) 3.937 + (save-excursion 3.938 + (forward-line -1) 3.939 + (while (and (not (bobp)) (looking-at "^\\s *$")) 3.940 + (forward-line -1)) 3.941 + (skip-chars-forward "\t ") 3.942 + (setq indent (current-column)) 3.943 + (not (looking-at "<")))) 3.944 + (progn 3.945 + (save-excursion 3.946 + (beginning-of-line) 3.947 + (skip-chars-forward " \t") 3.948 + (or (= (current-column) indent) 3.949 + (YaTeX-reindent indent))) 3.950 + (and (bolp) (skip-chars-forward " \t"))) 3.951 + (yahtml-indent-line-real)))) 3.952 + 3.953 +(defun yahtml-indent-line-real () 3.954 + (interactive) 3.955 + (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir") 3.956 + (itemizing-envs "^\\([uod]l\\|menu\\|dir\\)$") 3.957 (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") 3.958 inenv p col peol (case-fold-search t)) 3.959 (save-excursion 3.960 @@ -1223,38 +1462,43 @@ 3.961 "html") 3.962 col (get 'YaTeX-inner-environment 'indent) 3.963 p (get 'YaTeX-inner-environment 'point) 3.964 - op)) 3.965 + op nil)) 3.966 (save-excursion 3.967 (cond 3.968 ((string-match envs inenv) 3.969 (save-excursion 3.970 (beginning-of-line) 3.971 (skip-chars-forward " \t") 3.972 - (cond 3.973 + (cond ;lookup current line's tag 3.974 ((looking-at (concat "</\\(" envs "\\)>")) 3.975 (YaTeX-reindent col)) 3.976 - ((or (looking-at itms) 3.977 - (and yahtml-hate-too-deep-indentation 3.978 - (looking-at (concat "<" envs)))) 3.979 + ((looking-at itms) 3.980 (YaTeX-reindent (+ col yahtml-environment-indent))) 3.981 + ((and yahtml-hate-too-deep-indentation 3.982 + (looking-at (concat "<\\(" envs "\\)"))) 3.983 + (YaTeX-reindent (+ col (* 2 yahtml-environment-indent)))) 3.984 ((and (< p (point)) 3.985 + (string-match itemizing-envs inenv) 3.986 (save-excursion 3.987 (and 3.988 ;;(re-search-backward itms p t) 3.989 (setq op (point)) 3.990 (goto-char p) 3.991 (re-search-forward itms op t) 3.992 - ;(goto-char (match-end 0)) 3.993 - (skip-chars-forward "^>") 3.994 - (skip-chars-forward ">") 3.995 - (skip-chars-forward " \t") 3.996 - (setq col (current-column))))) 3.997 + (progn 3.998 + (skip-chars-forward "^>") 3.999 + (skip-chars-forward ">") 3.1000 + (skip-chars-forward " \t") 3.1001 + (setq col (if (looking-at "$") 3.1002 + (+ col yahtml-environment-indent) 3.1003 + (current-column))))))) 3.1004 (YaTeX-reindent col)) 3.1005 (t 3.1006 (YaTeX-reindent (+ col yahtml-environment-indent))))))) 3.1007 (and (bolp) (skip-chars-forward " \t")) 3.1008 (if (and (setq inenv (yahtml-on-begend-p)) 3.1009 - (string-match (concat "^\\(" envs "\\)") inenv)) 3.1010 + (string-match 3.1011 + (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv)) 3.1012 (save-excursion 3.1013 (setq peol (point-end-of-line)) 3.1014 (or (= (char-after (point)) ?<) 3.1015 @@ -1312,6 +1556,7 @@ 3.1016 3.1017 (defun yahtml-lint-buffer (buf) 3.1018 "Call lint on buffer BUF." 3.1019 + (require 'yatexprc) 3.1020 (interactive "bCall lint on buffer: ") 3.1021 (setq buf (get-buffer buf)) 3.1022 (YaTeX-save-buffers) 3.1023 @@ -1329,7 +1574,7 @@ 3.1024 (setq file (expand-file-name file))) 3.1025 (if (string-match "^[A-Za-z]:/" file) 3.1026 (progn 3.1027 - ;; (aset file 1 ?|) ;$B$3$l$OMW$i$J$$$i$7$$!D(B 3.1028 + ;; (aset file 1 ?|) ;これは要らないらしい… 3.1029 (setq file (concat "///" file)))) 3.1030 (while list 3.1031 (if (string-match (concat "^" (regexp-quote (car (car list)))) file) 3.1032 @@ -1356,15 +1601,16 @@ 3.1033 (if (string-match "\\(http://[^/]*\\)/" url) 3.1034 (setq docroot (substring url (match-end 1))) 3.1035 (setq docroot url)) 3.1036 - (if (string-match (concat "^" (regexp-quote docroot)) file) 3.1037 - (setq realpath 3.1038 - (expand-file-name 3.1039 - (substring 3.1040 - file 3.1041 - (if (= (aref file (1- (match-end 0))) ?/) 3.1042 - (match-end 0) ; "/foo" 3.1043 - (min (1+ (match-end 0)) (length file)))) ; "/~foo" 3.1044 - (car (car list))))) 3.1045 + (cond 3.1046 + ((string-match (concat "^" (regexp-quote docroot)) file) 3.1047 + (setq realpath 3.1048 + (expand-file-name 3.1049 + (substring 3.1050 + file 3.1051 + (if (= (aref file (1- (match-end 0))) ?/) 3.1052 + (match-end 0) ; "/foo" 3.1053 + (min (1+ (match-end 0)) (length file)))) ; "/~foo" 3.1054 + (car (car list)))))) 3.1055 (if realpath 3.1056 (progn (setq list nil) 3.1057 (if (and dirsufp (not (string-match "/$" realpath))) 3.1058 @@ -1406,15 +1652,22 @@ 3.1059 (interactive "P") 3.1060 (let (env func) 3.1061 (end-of-line) 3.1062 - (setq env (downcase (or (YaTeX-inner-environment) "html"))) 3.1063 + (setq env (downcase (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t) 3.1064 + "html"))) 3.1065 (setq func (intern-soft (concat "yahtml-intelligent-newline-" env))) 3.1066 (newline) 3.1067 (if (and env func (fboundp func)) 3.1068 - (funcall func)))) 3.1069 + ;; if intelligent line function is defined, call that 3.1070 + (funcall func) 3.1071 + ;; else do the default action 3.1072 + (if (string-match yahtml-p-prefered-env-regexp env) 3.1073 + (yahtml-insert-p))))) 3.1074 3.1075 +(defvar yahtml-faithful-to-htmllint nil) 3.1076 (defun yahtml-intelligent-newline-ul () 3.1077 (interactive) 3.1078 - (insert (if yahtml-prefer-upcases "<LI> " "<li> ")) 3.1079 + (yahtml-insert-single "li") 3.1080 + (or yahtml-faithful-to-htmllint (insert " ")) 3.1081 (yahtml-indent-line)) 3.1082 3.1083 (fset 'yahtml-intelligent-newline-ol 'yahtml-intelligent-newline-ul) 3.1084 @@ -1427,13 +1680,19 @@ 3.1085 (get 'YaTeX-inner-environment 'point) t)) 3.1086 (cond 3.1087 ((match-beginning 2) 3.1088 - (insert (if yahtml-prefer-upcases "<DD> " "<dd> ")) 3.1089 + (yahtml-insert-single "dd") 3.1090 + (or yahtml-faithful-to-htmllint (insert " ")) 3.1091 (setq yahtml-last-single-cmd "dt")) 3.1092 ((match-beginning 3) 3.1093 - (insert (if yahtml-prefer-upcases "<DT> " "<dt> ")) 3.1094 + (yahtml-insert-single "dt") 3.1095 + (or yahtml-faithful-to-htmllint (insert " ")) 3.1096 (setq yahtml-last-single-cmd "dd"))) 3.1097 - (insert (if yahtml-prefer-upcases "<DT> " "<dt> "))) 3.1098 - (yahtml-indent-line))) 3.1099 + (insert (if yahtml-prefer-upcases "<DT> " "<dt> ")) 3.1100 + (setq yahtml-last-single-cmd "dd")) 3.1101 + (yahtml-indent-line) 3.1102 + (and (string-match yahtml-p-prefered-env-regexp "dl") 3.1103 + (string-equal yahtml-last-single-cmd "dt") 3.1104 + (yahtml-insert-p nil)))) 3.1105 3.1106 (defun yahtml-intelligent-newline-select () 3.1107 (interactive) 3.1108 @@ -1478,17 +1737,18 @@ 3.1109 (or (get-buffer yahtml-lint-buffer) 3.1110 (error "No lint program ran.")) 3.1111 (YaTeX-showup-buffer yahtml-lint-buffer nil t) 3.1112 - (yahtml-jump-to-error-line)) 3.1113 + (yahtml-jump-to-error-line t)) 3.1114 3.1115 -(defun yahtml-jump-to-error-line () 3.1116 - (interactive) 3.1117 +(defun yahtml-jump-to-error-line (&optional sit) 3.1118 + (interactive "P") 3.1119 (let ((p (point)) (e (point-end-of-line))) 3.1120 (end-of-line) 3.1121 (if (re-search-backward yahtml-error-line-regexp nil t) 3.1122 (let ((f (YaTeX-match-string 1)) 3.1123 (l (string-to-int (YaTeX-match-string 2)))) 3.1124 + (if sit (sit-for 1)) 3.1125 (forward-line -1) 3.1126 - (YaTeX-showup-buffer f nil t) 3.1127 + (YaTeX-showup-buffer (YaTeX-switch-to-buffer f t) nil t) 3.1128 (goto-line l)) 3.1129 (message "No line number usage")))) 3.1130 3.1131 @@ -1513,8 +1773,7 @@ 3.1132 ("</?[uod]l>" 0 decl) 3.1133 ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label) 3.1134 ("<a\\s +href" "</a>" crossref) 3.1135 - ("</?\\sw+>" 0 decl) 3.1136 - ("<form" "</form" form) 3.1137 + (yahtml-hilit-region-tag-itself "</?\\sw+\\>" decl) 3.1138 )) 3.1139 3.1140 (defun yahtml-hilit-region-tag (tag) 3.1141 @@ -1526,13 +1785,19 @@ 3.1142 (progn (re-search-forward (concat "</" tag ">") nil t) 3.1143 (match-beginning 0)))))) 3.1144 3.1145 +(defun yahtml-hilit-region-tag-itself (ptn) 3.1146 + "Return list of start/end point of <tag options...> itself." 3.1147 + (if (re-search-forward ptn nil t) 3.1148 + (let ((m0 (match-beginning 0))) 3.1149 + (skip-chars-forward "^>") 3.1150 + (cons m0 (1+ (point) ))))) 3.1151 + 3.1152 ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist)) 3.1153 -(cond 3.1154 - ((and (featurep 'hilit19) (featurep 'yatex19)) 3.1155 - (or (assq 'yahtml-mode hilit-patterns-alist) 3.1156 - (setq hilit-patterns-alist 3.1157 - (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist) 3.1158 - hilit-patterns-alist))))) 3.1159 +(and (featurep 'hilit19) 3.1160 + (or (assq 'yahtml-mode hilit-patterns-alist) 3.1161 + (setq hilit-patterns-alist 3.1162 + (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist) 3.1163 + hilit-patterns-alist)))) 3.1164 3.1165 (provide 'yahtml) 3.1166
4.1 --- a/yatex.el Sat Dec 13 12:41:43 1997 +0000 4.2 +++ b/yatex.el Tue Dec 16 13:28:38 1997 +0000 4.3 @@ -1,8 +1,8 @@ 4.4 ;;; -*- Emacs-Lisp -*- 4.5 ;;; Yet Another tex-mode for emacs. 4.6 -;;; yatex.el rev. 1.64 4.7 +;;; yatex.el rev. 1.65 4.8 ;;; (c )1991-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 4.9 -;;; Last modified Tue Apr 8 05:07:31 1997 on crx 4.10 +;;; Last modified Tue Dec 16 22:15:26 1997 on crx 4.11 ;;; $Id$ 4.12 4.13 ;; This program is free software; you can redistribute it and/or modify 4.14 @@ -20,10 +20,10 @@ 4.15 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 4.16 4.17 (require 'comment) 4.18 -(defconst YaTeX-revision-number "1.64" 4.19 +(require 'yatexlib) 4.20 +(defconst YaTeX-revision-number "1.65" 4.21 "Revision number of running yatex.el" 4.22 ) 4.23 - 4.24 ;---------- Local variables ---------- 4.25 ;;; 4.26 ;; Initialize local variable for yatex-mode. 4.27 @@ -39,9 +39,9 @@ 4.28 (defvar YaTeX-environment-indent 1 4.29 "*Indentation depth at column width in LaTeX environments." 4.30 ) 4.31 -(defvar YaTeX-fill-prefix "" 4.32 +(defvar YaTeX-fill-prefix nil 4.33 "*fill-prefix used for auto-fill-mode. 4.34 -The default value is null string." 4.35 +The default value is nil." 4.36 ) 4.37 (defvar YaTeX-fill-column 72 4.38 "*fill-column used for auto-fill-mode." 4.39 @@ -57,21 +57,12 @@ 4.40 return to the editing paragraph by calling register-to-point with argument 4.41 YaTeX-current-position-register." 4.42 ) 4.43 -(defvar YaTeX-dos (eq system-type 'ms-dos)) 4.44 -(defvar YaTeX-emacs-19 (string= "19" (substring emacs-version 0 2))) 4.45 -(defvar YaTeX-user-completion-table 4.46 - (if YaTeX-dos "~/_yatexrc" "~/.yatexrc") 4.47 - "*Default filename in which user completion table is saved." 4.48 -) 4.49 ;;(defvar YaTeX-tmp-dic-unit 'main-file 4.50 ;; "*Default switching unit of temporary dictionary. 4.51 ;;There are two switching unit: 4.52 ;;'main-file : switch tmp-dic according to main-file directory. 4.53 ;;'directory : switch tmp-dic dir by dir." 4.54 ;;) 4.55 -(defvar YaTeX-japan (or (boundp 'NEMACS) (boundp 'MULE)) 4.56 - "Whether yatex mode is running on Japanese environment or not." 4.57 -) 4.58 (defvar tex-command (if YaTeX-japan "jlatex" "latex") 4.59 "*Default command for typesetting LaTeX text." 4.60 ) 4.61 @@ -134,19 +125,19 @@ 4.62 "*Kanji coding system latex command types out. 4.63 1 = Shift JIS, 2 = JIS, 3 = EUC." 4.64 ) 4.65 -(defvar YaTeX-inhibit-prefix-letter nil 4.66 - "*T for changing key definitions from [prefix] Letter to [prefix] C-Letter." 4.67 +(defvar NTT-jTeX nil 4.68 + "*T for using NTT-jTeX for latex command. 4.69 +More precisely, setting t to this variables inhibits inter-word break on 4.70 +typeset document by line-break of source text. That is, YaTeX automatically 4.71 +put % after each line at filling. 4.72 +改行+インデントによって、タイプセット後の字間が空いてしまうのを抑制する場合に 4.73 +tにする(古いNTT-jTeXで顕著に現れる)。具体的には、fillするときに各行の終わりに 4.74 +%を付加する。" 4.75 ) 4.76 -(defvar NTT-jTeX nil 4.77 - "*Use NTT-jTeX for latex command." 4.78 -) 4.79 -(defvar YaTeX-item-regexp (concat (regexp-quote "\\") "\\(sub\\)*item") 4.80 +(defvar YaTeX-item-regexp 4.81 + (concat (regexp-quote "\\") "\\(sub\\|bib\\)*item") 4.82 "*Regular expression of item command." 4.83 ) 4.84 -(defvar YaTeX-nervous t 4.85 - "*If you are nervous about maintenance of yatexrc, set this value to T. 4.86 -And you will have the local dictionary." 4.87 -) 4.88 (defvar YaTeX-sectioning-regexp 4.89 "\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b" 4.90 "*LaTeX sectioning commands regexp." 4.91 @@ -182,7 +173,7 @@ 4.92 Define those environments as a form of list." 4.93 ) 4.94 (defvar YaTeX-itemizing-env-regexp 4.95 - "itemize\\|enumerate\\|description\\|list" 4.96 + "itemize\\|enumerate\\|description\\|list\\|thebibliography" 4.97 "*Regexp of itemizing environments") 4.98 (defvar YaTeX-equation-env-regexp 4.99 "array\\*?\\|equation\\*?" 4.100 @@ -197,18 +188,9 @@ 4.101 "*T for removing all continuous commenting character(%). 4.102 Nil for removing only one commenting character at the beginning-of-line." 4.103 ) 4.104 -(defvar YaTeX-default-pop-window-height 10 4.105 - "Default typesetting buffer height. 4.106 -If integer, sets the window-height of typesetting buffer. 4.107 -If string, sets the percentage of it. 4.108 -If nil, use default pop-to-buffer." 4.109 -) 4.110 (defvar YaTeX-close-paren-always t 4.111 "Close parenthesis always when YaTeX-modify-mode is nil." 4.112 ) 4.113 -(defvar YaTeX-no-begend-shortcut nil 4.114 - "*T for disabling shortcut of begin-type completion, [prefix] b d, etc." 4.115 -) 4.116 (defvar YaTeX-greek-by-maketitle-completion nil 4.117 "*T for greek letters completion by maketitle-type completion." 4.118 ) 4.119 @@ -234,22 +216,22 @@ 4.120 (append YaTeX-math-key-list-private YaTeX-math-key-list-default) 4.121 "Key sequence to invoke math-mode's image completion." 4.122 ) 4.123 -(defvar YaTeX-create-file-prefix-g nil 4.124 - "*Non-nil creates new file when [prefix] g on \\include{foo}." 4.125 -) 4.126 (defvar YaTeX-skip-default-reader nil 4.127 "Non-nil skips default argument reader of section-type completion." 4.128 ) 4.129 (defvar YaTeX-simple-messages nil 4.130 "Non-nil makes minibuffer messages simpler." 4.131 ) 4.132 +(defvar YaTeX-template-file "~/work/template.tex" 4.133 + "*Template TeX source file. This will be inserted to empty file." 4.134 +) 4.135 (defvar YaTeX-addin-prefix "YaTeX:") 4.136 ;------------ Completion table ------------ 4.137 ; Set tex-section-like command possible completion 4.138 (defvar section-table 4.139 '(("part") ("chapter") ("section") ("subsection") 4.140 ("subsubsection") ("paragraph") ("subparagraph") 4.141 - ("author") ("thanks") ("documentstyle") ("pagestyle") 4.142 + ("author") ("thanks") ("documentstyle") ("documentclass") ("pagestyle") 4.143 ("title") ("underline") ("label") ("makebox") 4.144 ("footnote") ("footnotetext") 4.145 ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite") 4.146 @@ -258,7 +240,8 @@ 4.147 ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2) 4.148 ("newcommand" 2) ("renewcommand" 2) 4.149 ("setcounter" 2) ("newenvironment" 3) ("newtheorem" 2) 4.150 - ("cline") ("framebox") ("savebox" 2) ("date") ("put") ("ref") 4.151 + ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox") 4.152 + ("date") ("put") ("ref") 4.153 ("frac" 2) ("multicolumn" 3) ("shortstack") 4.154 ) 4.155 "Default completion table for section-type completion." 4.156 @@ -324,9 +307,6 @@ 4.157 (defvar YaTeX-mode-map nil 4.158 "Keymap used in YaTeX mode" 4.159 ) 4.160 -(defvar YaTeX-typesetting-mode-map nil 4.161 - "Keymap used in YaTeX typesetting buffer" 4.162 -) 4.163 (defvar YaTeX-prefix-map nil 4.164 "Keymap used when YaTeX-prefix key pushed" 4.165 ) 4.166 @@ -343,39 +323,6 @@ 4.167 (defvar YaTeX-math-mode nil 4.168 "Holds whether current mode is math-mode." 4.169 ) 4.170 -;---------- Define default key bindings on YaTeX mode map ---------- 4.171 -(defun YaTeX-define-key (key binding &optional map) 4.172 - "Define key on YaTeX-prefix-map." 4.173 - (if YaTeX-inhibit-prefix-letter 4.174 - (let ((c (aref key 0))) 4.175 - (cond 4.176 - ((and (>= c ?a) (<= c ?z)) (aset key 0 (1+ (- c ?a)))) 4.177 - ((and (>= c ?A) (<= c ?Z) (numberp YaTeX-inhibit-prefix-letter)) 4.178 - (aset key 0 (1+ (- c ?A)))) 4.179 - (t nil)))) 4.180 - (define-key (or map YaTeX-prefix-map) key binding) 4.181 -) 4.182 -(defun YaTeX-define-begend-key-normal (key env &optional map) 4.183 - "Define short cut YaTeX-make-begin-end key." 4.184 - (YaTeX-define-key 4.185 - key 4.186 - (list 'lambda '(arg) '(interactive "P") 4.187 - (list 'YaTeX-insert-begin-end env 'arg)) 4.188 - map) 4.189 -) 4.190 -(defun YaTeX-define-begend-region-key (key env &optional map) 4.191 - "Define short cut YaTeX-make-begin-end-region key." 4.192 - (YaTeX-define-key key (list 'lambda nil '(interactive) 4.193 - (list 'YaTeX-insert-begin-end env t)) map) 4.194 -) 4.195 -(defun YaTeX-define-begend-key (key env &optional map) 4.196 - "Define short cut key for begin type completion both for normal 4.197 -and region mode. To customize YaTeX, user should use this function." 4.198 - (YaTeX-define-begend-key-normal key env map) 4.199 - (if YaTeX-inhibit-prefix-letter nil 4.200 - (YaTeX-define-begend-region-key 4.201 - (concat (upcase (substring key 0 1)) (substring key 1)) env)) 4.202 -) 4.203 ;;; 4.204 ;; Define key table 4.205 ;;; 4.206 @@ -473,16 +420,6 @@ 4.207 YaTeX-math-key-list) 4.208 ) 4.209 4.210 -(if YaTeX-typesetting-mode-map nil 4.211 - (setq YaTeX-typesetting-mode-map (make-keymap)) 4.212 - ;(suppress-keymap YaTeX-typesetting-mode-map t) 4.213 - (define-key YaTeX-typesetting-mode-map " " 'YaTeX-jump-error-line) 4.214 - (define-key YaTeX-typesetting-mode-map "\C-m" 'YaTeX-send-string) 4.215 - (define-key YaTeX-typesetting-mode-map "1" 'delete-other-windows) 4.216 - (define-key YaTeX-typesetting-mode-map "0" 'delete-window) 4.217 - (define-key YaTeX-typesetting-mode-map "q" 'delete-window) 4.218 -) 4.219 - 4.220 (defvar YaTeX-section-completion-map nil 4.221 "*Key map used at YaTeX completion in the minibuffer.") 4.222 (if YaTeX-section-completion-map nil 4.223 @@ -503,53 +440,34 @@ 4.224 (setq YaTeX-recursive-map (copy-keymap global-map)) 4.225 (define-key YaTeX-recursive-map YaTeX-prefix YaTeX-prefix-map)) 4.226 4.227 -;; (define-key YaTeX-recursive-map 4.228 -;; (concat YaTeX-prefix (if YaTeX-inhibit-prefix-letter "\C-s" "s")) 4.229 -;; 'YaTeX-make-section) 4.230 -;; (define-key map 4.231 -;; (concat YaTeX-prefix (if YaTeX-inhibit-prefix-letter "\C-m" "m")) 4.232 -;; 'YaTeX-make-singlecmd) 4.233 -;; (define-key map 4.234 -;; (concat YaTeX-prefix (if YaTeX-inhibit-prefix-letter "\C-l" "l")) 4.235 -;; 'YaTeX-make-fontsize) 4.236 - 4.237 - 4.238 ;---------- Define other variable ---------- 4.239 (defvar env-name "document" "*Initial tex-environment completion") 4.240 (defvar section-name "documentstyle" "*Initial tex-section completion") 4.241 (defvar fontsize-name "large" "*Initial fontsize completion") 4.242 (defvar single-command "maketitle" "*Initial LaTeX single command") 4.243 -(defvar YaTeX-user-table-is-read nil 4.244 - "Flag that means whether user completion table has been read or not." 4.245 -) 4.246 -(defvar YaTeX-kanji-code-alist nil 4.247 - "Kanji-code expression translation table." 4.248 -) 4.249 -(if (boundp 'MULE) 4.250 - (setq YaTeX-kanji-code-alist 4.251 - (list (cons 4.252 - 1 4.253 - (if YaTeX-dos (if (boundp '*sjis-dos*) *sjis-dos* *sjis*dos) 4.254 - *sjis*)) 4.255 - '(2 . *junet*) '(3 . *euc-japan*)) 4.256 -)) 4.257 (defvar YaTeX-kanji-code (if YaTeX-dos 1 2) 4.258 "*File kanji code used by Japanese TeX." 4.259 ) 4.260 (defvar YaTeX-coding-system nil "File coding system used by Japanese TeX.") 4.261 -(defvar YaTeX-latex-message-code "Process coding system for LaTeX.") 4.262 (cond 4.263 + (YaTeX-emacs-20 4.264 + (setq YaTeX-coding-system 4.265 + (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist)))) 4.266 ((boundp 'MULE) 4.267 (setq YaTeX-coding-system 4.268 - (symbol-value (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist)))) 4.269 - (if (not YaTeX-dos) 4.270 - (setq YaTeX-latex-message-code *autoconv*))) 4.271 + (symbol-value (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist))))) 4.272 ((boundp 'NEMACS) 4.273 - (setq YaTeX-latex-message-code latex-message-kanji-code)) 4.274 + (setq YaTeX-latex-message-code latex-message-kanji-code))) 4.275 + 4.276 +(defvar YaTeX-mode-syntax-table nil 4.277 + "*Syntax table for yatex-mode") 4.278 + 4.279 +(if YaTeX-mode-syntax-table nil 4.280 + (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table))) 4.281 + (modify-syntax-entry ?\< "(>" YaTeX-mode-syntax-table) 4.282 + (modify-syntax-entry ?\> ")<" YaTeX-mode-syntax-table) 4.283 + (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table) 4.284 ) 4.285 -(defvar YaTeX-parent-file nil 4.286 - "*Main LaTeX source file name used when %#! expression doesn't exist.") 4.287 -(make-variable-buffer-local 'YaTeX-parent-file) 4.288 4.289 ;---------- Provide YaTeX-mode ---------- 4.290 ;;; 4.291 @@ -628,6 +546,12 @@ 4.292 )) 4.293 (cond ((boundp 'MULE) 4.294 (set-file-coding-system YaTeX-coding-system)) 4.295 + ((and YaTeX-emacs-20 (fboundp 'coding-system-equal)) 4.296 + (or (coding-system-equal 4.297 + YaTeX-coding-system buffer-file-coding-system) 4.298 + (set-buffer-file-coding-system YaTeX-coding-system))) 4.299 + ((featurep 'mule) 4.300 + (set-file-coding-system YaTeX-coding-system)) 4.301 ((boundp 'NEMACS) 4.302 (make-local-variable 'kanji-fileio-code) 4.303 (setq kanji-fileio-code YaTeX-kanji-code))) 4.304 @@ -641,10 +565,14 @@ 4.305 ;;comment-start-skip "[^\\\\]%+[ \t]*" 4.306 ) 4.307 (use-local-map YaTeX-mode-map) 4.308 + (set-syntax-table YaTeX-mode-syntax-table) 4.309 (if YaTeX-dos (setq YaTeX-saved-screen-height (screen-height))) 4.310 (YaTeX-read-user-completion-table) 4.311 (and (fboundp 'YaTeX-19-collect-macros) (YaTeX-19-collect-macros)) 4.312 (turn-on-auto-fill) ;1.63 4.313 + (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file) 4.314 + (y-or-n-p (format "Insert %s?" YaTeX-template-file)) 4.315 + (insert-file-contents (expand-file-name YaTeX-template-file))) 4.316 (run-hooks 'text-mode-hook 'yatex-mode-hook) 4.317 ) 4.318 4.319 @@ -653,9 +581,10 @@ 4.320 (defvar YaTeX-ec-regexp (regexp-quote YaTeX-ec)) 4.321 (defvar YaTeX-struct-begin 4.322 (concat YaTeX-ec "begin{%1}%2") 4.323 - "Keyword to begin environment.") 4.324 -(defvar YaTeX-struct-end (concat YaTeX-ec "end{%1}") 4.325 - "Keyword to end environment.") 4.326 + "Keyword format of begin-environment.") 4.327 +(defvar YaTeX-struct-end 4.328 + (concat YaTeX-ec "end{%1}") 4.329 + "Keyword format of end-environment.") 4.330 (defvar YaTeX-struct-name-regexp "[^}]+" 4.331 "Environment name regexp.") 4.332 (defvar YaTeX-TeX-token-regexp 4.333 @@ -672,25 +601,6 @@ 4.334 ;;; 4.335 ;; autoload section 4.336 ;;; 4.337 -;;autoload from yatexlib(general functions). 4.338 -(autoload 'YaTeX-showup-buffer "yatexlib" "YaTeX library" t) 4.339 -(autoload 'YaTeX-window-list "yatexlib" "YaTeX library" t) 4.340 -(autoload 'YaTeX-search-active-forward "yatexlib" "YaTeX library" t) 4.341 -(autoload 'YaTeX-search-active-backward "yatexlib" "YaTeX library" t) 4.342 -(autoload 'substitute-all-key-definition "yatexlib" "YaTeX library" t) 4.343 -(autoload 'YaTeX-switch-to-buffer "yatexlib" "YaTeX library" t) 4.344 -(autoload 'YaTeX-switch-to-buffer-other-window "yatexlib" "YaTeX library" t) 4.345 -(autoload 'YaTeX-replace-format "yatexlib" "YaTeX library" t) 4.346 -(autoload 'YaTeX-replace-format-args "yatexlib" "YaTeX library" t) 4.347 -(autoload 'rindex "yatexlib" "YaTeX library" t) 4.348 -(autoload 'YaTeX-match-string "yatexlib" "YaTeX library" t) 4.349 -(autoload 'YaTeX-minibuffer-complete "yatexlib" "YaTeX library" t) 4.350 -(autoload 'goto-buffer-window "yatexlib" "YaTeX library" t) 4.351 -(autoload 'split-window-calculate-height "yatexlib" "YaTeX library" t) 4.352 -(autoload 'read-string-with-history "yatexlib" "YaTeX library" t) 4.353 -(autoload 'read-from-minibuffer-with-history "yatexlib" "YaTeX library" t) 4.354 -(autoload 'completing-read-with-history "yatexlib" "YaTeX library" t) 4.355 -(autoload 'YaTeX-switch-to-window "yatexlib" "For windows.el" t) 4.356 4.357 ;;autoload from yatexprc.el 4.358 (autoload 'YaTeX-visit-main "yatexprc" "Visit main LaTeX file." t) 4.359 @@ -782,7 +692,8 @@ 4.360 (insert "\n") 4.361 (or exchange (exchange-point-and-mark))) 4.362 (goto-char beg2) 4.363 - (YaTeX-intelligent-newline nil)) 4.364 + (YaTeX-intelligent-newline nil) 4.365 + (YaTeX-indent-line)) 4.366 (if YaTeX-current-position-register 4.367 (point-to-register YaTeX-current-position-register))) 4.368 ) 4.369 @@ -813,93 +724,6 @@ 4.370 (YaTeX-make-begin-end t) 4.371 ) 4.372 4.373 -(defun YaTeX-inner-environment (&optional quick) 4.374 - "Return current inner-most environment. 4.375 -Non-nil for optional argument QUICK restricts search bound to most 4.376 -recent sectioning command. Matching point is stored to property 'point 4.377 -of 'YaTeX-inner-environment, which can be referred by 4.378 - (get 'YaTeX-inner-environment 'point)." 4.379 - (let*((nest 0) 4.380 - (beg (YaTeX-replace-format-args 4.381 - (regexp-quote YaTeX-struct-begin) 4.382 - YaTeX-struct-name-regexp 4.383 - (if (eq major-mode 'yahtml-mode) "\\s *.*" "") 4.384 - "")) 4.385 - (end (YaTeX-replace-format-args 4.386 - (regexp-quote YaTeX-struct-end) 4.387 - YaTeX-struct-name-regexp "" "")) 4.388 - (begend (concat "\\(" beg "\\)\\|\\(" end "\\)")) 4.389 - bound m0 4.390 - (open 4.391 - (concat "^" (or (cdr (assq major-mode '((yahtml-mode . "<")))) "{"))) 4.392 - (close 4.393 - (concat "^" 4.394 - (or (cdr(assq major-mode '((yahtml-mode . "\n\t >")))) "}")))) 4.395 - (save-excursion 4.396 - (if quick 4.397 - (setq bound 4.398 - (save-excursion 4.399 - (YaTeX-re-search-active-backward 4.400 - (concat YaTeX-ec-regexp 4.401 - "\\(" YaTeX-sectioning-regexp "\\)\\*?\\{") 4.402 - YaTeX-comment-prefix nil 1) 4.403 - (or (bobp) (end-of-line)) 4.404 - (point)))) 4.405 - (if (catch 'begin 4.406 - (if (and (numberp bound) (< (point) bound)) (throw 'begin nil)) 4.407 - (while (YaTeX-re-search-active-backward 4.408 - begend YaTeX-comment-prefix bound t) 4.409 - (setq m0 (match-beginning 0)) 4.410 - (if (looking-at end) ;;(match-beginning 2) 4.411 - (setq nest (1+ nest)) 4.412 - (setq nest (1- nest))) 4.413 - (if (< nest 0) 4.414 - (progn 4.415 - (put 'YaTeX-inner-environment 'point m0) 4.416 - (goto-char m0) 4.417 - (put 'YaTeX-inner-environment 'indent (current-column)) 4.418 - (throw 'begin t))))) 4.419 - (buffer-substring 4.420 - (progn (skip-chars-forward open) (1+ (point))) 4.421 - (progn (skip-chars-forward close) (point)))))) 4.422 -) 4.423 - 4.424 -(defun YaTeX-end-environment () 4.425 - "Close opening environment" 4.426 - (interactive) 4.427 - (let ((env (YaTeX-inner-environment))) 4.428 - (if (not env) (error "No premature environment") 4.429 - (save-excursion 4.430 - (if (YaTeX-search-active-forward 4.431 - (YaTeX-replace-format-args YaTeX-struct-end env "" "") 4.432 - YaTeX-comment-prefix nil t) 4.433 - (if (y-or-n-p 4.434 - (concat "Environment `" env 4.435 - "' may be already closed. Force close?")) 4.436 - nil 4.437 - (error "end environment aborted.")))) 4.438 - (message "") ;Erase (y or n) message. 4.439 - (YaTeX-insert-struc 'end env) 4.440 - (save-excursion 4.441 - (goto-char (or (get 'YaTeX-inner-environment 'point) (match-end 0))) 4.442 - (if (pos-visible-in-window-p) 4.443 - (sit-for (if YaTeX-dos 2 1)) 4.444 - (message "Matches with %s at line %d" 4.445 - (YaTeX-replace-format-args YaTeX-struct-begin env "" "") 4.446 - (count-lines (point-min) (point))))))) 4.447 -) 4.448 - 4.449 -;;;VER2 4.450 -(defun YaTeX-insert-struc (what env) 4.451 - (cond 4.452 - ((eq what 'begin) 4.453 - (insert (YaTeX-replace-format-args 4.454 - YaTeX-struct-begin env (YaTeX-addin env)))) 4.455 - ((eq what 'end) 4.456 - (insert (YaTeX-replace-format-args YaTeX-struct-end env))) 4.457 - (t nil)) 4.458 -) 4.459 - 4.460 (defun YaTeX-make-section (arg &optional beg end cmd) 4.461 "Make LaTeX \\section{} type command with completing read. 4.462 With numeric ARG, you can specify the number of arguments of 4.463 @@ -955,7 +779,8 @@ 4.464 (goto-char (marker-position e))) 4.465 (use-global-map YaTeX-recursive-map) 4.466 (if (= numarg 0) (YaTeX-make-singlecmd section-name) 4.467 - (insert YaTeX-ec section-name (YaTeX-addin section-name))) 4.468 + (progn (insert YaTeX-ec section-name) 4.469 + (insert (YaTeX-addin section-name)))) 4.470 (while (<= j numarg) 4.471 (insert 4.472 "{" 4.473 @@ -1629,10 +1454,10 @@ 4.474 ") 4.475 4.476 (defvar YaTeX-processed-file-regexp-alist-default 4.477 - '(("\\\\epsfile{[^},]*file=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 1) 4.478 + '(("\\\\epsfile\\(\\[[^]]+\\]\\)?{[^},]*file=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 2) 4.479 ("\\\\epsfig{[^},]*fi\\(le\\|gure\\)=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 2) 4.480 ("\\\\postscriptbox{[^}]*}{[^}]*}{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 1) 4.481 - ("\\\\\\(epsfbox\\|includegraphics\\){\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 2) 4.482 + ("\\\\\\(epsfbox\\|includegraphics\\|epsfig\\)\\*?{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 2) ;\epsfbox{hoge.ps} or \includegraphics{hoge.eps} 4.483 ("\\\\\\(psbox\\)\\(\\[[^]]+\\]\\)?{\\(\\([^,} ]*/\\)?[^} ]+\\)\\(\\.e?ps\\)}" 3) ;\psbox[options...]{hoge.eps} (97/1/11) 4.484 ) 4.485 "See the documentation of YaTeX-processed-file-regexp-alist." 4.486 @@ -1985,34 +1810,55 @@ 4.487 (if once (end-of-line))) 4.488 ) 4.489 4.490 -(defun YaTeX-kill-option-string () 4.491 - (if (and (eq predicate 'YaTeX-on-begin-end-p) 4.492 - (looking-at "\\(\\[.*\\]\\)*\\({.*}\\)*")) 4.493 - (delete-region (match-beginning 0) (match-end 0))) 4.494 -) 4.495 - 4.496 (defun YaTeX-kill-some-pairs (predicate gofunc kill-contents) 4.497 "Kill some matching pair. 4.498 -This function assumes that pairs occupy each line where they resid." 4.499 - ;;(interactive) 4.500 +This function assumes that pairs occupy whole of each line where they resid." 4.501 (if (not (funcall predicate)) nil 4.502 - (let ((beg (make-marker)) (end (make-marker)) (p (make-marker))) 4.503 - (set-marker end (match-end 0)) 4.504 - (if (match-beginning 2) 4.505 - (set-marker beg (match-beginning 2)) 4.506 - (set-marker beg (match-beginning 1)) 4.507 - (goto-char (match-end 0)) 4.508 - (YaTeX-kill-option-string)) 4.509 + (let ((b1 (match-beginning 0)) (e1 (match-end 0)) 4.510 + b2 e2) 4.511 (save-excursion 4.512 (funcall gofunc) 4.513 - (delete-region (point-beginning-of-line) (match-end 0)) 4.514 - (YaTeX-kill-option-string) 4.515 - (if (and (eolp) (not (eobp))) (delete-char 1)) 4.516 - (set-marker p (point)) 4.517 - (goto-char beg) 4.518 - (delete-region (point-beginning-of-line) end) 4.519 - (if (and (eolp) (not (eobp))) (delete-char 1)) 4.520 - (if kill-contents (delete-region p (point)))) 4.521 + (funcall predicate) ;get match data 4.522 + (if (< (point) e1) ;if currently on begin-line 4.523 + (progn 4.524 + (setq b2 b1 e2 e1 4.525 + b1 (match-beginning 0) e1 (match-end 0)) 4.526 + (goto-char e2)) ;goto end-line's end 4.527 + (setq b2 (match-beginning 0) 4.528 + e2 (match-end 0)) 4.529 + (goto-char e2)) ;now e2 has surely end-line's end 4.530 + (skip-chars-forward " \t") 4.531 + (and (eolp) 4.532 + (not (eobp)) 4.533 + (setq e2 (1+ (point)))) 4.534 + (if (not kill-contents) 4.535 + (kill-region 4.536 + (progn 4.537 + (goto-char b2) 4.538 + (skip-chars-backward " \t") 4.539 + (if (bolp) (point) b2)) 4.540 + e2)) 4.541 + (goto-char b1) 4.542 + (skip-chars-backward " \t") 4.543 + (if (not kill-contents) 4.544 + (progn 4.545 + (kill-append 4.546 + (buffer-substring 4.547 + (setq b1 (if (bolp) (point) b1)) 4.548 + (setq e1 4.549 + (progn 4.550 + (goto-char e1) 4.551 + (while (looking-at "{\\| \t") 4.552 + (forward-list 1)) 4.553 + (skip-chars-forward " \t") 4.554 + (if (and (eolp) (not (eobp))) 4.555 + (1+ (point)) 4.556 + (point))))) 4.557 + t) 4.558 + (delete-region b1 e1)) 4.559 + (kill-region 4.560 + (if (bolp) (point) b1) 4.561 + e2))) 4.562 t)) 4.563 ) 4.564 4.565 @@ -2094,7 +1940,9 @@ 4.566 (require 'yatexsec) ;some case needs this 4.567 (if (> (minibuffer-depth) 1) 4.568 (error "Too many minibuffer levels for overview.")) 4.569 - (let ((sw (selected-window))(enable-recursive-minibuffers t) sect) 4.570 + (let ((sw (selected-window)) 4.571 + (minibuffer-max-depth nil) ; for XEmacs20 4.572 + (enable-recursive-minibuffers t) sect) 4.573 (unwind-protect 4.574 (progn 4.575 (select-window source-window) 4.576 @@ -2622,17 +2470,6 @@ 4.577 (skip-chars-forward " \t") 4.578 (current-column))) 4.579 4.580 -(defun YaTeX-reindent (col) 4.581 - "Remove current indentation and reindento to COL column." 4.582 - (save-excursion 4.583 - (beginning-of-line) 4.584 - (skip-chars-forward " \t") 4.585 - (if (/= col (current-column)) 4.586 - (progn 4.587 - (delete-region (point) (progn (beginning-of-line) (point))) 4.588 - (indent-to col)))) 4.589 - (skip-chars-forward " \t" (point-end-of-line))) 4.590 - 4.591 (defun YaTeX-indent-line () 4.592 "Indent corrent line referrin current environment." 4.593 (interactive) 4.594 @@ -2706,8 +2543,14 @@ 4.595 ((and (bolp) fill-prefix) (insert fill-prefix)) 4.596 (t (save-excursion 4.597 (beginning-of-line) 4.598 - (skip-chars-forward " \t") 4.599 - (indent-relative-maybe)) 4.600 + (if fill-prefix 4.601 + (progn 4.602 + (delete-region (point) 4.603 + (progn (skip-chars-forward " \t") 4.604 + (point))) 4.605 + (insert fill-prefix)) 4.606 + (skip-chars-forward " \t") 4.607 + (indent-relative-maybe))) 4.608 (skip-chars-forward " \t"))) 4.609 ;;if current line is \begin, re-indent \end too 4.610 (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) 4.611 @@ -2747,179 +2590,6 @@ 4.612 (insert YaTeX-comment-prefix)))))) 4.613 ) 4.614 4.615 -(defun YaTeX-local-table-symbol (symbol) 4.616 - "Return the lisp symbol which keeps local completion table of SYMBOL." 4.617 - (intern (concat "YaTeX$" 4.618 - default-directory 4.619 - (symbol-name symbol))) 4.620 -) 4.621 - 4.622 -(defun YaTeX-sync-local-table (symbol) 4.623 - "Synchronize local variable SYMBOL. 4.624 -Copy its corresponding directory dependent completion table to SYMBOL." 4.625 - (if (boundp (YaTeX-local-table-symbol symbol)) 4.626 - (set symbol (symbol-value (YaTeX-local-table-symbol symbol)))) 4.627 -) 4.628 - 4.629 -(defun YaTeX-read-user-completion-table (&optional forcetoread) 4.630 - "Append user completion table of LaTeX macros" 4.631 - (let*((user-table (expand-file-name YaTeX-user-completion-table)) 4.632 - (local-table (expand-file-name (file-name-nondirectory user-table))) 4.633 - var localvar localbuf (curbuf (current-buffer)) sexp) 4.634 - (if YaTeX-user-table-is-read nil 4.635 - (message "Loading user completion table") 4.636 - (if (file-exists-p user-table) (load-file user-table) 4.637 - (message "Welcome to the field of YaTeX. I'm glad to see you!"))) 4.638 - (setq YaTeX-user-table-is-read t) 4.639 - (cond 4.640 - ((file-exists-p local-table) 4.641 - (set-buffer (setq localbuf (find-file-noselect local-table))) 4.642 - (widen) 4.643 - (goto-char (point-min)) 4.644 - (while (re-search-forward "(setq \\([^ ]+\\)" nil t) 4.645 - (setq var (intern (buffer-substring 4.646 - (match-beginning 1) (match-end 1))) 4.647 - localvar (YaTeX-local-table-symbol var)) 4.648 - (goto-char (match-beginning 0)) 4.649 - (setq sexp (buffer-substring (point) 4.650 - (progn (forward-sexp) (point)))) 4.651 - (set-buffer curbuf) 4.652 - (or (assq var (buffer-local-variables)) (make-local-variable var)) 4.653 - (eval (read sexp)) 4.654 - (or (and (boundp localvar) 4.655 - (symbol-value localvar) 4.656 - (not forcetoread)) 4.657 - (set localvar (symbol-value var))) 4.658 - (set-buffer localbuf)) 4.659 - (kill-buffer localbuf))) 4.660 - (set-buffer curbuf)) 4.661 -) 4.662 - 4.663 -(defun YaTeX-reload-dictionary () 4.664 - "Reload local dictionary. 4.665 -Use this function after editing ./.yatexrc." 4.666 - (interactive) 4.667 - (let ((YaTeX-user-table-is-read nil)) 4.668 - (YaTeX-read-user-completion-table t)) 4.669 -) 4.670 - 4.671 -(defun YaTeX-lookup-table (word type) 4.672 - "Lookup WORD in completion table whose type is TYPE. 4.673 -This function refers the symbol tmp-TYPE-table, user-TYPE-table, TYPE-table. 4.674 -Typically, TYPE is one of 'env, 'section, 'fontsize, 'singlecmd." 4.675 - (if (symbolp type) (setq type (symbol-name type))) 4.676 - (or (assoc word (symbol-value (intern (concat "tmp-" type "-table")))) 4.677 - (assoc word (symbol-value (intern (concat "user-" type "-table")))) 4.678 - (assoc word (symbol-value (intern (concat type "-table")))))) 4.679 - 4.680 -(defun YaTeX-update-table (vallist default-table user-table local-table) 4.681 - "Update completion table if the car of VALLIST is not in current tables. 4.682 -Second argument DEFAULT-TABLE is the quoted symbol of default completion 4.683 -table, third argument USER-TABLE is user table which will be saved in 4.684 -YaTeX-user-completion-table, fourth argument LOCAL-TABLE should have the 4.685 -completion which is valid during current Emacs's session. If you 4.686 -want to make LOCAL-TABLE valid longer span (but restrict in this directory) 4.687 -create the file in current directory which has the same name with 4.688 -YaTeX-user-completion-table." 4.689 - (let ((car-v (car vallist)) key answer 4.690 - (file (file-name-nondirectory YaTeX-user-completion-table))) 4.691 - (cond 4.692 - ((assoc car-v (symbol-value default-table)) 4.693 - nil) ;Nothing to do 4.694 - ((setq key (assoc car-v (symbol-value user-table))) 4.695 - (if (equal (cdr vallist) (cdr key)) nil 4.696 - ;; if association hits, but contents differ. 4.697 - (message 4.698 - "%s's attributes turned into %s" (car vallist) (cdr vallist)) 4.699 - (set user-table (delq key (symbol-value user-table))) 4.700 - (set user-table (cons vallist (symbol-value user-table))) 4.701 - (YaTeX-update-dictionary 4.702 - YaTeX-user-completion-table user-table "user"))) 4.703 - ((setq key (assoc car-v (symbol-value local-table))) 4.704 - (if (equal (cdr vallist) (cdr key)) nil 4.705 - (message 4.706 - "%s's attributes turned into %s" (car vallist) (cdr vallist)) 4.707 - (set local-table (delq key (symbol-value local-table))) 4.708 - (set local-table (cons vallist (symbol-value local-table))) 4.709 - (set (YaTeX-local-table-symbol local-table) (symbol-value local-table)) 4.710 - (YaTeX-update-dictionary file local-table))) 4.711 - ;; All of above cases, there are some completion in tables. 4.712 - ;; Then update tables. 4.713 - (t 4.714 - (if (not YaTeX-nervous) 4.715 - (setq answer "u") 4.716 - (message 4.717 - "`%s' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard" 4.718 - (car vallist)) 4.719 - (setq answer (char-to-string (read-char)))) 4.720 - (cond 4.721 - ((string-match answer "uy") 4.722 - (set user-table (cons vallist (symbol-value user-table))) 4.723 - (YaTeX-update-dictionary YaTeX-user-completion-table user-table "user") 4.724 - ) 4.725 - ((string-match answer "tl") 4.726 - (set local-table (cons vallist (symbol-value local-table))) 4.727 - (set (YaTeX-local-table-symbol local-table) (symbol-value local-table)) 4.728 - (YaTeX-update-dictionary file local-table)) 4.729 - ((string-match answer "d") nil) ;discard it 4.730 - (t (set default-table 4.731 - (cons vallist (symbol-value default-table)))))))) 4.732 -) 4.733 - 4.734 -(defun YaTeX-cplread-with-learning 4.735 - (prom default-table user-table local-table 4.736 - &optional pred reqmatch init hsym) 4.737 - "Completing read with learning. 4.738 -Do a completing read with prompt PROM. Completion table is what 4.739 -DEFAULT-TABLE, USER-TABLE, LOCAL table are appended in reverse order. 4.740 -Note that these tables are passed by the symbol. 4.741 -Optional arguments PRED, REQMATH and INIT are passed to completing-read 4.742 -as its arguments PREDICATE, REQUIRE-MATCH and INITIAL-INPUT respectively. 4.743 -If optional 8th argument HSYM, history symbol, is passed, use it as 4.744 -history list variable." 4.745 - (YaTeX-sync-local-table local-table) 4.746 - (let*((table (append (symbol-value local-table) 4.747 - (symbol-value user-table) 4.748 - (symbol-value default-table))) 4.749 - (word (completing-read-with-history 4.750 - prom table pred reqmatch init hsym))) 4.751 - (if (and (string< "" word) (not (assoc word table))) 4.752 - (YaTeX-update-table (list word) default-table user-table local-table)) 4.753 - word) 4.754 -) 4.755 - 4.756 -(defun YaTeX-update-dictionary (file symbol &optional type) 4.757 - (let ((local-table-buf (find-file-noselect file)) 4.758 - (name (symbol-name symbol)) 4.759 - (value (symbol-value symbol))) 4.760 - (save-excursion 4.761 - (message "Updating %s dictionary..." (or type "local")) 4.762 - (set-buffer local-table-buf) 4.763 - (goto-char (point-max)) 4.764 - (search-backward (concat "(setq " name) nil t) 4.765 - (delete-region (point) (progn (forward-sexp) (point))) 4.766 - (delete-blank-lines) 4.767 - (insert "(setq " name " '(\n") 4.768 - (mapcar '(lambda (s) 4.769 - (insert (format "%s\n" (prin1-to-string s)))) 4.770 - value) 4.771 - (insert "))\n\n") 4.772 - (delete-blank-lines) 4.773 - (basic-save-buffer) 4.774 - (kill-buffer local-table-buf) 4.775 - (message "Updating %s dictionary...Done" (or type "local")))) 4.776 -) 4.777 - 4.778 -;; --------------- General sub functions --------------- 4.779 -(defun point-beginning-of-line () 4.780 - (save-excursion (beginning-of-line)(point)) 4.781 -) 4.782 - 4.783 -(defun point-end-of-line () 4.784 - (save-excursion (end-of-line)(point)) 4.785 -) 4.786 - 4.787 - 4.788 (provide 'yatex) 4.789 (defvar yatex-mode-load-hook nil 4.790 "*List of functions to be called when yatex.el is loaded.")
5.1 --- a/yatex.new Sat Dec 13 12:41:43 1997 +0000 5.2 +++ b/yatex.new Tue Dec 16 13:28:38 1997 +0000 5.3 @@ -1,6 +1,27 @@ 5.4 What's new in YaTeX 5.5 野鳥/yahtml - 各バージョンの変更点について 5.6 5.7 +1.65 yahtmlのお任せ改行のバグフィクス。 5.8 + a, body, img タグのオプション引数入力アドインの強化。 5.9 + section型マクロの第一引数が改行によって分断されていても正しく 5.10 + hilitするようにした。 5.11 + yahtmlの行インデント関数の高速化。カレント行がタグで始まらないと 5.12 + きは直前の非空行のインデントを真似するようにした。副作用あるかも。 5.13 + thebibliography環境でitemize系インデントが効いていなかったのを修正。 5.14 + GNU Emacs 20 対応(by竹中さん&me)。 5.15 + XEmacs 20 対応。 5.16 + yahtmlパッケージの独立性強化。 5.17 + [prefix] k で環境を消したときはkill-ringに追加するようにした。 5.18 + yahtml-hate-too-deep-indentation がtのときにインデントが浅くなり 5.19 + すぎるのを修正。 5.20 + href 補完の http:// ヒストリを .mosaic-global-history から取るの 5.21 + を廃止し、ユーザ辞書に登録するようにした。 5.22 + yahtmlの [prefix] p で <p></p> が出るようにした。 5.23 + yahtmlのおまかせ改行で、yahtml-p-prefered-env-regexp にマッチす 5.24 + るタグ環境内のときは<p></p>を自動挿入するようにした。 5.25 + YaTeX-fill-prefix, yahtml-fill-prefix(新設)のデフォルトをnilに。 5.26 + YaTeX-template-file, yahtml-template-file を新規ファイルに挿入。 5.27 + 5.28 1.64 yahtmlを起動するとYaTeXで [prefix] Bc が<center>などになってしま 5.29 うのを修正。 5.30 NTT-jTeX が t のときにfillがうまく行かないことがあるのを修正。 5.31 @@ -20,14 +41,14 @@ 5.32 \のあとに{を入れたときは\}を入れるようにした。 5.33 yahtmlでブラウザにIEを指定したときの不具合を修正。 5.34 5.35 -1.62 \ref の引数が二行に渡る時行末に%を付けるようにした 5.36 - yahtmlでおまかせ改行が不必要に起動するのを修正 5.37 - href の補完文字列に # が含まれる時は name を補完 5.38 +1.62 \ref の引数が二行に渡る時行末に%を付けるようにした。 5.39 + yahtmlでおまかせ改行が不必要に起動するのを修正。 5.40 + href の補完文字列に # が含まれる時は name を補完。 5.41 \epsfile{file=foo.eps} などで [prefix] g した場合、foo.epsの元絵 5.42 - を編集しているお絵書きソフトを起動するようにした 5.43 - yahtmlで [prefix] a で < などが入るようにした 5.44 - verbatim環境の [prefix] g がうまく飛ばなかったのを修正 5.45 - sectionのオプション引数をつけた時の色づけが無効だったのを修正 5.46 + を編集しているお絵書きソフトを起動するようにした。 5.47 + yahtmlで [prefix] a で < などが入るようにした。 5.48 + verbatim環境の [prefix] g がうまく飛ばなかったのを修正。 5.49 + sectionのオプション引数をつけた時の色づけが無効だったのを修正。 5.50 5.51 1.61 AMS-LaTeX 対応 5.52 xdvi -remote によるサーチに対応 [prefix] t s
6.1 --- a/yatex19.el Sat Dec 13 12:41:43 1997 +0000 6.2 +++ b/yatex19.el Tue Dec 16 13:28:38 1997 +0000 6.3 @@ -1,7 +1,7 @@ 6.4 ;;; -*- Emacs-Lisp -*- 6.5 ;;; YaTeX facilities for Emacs 19 6.6 ;;; (c )1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 6.7 -;;; Last modified Fri Feb 14 13:52:54 1997 on supra 6.8 +;;; Last modified Sun Dec 14 21:51:14 1997 on firestorm 6.9 ;;; $Id$ 6.10 6.11 ;;; とりあえず hilit19 を使っている時に色が付くようにして 6.12 @@ -9,146 +9,117 @@ 6.13 ;;; いったい誰がメニューバー使ってLaTeXソース書くんだろうか? 6.14 ;;; まあいいや練習練習。後ろの方にちょっとコメントあり。 6.15 ;;; 真中辺にあるけど、hilit19.el 対応の方は結構本気。 6.16 +;;; とかいってるうちに hilit19 って obsolete になってしまった… 6.17 6.18 -(require 'yatex) 6.19 +;(require 'yatex) 6.20 6.21 -(defun YaTeX-19-define-sub-menu (map vec &rest bindings) 6.22 - "Define sub-menu-item in MAP at vector VEC as BINDINGS. 6.23 -BINDINGS is a form with optional length: (symbol title binding). 6.24 -When you defined menu-bar keymap such like: 6.25 - (define-key foo-map [menu-bar foo] (make-sparse-keymap \"foo menu\")) 6.26 -and you want to define sub menu for `foo menu' as followings. 6.27 - foo -> menu1 (calling function `func1') 6.28 - menu2 (doing interactive call `(func2 ...)' 6.29 -Call this function like this: 6.30 - (YaTeX-19-define-sub-menu foo-map [menu-bar foo] 6.31 - '(m1 \"Function 1\" func1) 6.32 - '(m2 \"Function 2\" (lambda () (interactive) (func2 ...)))) 6.33 -where 6.34 - `m1' and `m2' are the keymap symbol for sub-menu of `[menu-bar foo]. 6.35 - `Funtion 1' and `Function 2' are the title strings for sub-menu. 6.36 -" 6.37 - (let ((i 0) (vec2 (make-vector (1+ (length vec)) nil))) 6.38 - (while (< i (length vec)) 6.39 - (aset vec2 i (aref vec i)) 6.40 - (setq i (1+ i))) 6.41 - (setq bindings (reverse bindings)) 6.42 - (mapcar 6.43 - (function 6.44 - (lambda (bind) 6.45 - (aset vec2 (1- (length vec2)) (car bind)) ;set menu-symbol 6.46 - (define-key map vec2 6.47 - (cons (car (cdr bind)) 6.48 - (car (cdr (cdr bind))))))) 6.49 - bindings))) 6.50 +(defvar YaTeX-mode-menu-map (make-sparse-keymap "YaTeX")) 6.51 +(defvar YaTeX-mode-menu-map-process (make-sparse-keymap "Process")) 6.52 +(define-key YaTeX-mode-map [menu-bar yatex] 6.53 + (cons "YaTeX" YaTeX-mode-menu-map)) 6.54 +(YaTeX-define-menu 6.55 + 'YaTeX-mode-menu-map-process 6.56 + (nreverse 6.57 + '((buffer "LaTeX" . (lambda () (interactive) (YaTeX-typeset-menu nil ?j))) 6.58 + (kill "Kill LaTeX" . (lambda () (interactive) (YaTeX-typeset-menu nil ?k))) 6.59 + (bibtex "BibTeX" . (lambda () (interactive) (YaTeX-typeset-menu nil ?b))) 6.60 + (mindex "makeindex" . (lambda () (interactive) (YaTeX-typeset-menu nil ?i))) 6.61 + (preview "Preview" . (lambda () (interactive) (YaTeX-typeset-menu nil ?p))) 6.62 + (lpr "lpr" . (lambda () (interactive) (YaTeX-typeset-menu nil ?l))) 6.63 + (lpq "lpq" . (lambda () (interactive) (YaTeX-typeset-menu nil ?q)))))) 6.64 +(defvar YaTeX-mode-menu-map-modes (make-sparse-keymap "Modes")) 6.65 +(YaTeX-define-menu 6.66 + 'YaTeX-mode-menu-map-modes 6.67 + (delq nil 6.68 + (nreverse 6.69 + (list 6.70 + (if YaTeX-auto-math-mode nil 6.71 + (cons 'math (cons "Toggle math-mode" 6.72 + '(lambda () (interactive) 6.73 + (YaTeX-switch-mode-menu nil ?t))))) 6.74 + (cons 'mod (cons "Toggle Modify Mode" 6.75 + '(lambda () (interactive) 6.76 + (YaTeX-switch-mode-menu nil ?m)))))))) 6.77 +(defvar YaTeX-mode-menu-map-percent (make-sparse-keymap "percent")) 6.78 +(YaTeX-define-menu 6.79 + 'YaTeX-mode-menu-map-percent 6.80 + (nreverse 6.81 + '((! "Change LaTeX typesetter(%#!)" 6.82 + . (lambda () (interactive) (YaTeX-%-menu nil nil ?!))) 6.83 + (begend "Set %#BEGIN-%#END on region" 6.84 + . (lambda () (interactive) (YaTeX-%-menu nil nil ?b))) 6.85 + (lpr "Change LPR format" 6.86 + . (lambda () (interactive) (YaTeX-%-menu nil nil ?l)))))) 6.87 6.88 -;; Menu for Typeset relating processes ---------------------------------------- 6.89 -(define-key YaTeX-mode-map [menu-bar yatex] 6.90 - (cons "YaTeX" (make-sparse-keymap "YaTeX"))) 6.91 -(define-key YaTeX-mode-map [menu-bar yatex process] 6.92 - (cons "Process" (make-sparse-keymap "Process"))) 6.93 -(YaTeX-19-define-sub-menu 6.94 - YaTeX-mode-map [menu-bar yatex process] 6.95 - '(buffer "LaTeX" (lambda () (interactive) (YaTeX-typeset-menu nil ?j))) 6.96 - '(kill "Kill LaTeX" (lambda () (interactive) (YaTeX-typeset-menu nil ?k))) 6.97 - '(bibtex "BibTeX" (lambda () (interactive) (YaTeX-typeset-menu nil ?b))) 6.98 - '(makeindex "makeindex" (lambda () (interactive) (YaTeX-typeset-menu nil ?i))) 6.99 - '(preview "Preview" (lambda () (interactive) (YaTeX-typeset-menu nil ?p))) 6.100 - '(lpr "lpr" (lambda () (interactive) (YaTeX-typeset-menu nil ?l))) 6.101 - '(lpq "lpq" (lambda () (interactive) (YaTeX-typeset-menu nil ?q))) 6.102 -) 6.103 +(defvar YaTeX-mode-menu-map-jump (make-sparse-keymap "jump")) 6.104 +(YaTeX-define-menu 6.105 + 'YaTeX-mode-menu-map-jump 6.106 + (nreverse 6.107 + '((corres "Goto corersponding position" . YaTeX-goto-corresponding-*) 6.108 + (main "Visit main source" 6.109 + . (lambda () (interactive) (YaTeX-visit-main))) 6.110 + (main-other "Visit main source other window" 6.111 + . YaTeX-visit-main-other-window)))) 6.112 6.113 -;; Help for LaTeX ------------------------------------------------------------ 6.114 -(YaTeX-19-define-sub-menu 6.115 - YaTeX-mode-map [menu-bar yatex] 6.116 - '(sephelp "--") 6.117 - '(help "Help on LaTeX commands" YaTeX-help) 6.118 - '(apropos "Apropos on LaTeX commands" YaTeX-apropos)) 6.119 +(defvar YaTeX-mode-menu-map-comment (make-sparse-keymap "comment")) 6.120 +(YaTeX-define-menu 6.121 + 'YaTeX-mode-menu-map-comment 6.122 + (nreverse 6.123 + '((comment "Comment region or environment" . YaTeX-comment-region) 6.124 + (uncomment "Unomment region or environment" . YaTeX-uncomment-region) 6.125 + (commentp "Comment paragraph" . YaTeX-comment-paragraph) 6.126 + (uncommentp "Uncomment paragraph" . YaTeX-uncomment-paragraph)))) 6.127 6.128 -;; Switch modes -------------------------------------------------------------- 6.129 -(define-key YaTeX-mode-map [menu-bar yatex switch] 6.130 - (cons "Switching YaTeX's modes" (make-sparse-keymap "modes"))) 6.131 -(or YaTeX-auto-math-mode 6.132 - (define-key YaTeX-mode-map [menu-bar yatex switch math] 6.133 - '("Toggle math mode" . (lambda () (interactive) 6.134 - (YaTeX-switch-mode-menu nil ?t))))) 6.135 -(define-key YaTeX-mode-map [menu-bar yatex switch mod] 6.136 - '("Toggle modify mode" . (lambda () (interactive) 6.137 - (YaTeX-switch-mode-menu nil ?m)))) 6.138 +(YaTeX-define-menu 6.139 + 'YaTeX-mode-menu-map 6.140 + (nreverse 6.141 + (list 6.142 + ;; Change/Kill/Fill ------------------------------------------------------- 6.143 + (cons (list 'chg "Change") (cons "Change macros" 'YaTeX-change-*)) 6.144 + (cons (list 'kill "Kill") (cons "Kill macros" 'YaTeX-kill-*)) 6.145 + (cons (list 'fill "Fill") (cons "Fill \\item" 'YaTeX-fill-item)) 6.146 + (cons (list 'nl "Newline") (cons "Newline" 'YaTeX-intelligent-newline)) 6.147 + ;; ======================================================================== 6.148 + (cons (list 'sep1 "---") (cons "---" nil)) 6.149 + ;; Comment/Uncomment ------------------------------------------------------ 6.150 + (cons (list 'comment "comment") (cons "Comment region or environment" 6.151 + 'YaTeX-comment-region)) 6.152 + (cons (list 'uncomment "uncomment") (cons "Uncomment region or environment" 6.153 + 'YaTeX-uncomment-region)) 6.154 + (cons (list 'commentp "commentp") (cons "Comment paragraph" 6.155 + 'YaTeX-comment-paragraph)) 6.156 + (cons (list 'uncommentp "uncommentp") (cons "Uncomment paragraph" 6.157 + 'YaTeX-uncomment-paragraph)) 6.158 + ;; ======================================================================== 6.159 + (cons (list 'sep2 "---") (cons "---" nil)) 6.160 + ;; Jump cursor ------------------------------------------------------------ 6.161 + (cons (list 'jump "jump") (cons "Jump Cursor" YaTeX-mode-menu-map-jump)) 6.162 + ;; Document hierarchy --------------------------------------------------- 6.163 + (cons (list 'hier "hier") (cons "Display Document hierarchy" 6.164 + 'YaTeX-display-hierarchy)) 6.165 + ;; What position ---------------------------------------------------------- 6.166 + (cons (list 'col "column") (cons "What column in tabular" 6.167 + 'YaTeX-what-column)) 6.168 + ;; % menu ----------------------------------------------------------------- 6.169 + (cons (list 'percent "percent") (cons "Edit %# notation" 6.170 + YaTeX-mode-menu-map-percent)) 6.171 + ;; Switch modes ----------------------------------------------------------- 6.172 + (cons (list 'mode "mode") (cons "Switching YaTeX's modes" 6.173 + YaTeX-mode-menu-map-modes)) 6.174 + ;; ======================================================================== 6.175 + (cons (list 'sep "---") (cons "---" nil)) 6.176 + ;; Help for LaTeX --------------------------------------------------------- 6.177 + (cons (list 'ap "apr") (cons "Apropos on LaTeX commands" 'YaTeX-apropos)) 6.178 + (cons (list 'help "help") (cons "Help on LaTeX commands" 'YaTeX-help)) 6.179 + ;; Menu for Typeset relating processes ------------------------------------ 6.180 + (cons (list 'process "Process menu") 6.181 + (cons "Process" YaTeX-mode-menu-map-process))) 6.182 +)) 6.183 6.184 -;; % menu -------------------------------------------------------------------- 6.185 -(define-key YaTeX-mode-map [menu-bar yatex percent] 6.186 - (cons "Edit %# notation" (make-sparse-keymap "Edit %# notation"))) 6.187 -(YaTeX-19-define-sub-menu 6.188 - YaTeX-mode-map [menu-bar yatex percent] 6.189 - '(! "Change LaTeX typesetter(%#!)" 6.190 - (lambda () (interactive) (YaTeX-%-menu nil nil ?!))) 6.191 - '(begend "Set %#BEGIN-%#END on region" 6.192 - (lambda () (interactive) (YaTeX-%-menu nil nil ?b))) 6.193 - '(lpr "Change LPR format" 6.194 - (lambda () (interactive) (YaTeX-%-menu nil nil ?l)))) 6.195 - 6.196 -;; What position ------------------------------------------------------------- 6.197 -(YaTeX-19-define-sub-menu 6.198 - YaTeX-mode-map [menu-bar yatex] 6.199 - '(what "What column in tabular" YaTeX-what-column)) 6.200 - 6.201 -;; Document hierarchy ------------------------------------------------------ 6.202 -(YaTeX-19-define-sub-menu 6.203 - YaTeX-mode-map [menu-bar yatex] 6.204 - '(hier "Display document hierarchy" YaTeX-display-hierarchy-directly)) 6.205 - 6.206 -;; Jump cursor --------------------------------------------------------------- 6.207 -(define-key YaTeX-mode-map [menu-bar yatex jump] 6.208 - (cons "Jump cursor" 6.209 - (make-sparse-keymap "Jump cursor"))) 6.210 -(YaTeX-19-define-sub-menu 6.211 - YaTeX-mode-map [menu-bar yatex jump] 6.212 - '(corres "Goto corersponding position" YaTeX-goto-corresponding-*) 6.213 - '(main "Visit main source" (lambda () (interactive) (YaTeX-visit-main))) 6.214 - '(main-other "Visit main source other window" YaTeX-visit-main-other-window) 6.215 - ) 6.216 - 6.217 -;; =========================================================================== 6.218 -(define-key YaTeX-mode-map [menu-bar yatex sepcom] 6.219 - '("---" . nil)) 6.220 - 6.221 -;; Comment/Uncomment --------------------------------------------------------- 6.222 -(YaTeX-19-define-sub-menu 6.223 - YaTeX-mode-map [menu-bar yatex] 6.224 - '(comment "Comment region or environment" YaTeX-comment-region) 6.225 - '(uncomment "Unomment region or environment" YaTeX-uncomment-region) 6.226 - '(commentp "Comment paragraph" YaTeX-comment-paragraph) 6.227 - '(uncommentp "Uncomment paragraph" YaTeX-uncomment-paragraph) 6.228 - '(sepcom "--" nil) 6.229 -) 6.230 - 6.231 - 6.232 -;; =========================================================================== 6.233 -;; Change/Kill/Fill 6.234 -(YaTeX-19-define-sub-menu 6.235 - YaTeX-mode-map [menu-bar yatex] 6.236 - '(change "Change macros" YaTeX-change-*) 6.237 - '(kill "Kill macros" YaTeX-kill-*) 6.238 - '(fillitem "Fill \\item" YaTeX-fill-item) 6.239 - '(newline "Newline" YaTeX-intelligent-newline) 6.240 - '(sepchg "--" nil) 6.241 -) 6.242 - 6.243 -;; Menu for completions ------------------------------------------------------ 6.244 - 6.245 - 6.246 -;;;(YaTeX-19-define-sub-menu 6.247 -;;; YaTeX-mode-map [menu-bar yatex] 6.248 -;;; '(secr "Section-type command on region" YaTeX-make-section-region) 6.249 -;;; '(sec "Section-type command" YaTeX-make-section)) 6.250 - 6.251 -(define-key YaTeX-mode-map [menu-bar yatex sectionr] 6.252 - (cons "Section-type region(long name)" 6.253 - (make-sparse-keymap "Enclose region with section-type macro"))) 6.254 -(define-key YaTeX-mode-map [menu-bar yatex section] 6.255 - (cons "Section-type(long name)" 6.256 - (make-sparse-keymap "Section-type macro"))) 6.257 +;; Make section-type commands menu ------------------------------------------- 6.258 +(defvar YaTeX-mode-menu-map-sectionr 6.259 + (make-sparse-keymap "Enclose region with section-type macro")) 6.260 +(defvar YaTeX-mode-menu-map-section (make-sparse-keymap "Section-type macro")) 6.261 (let ((sorted-section 6.262 (sort 6.263 (delq nil 6.264 @@ -157,56 +128,91 @@ 6.265 (car s)))) 6.266 (append section-table user-section-table))) 6.267 'string<))) 6.268 - (apply 'YaTeX-19-define-sub-menu 6.269 - YaTeX-mode-map [menu-bar yatex section] 6.270 - (mapcar (function (lambda (secname) 6.271 - (list (intern secname) secname 6.272 - (list 'lambda () 6.273 - (list 'interactive) 6.274 - (list 'YaTeX-make-section 6.275 - nil nil nil secname))))) 6.276 - sorted-section)) 6.277 - (apply 'YaTeX-19-define-sub-menu 6.278 - YaTeX-mode-map [menu-bar yatex sectionr] 6.279 - (mapcar (function (lambda (secname) 6.280 - (list (intern secname) secname 6.281 - (list 'lambda () 6.282 - (list 'interactive) 6.283 - (list 'YaTeX-make-section 6.284 - nil 6.285 - (list 'region-beginning) 6.286 - (list 'region-end) 6.287 - secname))))) 6.288 - sorted-section))) 6.289 + (YaTeX-define-menu 6.290 + 'YaTeX-mode-menu-map-section 6.291 + (mapcar 6.292 + (function (lambda (secname) 6.293 + (cons (intern secname) 6.294 + (cons secname 6.295 + (list 'lambda () 6.296 + (list 'interactive) 6.297 + (list 'YaTeX-make-section 6.298 + nil nil nil 6.299 + secname)))))) 6.300 + sorted-section)) 6.301 + (YaTeX-define-menu 6.302 + 'YaTeX-mode-menu-map-sectionr 6.303 + (mapcar 6.304 + (function (lambda (secname) 6.305 + (cons (intern secname) 6.306 + (cons secname 6.307 + (list 'lambda () 6.308 + (list 'interactive) 6.309 + (list 'YaTeX-make-section 6.310 + nil 6.311 + (list 'region-beginning) 6.312 + (list 'region-end) 6.313 + secname)))))) 6.314 + sorted-section))) 6.315 6.316 -(define-key YaTeX-mode-map [menu-bar yatex envr] 6.317 - (cons "Environment region" (make-sparse-keymap "Environment region"))) 6.318 -(define-key YaTeX-mode-map [menu-bar yatex env] 6.319 - (cons "Environment" (make-sparse-keymap "Environment"))) 6.320 -(let (prev envname) 6.321 - (mapcar 6.322 - (function 6.323 - (lambda (envalist) 6.324 - (setq envname (car envalist)) 6.325 - (define-key-after 6.326 - (lookup-key YaTeX-mode-map [menu-bar yatex env]) 6.327 - (vector (intern envname)) 6.328 - (cons envname 6.329 - (list 'lambda () (list 'interactive) 6.330 - (list 'YaTeX-insert-begin-end 6.331 - envname nil))) 6.332 - prev) 6.333 - (define-key-after 6.334 - (lookup-key YaTeX-mode-map [menu-bar yatex envr]) 6.335 - (vector (intern envname)) 6.336 - (cons envname 6.337 - (list 'lambda () (list 'interactive) 6.338 - (list 'YaTeX-insert-begin-end 6.339 - envname t))) 6.340 - prev) 6.341 - (setq prev (intern envname)))) 6.342 - (sort (append env-table user-env-table) 6.343 - '(lambda (x y) (string< (car x) (car y)))))) 6.344 +(YaTeX-define-menu 6.345 + 'YaTeX-mode-menu-map 6.346 + (nreverse 6.347 + (list 6.348 + (cons '(sectionr "Section-type (long name)") 6.349 + (cons "Section type" YaTeX-mode-menu-map-section)) 6.350 + (cons '(section "Section-type region (long name)") 6.351 + (cons "Section type region (long name)" 6.352 + YaTeX-mode-menu-map-sectionr))))) 6.353 + 6.354 +;; Make large-type commands menu --------------------------------------------- 6.355 +(defvar YaTeX-mode-menu-map-envr (make-sparse-keymap "Environment region")) 6.356 +(defvar YaTeX-mode-menu-map-env (make-sparse-keymap "Environment")) 6.357 + 6.358 +(let ((sorted-env 6.359 + (sort 6.360 + (mapcar (function (lambda (s) (car s))) 6.361 + (append env-table user-env-table)) 6.362 + 'string<))) 6.363 + (YaTeX-define-menu 6.364 + 'YaTeX-mode-menu-map-env 6.365 + (mapcar 6.366 + (function (lambda (envname) 6.367 + (cons (intern envname) 6.368 + (cons envname 6.369 + (list 'lambda () 6.370 + (list 'interactive) 6.371 + (list 'YaTeX-insert-begin-end 6.372 + envname nil)))))) 6.373 + sorted-env)) 6.374 + (YaTeX-define-menu 6.375 + 'YaTeX-mode-menu-map-envr 6.376 + (mapcar 6.377 + (function (lambda (envname) 6.378 + (cons (intern envname) 6.379 + (cons envname 6.380 + (list 'lambda () 6.381 + (list 'interactive) 6.382 + (list 'YaTeX-insert-begin-end 6.383 + envname t)))))) 6.384 + sorted-env))) 6.385 +(YaTeX-define-menu 6.386 + 'YaTeX-mode-menu-map 6.387 + (nreverse 6.388 + (list 6.389 + (cons '(envr "Environment") 6.390 + (cons "Environment" YaTeX-mode-menu-map-env)) 6.391 + (cons '(env "Environment region") 6.392 + (cons "Environment region" 6.393 + YaTeX-mode-menu-map-envr))))) 6.394 + 6.395 +(and (featurep 'xemacs) 6.396 + (add-hook 'yatex-mode-hook 6.397 + '(lambda () 6.398 + (or (assoc "YaTeX" current-menubar) 6.399 + (progn 6.400 + (set-buffer-menubar (copy-sequence current-menubar)) 6.401 + (add-submenu nil YaTeX-mode-menu-map)))))) 6.402 6.403 ;; Other key bindings for window-system 6.404 ;(YaTeX-define-key [?\C- ] 'YaTeX-do-completion) 6.405 @@ -225,10 +231,10 @@ 6.406 "Return list of starting and end point of section-type commands of PATTERN." 6.407 (if (re-search-forward pattern nil t) 6.408 (let ((m0 (match-beginning 0)) cmd (argc 1)) 6.409 - (setq cmd (substring (YaTeX-match-string 0) 1 -1) 6.410 + (setq cmd (substring (YaTeX-match-string 0) 1) 6.411 argc (or (car (cdr (YaTeX-lookup-table cmd 'section))) argc)) 6.412 (cons m0 6.413 - (progn (skip-chars-backward "^{") (forward-char -2) 6.414 + (progn ;(skip-chars-backward "^{") (forward-char -2) 6.415 (while (> argc 0) 6.416 (skip-chars-forward "^{") 6.417 (forward-list 1) 6.418 @@ -264,23 +270,23 @@ 6.419 ;; comments 6.420 (YaTeX-19-region-comment "\\([^\\]\\|^\\)\\(%\\).*$" comment) 6.421 6.422 - (YaTeX-19-region-section-type "\\\\footnote\\(mark\\|text\\)?{" keyword) 6.423 + (YaTeX-19-region-section-type "\\\\footnote\\(mark\\|text\\)?\\>" keyword) 6.424 ("\\\\[a-z]+box" 0 keyword) 6.425 - (YaTeX-19-region-section-type "\\\\\\(v\\|h\\)space\\(\*\\)?{" keyword) 6.426 + (YaTeX-19-region-section-type "\\\\\\(v\\|h\\)space\\>" keyword) 6.427 6.428 ;; (re-)define new commands/environments/counters 6.429 (YaTeX-19-region-section-type 6.430 - "\\\\\\(re\\)?new\\(environment\\|command\\|theorem\\|length\\|counter\\){" 6.431 + "\\\\\\(re\\)?new\\(environment\\|command\\|theorem\\|length\\|counter\\)\\>" 6.432 defun) 6.433 (YaTeX-19-region-section-type 6.434 - "\\\\textbf{" bold) 6.435 + "\\\\textbf\\>" bold) 6.436 6.437 ;; various declarations/definitions 6.438 (YaTeX-19-region-section-type 6.439 - "\\\\\\(set\\|setto\\|addto\\)\\(length\\|width\\|counter\\){" 6.440 + "\\\\\\(set\\|setto\\|addto\\)\\(length\\|width\\|counter\\)\\>" 6.441 define) 6.442 (YaTeX-19-region-section-type 6.443 - "\\\\\\(title\\|author\\|date\\|thanks\\){" define) 6.444 + "\\\\\\(title\\|author\\|date\\|thanks\\)\\>" define) 6.445 6.446 ("\\\\document\\(style\\|class\\)\\(\\[.*\\]\\)?{" "}" decl) 6.447 ("\\\\\\(begin\\|end\\|nofiles\\|includeonly\\){" "}" decl) 6.448 @@ -295,11 +301,11 @@ 6.449 ;;this should be customized by YaTeX-item-regexp 6.450 ("\\\\\\(sub\\)*item\\b\\(\\[[^]]*\\]\\)?" 0 label) 6.451 (YaTeX-19-region-section-type 6.452 - "\\\\caption\\(\\[[^]]*\\]\\)?{" label) 6.453 + "\\\\caption\\(\\[[^]]*\\]\\)?\\>" label) 6.454 6.455 ;; things that do some sort of cross-reference 6.456 (YaTeX-19-region-section-type 6.457 - "\\\\\\(\\(no\\)?cite\\|\\(page\\)?ref\\|label\\|index\\|glossary\\){" 6.458 + "\\\\\\(\\(no\\)?cite\\|\\(page\\)?ref\\|label\\|index\\|glossary\\)\\>" 6.459 crossref) 6.460 6.461 ;; things that bring in external files 6.462 @@ -373,7 +379,9 @@ 6.463 list YaTeX-sectioning-level) 6.464 (while list 6.465 (setq pat (concat YaTeX-ec-regexp (car (car list)) 6.466 - "\\*?\\(\\[[^]]*\\]\\)?{") 6.467 + ;"\\*?\\(\\[[^]]*\\]\\)?\\>" 6.468 + "\\>" 6.469 + ) 6.470 level (cdr (car list)) 6.471 fg (format "hex-%02x%02x%02x" 6.472 (- fR (/ (* level fR fmin) lm 100)) 6.473 @@ -416,7 +424,7 @@ 6.474 (lambda (s) (regexp-quote (car s)))) 6.475 sect 6.476 "\\|") 6.477 - "\\){"))) 6.478 + "\\)\\>"))) 6.479 (if (setq single (append user-singlecmd-table tmp-singlecmd-table)) 6.480 (setq single (concat "\\\\\\(" 6.481 (mapconcat 6.482 @@ -511,6 +519,7 @@ 6.483 ;;; formula 'khaki 6.484 ;;; label 'yellow-underlined)) 6.485 (and YaTeX-emacs-19 6.486 + (not (featurep 'xemacs)) 6.487 (boundp 'byte-compile-current-file) 6.488 (if (and (boundp 'window-system) window-system) 6.489 (require 'hilit19)
7.1 --- a/yatexadd.el Sat Dec 13 12:41:43 1997 +0000 7.2 +++ b/yatexadd.el Tue Dec 16 13:28:38 1997 +0000 7.3 @@ -2,7 +2,7 @@ 7.4 ;;; YaTeX add-in functions. 7.5 ;;; yatexadd.el rev.13 7.6 ;;; (c )1991-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 7.7 -;;; Last modified Fri Jan 24 18:00:45 1997 on supra 7.8 +;;; Last modified Wed Jun 25 21:21:13 1997 on domani 7.9 ;;; $Id$ 7.10 7.11 ;;; 7.12 @@ -140,6 +140,11 @@ 7.13 "{" (read-string "Width: ") "}") 7.14 ) 7.15 7.16 +(defun YaTeX:thebibliography () 7.17 + (setq section-name "bibitem") 7.18 + "" 7.19 +) 7.20 + 7.21 ;;; 7.22 ;;Sample functions for section-type command. 7.23 ;;; 7.24 @@ -282,7 +287,7 @@ 7.25 ) 7.26 7.27 (defun YaTeX:bibitem () 7.28 - (let ((label (read-string "Citation label: "))) 7.29 + (let ((label (read-string "Citation label for bibitem: "))) 7.30 (if (string= label "") "" 7.31 (concat "[" label "]"))) 7.32 )
8.1 --- a/yatexenv.el Sat Dec 13 12:41:43 1997 +0000 8.2 +++ b/yatexenv.el Tue Dec 16 13:28:38 1997 +0000 8.3 @@ -2,7 +2,7 @@ 8.4 ;;; YaTeX environment-specific functions. 8.5 ;;; yatexenv.el 8.6 ;;; (c ) 1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 8.7 -;;; Last modified Mon Apr 7 15:19:05 1997 on crx 8.8 +;;; Last modified Wed Jun 25 21:30:45 1997 on domani 8.9 ;;; $Id$ 8.10 8.11 ;;; 8.12 @@ -188,6 +188,12 @@ 8.13 (YaTeX-indent-line) 8.14 ) 8.15 8.16 +(defun YaTeX-intelligent-newline-thebibliography () 8.17 + "Insert '\\bibitem '." 8.18 + (YaTeX-indent-line) 8.19 + (YaTeX-make-section nil nil nil "bibitem") 8.20 + (YaTeX-indent-line) 8.21 +) 8.22 8.23 ;;; 8.24 ;; Intelligent newline
9.1 --- a/yatexlib.el Sat Dec 13 12:41:43 1997 +0000 9.2 +++ b/yatexlib.el Tue Dec 16 13:28:38 1997 +0000 9.3 @@ -1,10 +1,283 @@ 9.4 ;;; -*- Emacs-Lisp -*- 9.5 -;;; YaTeX library of general functions. 9.6 +;;; YaTeX and yahtml common libraries, general functions and definitions 9.7 ;;; yatexlib.el 9.8 -;;; (c )1994-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 9.9 -;;; Last modified Fri Apr 5 17:56:43 1996 on supra 9.10 +;;; (c )1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 9.11 +;;; Last modified Tue Dec 16 14:48:22 1997 on firestorm 9.12 ;;; $Id$ 9.13 9.14 +;; General variables 9.15 +(defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2))) 9.16 +(defvar YaTeX-emacs-19 (>= (string-to-int emacs-version) 19)) 9.17 +(defvar YaTeX-emacs-20 (>= (string-to-int emacs-version) 20)) 9.18 +(defvar YaTeX-user-completion-table 9.19 + (if YaTeX-dos "~/_yatexrc" "~/.yatexrc") 9.20 + "*Default filename in which user completion table is saved.") 9.21 + 9.22 +(defvar YaTeX-japan (or (boundp 'NEMACS) (boundp 'MULE) YaTeX-emacs-20) 9.23 + "Whether yatex mode is running on Japanese environment or not.") 9.24 + 9.25 +(defvar YaTeX-kanji-code-alist 9.26 + (cond 9.27 + ((boundp '*junet*) 9.28 + (list (cons 9.29 + 1 9.30 + (if YaTeX-dos (if (boundp '*sjis-dos*) *sjis-dos* *sjis*dos) 9.31 + *sjis*)) 9.32 + '(2 . *junet*) '(3 . *euc-japan*))) 9.33 + (YaTeX-emacs-20 9.34 + ;;(cdr-safe(assq 'coding-system (assoc "Japanese" language-info-alist))) 9.35 + (list (cons 9.36 + 1 (cond (YaTeX-dos 'shift_jis-dos) 9.37 + ((member 'shift_jis (coding-system-list)) 'shift_jis-unix) 9.38 + (t 'sjis))) 9.39 + '(2 . iso-2022-7bit-unix) 9.40 + '(3 . euc-japan)))) 9.41 + "Kanji-code expression translation table.") 9.42 +(defvar YaTeX-inhibit-prefix-letter nil 9.43 + "*T for changing key definitions from [prefix] Letter to [prefix] C-Letter.") 9.44 + 9.45 +(defvar YaTeX-no-begend-shortcut nil 9.46 + "*T for disabling shortcut of begin-type completion, [prefix] b d, etc.") 9.47 + 9.48 +(defvar YaTeX-default-pop-window-height 10 9.49 + "Default typesetting buffer height. 9.50 +If integer, sets the window-height of typesetting buffer. 9.51 +If string, sets the percentage of it. 9.52 +If nil, use default pop-to-buffer.") 9.53 + 9.54 +(defvar YaTeX-create-file-prefix-g nil 9.55 + "*Non-nil creates new file when [prefix] g on \\include{foo}.") 9.56 + 9.57 +(defvar YaTeX-nervous t 9.58 + "*If you are nervous about maintenance of yatexrc, set this value to T. 9.59 +And you will have the local dictionary.") 9.60 + 9.61 +;----------- work variables ---------------------------------------- 9.62 +(defvar YaTeX-typesetting-mode-map nil 9.63 + "Keymap used in YaTeX typesetting buffer" 9.64 +) 9.65 +(if YaTeX-typesetting-mode-map nil 9.66 + (setq YaTeX-typesetting-mode-map (make-keymap)) 9.67 + ;(suppress-keymap YaTeX-typesetting-mode-map t) 9.68 + (define-key YaTeX-typesetting-mode-map " " 'YaTeX-jump-error-line) 9.69 + (define-key YaTeX-typesetting-mode-map "\C-m" 'YaTeX-send-string) 9.70 + (define-key YaTeX-typesetting-mode-map "1" 'delete-other-windows) 9.71 + (define-key YaTeX-typesetting-mode-map "0" 'delete-window) 9.72 + (define-key YaTeX-typesetting-mode-map "q" 'delete-window)) 9.73 + 9.74 +(defvar YaTeX-parent-file nil 9.75 + "*Main LaTeX source file name used when %#! expression doesn't exist.") 9.76 +(make-variable-buffer-local 'YaTeX-parent-file) 9.77 + 9.78 +;---------- Define default key bindings on YaTeX mode map ---------- 9.79 +;;;###autoload 9.80 +(defun YaTeX-define-key (key binding &optional map) 9.81 + "Define key on YaTeX-prefix-map." 9.82 + (if YaTeX-inhibit-prefix-letter 9.83 + (let ((c (aref key 0))) 9.84 + (cond 9.85 + ((and (>= c ?a) (<= c ?z)) (aset key 0 (1+ (- c ?a)))) 9.86 + ((and (>= c ?A) (<= c ?Z) (numberp YaTeX-inhibit-prefix-letter)) 9.87 + (aset key 0 (1+ (- c ?A)))) 9.88 + (t nil)))) 9.89 + (define-key (or map YaTeX-prefix-map) key binding)) 9.90 + 9.91 +;;;###autoload 9.92 +(defun YaTeX-local-table-symbol (symbol) 9.93 + "Return the lisp symbol which keeps local completion table of SYMBOL." 9.94 + (intern (concat "YaTeX$" 9.95 + default-directory 9.96 + (symbol-name symbol)))) 9.97 + 9.98 +;;;###autoload 9.99 +(defun YaTeX-sync-local-table (symbol) 9.100 + "Synchronize local variable SYMBOL. 9.101 +Copy its corresponding directory dependent completion table to SYMBOL." 9.102 + (if (boundp (YaTeX-local-table-symbol symbol)) 9.103 + (set symbol (symbol-value (YaTeX-local-table-symbol symbol))))) 9.104 + 9.105 +(defvar YaTeX-user-table-is-read nil 9.106 + "Flag that means whether user completion table has been read or not.") 9.107 +;;;###autoload 9.108 +(defun YaTeX-read-user-completion-table (&optional forcetoread) 9.109 + "Append user completion table of LaTeX macros" 9.110 + (let*((user-table (expand-file-name YaTeX-user-completion-table)) 9.111 + (local-table (expand-file-name (file-name-nondirectory user-table))) 9.112 + var localvar localbuf (curbuf (current-buffer)) sexp) 9.113 + (if YaTeX-user-table-is-read nil 9.114 + (message "Loading user completion table") 9.115 + (if (file-exists-p user-table) (load-file user-table) 9.116 + (message "Welcome to the field of YaTeX. I'm glad to see you!"))) 9.117 + (setq YaTeX-user-table-is-read t) 9.118 + (cond 9.119 + ((file-exists-p local-table) 9.120 + (set-buffer (setq localbuf (find-file-noselect local-table))) 9.121 + (widen) 9.122 + (goto-char (point-min)) 9.123 + (while (re-search-forward "(setq \\([^ ]+\\)" nil t) 9.124 + (setq var (intern (buffer-substring 9.125 + (match-beginning 1) (match-end 1))) 9.126 + localvar (YaTeX-local-table-symbol var)) 9.127 + (goto-char (match-beginning 0)) 9.128 + (setq sexp (buffer-substring (point) 9.129 + (progn (forward-sexp) (point)))) 9.130 + (set-buffer curbuf) 9.131 + (or (assq var (buffer-local-variables)) (make-local-variable var)) 9.132 + (eval (read sexp)) 9.133 + (or (and (boundp localvar) 9.134 + (symbol-value localvar) 9.135 + (not forcetoread)) 9.136 + (set localvar (symbol-value var))) 9.137 + (set-buffer localbuf)) 9.138 + (kill-buffer localbuf))) 9.139 + (set-buffer curbuf))) 9.140 + 9.141 +;;;###autoload 9.142 +(defun YaTeX-reload-dictionary () 9.143 + "Reload local dictionary. 9.144 +Use this function after editing ./.yatexrc." 9.145 + (interactive) 9.146 + (let ((YaTeX-user-table-is-read nil)) 9.147 + (YaTeX-read-user-completion-table t))) 9.148 + 9.149 +;;;###autoload 9.150 +(defun YaTeX-lookup-table (word type) 9.151 + "Lookup WORD in completion table whose type is TYPE. 9.152 +This function refers the symbol tmp-TYPE-table, user-TYPE-table, TYPE-table. 9.153 +Typically, TYPE is one of 'env, 'section, 'fontsize, 'singlecmd." 9.154 + (if (symbolp type) (setq type (symbol-name type))) 9.155 + (or (assoc word (symbol-value (intern (concat "tmp-" type "-table")))) 9.156 + (assoc word (symbol-value (intern (concat "user-" type "-table")))) 9.157 + (assoc word (symbol-value (intern (concat type "-table")))))) 9.158 + 9.159 +;;;###autoload 9.160 +(defun YaTeX-update-table (vallist default-table user-table local-table) 9.161 + "Update completion table if the car of VALLIST is not in current tables. 9.162 +Second argument DEFAULT-TABLE is the quoted symbol of default completion 9.163 +table, third argument USER-TABLE is user table which will be saved in 9.164 +YaTeX-user-completion-table, fourth argument LOCAL-TABLE should have the 9.165 +completion which is valid during current Emacs's session. If you 9.166 +want to make LOCAL-TABLE valid longer span (but restrict in this directory) 9.167 +create the file in current directory which has the same name with 9.168 +YaTeX-user-completion-table." 9.169 + (let ((car-v (car vallist)) key answer 9.170 + (file (file-name-nondirectory YaTeX-user-completion-table))) 9.171 + (cond 9.172 + ((assoc car-v (symbol-value default-table)) 9.173 + nil) ;Nothing to do 9.174 + ((setq key (assoc car-v (symbol-value user-table))) 9.175 + (if (equal (cdr vallist) (cdr key)) nil 9.176 + ;; if association hits, but contents differ. 9.177 + (message 9.178 + "%s's attributes turned into %s" (car vallist) (cdr vallist)) 9.179 + (set user-table (delq key (symbol-value user-table))) 9.180 + (set user-table (cons vallist (symbol-value user-table))) 9.181 + (YaTeX-update-dictionary 9.182 + YaTeX-user-completion-table user-table "user"))) 9.183 + ((setq key (assoc car-v (symbol-value local-table))) 9.184 + (if (equal (cdr vallist) (cdr key)) nil 9.185 + (message 9.186 + "%s's attributes turned into %s" (car vallist) (cdr vallist)) 9.187 + (set local-table (delq key (symbol-value local-table))) 9.188 + (set local-table (cons vallist (symbol-value local-table))) 9.189 + (set (YaTeX-local-table-symbol local-table) (symbol-value local-table)) 9.190 + (YaTeX-update-dictionary file local-table))) 9.191 + ;; All of above cases, there are some completion in tables. 9.192 + ;; Then update tables. 9.193 + (t 9.194 + (if (not YaTeX-nervous) 9.195 + (setq answer "u") 9.196 + (message 9.197 + (cond 9.198 + (YaTeX-japan 9.199 + "`%s'$B$NEPO?@h(B: U)$B%f!<%6<-=q(B L)$B%m!<%+%k<-=q(B N)$B%a%b%j(B D)$B$7$J$$(B") 9.200 + (t 9.201 + "Register `%s' into: U)serDic L)ocalDic N)one D)iscard")) 9.202 + (if (> (length car-v) 23) 9.203 + (concat (substring car-v 0 10) "..." (substring car-v -10)) 9.204 + car-v)) 9.205 + (setq answer (char-to-string (read-char)))) 9.206 + (cond 9.207 + ((string-match answer "uy") 9.208 + (set user-table (cons vallist (symbol-value user-table))) 9.209 + (YaTeX-update-dictionary YaTeX-user-completion-table user-table "user") 9.210 + ) 9.211 + ((string-match answer "tl") 9.212 + (set local-table (cons vallist (symbol-value local-table))) 9.213 + (set (YaTeX-local-table-symbol local-table) (symbol-value local-table)) 9.214 + (YaTeX-update-dictionary file local-table)) 9.215 + ((string-match answer "d") nil) ;discard it 9.216 + (t (set default-table 9.217 + (cons vallist (symbol-value default-table))))))))) 9.218 + 9.219 +;;;###autoload 9.220 +(defun YaTeX-cplread-with-learning 9.221 + (prom default-table user-table local-table 9.222 + &optional pred reqmatch init hsym) 9.223 + "Completing read with learning. 9.224 +Do a completing read with prompt PROM. Completion table is what 9.225 +DEFAULT-TABLE, USER-TABLE, LOCAL table are appended in reverse order. 9.226 +Note that these tables are passed by the symbol. 9.227 +Optional arguments PRED, REQMATH and INIT are passed to completing-read 9.228 +as its arguments PREDICATE, REQUIRE-MATCH and INITIAL-INPUT respectively. 9.229 +If optional 8th argument HSYM, history symbol, is passed, use it as 9.230 +history list variable." 9.231 + (YaTeX-sync-local-table local-table) 9.232 + (let*((table (append (symbol-value local-table) 9.233 + (symbol-value user-table) 9.234 + (symbol-value default-table))) 9.235 + (word (completing-read-with-history 9.236 + prom table pred reqmatch init hsym))) 9.237 + (if (and (string< "" word) (not (assoc word table))) 9.238 + (YaTeX-update-table (list word) default-table user-table local-table)) 9.239 + word)) 9.240 + 9.241 +;;;###autoload 9.242 +(defun YaTeX-update-dictionary (file symbol &optional type) 9.243 + (let ((local-table-buf (find-file-noselect file)) 9.244 + (name (symbol-name symbol)) 9.245 + (value (symbol-value symbol))) 9.246 + (save-excursion 9.247 + (message "Updating %s dictionary..." (or type "local")) 9.248 + (set-buffer local-table-buf) 9.249 + (goto-char (point-max)) 9.250 + (search-backward (concat "(setq " name) nil t) 9.251 + (delete-region (point) (progn (forward-sexp) (point))) 9.252 + (delete-blank-lines) 9.253 + (insert "(setq " name " '(\n") 9.254 + (mapcar '(lambda (s) 9.255 + (insert (format "%s\n" (prin1-to-string s)))) 9.256 + value) 9.257 + (insert "))\n\n") 9.258 + (delete-blank-lines) 9.259 + (basic-save-buffer) 9.260 + (kill-buffer local-table-buf) 9.261 + (message "Updating %s dictionary...Done" (or type "local"))))) 9.262 + 9.263 +;;;###autoload 9.264 +(defun YaTeX-define-begend-key-normal (key env &optional map) 9.265 + "Define short cut YaTeX-make-begin-end key." 9.266 + (YaTeX-define-key 9.267 + key 9.268 + (list 'lambda '(arg) '(interactive "P") 9.269 + (list 'YaTeX-insert-begin-end env 'arg)) 9.270 + map)) 9.271 + 9.272 +;;;###autoload 9.273 +(defun YaTeX-define-begend-region-key (key env &optional map) 9.274 + "Define short cut YaTeX-make-begin-end-region key." 9.275 + (YaTeX-define-key key (list 'lambda nil '(interactive) 9.276 + (list 'YaTeX-insert-begin-end env t)) map)) 9.277 + 9.278 +;;;###autoload 9.279 +(defun YaTeX-define-begend-key (key env &optional map) 9.280 + "Define short cut key for begin type completion both for normal 9.281 +and region mode. To customize YaTeX, user should use this function." 9.282 + (YaTeX-define-begend-key-normal key env map) 9.283 + (if YaTeX-inhibit-prefix-letter nil 9.284 + (YaTeX-define-begend-region-key 9.285 + (concat (upcase (substring key 0 1)) (substring key 1)) env))) 9.286 + 9.287 ;;;###autoload 9.288 (defun YaTeX-search-active-forward (string cmntrx &optional bound err cnt func) 9.289 "Search STRING which is not commented out by CMNTRX. 9.290 @@ -16,7 +289,8 @@ 9.291 (setq found (funcall sfunc string bound err cnt)) 9.292 (setq md (match-data))) 9.293 (or 9.294 - (YaTeX-in-verb-p (match-beginning 0)) 9.295 + (and (eq major-mode 'yatex-mode) 9.296 + (YaTeX-in-verb-p (match-beginning 0))) 9.297 (save-excursion 9.298 (beginning-of-line) 9.299 (re-search-forward cmntrx (match-beginning 0) t))))) 9.300 @@ -119,8 +393,16 @@ 9.301 (setq index pos) (setq pos -1)) 9.302 (t (setq pos (1- pos)))) 9.303 ) 9.304 - index) 9.305 -) 9.306 + index)) 9.307 + 9.308 +;;;###autoload 9.309 +(defun point-beginning-of-line () 9.310 + (save-excursion (beginning-of-line)(point))) 9.311 + 9.312 +;;;###autoload 9.313 +(defun point-end-of-line () 9.314 + (save-excursion (end-of-line)(point))) 9.315 + 9.316 9.317 ;;;###autoload 9.318 (defun YaTeX-showup-buffer (buffer &optional func select) 9.319 @@ -371,11 +653,158 @@ 9.320 (or (featurep 'windows) (error "Why don't you use `windows.el'?")) 9.321 (win-switch-to-window 1 (- last-command-char win:base-key))) 9.322 9.323 +;;;###autoload 9.324 +(defun YaTeX-reindent (col) 9.325 + "Remove current indentation and reindento to COL column." 9.326 + (save-excursion 9.327 + (beginning-of-line) 9.328 + (skip-chars-forward " \t") 9.329 + (if (/= col (current-column)) 9.330 + (progn 9.331 + (delete-region (point) (progn (beginning-of-line) (point))) 9.332 + (indent-to col)))) 9.333 + (skip-chars-forward " \t" (point-end-of-line))) 9.334 + 9.335 +(defun YaTeX-inner-environment (&optional quick) 9.336 + "Return current inner-most environment. 9.337 +Non-nil for optional argument QUICK restricts search bound to most 9.338 +recent sectioning command. Matching point is stored to property 'point 9.339 +of 'YaTeX-inner-environment, which can be referred by 9.340 + (get 'YaTeX-inner-environment 'point)." 9.341 + (let*((nest 0) 9.342 + (beg (YaTeX-replace-format-args 9.343 + (regexp-quote YaTeX-struct-begin) 9.344 + ;YaTeX-struct-begin ;=== TENTATIVE!! == 9.345 + YaTeX-struct-name-regexp 9.346 + (if (eq major-mode 'yahtml-mode) "\\s *.*" "") 9.347 + "")) 9.348 + (end (YaTeX-replace-format-args 9.349 + (regexp-quote YaTeX-struct-end) 9.350 + YaTeX-struct-name-regexp "" "")) 9.351 + (begend (concat "\\(" beg "\\)\\|\\(" end "\\)")) 9.352 + bound m0 9.353 + (htmlp (eq major-mode 'yahtml-mode)) 9.354 + (open 9.355 + (concat "^" (or (cdr (assq major-mode '((yahtml-mode . "<")))) "{"))) 9.356 + (close 9.357 + (concat "^" 9.358 + (or (cdr(assq major-mode '((yahtml-mode . "\n\t >")))) "}")))) 9.359 + (save-excursion 9.360 + (if quick 9.361 + (setq bound 9.362 + (save-excursion 9.363 + (if htmlp 9.364 + ;;(re-search-backward YaTeX-sectioning-regexp nil 1) 9.365 + (goto-char (point-min)) ;Is this enough? 97/6/26 9.366 + (YaTeX-re-search-active-backward 9.367 + (concat YaTeX-ec-regexp 9.368 + "\\(" YaTeX-sectioning-regexp "\\)\\*?{") 9.369 + YaTeX-comment-prefix nil 1)) 9.370 + (or (bobp) (end-of-line)) 9.371 + (point)))) 9.372 + (if (catch 'begin 9.373 + (if (and (numberp bound) (< (point) bound)) (throw 'begin nil)) 9.374 + (while (YaTeX-re-search-active-backward 9.375 + begend YaTeX-comment-prefix bound t) 9.376 + (setq m0 (match-beginning 0)) 9.377 + (if (looking-at end) ;;(match-beginning 2) 9.378 + (setq nest (1+ nest)) 9.379 + (setq nest (1- nest))) 9.380 + (if (< nest 0) 9.381 + (progn 9.382 + (put 'YaTeX-inner-environment 'point m0) 9.383 + (goto-char m0) 9.384 + (put 'YaTeX-inner-environment 'indent (current-column)) 9.385 + (throw 'begin t))))) 9.386 + (buffer-substring 9.387 + (progn (skip-chars-forward open) (1+ (point))) 9.388 + (progn (skip-chars-forward close) (point)))))) 9.389 +) 9.390 + 9.391 +(defun YaTeX-end-environment () 9.392 + "Close opening environment" 9.393 + (interactive) 9.394 + (let ((env (YaTeX-inner-environment))) 9.395 + (if (not env) (error "No premature environment") 9.396 + (save-excursion 9.397 + (if (YaTeX-search-active-forward 9.398 + (YaTeX-replace-format-args YaTeX-struct-end env "" "") 9.399 + YaTeX-comment-prefix nil t) 9.400 + (if (y-or-n-p 9.401 + (concat "Environment `" env 9.402 + "' may be already closed. Force close?")) 9.403 + nil 9.404 + (error "end environment aborted.")))) 9.405 + (message "") ;Erase (y or n) message. 9.406 + (YaTeX-insert-struc 'end env) 9.407 + (save-excursion 9.408 + (goto-char (or (get 'YaTeX-inner-environment 'point) (match-end 0))) 9.409 + (if (pos-visible-in-window-p) 9.410 + (sit-for (if YaTeX-dos 2 1)) 9.411 + (message "Matches with %s at line %d" 9.412 + (YaTeX-replace-format-args YaTeX-struct-begin env "" "") 9.413 + (count-lines (point-min) (point))))))) 9.414 +) 9.415 + 9.416 +;;;VER2 9.417 +(defun YaTeX-insert-struc (what env) 9.418 + (cond 9.419 + ((eq what 'begin) 9.420 + (insert (YaTeX-replace-format-args 9.421 + YaTeX-struct-begin env (YaTeX-addin env)))) 9.422 + ((eq what 'end) 9.423 + (insert (YaTeX-replace-format-args YaTeX-struct-end env))) 9.424 + (t nil)) 9.425 +) 9.426 + 9.427 +;;; Function for menu support 9.428 +(defun YaTeX-define-menu (keymap bindlist) 9.429 + "Define KEYMAP(symbol)'s menu-bindings according to BINDLIST. 9.430 +KEYMAP should be a quoted symbol of newly allocated keymap. 9.431 +BINDLIST consists of binding list. Each element is as follows. 9.432 + 9.433 + '(menusymbol DOC_String . contents) 9.434 + 9.435 +CONTENTS is one of lambda-form, interactive function, or other keymap. 9.436 +See yatex19.el for example." 9.437 + (cond 9.438 + ((featurep 'xemacs) 9.439 + (let (name) 9.440 + (if (keymapp (symbol-value keymap)) 9.441 + (progn 9.442 + (setq name (keymap-name (symbol-value keymap))) 9.443 + (set keymap nil)) 9.444 + (setq name (car (symbol-value keymap))) 9.445 + (set keymap (cdr (symbol-value keymap)))) 9.446 + (mapcar 9.447 + (function 9.448 + (lambda (bind) 9.449 + (setq bind (cdr bind)) 9.450 + (if (eq (car-safe (cdr bind)) 'lambda) 9.451 + (setcar (cdr bind) 'progn)) 9.452 + (if (stringp (car-safe (cdr bind))) 9.453 + (set keymap 9.454 + (cons (cdr bind) (symbol-value keymap))) 9.455 + (set keymap 9.456 + (cons (vector (car bind) (cdr bind) t) 9.457 + (symbol-value keymap)))))) 9.458 + bindlist) 9.459 + (set keymap (cons name (symbol-value keymap))))) 9.460 + (t 9.461 + (mapcar 9.462 + (function 9.463 + (lambda (bind) 9.464 + (define-key (symbol-value keymap) (vector (car bind)) (cdr bind)))) 9.465 + bindlist)))) 9.466 + 9.467 + 9.468 + 9.469 (defun bcf-and-exit () 9.470 "Byte compile rest of argument and kill-emacs." 9.471 (if command-line-args-left 9.472 (progn 9.473 (mapcar 'byte-compile-file command-line-args-left) 9.474 (kill-emacs)))) 9.475 + 9.476 9.477 (provide 'yatexlib)
10.1 --- a/yatexmth.el Sat Dec 13 12:41:43 1997 +0000 10.2 +++ b/yatexmth.el Tue Dec 16 13:28:38 1997 +0000 10.3 @@ -1,8 +1,8 @@ 10.4 ;;; -*- Emacs-Lisp -*- 10.5 ;;; YaTeX math-mode-specific functions. 10.6 -;;; yatexmth.el rev.4 10.7 +;;; yatexmth.el 10.8 ;;; (c )1993-1997 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 10.9 -;;; Last modified Fri Jan 24 18:00:08 1997 on supra 10.10 +;;; Last modified Tue Nov 25 12:33:05 1997 on firestorm 10.11 ;;; $Id$ 10.12 10.13 ;;; [Customization guide] 10.14 @@ -211,6 +211,7 @@ 10.15 ("->" "rightarrow" ("->" "→")) 10.16 ("\C-f" "rightarrow" ("->" "→")) 10.17 ("-->" "longrightarrow" ("-->" "--→")) 10.18 + ("=>" "Rightarrow" "=>") 10.19 ("==>" "Longrightarrow" "==>") 10.20 ("<->" "leftrightarrow" ("<->" "←→")) 10.21 ("<-->" "longleftrightarrow" ("<---->" "←--→"))
11.1 --- a/yatexprc.el Sat Dec 13 12:41:43 1997 +0000 11.2 +++ b/yatexprc.el Tue Dec 16 13:28:38 1997 +0000 11.3 @@ -2,10 +2,11 @@ 11.4 ;;; YaTeX process handler. 11.5 ;;; yatexprc.el 11.6 ;;; (c )1993-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 11.7 -;;; Last modified Mon Jan 27 10:22:06 1997 on crx 11.8 +;;; Last modified Thu Dec 11 16:16:21 1997 on crx 11.9 ;;; $Id$ 11.10 11.11 -(require 'yatex) 11.12 +;(require 'yatex) 11.13 +(require 'yatexlib) 11.14 11.15 (defvar YaTeX-typeset-process nil 11.16 "Process identifier for jlatex" 11.17 @@ -24,6 +25,18 @@ 11.18 (if YaTeX-dos "/c" "-c")) 11.19 "Shell option for command execution.") 11.20 11.21 +(defvar YaTeX-latex-message-code 11.22 + (cond 11.23 + (YaTeX-dos (cdr (assq 1 YaTeX-kanji-code-alist))) 11.24 + ((and YaTeX-emacs-20 (member 'undecided (coding-system-list)) 11.25 + 'undecided)) 11.26 + ((featurep 'mule) 11.27 + (or (and (boundp '*autoconv*) *autoconv*) 11.28 + (and (fboundp 'coding-system-list) 'automatic-conversion))) 11.29 + ((boundp 'NEMACS) 11.30 + (cdr (assq (if YaTeX-dos 1 2) YaTeX-kanji-code-alist)))) 11.31 + "Process coding system for LaTeX.") 11.32 + 11.33 (if YaTeX-typeset-buffer-syntax nil 11.34 (setq YaTeX-typeset-buffer-syntax 11.35 (make-syntax-table (standard-syntax-table))) 11.36 @@ -38,7 +51,10 @@ 11.37 (interactive) 11.38 (save-excursion 11.39 (let ((p (point)) (window (selected-window)) execdir (cb (current-buffer)) 11.40 - (map YaTeX-typesetting-mode-map)) 11.41 + (map YaTeX-typesetting-mode-map) 11.42 + (outcode 11.43 + (cond ((eq major-mode 'yatex-mode) YaTeX-coding-system) 11.44 + ((eq major-mode 'yahtml-mode) yahtml-coding-system)))) 11.45 (if (and YaTeX-typeset-process 11.46 (eq (process-status YaTeX-typeset-process) 'run)) 11.47 ;; if tex command is halting. 11.48 @@ -57,12 +73,9 @@ 11.49 (cd execdir) 11.50 (erase-buffer) 11.51 (cond 11.52 - (YaTeX-dos ;if MS-DOS 11.53 - ;(YaTeX-put-nonstopmode) 11.54 + ((not (fboundp 'start-process)) ;YaTeX-dos;if MS-DOS 11.55 (call-process 11.56 - shell-file-name nil buffer nil YaTeX-shell-command-option command) 11.57 - ;(YaTeX-remove-nonstopmode) 11.58 - ) 11.59 + shell-file-name nil buffer nil YaTeX-shell-command-option command)) 11.60 (t ;if UNIX 11.61 (set-process-buffer 11.62 (setq YaTeX-typeset-process 11.63 @@ -76,9 +89,15 @@ 11.64 (set-syntax-table YaTeX-typeset-buffer-syntax) 11.65 (setq mode-name modename) 11.66 (if YaTeX-typeset-process ;if process is running (maybe on UNIX) 11.67 - (cond ((boundp 'MULE) 11.68 + (cond ((fboundp 'set-current-process-coding-system) 11.69 (set-current-process-coding-system 11.70 - YaTeX-latex-message-code YaTeX-coding-system)) 11.71 + YaTeX-latex-message-code outcode)) 11.72 + ((fboundp 'set-process-coding-system) 11.73 + (set-process-coding-system 11.74 + YaTeX-typeset-process YaTeX-latex-message-code outcode)) 11.75 + (YaTeX-emacs-20 11.76 + (set-buffer-process-coding-system 11.77 + YaTeX-latex-message-code outcode)) 11.78 ((boundp 'NEMACS) 11.79 (set-kanji-process-code YaTeX-latex-message-code)))) 11.80 (if YaTeX-dos (message "Done.") 11.81 @@ -213,7 +232,7 @@ 11.82 (set-buffer (find-file-noselect texput))) 11.83 ;;(find-file YaTeX-texput-file) 11.84 (erase-buffer) 11.85 - (if YaTeX-need-nonstop 11.86 + (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) 11.87 (insert "\\nonstopmode{}\n")) 11.88 (insert preamble "\n" subpreamble "\n") 11.89 (setq lineinfo (list (count-lines 1 (point-end-of-line)) lineinfo)) 11.90 @@ -340,7 +359,7 @@ 11.91 (setq default-directory df) 11.92 (cd df)) 11.93 (erase-buffer) 11.94 - (if YaTeX-dos 11.95 + (if (not (fboundp 'start-process)) 11.96 (call-process 11.97 shell-file-name nil buffer nil YaTeX-shell-command-option command) 11.98 (if (and (get-buffer-process buffer) 11.99 @@ -386,7 +405,7 @@ 11.100 (setq default-directory dir) ;for 18 11.101 (cd dir) ;for 19 11.102 (cond 11.103 - (YaTeX-dos ;if MS-DOS 11.104 + ((not (fboundp 'start-process)) ;if MS-DOS 11.105 (send-string-to-terminal "\e[2J\e[>5h") ;CLS & hide cursor 11.106 (call-process shell-file-name "con" "*dvi-preview*" nil 11.107 YaTeX-shell-command-option 11.108 @@ -573,7 +592,7 @@ 11.109 ) 11.110 11.111 (defun YaTeX-put-nonstopmode () 11.112 - (if (and YaTeX-need-nonstop (eq major-mode 'yatex-mode)) 11.113 + (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) 11.114 (if (re-search-backward "\\\\nonstopmode{}" (point-min) t) 11.115 nil ;if already written in text then do nothing 11.116 (save-excursion 11.117 @@ -585,7 +604,7 @@ 11.118 ) 11.119 11.120 (defun YaTeX-remove-nonstopmode () 11.121 - (if (and YaTeX-need-nonstop (eq major-mode 'yatex-mode)) ;for speed 11.122 + (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) ;for speed 11.123 (save-excursion 11.124 (YaTeX-visit-main t) 11.125 (goto-char (point-min)) 11.126 @@ -692,7 +711,7 @@ 11.127 (erase-buffer) 11.128 (cd dir) ;for 19 11.129 (cond 11.130 - (YaTeX-dos 11.131 + ((not (fboundp 'start-process)) 11.132 (call-process shell-file-name "con" "*dvi-printing*" nil 11.133 YaTeX-shell-command-option cmd)) 11.134 (t
12.1 --- a/yatexsec.el Sat Dec 13 12:41:43 1997 +0000 12.2 +++ b/yatexsec.el Tue Dec 16 13:28:38 1997 +0000 12.3 @@ -277,6 +277,7 @@ 12.4 ) 12.5 12.6 (defvar YaTeX-sectioning-buffer "*Sectioning lines*") 12.7 +(defvar YaTeX-sectioning-indent 1) 12.8 (defun YaTeX-colloect-sections () 12.9 "Collect all the lines which contains sectioning command." 12.10 (let ((cw (selected-window)) level indent begp (prevp 1) (prevl 1) 12.11 @@ -296,7 +297,7 @@ 12.12 begp (match-beginning 0)) 12.13 ;;(beginning-of-line) 12.14 ;;(skip-chars-forward " \t") 12.15 - (setq indent (format "%%%ds" level)) 12.16 + (setq indent (format "%%%ds" (* level YaTeX-sectioning-indent))) 12.17 (princ (format indent "")) 12.18 (if (YaTeX-on-comment-p) (princ "%")) 12.19 (princ (buffer-substring begp (progn (forward-list 1) (point)))) 12.20 @@ -393,7 +394,8 @@ 12.21 (let (buffer-read-only) 12.22 (delete-region 12.23 (point) (progn (skip-chars-forward " \t") (point))) 12.24 - (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level))) 12.25 + (indent-to-column (* (cdr (assoc nsc YaTeX-sectioning-level)) 12.26 + YaTeX-sectioning-indent)) 12.27 (skip-chars-forward "^\\\\") 12.28 (delete-region 12.29 (1+ (point)) (progn (skip-chars-forward "^*{") (point)))