yatex
changeset 69:807c1e7e68b7
yahtml-escape-chars-region
Translate <>"& to entity reference.
And inverse translation to above.
yahtml-translate-hyphens-when-comment-region
yahtml-prefer-upcase-attributes
Inquire .htaccess file to determine the file-coding-system.
Completions for StyleSheet.
---yahtml---
Auto insert of \), \|, \] after corresponding \(, \| \].
[prefix] c for \right\left parens.
author | yuuji |
---|---|
date | Thu, 15 Jul 1999 04:58:26 +0000 |
parents | 0eb6997bee16 |
children | 44e3a5e1e883 |
files | docs/htmlqa docs/qanda.eng docs/yahtmlj.tex docs/yatex.ref docs/yatexadd.doc docs/yatexe.tex docs/yatexgen.doc docs/yatexj.tex docs/yatexref.eng help/YATEXHLP.jp yahtml.el yatex.el yatex.new yatex19.el yatexadd.el yatexlib.el yatexmth.el yatexprc.el |
diffstat | 18 files changed, 1725 insertions(+), 632 deletions(-) [+] |
line diff
1.1 --- a/docs/htmlqa Mon Oct 26 12:05:32 1998 +0000 1.2 +++ b/docs/htmlqa Thu Jul 15 04:58:26 1999 +0000 1.3 @@ -8,22 +8,36 @@ 1.4 ■インストール関連 1.5 ・LaTeX使わないんだけど野鳥も入れなきゃダメですか? 1.6 1.7 - そうなにょ。野鳥のライブラリ関数を使っているので野鳥も棲まわせて 1.8 - やって下さいまし。 1.9 + や、別にええっす。 1.10 + ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/text/yatex/ 1.11 + のなかに、"yahtml" で始まるファイルがあるので次からはそれを持っ 1.12 + て来ればよござんす。 1.13 1.14 ■カスタマイズ関連 1.15 ・いつもは EUC にしてたまに JIS コードのファイルを作りたいんだけど。 1.16 1.17 ~/.emacs で 1.18 (setq yahtml-kanji-code 3) ;3はEUC 1.19 - しておけば普段のhtmlコードはEUCになります。JISにしたいときは、 1.20 - htmlソースのお尻に、 1.21 + しておけば普段のhtmlコードはEUCになります。で局所的に変える方法。 1.22 + サーバーはApacheですね? ならそのディレクトリに .htaccess という 1.23 + ファイルを用意して、 1.24 + 1.25 + AddType "text/html; charset=iso-2020-jp" .html 1.26 + 1.27 + という行を書きましょう。するとApache君はそのディレクトリのhtmlファ 1.28 + イルを「iso-2022-jp(いわゆるJIS)だよー」とお客さんにあらかじめ伝 1.29 + えるようになります。yahtmlもこれに従い、そのディレクトリ以下のファ 1.30 + イルは漢字コードをJISに設定します。 1.31 + 1.32 + なに、apacheではないとな。なら明示的にhtmlソースのお尻に、 1.33 1.34 <!-- Local Variables: --> 1.35 <!-- file-coding-system: *junet* --> 1.36 <!-- End: --> 1.37 1.38 と書いておけばそのファイルだけJISになります。 1.39 + ただし、Emacs-20 や XEmacs の場合、漢字コードのシンボルの両端の* 1.40 + は付きません。 1.41 1.42 ■どうにかならんかなあ関連 1.43 ・長い文書の下の方だとインデントがめちゃ遅いんだけど。 1.44 @@ -73,7 +87,7 @@ 1.45 ・yahtmlの最新情報は? 1.46 1.47 もしあなたが、WWWにアクセスできるなら、 1.48 - http://www.comp.ae.keio.ac.jp/~yuuji/yatex/ 1.49 + http://www.yatex.org/ 1.50 を覗いてみて下さい。このなかの、「yatex-current」というリンクを 1.51 たどると最新版の野鳥を入手することができます。ただし、正式リリー 1.52 ス版ではなく、作者がデバッグ中だったりして正常に動作しない可能性 1.53 @@ -86,7 +100,7 @@ 1.54 1.55 ・近くにいる詳しい人に聞く 1.56 ・メイリングリストに質問を出す 1.57 - ・yuuji@ae.keio.ac.jp に質問を出す 1.58 + ・yuuji@gentei.org に質問を出す 1.59 1.60 でしょうか。お好きな方法でどうぞ。 1.61
2.1 --- a/docs/qanda.eng Mon Oct 26 12:05:32 1998 +0000 2.2 +++ b/docs/qanda.eng Thu Jul 15 04:58:26 1999 +0000 2.3 @@ -212,6 +212,17 @@ 2.4 commands in a suitable sequence. You can find `latexmk' script 2.5 in a directory of supports/latexmk in some CTAN ftp directory. 2.6 2.7 +*Can I inhibit auto-filling against very long <a href="..."> line? 2.8 + 2.9 + If you use Emacs-19 or later, Yes. The variable 2.10 + auto-fill-inhibit-regexp controls the filling behaviour. To set 2.11 + this, use yatex-mode-hook as below. 2.12 + 2.13 + (add-hook 'yahtml-mode-hook 2.14 + '(lambda () 2.15 + (setq auto-fill-inhibit-regexp 2.16 + "^[ ]*\\(<a href\\|<img src=\\)"))) 2.17 + 2.18 *Filling a paragraph doesn't work as I expected. 2.19 2.20 It is because the indentation depth is different from default 2.21 @@ -339,15 +350,18 @@ 2.22 ===== 2.23 *Mailing lists? 2.24 2.25 - A question, so an answer. The mailing list for YaTeX (Wild 2.26 - Bird) and it's implementation to Vz, Raicho (by KATSURAGAWA, 2.27 - Naoki; katsura@prc.tsukuba.ac.jp) is "fj Wild Bird Society". 2.28 - Send a mail like 2.29 + A question, so an answer. The mailing list for YaTeX (Wild 2.30 + Bird) and it's implementation to Vz; Raicho (by KATSURAGAWA, 2.31 + Naoki; katsura@prc.tsukuba.ac.jp), implementation to Wz Editor; 2.32 + HackTeX (by TAKKENAKA, Hiroshi), implementation to Hidemaru; 2.33 + HiTeX (by YASUDA, Haruyuki) is "fj Wild Bird Society". Send a 2.34 + mail like 2.35 2.36 - To: yatex-control@jaist.ac.jp 2.37 + To: yatex@jaist.ac.jp 2.38 Subject: append 2.39 ----- 2.40 - Hi! My name is yuuji. See any birds fly by? 2.41 + Hi! My name is yuuji. 2.42 + See any birds fly by? 2.43 2.44 and you're in. The text will be used as your profile. (you can 2.45 change it later) Once you're in, you'll get a reply with lists 2.46 @@ -359,7 +373,7 @@ 2.47 *How to get the up-to-date information on YaTeX? 2.48 2.49 If you can access WWW, try to see; 2.50 - http://www.comp.ae.keio.ac.jp/~yuuji/yatex/ 2.51 + http://www.yatex.org/ 2.52 And if you trace the link of `yatex-current', you can get the 2.53 really latest version of YaTeX. Since it collects the elisps in 2.54 the author's source directory, what you'll get may contain some 2.55 @@ -372,7 +386,7 @@ 2.56 2.57 *Look for someone near you who knows what's he/she's doing. 2.58 *Post a question to the mailing list. 2.59 - *Send mail to yuuji@ae.keio.ac.jp 2.60 + *Send mail to yuuji@gentei.org 2.61 2.62 take a pick. 2.63
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/docs/yahtmlj.tex Thu Jul 15 04:58:26 1999 +0000 3.3 @@ -0,0 +1,446 @@ 3.4 +\def\lang{jp} % -*- texinfo -*- for Texinfo V.3.1 3.5 +\input texinfo 3.6 +@setfilename yahtmlj 3.7 +@settitle Yet Another html-mode for Emacs 3.8 + 3.9 +@iftex 3.10 +@c @syncodeindex fn cp 3.11 +@c Infoって最近読む人が増えたらしい 3.12 +@c まだ書き終わっていません。 3.13 +@syncodeindex vr cp 3.14 +@end iftex 3.15 + 3.16 +@titlepage 3.17 +@sp 10 3.18 +@center 3.19 +@subtitle Yet Another html-mode for emacs 3.20 +@title 『HTML屋』 3.21 +@subtitle // yahtml // 3.22 +@author @copyright{} 1994-1997 by HIROSE, Yuuji [yuuji@@gentei.org] 3.23 +@end titlepage 3.24 + 3.25 +@node Top, Intro, (dir), (dir) 3.26 +@comment node-name, next, previous, up 3.27 + 3.28 +@menu 3.29 +* Intro:: はじめに 3.30 +* Installation:: インストール 3.31 +* Command Invocation:: 外部コマンド起動 3.32 +* Completion:: 補完入力 3.33 +* Jump:: カーソルジャンプ 3.34 +* Changing and Deleting:: 変更と削除 3.35 +* Customizations:: カスタマイズ変数一覧 3.36 +* Copying:: とりあつかい 3.37 +* Concept Index:: 索引 3.38 + 3.39 +@end menu 3.40 + 3.41 +@node Intro, Installation, Top, Top 3.42 +@comment node-name, next, previous, up 3.43 +@chapter はじめに 3.44 +@cindex Demacs 3.45 +@cindex Mule 3.46 +@cindex LaTeX 3.47 +@cindex HTML屋[HTMLや] 3.48 + 3.49 +yahtmlは GNU Emacs 上で HTML文書を作成する時に、繁雑なHTMLタグの入力を補 3.50 +完機能によってスムーズに行えるようにするだけでなく、weblintなどの構文チェッ 3.51 +クプログラム、カーソル位置のURLやファイル名に依存したブラウザ/イメージヴュー 3.52 +アの起動などを Emacs 編集画面中から 3.53 +行えるようにするパッケージです。 3.54 + 3.55 +(このInfoは未完成です(__)…) 3.56 + 3.57 +@node Installation, Command Invocation, Intro, Top 3.58 +@comment node-name, next, previous, up 3.59 +@chapter インストール 3.60 +@menu 3.61 +* yahtml起動のための設定:: 3.62 +* lintプログラム/ブラウザ/イメージヴューア環境等の設定:: 3.63 +* WWWページ環境用変数の設定:: 3.64 +@end menu 3.65 + 3.66 +@node yahtml起動のための設定, lintプログラム/ブラウザ/イメージヴューア環境等の設定, Installation, Installation 3.67 +@section yahtml起動のための設定 3.68 + 3.69 + 3.70 +@file{~/.emacs}に下の2項目を加えます。 3.71 + 3.72 +@lisp 3.73 +(setq auto-mode-alist 3.74 + (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) 3.75 +(autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) 3.76 +@end lisp 3.77 + 3.78 +次にyahtmlに必要なファイル(@file{yahtml.el}, @file{yatexlib.el}, 3.79 +@file{yatexprc.el}) を置くディレクトリを load-path に加えます。たとえば、 3.80 +@file{~/src/emacs/yahtml}に置くのであれば、 3.81 + 3.82 +@lisp 3.83 +(setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path)) 3.84 +@end lisp 3.85 + 3.86 +@noindent 3.87 +などとします。 3.88 + 3.89 + 以上の設定により、拡張子が .html であるファイルを編集すると自動的に 3.90 +yahtml がロードされます。yahtmlが正常に起動できたときはモードラインの表示が 3.91 +「yahtml」に変わります。 3.92 + 3.93 +@node lintプログラム/ブラウザ/イメージヴューア環境等の設定, WWWページ環境用変数の設定, yahtml起動のための設定, Installation 3.94 +@section lintプログラム/ブラウザ/イメージヴューア環境等の設定 3.95 + 3.96 +利用する外部プログラムなどに関する以下の変数を確認し、必要なら正しい値に変 3.97 +更します(括弧内はデフォルト値)。 3.98 +@table @code 3.99 +@item yahtml-www-browser 3.100 + @dots{} 起動するブラウザのコマンド名(netscape) 3.101 +@item yahtml-image-viewer 3.102 + @dots{} 起動する画像ビューアのコマンド名(xv) 3.103 +@item yahtml-lint-program 3.104 + @dots{} 構文チェックプログラムのコマンド名(jweblint) 3.105 +@item yahtml-kanji-code 3.106 + @dots{} htmlファイルの漢字コード 3.107 +@end table 3.108 + 3.109 +@node WWWページ環境用変数の設定, , lintプログラム/ブラウザ/イメージヴューア環境等の設定, Installation 3.110 +@section WWWページ環境用変数の設定 3.111 + 3.112 +ホームページとなるファイルが存在するPATH名に関する変数を設定します。 3.113 +@table @code 3.114 +@item yahtml-path-url-alist 3.115 + @dots{} ファイルシステム上のPATH名と、URLの対応表 3.116 +@item yahtml-directory-index 3.117 + @dots{} URL指定でファイル名を省略したときに表示されるインデックス 3.118 + ファイル名(NCSA系httpdなら @file{index.html}, CERN系なら 3.119 + @file{Welcome.html}が一般的) 3.120 +@end table 3.121 + 3.122 +変数 @code{yahtml-path-url-alist} の設定例を示します。例えば、自宅では、 3.123 +@file{/home/yuuji/http/} が @code{http://localhost/~yuuji} で参照でき、職 3.124 +場では @file{/usr/home/yuuji/www/} が@code{http://www.keio.ac.jp/~yuuji/} 3.125 +で参照できるようになっている場合は以下のように設定します。 3.126 + 3.127 +@lisp 3.128 +(setq yahtml-path-url-alist 3.129 + '(("/home/yuuj/http" . "http://localhost/~yuuji") 3.130 + ("/usr/home/yuuj/www" . "http://www.keio.ac.jp/~yuuji"))) 3.131 +@end lisp 3.132 + 3.133 +この対応組はいくらでも設定することができます。 3.134 + 3.135 +@node Command Invocation, Completion, Installation, Top 3.136 +@comment node-name, next, previous, up 3.137 +@chapter 外部コマンド起動 3.138 + 3.139 +HTMLファイル編集にかかわるいくつかのコマンドを即座に呼ぶことができます。 3.140 +@table @kbd 3.141 +@item [prefix] t j 3.142 + @dots{} HTML構文チェッカ(jweblint)起動 3.143 +@item [prefix] t p 3.144 + @dots{} 現在のページを対象としたブラウザ起動 3.145 +@item [prefix] t r 3.146 + @dots{} 現在のページがブラウザに表示されているときのreload指定 3.147 +@end table 3.148 + 3.149 +@node Completion, Jump, Command Invocation, Top 3.150 +@comment node-name, next, previous, up 3.151 +@chapter 補完入力 3.152 + 3.153 +「野鳥」で利用できる、「begin型補完」、「section型補完」、 3.154 +「large型補完」、「maketitle型補完」、「アクセント補完」 3.155 +と全く同じキー操作で対応する 3.156 +HTMLタグの補完入力ができます。それぞれの型の補完は順に、 3.157 +「複数行に渡るタグ入力」、「空要素タグ(imgなど)の補完」、 3.158 +「一行内での開始/終了タグの入力」、「空要素空属性タグの入力」、 3.159 +「文字参照入力」 3.160 +に 3.161 +対応しています。具体的には 3.162 + 3.163 +@table @kbd 3.164 +@item [prefix] b (野鳥のbegin補完に対応) 3.165 +@dots{} 3.166 +@example 3.167 +<ul> 3.168 +</ul> 3.169 +@end example 3.170 + 3.171 +@noindent 3.172 +のように開始タグと終了タグを二行に渡って書きたい場合の補完を指します。 3.173 +おもにブロック型タグが補完候補に含まれます。 3.174 + 3.175 +@item [prefix] s (野鳥のsection型補完に対応) 3.176 +@dots{} 3.177 +@example 3.178 +<img src="foo.gif" alt="photo"> 3.179 +@end example 3.180 + 3.181 +@noindent 3.182 +のように終了タグを持たず、かつ属性値のみで機能を指定するタグを補完します。 3.183 +補完候補としては、img, input が存在します。 3.184 + 3.185 +@item [prefix] l (野鳥のlarge型補完に対応) 3.186 +@dots{} begin型補完とほぼ同じですが、 3.187 + 3.188 +@example 3.189 +<big> 〜 </big> 3.190 +@end example 3.191 + 3.192 +@noindent 3.193 +のように一行内に開始/終了タグを入れたいときに利用します。 3.194 + 3.195 +@item [prefix] m (野鳥のmaketitle型補完に対応) 3.196 +@dots{} 要素も属性値も持たないタグを補完入力します。<br> 3.197 +などが補完候補に相当します。 3.198 + 3.199 +@item [prefix] a (野鳥のアクセント補完に対応) 3.200 +@dots{} エンティティ参照による文字表記を入力するときに用います。 3.201 +デフォルトでは < (<), > (>), & (&), " ("), ' ('), 3.202 +ブランク ( ) の補完入力が行えます。 3.203 +@end table 3.204 + 3.205 +@node Jump, Changing and Deleting, Completion, Top 3.206 +@comment node-name, next, previous, up 3.207 +@chapter カーソルジャンプ 3.208 +文書中のいろいろな場所で 3.209 + 3.210 +@table @kbd 3.211 +@item [prefix] g 3.212 + @dots{} 対応するオブジェクトにジャンプ 3.213 +@end table 3.214 + 3.215 +@noindent 3.216 +を押すことにより、カーソル位置のHTML構文に対応する場所にジャンプ 3.217 +します。対応関係が存在すると解釈されるコマンドには以下のものがあります。 3.218 + 3.219 +@itemize @bullet 3.220 +@item @code{<TAG>} ←→ @code{</TAG>} 3.221 +@item @code{<img src="画像ファイル">} → 対応するviewer起動 3.222 +@item @code{<a href="リンク先">} → リンク先へのポイント移動 3.223 +@item @code{<applet code="プログラム">} → Javaソースプログラムへの移動 3.224 +@c @item @code{\include(\input)} → 対応するファイル 3.225 +@end itemize 3.226 + 3.227 +@node Changing and Deleting, Customizations, Jump, Top 3.228 +@comment node-name, next, previous, up 3.229 +@chapter 変更/削除 3.230 + 3.231 +@menu 3.232 +* 対タグの変更:: 3.233 +* 文字参照への変更:: 3.234 +* リジョン内文字のURLencode:: 3.235 +@end menu 3.236 + 3.237 +@node 対タグの変更, 文字参照への変更, Changing and Deleting, Changing and Deleting 3.238 +@comment node-name, next, previous, up 3.239 +@section 対タグの変更 3.240 +文書中のいろいろな場所で 3.241 + 3.242 +@table @kbd 3.243 +@item [prefix] c 3.244 + @dots{} 対応するタグ等を変更 3.245 +@end table 3.246 + 3.247 +@noindent 3.248 +を押すことにより、カーソル位置のHTML構文に応じた 3.249 +記述内容の変更を行います。カーソル位置と変更する内容の 3.250 +対応は以下の通りです。 3.251 + 3.252 +@itemize @bullet 3.253 +@item @code{<TAG>}〜@code{</TAG>} 3.254 +@dots{} @code{TAG} の変更 3.255 +@item @code{<img src="画像ファイル"> alt="photo"} などの属性値 3.256 +@dots{} 属性値の変更 3.257 +@end itemize 3.258 + 3.259 +@node 文字参照への変更, リジョン内文字のURLencode, 対タグの変更, Changing and Deleting 3.260 +@comment node-name, next, previous, up 3.261 +@section 文字参照への変更 3.262 +文字としての < や > を表現するときは、文字参照を用いて 3.263 +< や > と表記する必要がありますが、 3.264 +HTML以外のファイルからこれらの文字を含むテキストを張り込んだ場合 3.265 +などに、これらの文字を一括して文字参照形式に変換できます。 3.266 + 3.267 +@table @kbd 3.268 +@item [prefix] ; 3.269 + @dots{} 指定した領域の文字参照に置き換えるべき文字の置換 3.270 +@item [prefix] : 3.271 + @dots{} 指定した領域の文字参照を参照文字そのものに置換 3.272 + ([prefix] ; の逆変換) 3.273 +@end table 3.274 + 3.275 + 3.276 +@node リジョン内文字のURLencode, , 文字参照への変更, Changing and Deleting 3.277 +@comment node-name, next, previous, up 3.278 +@section リジョン内文字のURLencode 3.279 +@table 3.280 + @item [prefix] # 3.281 + @dots{} 指定した領域内に URLencode すべき文字があればそれらを 3.282 + エンコード表記に置換。 3.283 +@end table 3.284 + 3.285 + 3.286 +@node Customizations, Copying, Changing and Deleting, Top 3.287 +@comment node-name, next, previous, up 3.288 +@chapter カスタマイズ 3.289 +@cindex カスタマイズ[かすたまいす] 3.290 +@cindex キーアサイン[きいあさいん] 3.291 + 3.292 +yahtmlの動作を制御する変数について説明します。 3.293 + 3.294 +@menu 3.295 +* All customizable variables:: カスタマイズ変数一覧 3.296 +* Hook variables:: hook変数 3.297 +@end menu 3.298 + 3.299 +@node All customizable variables, Hook variables, Customizations, Customizations 3.300 +@comment node-name, next, previous, up 3.301 +@section カスタマイズ変数一覧 3.302 + 3.303 +@defvar yahtml-prefix 3.304 +yahtml-mode 中のプリフィクスキー (@kbd{\C-c}) 3.305 +@end defvar 3.306 + 3.307 +@defvar yahtml-image-viewer 3.308 +imgで参照している画像ファイルを表示するときに起動するコマンド (xv) 3.309 +@end defvar 3.310 + 3.311 +@defvar yahtml-www-browser 3.312 +@kbd{[prefix]g} で外部ページを表示するときに起動するブラウザ (netscape) 3.313 +@end defvar 3.314 + 3.315 +@defvar yahtml-kanji-code 3.316 +デフォルトの漢字コード。1=sjis, 2=jis, 3=euc (2) 3.317 +.htaccess ファイルに 3.318 +@quotation 3.319 + AddType "text/html; charset=xxx" .html 3.320 +@end quotation 3.321 +の記述があった場合はそれに従う 3.322 +@end defvar 3.323 + 3.324 +@defvar yahtml-fill-column 3.325 +auto-fillするときのカラム数 (72) 3.326 +@end defvar 3.327 + 3.328 +@defvar yahtml-fill-prefix 3.329 +yahtml-mode 固有のfill-prefix (@code{nil}) 3.330 +@end defvar 3.331 + 3.332 +@defvar yahtml-path-url-alist 3.333 +OSのファイルシステム上でのフルパス名と、その外部公開時のURLの対応表。 3.334 +@end defvar 3.335 + 3.336 +@defvar yahtml-directory-index 3.337 +サーバアクセス時ファイル名を省略したときにデフォルトで開かれる 3.338 +インデックスファイルの名前。多くの場合 index.html。(@code{"index.html"}) 3.339 +@end defvar 3.340 + 3.341 +@defvar yahtml-lint-program 3.342 +HTML構文チェックプログラム。(@code{"jweblint"}) 3.343 +@end defvar 3.344 + 3.345 +@defvar yahtml-hate-too-deep-indentation 3.346 +ネストした列挙系環境でのインデントが深すぎるときにtにする。(@code{nil}) 3.347 +@end defvar 3.348 + 3.349 +@defvar yahtml-always-/p 3.350 +@code{<p>} をいれたら必ず @code{</p>} したい人向け。@code{nil} 3.351 +@end defvar 3.352 + 3.353 +@defvar yahtml-p-prefered-env-regexp 3.354 +自動的に @code{<p>} を入れて欲しい環境。@code{^\(body\|dl\)} 3.355 +@end defvar 3.356 + 3.357 +@defvar yahtml-template-file 3.358 +新規HTMLファイル作成時に自動的に挿入して欲しいファイル名。 3.359 +@file{"~/http/template.html"} 3.360 +@end defvar 3.361 + 3.362 +@defvar yahtml-prefer-upcases 3.363 +タグに大文字を使いたい。@code{nil} 3.364 +@end defvar 3.365 + 3.366 +@defvar yahtml-prefer-upcase-attributes 3.367 +属性指定子に大文字を使いたい。@code{nil} 3.368 +@end defvar 3.369 + 3.370 +@defvar yahtml-server-type 3.371 +Apache系のサーバを利用している場合は 'apache をセットする。 3.372 +./.htaccess を参照するかどうかを決定する。@code{'apache} 3.373 +@end defvar 3.374 + 3.375 +@defvar yahtml-apache-access-file 3.376 +@code{yahtml-server-type} が @code{'apache} のときに 3.377 +アクセス制限ファイル名を指定。@file{".htaccess"} 3.378 +@end defvar 3.379 + 3.380 +@defvar yahtml-shell-command-option 3.381 +シェルで別コマンドを起動するときのオプション。 3.382 +@end defvar 3.383 + 3.384 +@defvar yahtml-translate-hyphens-when-comment-region 3.385 +領域コメントアウトをするときに既に存在するハイフンを @code{-} に 3.386 +変更するかどうか。(@code{t}) 3.387 +@end defvar 3.388 + 3.389 +@defvar yahtml-entity-reference-chars-alist 3.390 +エンティティ参照(Entity Reference)で記述すべき文字群を 3.391 + @code{'(?文字 . "エンティティ表記")} という形式を列挙した 3.392 +alistで並べる。デフォルトで @code{<}, @code{>}, @code{&}, @code{'}, 3.393 +@code{"} に対するalistが設定されているので、追加したい分だけを記述すれば良 3.394 +い。cdr部 @code{"エンティティ表記"} は、先頭の @code{&} と 末尾の@code{;} 3.395 +は含めずに書く。 3.396 +@end defvar 3.397 + 3.398 +@defvar yahtml-faithful-to-htmllint 3.399 +構文チェッカとして htmllint を利用する場合ちょっとした余計な空白などに 3.400 +対しても警告を示すので、これを回避するときにはこの変数を@code{t}に 3.401 +する。 3.402 +@end defvar 3.403 + 3.404 + 3.405 +@node Hook variables, , All customizable variables, Customizations 3.406 +@comment node-name, next, previous, up 3.407 +@section hook変数 3.408 + 3.409 + 3.410 +@node Copying, Concept Index, Customizations, Top 3.411 +@comment node-name, next, previous, up 3.412 +@chapter 取り扱い 3.413 + 3.414 + 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたいかな 3.415 +る結果に対しても作者は責任を負わないこととします。転載等に関しては制限いた 3.416 +しません。常識的に扱ってください。また、使用している旨をメイルでお知らせい 3.417 +ただくと、作者は喜んでサポートに励むことでしょう。 3.418 + 3.419 + 苦情、希望、バグ報告、感想等は歓迎いたします。 3.420 +連絡は gentei.org まで(1999年7月現在)。 3.421 +継続的に使用してくださる方はメイリングリスト「fj野鳥の会」に 3.422 +是非加入してください。加入方法については本パッケージの @file{docs/yahtmlqa} 3.423 +ファイルの「その他」の章を御覧ください。 3.424 + 3.425 +仕様は、予告なく確実に(気分次第で)変更されます:-p。 3.426 + 3.427 +@flushright 3.428 +広瀬雄二 3.429 +@end flushright 3.430 + 3.431 + 3.432 +@node Concept Index, , Copying, Top 3.433 +@comment node-name, next, previous, up 3.434 +@unnumbered 索引 3.435 +@printindex cp 3.436 + 3.437 + 3.438 +@contents 3.439 + 3.440 +@bye 3.441 + 3.442 +@c Local Variables: 3.443 +@c fill-column: 74 3.444 +@c fill-prefix: nil 3.445 +@c End: 3.446 + 3.447 +Tag table: 3.448 + 3.449 +End tag table
4.1 --- a/docs/yatex.ref Mon Oct 26 12:05:32 1998 +0000 4.2 +++ b/docs/yatex.ref Thu Jul 15 04:58:26 1999 +0000 4.3 @@ -159,8 +159,7 @@ 4.4 ◆インクルード構造ブラウズ [prefix] d 4.5 4.6 広瀬雄二 4.7 - yuuji@ae.keio.ac.jp 4.8 - pcs39334@asciinet.or.jp 4.9 + yuuji@gentei.org 4.10 4.11 Local variables: 4.12 mode: text
5.1 --- a/docs/yatexadd.doc Mon Oct 26 12:05:32 1998 +0000 5.2 +++ b/docs/yatexadd.doc Thu Jul 15 04:58:26 1999 +0000 5.3 @@ -169,5 +169,5 @@ 5.4 思います。 5.5 5.6 5.7 - 広瀬雄二 5.8 - yuuji@ae.keio.ac.jp 5.9 + 広瀬雄二 5.10 + yuuji@gentei.org
6.1 --- a/docs/yatexe.tex Mon Oct 26 12:05:32 1998 +0000 6.2 +++ b/docs/yatexe.tex Thu Jul 15 04:58:26 1999 +0000 6.3 @@ -14,7 +14,7 @@ 6.4 @subtitle Yet Another tex-mode for emacs 6.5 @title Wild Bird 6.6 @subtitle // YaTeX // 6.7 -@author @copyright{} 1991-1996 by HIROSE, Yuuji [yuuji@@ae.keio.ac.jp] 6.8 +@author @copyright{} 1991-1996 by HIROSE, Yuuji [yuuji@@gentei.org] 6.9 @end titlepage 6.10 6.11 @node Top, What is YaTeX?, (dir), (dir) 6.12 @@ -2018,7 +2018,7 @@ 6.13 short descriptions on useful functions, where [F] means function, [A] 6.14 means arguments, [D] means description. 6.15 6.16 -@itemize 6.17 +@table @kbd 6.18 @item [F] 6.19 YaTeX:read-position 6.20 @itemx [A] 6.21 @@ -2047,7 +2047,7 @@ 6.22 Check the current completion type is specified one and cause error if 6.23 not. The variable @code{YaTeX-current-completion-type} holds the symbol 6.24 according to the current completion type. 6.25 -@end itemize 6.26 +@end table 6.27 6.28 @node Contribution, , Useful functions for creating add-in, Add-in functions 6.29 @comment node-name, next, previous, up 6.30 @@ -2271,8 +2271,8 @@ 6.31 redistribute this software freely but with NO warranty to anything 6.32 as a result of using this software. However, any reports and 6.33 suggestions are welcome as long as I feel interests in this 6.34 -software. My possible e-mail address is `yuuji@@ae.keio.ac.jp'. 6.35 -(up to Mar.1995 at least) And there is mailing list for YaTeX. 6.36 +software. My possible e-mail address is `yuuji@@gentei.org'. 6.37 +(up to May.1999 at least) And there is mailing list for YaTeX. 6.38 Although the common language is Japanese, questions in English will be 6.39 welcome. To join the ML, send the mail whose subject is `append' to 6.40 the address `yatex-control@@jaist.ac.jp'. If you have some
7.1 --- a/docs/yatexgen.doc Mon Oct 26 12:05:32 1998 +0000 7.2 +++ b/docs/yatexgen.doc Thu Jul 15 04:58:26 1999 +0000 7.3 @@ -175,5 +175,5 @@ 7.4 ら、幸福感に浸るだけにして、決して筆者まで送ったりしないで下さい。 7.5 yatexgen が作るんだから、ろくな関数じゃないことは分かってます:-p。 7.6 7.7 - 広瀬雄二 7.8 - yuuji@ae.keio.ac.jp 7.9 + 広瀬雄二 7.10 + yuuji@gentei.org
8.1 --- a/docs/yatexj.tex Mon Oct 26 12:05:32 1998 +0000 8.2 +++ b/docs/yatexj.tex Thu Jul 15 04:58:26 1999 +0000 8.3 @@ -6,6 +6,7 @@ 8.4 @iftex 8.5 @c @syncodeindex fn cp 8.6 @c いつも忘れるのでここに書いとくか。 8.7 +@c C-l C-c n でノード入れ 8.8 @c ノードいじったら C-l C-u C-n 全部のノード更新 C-l C-u C-e 8.9 @c メニュー増やしたら C-l C-u C-m 全部のメニュー更新 C-l C-u C-a 8.10 @c フォーマットするときは C-l C-e C-b 8.11 @@ -18,7 +19,7 @@ 8.12 @subtitle Yet Another tex-mode for emacs 8.13 @title 『野鳥』 8.14 @subtitle // YaTeX // 8.15 -@author @copyright{} 1991-1997 by HIROSE, Yuuji [yuuji@@ae.keio.ac.jp] 8.16 +@author @copyright{} 1991-1999 by HIROSE, Yuuji [yuuji@@gentei.org] 8.17 @end titlepage 8.18 8.19 @node Top, Intro, (dir), (dir) 8.20 @@ -2112,8 +2113,7 @@ 8.21 ただくと、作者は喜んでサポートに励むことでしょう。 8.22 8.23 苦情、希望、バグ報告、感想等は歓迎いたします。 8.24 -連絡は yuuji@@ae.keio.ac.jp または、 8.25 -pcs39334@@asciinet.or.jp まで(1995年3月現在)。 8.26 +連絡は yuuji@@gentei.org まで(1999年5月現在)。 8.27 継続的に使用してくださる方はメイリングリスト「fj野鳥の会」に 8.28 是非加入してください。加入方法については本パッケージの @file{docs/qanda} 8.29 ファイルの「その他」の章を御覧ください。
9.1 --- a/docs/yatexref.eng Mon Oct 26 12:05:32 1998 +0000 9.2 +++ b/docs/yatexref.eng Thu Jul 15 04:58:26 1999 +0000 9.3 @@ -154,9 +154,8 @@ 9.4 9.5 *Browse included structure [prefix] d 9.6 9.7 - HIROSE Yuuji 9.8 - yuuji@ae.keio.ac.jp 9.9 - pcs39334@asciinet.or.jp 9.10 + HIROSE Yuuji 9.11 + yuuji@gentei.org 9.12 9.13 Local variables: 9.14 mode: text
10.1 --- a/help/YATEXHLP.jp Mon Oct 26 12:05:32 1998 +0000 10.2 +++ b/help/YATEXHLP.jp Thu Jul 15 04:58:26 1999 +0000 10.3 @@ -1297,12 +1297,12 @@ 10.4 たれました。享年二十六歳。彼には、野鳥だけでなく私が手掛けた数多 10.5 くのソフトウェアを作る動機、センスあふれるコメントなどを頂きまし 10.6 た。現在の野鳥が皆様に支持されるように健やかに育ったのは彼のおか 10.7 - げと言っても過言ではありません。野鳥/雷鳥/白鳥を使うときに彼の安 10.8 - らかな眠りを私と共に祈って下さい。 10.9 + げと言っても過言ではありません。野鳥/雷鳥/白鳥/飛鳥を使うときに 10.10 + 彼の安らかな眠りを私と共に祈って下さい。 10.11 10.12 るねきちさん(asciinet) 10.13 占い師だそうです。 10.14 - http://www.comp.ae.keio.ac.jp/~yuuji/lune/astrology/ 10.15 + http://www.gentei.org/~yuuji/lune/astrology/ 10.16 10.17 三平善郎さん(慶應大) 10.18 開き括弧の入力時の処理のモード分けのアイデアを頂きました。 10.19 @@ -1370,6 +1370,7 @@ 10.20 YaTeX-insert-amper をcontributeして頂きました。 10.21 作者の数多くの凡ミスを丁寧に拾って下さいました。 10.22 YaTeX-shift-section-undo の実現方法を教えていただきました。 10.23 + Wzへの移植版 HackTeX を作成されました。 10.24 10.25 佐藤圭さん(慶應大) 10.26 ネストした同種のitemize環境でのindentationの不具合を指摘して頂き 10.27 @@ -1428,6 +1429,9 @@ 10.28 数式モードでのセクション型マクロ対応の要望と足すべきマクロ一覧を 10.29 頂きました。 10.30 10.31 +松田茂樹さん(千葉大) 10.32 + AMS LaTeX用のいくつかの関数、YaTeX-change-parentheses などを作成 10.33 + して頂きました。 10.34 yatex 10.35 (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist)) 10.36 <refer YaTeX>
11.1 --- a/yahtml.el Mon Oct 26 12:05:32 1998 +0000 11.2 +++ b/yahtml.el Thu Jul 15 04:58:26 1999 +0000 11.3 @@ -1,9 +1,7 @@ 11.4 ;;; -*- Emacs-Lisp -*- 11.5 -;;; (c ) 1994-1997 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 11.6 -;;; Last modified Mon Oct 26 19:57:36 1998 on firestorm 11.7 +;;; (c ) 1994-1999 by HIROSE Yuuji [yuuji@gentei.org] 11.8 +;;; Last modified Wed Jul 14 18:01:18 1999 on firestorm 11.9 ;;; $Id$ 11.10 -(defconst yahtml-revision-number "1.65.5" 11.11 - "Revision number of running yatex.el") 11.12 11.13 ;;;[Installation] 11.14 ;;; 11.15 @@ -77,6 +75,12 @@ 11.16 ;;; is "netscape") 11.17 ;;; * [prefix] a YaTeX's accent mark's equivalent of yahtml. 11.18 ;;; This function can input $lt, $gt or so. 11.19 +;;; * [prefix] ; Translate chars of `>', `<', `&', and `"' to 11.20 +;;; `>', `<', `&', `"' respectively 11.21 +;;; in the region. 11.22 +;;; * [prefix] : Do translation opposite to above, in the region. 11.23 +;;; * [prefix] # Translate unsafe-chars and unreserved-chars to 11.24 +;;; URLencoded string in the region. 11.25 ;;; 11.26 ;;;[キーの説明] 11.27 ;;; 11.28 @@ -126,6 +130,11 @@ 11.29 ;;; 送るという芸当が出来ます) 11.30 ;;; * [prefix] a YaTeX のアクセント記号補完と同じです。 11.31 ;;; < > 等が入力できます。 11.32 +;;; * [prefix] ; 指定したリジョン中の > < & " をそれぞれ 11.33 +;;; > < & " に変換します。 11.34 +;;; * [prefix] : 指定したリジョン中で上と逆の変換をします。 11.35 +;;; * [prefix] # 指定したリジョン中で%エンコードの必要な文字が 11.36 +;;; あればそれらをエンコードします。 11.37 ;;; 11.38 ;;; [謝辞] 11.39 ;;; 11.40 @@ -150,9 +159,14 @@ 11.41 "*WWW Browser command") 11.42 (defvar yahtml-kanji-code 2 11.43 "*Kanji coding system number of html file; 1=sjis, 2=jis, 3=euc") 11.44 -(defvar yahtml-coding-system 11.45 - (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)) 11.46 - "Kanji coding system") 11.47 +;;(defvar yahtml-coding-system 11.48 +;; (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)) 11.49 +;; "Kanji coding system") 11.50 +(and (featurep 'mule) 11.51 + (integerp yahtml-kanji-code) 11.52 + (setq yahtml-kanji-code 11.53 + (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)))) 11.54 + 11.55 (defvar yahtml-fill-column 72 "*fill culumn used for yahtml-mode") 11.56 (defvar yahtml-fill-prefix nil "*fill prefix for yahtml-mode") 11.57 11.58 @@ -186,6 +200,20 @@ 11.59 (defvar yahtml-template-file "~/http/template.html" 11.60 "*Template HTML file. It'll be inserted to empty file.") 11.61 11.62 +(defvar yahtml-prefer-upcases nil 11.63 + "*Non-nil for preferring upcase TAGs") 11.64 + 11.65 +(defvar yahtml-prefer-upcase-attributes nil 11.66 + "*Non-nil for preferring upcase attributes") 11.67 + 11.68 +(defvar yahtml-server-type 'apache 11.69 + "*WWW server program type") 11.70 + 11.71 +(defvar yahtml-apache-access-file ".htaccess" 11.72 + "*Server access file name for apache") 11.73 + 11.74 +(defvar yahtml-use-css t "*Use stylesheet or not") 11.75 + 11.76 ;;; --- customizable variable ends here --- 11.77 (defvar yahtml-prefix-map nil) 11.78 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") 11.79 @@ -216,7 +244,6 @@ 11.80 (yahtml-define-begend-region-key 11.81 (concat (upcase (substring key 0 1)) (substring key 1)) env map))) 11.82 11.83 - 11.84 (if yahtml-mode-map nil 11.85 (setq yahtml-mode-map (make-sparse-keymap) 11.86 yahtml-prefix-map (make-sparse-keymap)) 11.87 @@ -279,6 +306,9 @@ 11.88 (YaTeX-define-key "t" 'yahtml-browse-menu map) 11.89 (YaTeX-define-key "a" 'yahtml-complete-mark map) 11.90 (YaTeX-define-key "'" 'yahtml-prev-error map) 11.91 + (YaTeX-define-key ";" 'yahtml-translate-region map) 11.92 + (YaTeX-define-key ":" 'yahtml-translate-reverse-region map) 11.93 + (YaTeX-define-key "#" 'yahtml-escape-chars-region map) 11.94 ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map) 11.95 )) 11.96 11.97 @@ -310,7 +340,7 @@ 11.98 11.99 ;;; Completion tables for `form' 11.100 (defvar yahtml-form-table 11.101 - '(("img") ("input"))) 11.102 + '(("img") ("input") ("link") ("meta"))) 11.103 (defvar yahtml-user-form-table nil) 11.104 (defvar yahtml-tmp-form-table nil) 11.105 (defvar yahtml-last-form "img") 11.106 @@ -322,14 +352,16 @@ 11.107 ("UnorderedList" . "ul") 11.108 ("DefinitionList" . "dl") 11.109 ("Preformatted" . "pre") 11.110 - ("table") ("tr") ("th") ("td") 11.111 + ("table") ("thead") ("tbody") ("tfoot") ("caption") ("tr") ("th") ("td") 11.112 + ("address") 11.113 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") 11.114 ;; ("p") ;This makes indentation screwed up! 11.115 + ("style") ("div") 11.116 )) 11.117 11.118 -(defvar yahtml-itemizing-regexp 11.119 - "\\(ul\\|ul\\|dl\\)" 11.120 - "Regexp of itemizing forms") 11.121 +;(defvar yahtml-itemizing-regexp 11.122 +; "\\(ul\\|ol\\|dl\\)" 11.123 +; "Regexp of itemizing forms") 11.124 11.125 (defvar yahtml-user-env-table nil) 11.126 (defvar yahtml-tmp-env-table nil) 11.127 @@ -342,7 +374,8 @@ 11.128 (defvar yahtml-typeface-table 11.129 (append 11.130 '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("strike") 11.131 - ("strong") ("var") ("b") ("i") ("tt") ("u") ("address") ("font")) 11.132 + ("strong") ("var") ("b") ("i") ("tt") ("u") ("big") ("small") ("font") 11.133 + ("sup") ("sub") ("span")) 11.134 yahtml-env-table) 11.135 "Default completion table of typeface designator") 11.136 (defvar yahtml-user-typeface-table nil) 11.137 @@ -364,8 +397,6 @@ 11.138 (defvar yahtml-tmp-single-cmd-table nil) 11.139 (defvar yahtml-last-single-cmd nil) 11.140 11.141 -(defvar yahtml-prefer-upcases nil) 11.142 - 11.143 ;(defvar yahtml-struct-name-regexp 11.144 ; "\\<\\(h[1-6]\\|[uod]l\\|html\\|body\\|title\\|head\\|table\\|t[rhd]\\|pre\\|a\\|form\\|select\\|center\\|blockquote\\)\\b") 11.145 (defvar yahtml-struct-name-regexp 11.146 @@ -377,23 +408,65 @@ 11.147 (or (assoc "p" yahtml-env-table) 11.148 (setq yahtml-env-table (cons '("p") yahtml-env-table))) 11.149 11.150 +(defun yahtml-dir-default-charset () 11.151 + (cond 11.152 + ((and (eq yahtml-server-type 'apache) ;;check .htaccess 11.153 + buffer-file-name) 11.154 + (let ((dir default-directory) 11.155 + charset af ext (ldir "") 11.156 + (case-fold-search t) 11.157 + (uid (car (cdr (cdr (file-attributes ".")))))) 11.158 + (setq ext (file-name-nondirectory buffer-file-name) 11.159 + ext (substring ext (string-match "\\.[a-z0-9]+$" ext))) 11.160 + (if (string-match "^[A-Z]:" dir) 11.161 + (setq dir (substring dir 2))) ;remove drive letter 11.162 + (while (and dir 11.163 + (not (string= dir ldir)) 11.164 + (equal uid (car (cdr (cdr (file-attributes dir)))))) 11.165 + (setq af (expand-file-name yahtml-apache-access-file dir)) 11.166 + (if (file-exists-p af) 11.167 + (save-excursion 11.168 + (set-buffer (find-file-noselect af)) 11.169 + (save-excursion 11.170 + (goto-char (point-min)) 11.171 + (if (re-search-forward ;search the charset for same extension 11.172 + (format "^\\s *AddType.*charset=\\(.*\\)\\%s$" ext) 11.173 + nil t) 11.174 + (progn 11.175 + (setq charset 11.176 + (buffer-substring 11.177 + (match-beginning 1) (match-end 1))) 11.178 + (cond 11.179 + ((string-match "iso-2022-jp" charset) 11.180 + (setq charset 2)) 11.181 + ((string-match "euc-jp" charset) 11.182 + (setq charset 3)) 11.183 + ((string-match "shift_jis" charset) 11.184 + (setq charset 1)) 11.185 + (t (setq charset nil))) 11.186 + (setq dir "")))) 11.187 + (kill-buffer (current-buffer)))) 11.188 + (setq ldir dir 11.189 + dir (substring dir 0 (string-match "/$" dir)) 11.190 + dir (file-name-directory dir))) 11.191 + (if (featurep 'mule) 11.192 + (setq charset (cdr (assq charset YaTeX-kanji-code-alist)))) 11.193 + charset 11.194 + )) 11.195 + (t nil)) 11.196 + ) 11.197 + 11.198 (defun yahtml-mode () 11.199 (interactive) 11.200 - (cond 11.201 - ((and YaTeX-emacs-20 (fboundp 'coding-system-equal)) 11.202 - (let ((mp (buffer-modified-p)) 11.203 - (ud (memq buffer-file-coding-system 11.204 - '(undecided undecided-unix undecided-dos undecided-mac)))) 11.205 - (if (coding-system-equal 11.206 - yahtml-coding-system buffer-file-coding-system) 11.207 - nil ; if coding-system is the same, do nothing 11.208 - (set-buffer-file-coding-system yahtml-coding-system) 11.209 - (if ud (set-buffer-modified-p mp))))) 11.210 - ((featurep 'mule) 11.211 - (set-file-coding-system yahtml-coding-system)) 11.212 - ((boundp 'NEMACS) 11.213 - (make-local-variable 'kanji-fileio-code) 11.214 - (setq kanji-fileio-code yahtml-kanji-code))) 11.215 + (let ((coding (or (yahtml-dir-default-charset) yahtml-kanji-code))) 11.216 + (cond 11.217 + ((and YaTeX-emacs-20 (boundp 'buffer-file-coding-system)) 11.218 + (setq buffer-file-coding-system coding)) 11.219 + ((featurep 'mule) 11.220 + (set-file-coding-system coding)) 11.221 + ((boundp 'NEMACS) 11.222 + (make-local-variable 'kanji-fileio-code) 11.223 + (setq kanji-fileio-code coding)))) 11.224 (setq major-mode 'yahtml-mode 11.225 mode-name "yahtml") 11.226 (mapcar 11.227 @@ -408,7 +481,7 @@ 11.228 (YaTeX-struct-end . "</%1>") 11.229 (YaTeX-struct-name-regexp . yahtml-struct-name-regexp) 11.230 (YaTeX-comment-prefix . "<!--") 11.231 - (YaTeX-coding-system . yahtml-coding-system) 11.232 + (YaTeX-coding-system . yahtml-kanji-code) ;necessary? 11.233 (YaTeX-typesetting-mode-map . yahtml-lint-buffer-map) 11.234 (fill-prefix . yahtml-fill-prefix) (fill-column . yahtml-fill-column) 11.235 (paragraph-start . yahtml-paragraph-start) 11.236 @@ -420,6 +493,7 @@ 11.237 (set-syntax-table yahtml-syntax-table) 11.238 (use-local-map yahtml-mode-map) 11.239 (YaTeX-read-user-completion-table) 11.240 + (yahtml-css-scan-styles) 11.241 (turn-on-auto-fill) ;Sorry, this is prerequisite 11.242 (and (= 0 (buffer-size)) (file-exists-p yahtml-template-file) 11.243 (y-or-n-p (format "Insert %s?" yahtml-template-file)) 11.244 @@ -582,13 +656,16 @@ 11.245 (setq cmd yahtml-last-begend) 11.246 (if yahtml-prefer-upcases (setq cmd (upcase cmd))) 11.247 (if region 11.248 + ;; We want to keep region effective for new tagged environment 11.249 + ;; to enable continuous regioning by another environment 11.250 (let ((beg (region-beginning)) 11.251 (end (region-end)) 11.252 (addin (yahtml-addin cmd))) 11.253 - (goto-char end) 11.254 - (insert (format "</%s>%s" cmd (if bolp "\n" ""))) 11.255 - (goto-char beg) 11.256 - (insert (format "<%s%s>%s" cmd addin (if bolp "\n" "")))) 11.257 + (save-excursion 11.258 + (goto-char end) 11.259 + (insert-before-markers (format "</%s>%s" cmd (if bolp "\n" ""))) 11.260 + (goto-char beg) 11.261 + (insert (format "<%s%s>%s" cmd addin (if bolp "\n" ""))))) 11.262 (insert (format "<%s%s>" cmd (yahtml-addin cmd))) 11.263 (save-excursion 11.264 (insert "\n") 11.265 @@ -628,33 +705,40 @@ 11.266 ;;; ---------- Add-in ---------- 11.267 (defun yahtml-addin (form) 11.268 "Check add-in function's existence and call it if exists." 11.269 - (let ((addin (concat "yahtml:" (downcase form))) s) 11.270 - (if (and (intern-soft addin) (fboundp (intern-soft addin)) 11.271 - (stringp (setq s (funcall (intern addin)))) 11.272 - (string< "" s)) 11.273 - (if (eq (aref s 0) ? ) s (concat " " s)) 11.274 - ""))) 11.275 + (let ((addin (concat "yahtml:" (downcase form))) s a) 11.276 + (concat 11.277 + (if (setq a (assoc form yahtml-css-class-alist)) 11.278 + (yahtml-make-optional-argument ;should be made generic? 11.279 + "class" (completing-read "class: " (cdr a)))) 11.280 + (if (and (intern-soft addin) (fboundp (intern-soft addin)) 11.281 + (stringp (setq s (funcall (intern addin)))) 11.282 + (string< "" s)) 11.283 + (if (eq (aref s 0) ? ) s (concat " " s)) 11.284 + "")))) 11.285 11.286 11.287 (defvar yahtml-completing-buffer nil) 11.288 (defun yahtml-collect-labels (&optional file) 11.289 "Collect current buffers label (<?? name=...>). 11.290 If optional argument FILE is specified collect labels in FILE." 11.291 - (let (list bound) 11.292 + (let (list end) 11.293 (save-excursion 11.294 (set-buffer yahtml-completing-buffer) 11.295 (if file (let (hilit-auto-highlight) 11.296 (set-buffer (find-file-noselect file)))) 11.297 (save-excursion 11.298 (goto-char (point-min)) 11.299 - (while (re-search-forward "<\\w+\\b" nil t) 11.300 - (setq bound (match-end 0)) 11.301 - (search-forward ">" nil t) 11.302 - (if (and (re-search-backward "\\(name\\|id\\)\\s *=" bound t) 11.303 - (progn 11.304 - (goto-char (match-end 0)) 11.305 - (skip-chars-forward " \t\n") 11.306 - (looking-at "\"?#?\\([^\">]+\\)\"?\\b"))) 11.307 + (while ;(re-search-forward "<\\w+\\b" nil t) 11.308 + (re-search-forward "\\(name\\|id\\)\\s *=" nil t) 11.309 + ;(setq bound (match-end 0)) 11.310 + ;(search-forward ">" nil t) 11.311 + (setq end (match-end 0)) 11.312 + (if (and ;(re-search-backward "\\(name\\|id\\)\\s *=" bound t) 11.313 + (yahtml-on-assignment-p) 11.314 + (progn 11.315 + (goto-char end) 11.316 + (skip-chars-forward " \t\n") 11.317 + (looking-at "\"?#?\\([^\">]+\\)\"?\\b"))) 11.318 (setq list (cons 11.319 (list (concat "#" (YaTeX-match-string 1))) 11.320 list)))) 11.321 @@ -723,22 +807,99 @@ 11.322 (goto-char p) 11.323 (insert " [Sole completion]")) 11.324 (delete-region p (point-max)))))))) 11.325 - 11.326 + 11.327 +(defvar yahtml-escape-chars 'ask 11.328 + "*Escape reserved characters to URL-encoding or not. 11.329 +Nil for never, t for everytime, and 'ask for inquiring 11.330 +at each reserved chars.") 11.331 + 11.332 +; 11.333 +; Subject: [yatex:02849] Re: [yahtml] tilda in href tag 11.334 +; From: Masayasu Ishikawa <mimasa@sfc.keio.ac.jp> 11.335 +; To: yatex@arcadia.jaist.ac.jp 11.336 +; Date: Mon, 31 May 1999 21:09:31 +0900 11.337 +; RFC 2396 の "2.4.3. Excluded US-ASCII Characters" によると、以下の文字 11.338 +; は必ずエスケープしないといけません。 11.339 +; 11.340 +; control = <US-ASCII coded characters 00-1F and 7F hexadecimal> 11.341 +; space = <US-ASCII coded character 20 hexadecimal> 11.342 +; delims = "<" | ">" | "#" | "%" | <"> 11.343 +; unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" 11.344 +(defvar yahtml-unsafe-chars-regexp 11.345 + "[][\x0- \x7f <>%\"{}|\\^`]" ;#は除去する 11.346 + "Characters regexp which must be escaped in URI.") 11.347 +; 11.348 +; また、以下の文字は予約された用法以外に用いる場合にはエスケープしないと 11.349 +; いけないことになっています。 11.350 +; 11.351 +; reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | 11.352 +; "$" | "," 11.353 +(defvar yahtml-unreserved-chars-regexp 11.354 + "[;/?:@&=+$,]" 11.355 + "Characters regexp which should be escaped in URI on certain conditions. 11.356 +Not used yet.") 11.357 + 11.358 +(defun yahtml-escape-chars-string (str) 11.359 + "Translate reserved chars to URL encoded string." 11.360 + (let ((p 0) (target "") 11.361 + (ask (eq yahtml-escape-chars 'ask))) 11.362 + (cond 11.363 + ((null yahtml-escape-chars) str) 11.364 + (t 11.365 + (while (and (string< "" str) 11.366 + (setq p (string-match yahtml-unsafe-chars-regexp str))) 11.367 + (if (and ask (y-or-n-p (format "Escape char [%c] of `%s'" 11.368 + (aref str p) (substring str 0 (1+ p))))) 11.369 + (setq target (concat target 11.370 + (substring str 0 p) 11.371 + (format "%%%x" (aref str p)))) 11.372 + (setq target (concat target (substring str 0 (1+ p))))) 11.373 + (setq str (substring str (1+ p)))) 11.374 + (concat target str))))) 11.375 + 11.376 +(defun yahtml-escape-chars-region (beg end) 11.377 + "Translate reserved chars to encoded string in the region." 11.378 + (interactive "r") 11.379 + (save-excursion 11.380 + (let ((e (set-marker (make-marker) end)) c m yes) 11.381 + (goto-char beg) 11.382 + (while (and (< (point) e) 11.383 + (re-search-forward 11.384 + (concat yahtml-unsafe-chars-regexp "\\|" 11.385 + yahtml-unreserved-chars-regexp) e t)) 11.386 + (sit-for 0) 11.387 +; (setq m (buffer-modified-p) 11.388 +; c (char-after (1- (point)))) 11.389 +; (save-excursion (backward-char 1) (insert " ==>")) 11.390 +; (unwind-protect 11.391 +; (setq yes (y-or-n-p (format "Replace: [%c]" c))) 11.392 +; (save-excursion 11.393 +; (backward-char 1) 11.394 +; (delete-backward-char 4)) 11.395 +; (set-buffer-modified-p m)) 11.396 + (message "Replace: [%c] (y or n):" (setq c (char-after (1- (point))))) 11.397 + (if (memq (read-char) '(?y ?Y)) 11.398 + (progn 11.399 + (delete-region (match-beginning 0) (match-end 0)) 11.400 + (insert (format "%%%x" c))))) 11.401 + (set-marker e nil)))) 11.402 +;; ab%defgls/.| 11.403 + 11.404 (defun yahtml:a () 11.405 "Add-in function for <a>" 11.406 (let ((href "")) 11.407 (setq yahtml-completing-buffer (current-buffer) 11.408 - href (read-from-minibuffer "href: " "" yahtml-url-completion-map) 11.409 - ;; yahtml-urls-local is buffer-local, so we must put 11.410 - ;; that into yahtml-urls here 11.411 - yahtml-urls (append yahtml-urls-private yahtml-urls-local)) 11.412 + yahtml-urls (append yahtml-urls-private yahtml-urls-local) 11.413 + href (yahtml-escape-chars-string 11.414 + (read-from-minibuffer "href: " "" yahtml-url-completion-map))) 11.415 (prog1 11.416 (concat (yahtml-make-optional-argument 11.417 "href" href) 11.418 (yahtml-make-optional-argument 11.419 "name" (read-string "name: "))) 11.420 (if (and (string-match "^http://" href) 11.421 - (null (assoc href yahtml-urls))) 11.422 + (null (assoc href yahtml-urls-private)) 11.423 + (null (assoc href yahtml-urls-local))) 11.424 (YaTeX-update-table 11.425 (list href) 11.426 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local)) 11.427 @@ -747,26 +908,45 @@ 11.428 (defvar yahtml-parameters-completion-alist 11.429 '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center")) 11.430 ("src" . file) 11.431 - ("method" ("POST") ("GET")))) 11.432 + ("method" ("POST") ("GET")) 11.433 + ("rev" . yahtml-link-types-alist) 11.434 + ("rel" . yahtml-link-types-alist) 11.435 + ("type" . yahtml-content-types-alist))) 11.436 11.437 -(defun yahtml-read-parameter (par) 11.438 - (let* ((alist (cdr-safe (assoc (downcase par) 11.439 - yahtml-parameters-completion-alist))) 11.440 +(defvar yahtml-link-types-alist 11.441 + '(("alternate") ("stylesheet") ("start") ("next") ("prev") 11.442 + ("contents") ("index") ("glossary") ("chapter") ("section") 11.443 + ("subsection") ("appendix") ("help") ("bookmark"))) 11.444 + 11.445 +(defvar yahtml-content-types-alist 11.446 + '(("text/css") ("text/html") ("text/plain") ("text/richtext") 11.447 + ("text/sgml") ("text/xml") 11.448 + ("application/octet-stream") ("application/postscript") ("application/pdf") 11.449 + ("image/jpeg") ("image/gif") ("image/tiff") ("video/mpeg")) 11.450 + "Alist of content-types") 11.451 + 11.452 +(defun yahtml-read-parameter (par &optional default alist) 11.453 + (let* ((alist 11.454 + (cdr-safe (assoc (downcase par) 11.455 + (or alist yahtml-parameters-completion-alist)))) 11.456 (prompt (concat par ": ")) 11.457 v) 11.458 (cond 11.459 ((eq alist 'file) 11.460 - (read-file-name prompt "" nil nil "")) 11.461 + (read-file-name prompt "" default nil "")) 11.462 + ((symbolp alist) 11.463 + (completing-read prompt (symbol-value alist) nil nil default)) 11.464 (alist 11.465 - (completing-read prompt alist)) 11.466 + (completing-read prompt alist nil nil default)) 11.467 (t 11.468 - (read-string prompt))))) 11.469 + (read-string prompt default))))) 11.470 11.471 (defun yahtml-make-optional-argument (opt arg) 11.472 "Make optional argument string." 11.473 (if (string= "" arg) 11.474 "" 11.475 - (concat " " (if yahtml-prefer-upcases (upcase opt) (downcase opt)) 11.476 + (concat " " 11.477 + (if yahtml-prefer-upcase-attributes (upcase opt) (downcase opt)) 11.478 "=\"" arg "\""))) 11.479 11.480 (defun yahtml:body () 11.481 @@ -788,7 +968,7 @@ 11.482 (alg (yahtml-read-parameter "align")) 11.483 (alt (yahtml-read-parameter "alt")) 11.484 (brd (read-string "border=")) 11.485 - (l yahtml-prefer-upcases)) 11.486 + (l yahtml-prefer-upcase-attributes)) 11.487 (concat (if l "SRC" "src") "=\"" src "\"" 11.488 (yahtml-make-optional-argument "align" alg) 11.489 (yahtml-make-optional-argument "alt" alt) 11.490 @@ -797,16 +977,16 @@ 11.491 (defun yahtml:form () 11.492 "Add-in function `form' input format" 11.493 (concat 11.494 - " " (if yahtml-prefer-upcases "METHOD" "method=") 11.495 + " " (if yahtml-prefer-upcase-attributes "METHOD" "method=") 11.496 (completing-read "Method: " '(("POST") ("GET")) nil t) 11.497 - " " (if yahtml-prefer-upcases "ACTION" "action") "=\"" 11.498 + " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\"" 11.499 (read-string "Action: ") "\"" 11.500 )) 11.501 11.502 (defun yahtml:select () 11.503 "Add-in function for `select' input format" 11.504 (setq yahtml-last-single-cmd "option") 11.505 - (concat " " (if yahtml-prefer-upcases "NAME" "name") "=\"" 11.506 + (concat " " (if yahtml-prefer-upcase-attributes "NAME" "name") "=\"" 11.507 (read-string "name: ") "\"")) 11.508 11.509 (defun yahtml:ol () 11.510 @@ -830,7 +1010,7 @@ 11.511 (defun yahtml:input () 11.512 "Add-in function for `input' form" 11.513 (let ((size "") name type value checked (maxlength "") 11.514 - (l yahtml-prefer-upcases)) 11.515 + (l yahtml-prefer-upcase-attributes)) 11.516 (setq name (read-string "name: ") 11.517 type (completing-read "type (default=text): " 11.518 yahtml-input-types nil t) 11.519 @@ -854,14 +1034,23 @@ 11.520 cols (read-string "Columns: ") 11.521 rows (read-string "Rows: ")) 11.522 (concat 11.523 - (concat (if yahtml-prefer-upcases "NAME=" "name=") 11.524 + (concat (if yahtml-prefer-upcase-attributes "NAME=" "name=") 11.525 "\"" name "\"") 11.526 (yahtml-make-optional-argument "cols" cols) 11.527 (yahtml-make-optional-argument "rows" rows)))) 11.528 11.529 (defun yahtml:table () 11.530 "Add-in function for `table'" 11.531 - (yahtml-make-optional-argument "border" (read-string "border="))) 11.532 + (let ((b (read-string "border=")) 11.533 + (a (yahtml-read-parameter "align"))) 11.534 + (concat 11.535 + (yahtml-make-optional-argument "border" b) 11.536 + (yahtml-make-optional-argument "align" a)))) 11.537 +;(fset 'yahtml:caption 'yahtml:p) 11.538 +(defun yahtml:caption () 11.539 + "Add-in function for `caption' in table tag" 11.540 + (let ((yahtml-parameters-completion-alist '(("align" ("top") ("bottom"))))) 11.541 + (yahtml-make-optional-argument "align" (yahtml-read-parameter "align")))) 11.542 11.543 (defun yahtml:font () 11.544 "Add-in function for `font'" 11.545 @@ -869,6 +1058,49 @@ 11.546 (yahtml-make-optional-argument "color" (read-string "color=")) 11.547 (yahtml-make-optional-argument "size" (read-string "size=")))) 11.548 11.549 +(defun yahtml:style () 11.550 + "Add-in function for `style'" 11.551 + (yahtml-make-optional-argument 11.552 + "type" (read-string "type=" "text/css"))) 11.553 + 11.554 +(defun yahtml:tr () 11.555 + "Add-in function for `tr'" 11.556 + (setq ;yahtml-last-begend "td" ;; which do you prefer? 11.557 + yahtml-last-typeface-cmd "td") 11.558 + "") 11.559 + 11.560 +(defun yahtml:link () 11.561 + "Add-in function for `link' (まだちょっと良く分かってない)" 11.562 + (let (rel rev type href) 11.563 + (setq rel (yahtml-read-parameter "rel")) 11.564 + (cond 11.565 + ((equal rel "") 11.566 + (concat (yahtml-make-optional-argument 11.567 + "rev" (yahtml-read-parameter "rev")) 11.568 + (yahtml-make-optional-argument 11.569 + "href" (yahtml-read-parameter "href") 11.570 + ;;他に良く使うのって何? 11.571 + ))) 11.572 + ((string-match "stylesheet" rel) 11.573 + (concat 11.574 + (yahtml-make-optional-argument "rel" rel) 11.575 + (yahtml-make-optional-argument 11.576 + "type" (yahtml-read-parameter "type" "text/css")) 11.577 + (progn 11.578 + (setq href 11.579 + (read-from-minibuffer "href: " "" yahtml-url-completion-map)) 11.580 + (if (string< "" href) 11.581 + (progn 11.582 + (if (and (file-exists-p (yahtml-url-to-path href)) 11.583 + (y-or-n-p "Load css symbols now? ")) 11.584 + (setq yahtml-css-class-alist 11.585 + (yahtml-css-collect-classes-file 11.586 + (yahtml-url-to-path href) yahtml-css-class-alist))) 11.587 + (message "") 11.588 + (yahtml-make-optional-argument "href" href)))))) 11.589 + (t ;;?? 11.590 + )))) 11.591 + 11.592 ;;; ---------- Simple tag ---------- 11.593 (defun yahtml-insert-tag (region-mode &optional tag) 11.594 "Insert <TAG> </TAG> and put cursor inside of them." 11.595 @@ -933,11 +1165,13 @@ 11.596 "Check if point is on href clause." 11.597 (let ((p (point)) e cmd (case-fold-search t)) 11.598 (save-excursion 11.599 - (and (string= (YaTeX-inner-environment t) "a") 11.600 + (and ;;(string= (YaTeX-inner-environment t) "a") ;aでなくても許可にした 11.601 (save-excursion 11.602 - (search-forward "</a>" nil t) 11.603 + ;;(search-forward "</a>" nil t) ;aでなくても許可にした 11.604 + (search-forward "[\" \t\n]" nil t) 11.605 (setq e (point))) 11.606 - (goto-char (get 'YaTeX-inner-environment 'point)) 11.607 + ;(goto-char (get 'YaTeX-inner-environment 'point)) 11.608 + (re-search-backward "<\\(a\\|link\\)\\>" nil t) 11.609 (search-forward "href" e t) 11.610 (search-forward "=" e t) 11.611 (progn 11.612 @@ -1032,7 +1266,7 @@ 11.613 11.614 (defun yahtml-jump-to-name (name) 11.615 "Jump to html's named tag." 11.616 - (setq name (format "\\(name\\|id\\)\\s *=\\s *\"?%s\"?" name)) 11.617 + (setq name (format "\\(name\\|id\\)\\s *=\\s *\"?%s\\>\"?" name)) 11.618 (or (and (re-search-forward name nil t) (goto-char (match-beginning 0))) 11.619 (and (re-search-backward name nil t) (goto-char (match-beginning 0))) 11.620 (message "Named tag `%s' not found" (substring href 1)))) 11.621 @@ -1270,7 +1504,7 @@ 11.622 (default (append yahtml-env-table yahtml-typeface-table)) 11.623 (user (append yahtml-user-env-table yahtml-user-typeface-table)) 11.624 (tmp (append yahtml-tmp-env-table yahtml-tmp-typeface-table)) 11.625 - href b1 e1) 11.626 + href b1 e1 attr new css) 11.627 (cond 11.628 (tag 11.629 (cond 11.630 @@ -1306,6 +1540,16 @@ 11.631 (delete-region b1 e1) 11.632 (goto-char b1) 11.633 (insert href)))) 11.634 + ((setq attr (yahtml-on-assignment-p)) ;if on the assignment to attr 11.635 + (if (and (equal attr "class") ;treat "class" attribute specially 11.636 + (setq css (assoc tag yahtml-css-class-alist))) 11.637 + (setq new (yahtml-read-parameter ;should be made generic? 11.638 + attr nil (list (cons "class" (cdr css))))) 11.639 + ;;other than "class", read parameter normally 11.640 + (setq new (yahtml-read-parameter attr))) 11.641 + (goto-char (car (get 'yahtml-on-assignment-p 'region))) 11.642 + (delete-region (point) (cdr (get 'yahtml-on-assignment-p 'region))) 11.643 + (insert new)) 11.644 (t 11.645 (save-excursion 11.646 (if (= (aref tag 0) ?/) (setq tag (substring tag 1))) 11.647 @@ -1385,12 +1629,15 @@ 11.648 )) 11.649 11.650 ;;; ---------- commenting ---------- 11.651 +(defvar yahtml-translate-hyphens-when-comment-region t 11.652 + "*Non-nil for translate hyphens to - when comment-region") 11.653 + 11.654 (defun yahtml-comment-region (&optional uncom) 11.655 "Comment out region or environment." 11.656 (interactive) 11.657 - (let (e beg p) 11.658 + (let ((e (make-marker)) beg p) 11.659 (cond 11.660 - ((setq e (yahtml-on-begend-p)) 11.661 + ((marker-position (set-marker e (yahtml-on-begend-p))) 11.662 (save-excursion 11.663 (setq p (point)) 11.664 (if (string-match "^/" e) 11.665 @@ -1401,15 +1648,90 @@ 11.666 (if (string-match "^/" e) 11.667 (beginning-of-line) 11.668 (forward-line 1)) 11.669 - (comment-region beg (point) (if uncom (list 4))))) 11.670 - (t (comment-region (region-beginning) (region-end) 11.671 - (if uncom (list 4))))))) 11.672 + (set-marker e (point)) 11.673 + ;(comment-region beg (point) (if uncom (list 4))) 11.674 + )) 11.675 + (t ;(comment-region (region-beginning) (region-end) (if uncom (list 4))) 11.676 + (setq beg (region-beginning)) 11.677 + (set-marker e (region-end)))) 11.678 + (if yahtml-translate-hyphens-when-comment-region 11.679 + (let ((yahtml-entity-reference-chars-alist-default nil) 11.680 + (yahtml-entity-reference-chars-alist '((?- . "#45"))) 11.681 + yahtml-entity-reference-chars-regexp 11.682 + yahtml-entity-reference-chars-reverse-regexp) 11.683 + (yahtml-entity-reference-chars-setup) 11.684 + (funcall 11.685 + (if uncom 'yahtml-translate-reverse-region 11.686 + 'yahtml-translate-region) 11.687 + beg e))) 11.688 + (comment-region beg e (if uncom (list 4))) 11.689 + (set-marker e nil))) 11.690 11.691 (defun yahtml-uncomment-region () 11.692 (interactive) 11.693 (yahtml-comment-region t)) 11.694 11.695 +;;; ---------- translate to entity references ---------- 11.696 +(defvar yahtml-entity-reference-chars-alist-default 11.697 + ;'((?> . "gt") (?< . "lt") (?& . "amp") (?\" . "quot") (?' . "apos")) 11.698 + '((?> . "gt") (?< . "lt") (?& . "amp") (?\" . "quot")) 11.699 + "Default translation table from character to entity reference") 11.700 +(defvar yahtml-entity-reference-chars-alist nil 11.701 + "*Translation table from character to entity reference") 11.702 +(defvar yahtml-entity-reference-chars-regexp nil) 11.703 +(defvar yahtml-entity-reference-chars-reverse-regexp nil) 11.704 11.705 +(defun yahtml-entity-reference-chars-setup () 11.706 + (let ((list (append yahtml-entity-reference-chars-alist-default 11.707 + yahtml-entity-reference-chars-alist))) 11.708 + (setq yahtml-entity-reference-chars-regexp "[" 11.709 + yahtml-entity-reference-chars-reverse-regexp "&\\(") 11.710 + (while list 11.711 + (setq yahtml-entity-reference-chars-regexp 11.712 + (concat yahtml-entity-reference-chars-regexp 11.713 + (char-to-string (car (car list)))) 11.714 + yahtml-entity-reference-chars-reverse-regexp 11.715 + (concat yahtml-entity-reference-chars-reverse-regexp 11.716 + (cdr (car list)) 11.717 + (if (cdr list) "\\|"))) 11.718 + (setq list (cdr list))) 11.719 + (setq yahtml-entity-reference-chars-regexp 11.720 + (concat yahtml-entity-reference-chars-regexp "]") 11.721 + yahtml-entity-reference-chars-reverse-regexp 11.722 + (concat yahtml-entity-reference-chars-reverse-regexp "\\);")))) 11.723 + 11.724 +(yahtml-entity-reference-chars-setup) 11.725 + 11.726 +(defun yahtml-translate-region (beg end) 11.727 + "Translate inhibited literals." 11.728 + (interactive "r") 11.729 + (save-excursion 11.730 + (save-restriction 11.731 + (narrow-to-region beg end) 11.732 + (let ((ct (append yahtml-entity-reference-chars-alist 11.733 + yahtml-entity-reference-chars-alist-default))) 11.734 + (goto-char beg) 11.735 + (while (re-search-forward yahtml-entity-reference-chars-regexp nil t) 11.736 + ;(setq c (preceding-char)) 11.737 + (replace-match 11.738 + (concat "&" (cdr (assoc (preceding-char) ct)) ";"))))))) 11.739 + 11.740 +(defun yahtml-translate-reverse-region (beg end) 11.741 + "Translate entity references to literals." 11.742 + (interactive "r") 11.743 + (save-excursion 11.744 + (save-restriction 11.745 + (narrow-to-region beg end) 11.746 + (let ((ct (append yahtml-entity-reference-chars-alist 11.747 + yahtml-entity-reference-chars-alist-default)) 11.748 + ec) 11.749 + (goto-char beg) 11.750 + (while (re-search-forward 11.751 + yahtml-entity-reference-chars-reverse-regexp nil t) 11.752 + ;(setq c (preceding-char)) 11.753 + (setq ec (YaTeX-match-string 1)) 11.754 + (delete-region (match-end 0) (match-beginning 0)) 11.755 + (insert (car (YaTeX-rassoc ec ct)))))))) 11.756 11.757 (defun yahtml-inner-environment-but (exclude &optional quick) 11.758 "Return the inner environment but matches with EXCLUDE tag." 11.759 @@ -1421,7 +1743,6 @@ 11.760 e)) 11.761 11.762 ;;; ---------- filling ---------- 11.763 - 11.764 (defvar yahtml-saved-move-to-column (symbol-function 'move-to-column)) 11.765 (defun yahtml-move-to-column (col &optional force) 11.766 (beginning-of-line) 11.767 @@ -1444,7 +1765,11 @@ 11.768 (setq ccol (+ ccol wd)))) 11.769 (setq ccol (1+ ccol))) 11.770 (if (and YaTeX-japan 11.771 - (string-match "[chj]" (char-category (preceding-char)))) 11.772 + (or 11.773 + (and (fboundp 'char-category) 11.774 + (string-match "[chj]" (char-category (preceding-char)))) 11.775 + (and (fboundp 'char-charset) 11.776 + (not (eq (char-charset (preceding-char)) 'ascii))))) 11.777 (setq ccol (1+ ccol))))) 11.778 (if (and force (> col ccol)) 11.779 (progn 11.780 @@ -1462,7 +1787,7 @@ 11.781 (ps1 (if prep (default-value 'paragraph-start) 11.782 paragraph-start)) 11.783 (ps2 (if prep (concat (default-value 'paragraph-start) 11.784 - "\\|^\\s *</?pre>") 11.785 + "$\\|^\\s *</?pre>") 11.786 paragraph-start))) 11.787 (save-excursion 11.788 (unwind-protect 11.789 @@ -1488,9 +1813,7 @@ 11.790 (point))) 11.791 (progn (goto-char p) 11.792 (re-search-forward ps2 nil t) 11.793 - (match-beginning 0) 11.794 - 11.795 - ))) 11.796 + (match-beginning 0)))) 11.797 (fset 'move-to-column yahtml-saved-move-to-column))))) 11.798 11.799 ;(defun yahtml-indent-new-commnet-line () 11.800 @@ -1797,14 +2120,15 @@ 11.801 (defun yahtml-complete-mark () 11.802 "Complete >, <, &ersand, and "e." 11.803 (interactive) 11.804 - (message "1:< 2:> 3:& 4:\"") 11.805 + (message "1:< 2:> 3:& 4:\" 5:' 6:nbsp") 11.806 (let ((c (read-char))) 11.807 - (setq c (if (or (< c ?0) (> c ?5)) 11.808 + (setq c (if (or (< c ?0) (> c ?7)) 11.809 (string-match (regexp-quote (char-to-string c)) "<>&\"") 11.810 (- c ?1))) 11.811 - (if (or (< c 0) (> c 4)) 11.812 + (if (or (< c 0) (> c 6)) 11.813 nil 11.814 - (insert (format "&%s;" (nth c '("lt" "gt" "amp" "quot"))))))) 11.815 + (insert (format "&%s;" 11.816 + (nth c '("lt" "gt" "amp" "quot" "apos" "nbsp"))))))) 11.817 11.818 11.819 ;;; ---------- jump to error line ---------- 11.820 @@ -1831,7 +2155,77 @@ 11.821 (YaTeX-showup-buffer (YaTeX-switch-to-buffer f t) nil t) 11.822 (goto-line l)) 11.823 (message "No line number usage")))) 11.824 - 11.825 + 11.826 +;;; ---------- Style Sheet Support ---------- 11.827 +(defvar yahtml-css-class-alist nil 11.828 + "Alist of elements vs. their classes") 11.829 + 11.830 +(defun yahtml-css-collect-classes-region (beg end &optional initial) 11.831 + (save-restriction 11.832 + (save-excursion 11.833 + (narrow-to-region beg end) 11.834 + (goto-char (point-min)) 11.835 + (let ((alist initial) b e element class a 11.836 + (s1 (aref (syntax-table) ?\{ )) 11.837 + (s2 (aref (syntax-table) ?\} ))) 11.838 + ;(modify-syntax-entry ?{ "(}") 11.839 + ;(modify-syntax-entry ?} "){") 11.840 + (setq b (point)) 11.841 + (unwind-protect 11.842 + (while (search-forward "{" nil t) 11.843 + (setq e (point)) 11.844 + (goto-char b) 11.845 + (while (re-search-forward ;ちょといい加減なREGEXP 11.846 + "\\([a-z][a-z0-9]*\\)\\.\\([a-z][a-z0-9]*\\)\\>" e t) 11.847 + (setq element (YaTeX-match-string 1) 11.848 + class (YaTeX-match-string 2)) 11.849 + (if (setq a (assoc element alist)) 11.850 + (or (assoc class (cdr a)) 11.851 + (setcdr a (cons (list class) (cdr a)))) 11.852 + (setq alist (cons (list element (list class)) alist)))) 11.853 + (goto-char (1- e)) 11.854 + ;(forward-list 1) 11.855 + (search-forward "}" nil t) 11.856 + (setq b (point))) 11.857 + (aset (syntax-table) ?\{ s1) 11.858 + (aset (syntax-table) ?} s2)) 11.859 + alist)))) 11.860 + 11.861 +(defun yahtml-css-collect-classes-buffer (&optional initial) 11.862 + (interactive) 11.863 + (yahtml-css-collect-classes-region (point-min) (point-max) initial)) 11.864 + 11.865 +(defun yahtml-css-collect-classes-file (file &optional initial) 11.866 + (let ((hilit-auto-highlight nil) (cb (current-buffer))) 11.867 + (set-buffer (find-file-noselect file)) 11.868 + (prog1 11.869 + (yahtml-css-collect-classes-buffer initial) 11.870 + (set-buffer cb)))) 11.871 + 11.872 +(defun yahtml-css-scan-styles () 11.873 + (save-excursion 11.874 + (goto-char (point-min)) 11.875 + (set (make-local-variable 'yahtml-css-class-alist) nil) 11.876 + (while (re-search-forward "<\\(style\\|link\\)" nil t) 11.877 + (let ((b (match-beginning 0))(tag (YaTeX-match-string 1)) e href alist) 11.878 + (cond 11.879 + ((string-match "style" tag) 11.880 + (goto-char b) 11.881 + (save-excursion (forward-list 1) (setq e (point))) 11.882 + (cond 11.883 + ((search-forward "text/css" e 1) ;css definition starts 11.884 + (setq alist 11.885 + (yahtml-css-collect-classes-region 11.886 + (point) (progn (search-forward "</style>") (point)) 11.887 + alist))))) 11.888 + ((and (string-match "link" tag) 11.889 + (setq href (yahtml-get-attrvalue "href")) 11.890 + (file-exists-p (yahtml-url-to-path href))) 11.891 + (setq alist 11.892 + (yahtml-css-collect-classes-file 11.893 + (yahtml-url-to-path href) alist)))) 11.894 + (setq yahtml-css-class-alist alist))))) 11.895 + 11.896 ;;; ---------- ---------- 11.897 11.898 ;;; 11.899 @@ -1846,7 +2240,7 @@ 11.900 ;; comments 11.901 ("<!--\\s " "-->" comment) 11.902 ;; include&exec 11.903 - ("<!--#\\(include\\|exec\\)" "-->" include) 11.904 + ("<!--#\\(include\\|exec\\|config\\|fsize\\|flastmod\\)" "-->" include) 11.905 ;; string 11.906 (hilit-string-find ?\\ string) 11.907 (yahtml-hilit-region-tag "\\(em\\|strong\\)" bold)
12.1 --- a/yatex.el Mon Oct 26 12:05:32 1998 +0000 12.2 +++ b/yatex.el Thu Jul 15 04:58:26 1999 +0000 12.3 @@ -1,9 +1,11 @@ 12.4 ;;; -*- Emacs-Lisp -*- 12.5 -;;; Yet Another tex-mode for emacs. 12.6 -;;; yatex.el rev. 1.66 12.7 -;;; (c )1991-1998 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 12.8 -;;; Last modified Mon Oct 26 21:05:14 1998 on firestorm 12.9 +;;; Yet Another tex-mode for emacs - //野鳥// 12.10 +;;; yatex.el rev. 1.67 12.11 +;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@gentei.org] 12.12 +;;; Last modified Tue Jul 13 14:20:45 1999 on firestorm 12.13 ;;; $Id$ 12.14 +;;; The latest version of this software is always available at; 12.15 +;;; http://www.yatex.org/ 12.16 12.17 ;; This program is free software; you can redistribute it and/or modify 12.18 ;; it under the terms of the GNU General Public License as published by 12.19 @@ -22,35 +24,35 @@ 12.20 12.21 (require 'comment) 12.22 (require 'yatexlib) 12.23 -(defconst YaTeX-revision-number "1.66" 12.24 - "Revision number of running yatex.el" 12.25 -) 12.26 +(defconst YaTeX-revision-number "1.67" 12.27 + "Revision number of running yatex.el") 12.28 + 12.29 ;---------- Local variables ---------- 12.30 (defvar YaTeX-prefix "\C-c" 12.31 "*Prefix key to call YaTeX functions. 12.32 -You can select favorite prefix key by setq in your ~/.emacs." 12.33 -) 12.34 +You can select favorite prefix key by setq in your ~/.emacs.") 12.35 + 12.36 (defvar YaTeX-environment-indent 1 12.37 - "*Indentation depth at column width in LaTeX environments." 12.38 -) 12.39 + "*Indentation depth at column width in LaTeX environments.") 12.40 + 12.41 (defvar YaTeX-fill-prefix nil 12.42 "*fill-prefix used for auto-fill-mode. 12.43 -The default value is nil." 12.44 -) 12.45 +The default value is nil.") 12.46 + 12.47 (defvar YaTeX-fill-column 72 12.48 - "*fill-column used for auto-fill-mode." 12.49 -) 12.50 + "*fill-column used for auto-fill-mode.") 12.51 + 12.52 (defvar YaTeX-comment-prefix "%" 12.53 - "TeX comment prefix." 12.54 -) 12.55 + "TeX comment prefix.") 12.56 + 12.57 (defvar YaTeX-current-position-register ?3 12.58 "*Position register to keep where the last completion was done. 12.59 All of YaTeX completing input store the current position into 12.60 the register YaTeX-current-position-register. So every time you 12.61 make a trip to any other part of text other than you are writing, you can 12.62 return to the editing paragraph by calling register-to-point with argument 12.63 -YaTeX-current-position-register." 12.64 -) 12.65 +YaTeX-current-position-register.") 12.66 + 12.67 ;;(defvar YaTeX-tmp-dic-unit 'main-file 12.68 ;; "*Default switching unit of temporary dictionary. 12.69 ;;There are two switching unit: 12.70 @@ -58,20 +60,20 @@ 12.71 ;;'directory : switch tmp-dic dir by dir." 12.72 ;;) 12.73 (defvar tex-command (if YaTeX-japan "jlatex" "latex") 12.74 - "*Default command for typesetting LaTeX text." 12.75 -) 12.76 + "*Default command for typesetting LaTeX text.") 12.77 + 12.78 (defvar bibtex-command (if YaTeX-japan "jbibtex" "bibtex") 12.79 - "*Default command of BibTeX." 12.80 -) 12.81 + "*Default command of BibTeX.") 12.82 + 12.83 (defvar dvi2-command ;previewer command for your site 12.84 (if YaTeX-dos "dviout -wait=0" 12.85 "xdvi -geo +0+0 -s 4") 12.86 "*Default previewer command including its option. 12.87 -This default value is for X window system." 12.88 -) 12.89 +This default value is for X window system.") 12.90 + 12.91 (defvar makeindex-command (if YaTeX-dos "makeind" "makeindex") 12.92 - "*Default makeindex command." 12.93 -) 12.94 + "*Default makeindex command.") 12.95 + 12.96 (defvar dviprint-command-format 12.97 (if YaTeX-dos "dviprt %s %f%t" 12.98 "dvi2ps %f %t %s | lpr") 12.99 @@ -79,31 +81,31 @@ 12.100 Format string %s will be replaced by the filename. Do not forget to 12.101 specify the `from usage' and `to usage' with their option by format string 12.102 %f and %t. 12.103 - See also documentation of dviprint-from-format and dviprint-to-format." 12.104 -) 12.105 + See also documentation of dviprint-from-format and dviprint-to-format.") 12.106 + 12.107 (defvar dviprint-from-format 12.108 (if YaTeX-dos "%b-" "-f %b") 12.109 - "*`From' page format of dvi filter. %b will turn to beginning page number." 12.110 -) 12.111 + "*`From' page format of dvi filter. %b will turn to beginning page number.") 12.112 + 12.113 (defvar dviprint-to-format 12.114 (if YaTeX-dos "%e" "-t %e") 12.115 - "*`To' page format of dvi filter. %e will turn to end page number." 12.116 -) 12.117 + "*`To' page format of dvi filter. %e will turn to end page number.") 12.118 + 12.119 (defvar YaTeX-default-document-style 12.120 (concat (if YaTeX-japan "j") "article") 12.121 - "*Default LaTeX Documentstyle for YaTeX-typeset-region." 12.122 -) 12.123 + "*Default LaTeX Documentstyle for YaTeX-typeset-region.") 12.124 + 12.125 (defvar YaTeX-need-nonstop nil 12.126 - "*T for adding `\\nonstopmode{}' to text before invoking latex command." 12.127 -) 12.128 + "*T for adding `\\nonstopmode{}' to text before invoking latex command.") 12.129 + 12.130 (defvar latex-warning-regexp "line.* [0-9]*" 12.131 - "*Regular expression of line number of warning message by latex command." 12.132 -) 12.133 + "*Regular expression of line number of warning message by latex command.") 12.134 + 12.135 (defvar latex-error-regexp "l\\.[1-9][0-9]*" 12.136 "*Regular expression of line number of latex error. 12.137 Perhaps your latex command stops at this error message with line number of 12.138 -LaTeX source text." 12.139 -) 12.140 +LaTeX source text.") 12.141 + 12.142 (defvar latex-dos-emergency-message 12.143 "Emergency stop" ;<- for Micro tex, ASCII-pTeX 1.6 12.144 "Message pattern of emergency stop of typesetting. 12.145 @@ -113,12 +115,12 @@ 12.146 other process, user or OS. Define to this variable a message string of your 12.147 latex command on DOS shown at abnormal termination. 12.148 Remember Demacs's call-process function is not oriented for interactive 12.149 -process." 12.150 -) 12.151 +process.") 12.152 + 12.153 (defvar latex-message-kanji-code 2 12.154 "*Kanji coding system latex command types out. 12.155 -1 = Shift JIS, 2 = JIS, 3 = EUC." 12.156 -) 12.157 +1 = Shift JIS, 2 = JIS, 3 = EUC.") 12.158 + 12.159 (defvar NTT-jTeX nil 12.160 "*T for using NTT-jTeX for latex command. 12.161 More precisely, setting t to this variables inhibits inter-word break on 12.162 @@ -126,16 +128,16 @@ 12.163 put % after each line at filling. 12.164 改行+インデントによって、タイプセット後の字間が空いてしまうのを抑制する場合に 12.165 tにする(古いNTT-jTeXで顕著に現れる)。具体的には、fillするときに各行の終わりに 12.166 -%を付加する。" 12.167 -) 12.168 +%を付加する。") 12.169 + 12.170 (defvar YaTeX-item-regexp 12.171 (concat (regexp-quote "\\") "\\(sub\\|bib\\)*item") 12.172 - "*Regular expression of item command." 12.173 -) 12.174 + "*Regular expression of item command.") 12.175 + 12.176 (defvar YaTeX-sectioning-regexp 12.177 - "part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\(\\*?\\|\\b\\)" 12.178 - "*LaTeX sectioning commands regexp." 12.179 -) 12.180 + "\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\)\\(\\*\\|\\b\\)" 12.181 + "*LaTeX sectioning commands regexp.") 12.182 + 12.183 (defvar YaTeX-paragraph-start 12.184 (concat "^[ \t]*%\\|^[ \t]*$\\|\\'\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\(" 12.185 YaTeX-sectioning-regexp ;sectioning commands 12.186 @@ -143,8 +145,8 @@ 12.187 "\\|newpage\\b\\|vspace\\b" 12.188 "\\)") 12.189 "*Paragraph starting regexp of common LaTeX source. Use this value 12.190 -for YaTeX-uncomment-paragraph." 12.191 -) 12.192 +for YaTeX-uncomment-paragraph.") 12.193 + 12.194 (defvar YaTeX-paragraph-separate 12.195 (concat "^[ \t]*%\\|^[ \t]*$\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\(" 12.196 YaTeX-sectioning-regexp ;sectioning commands 12.197 @@ -153,8 +155,8 @@ 12.198 "\\|newpage\\b\\|vspace\\b" 12.199 "\\)") 12.200 "*Paragraph delimiter regexp of common LaTeX source. Use this value 12.201 -for YaTeX-uncomment-paragraph." 12.202 -) 12.203 +for YaTeX-uncomment-paragraph.") 12.204 + 12.205 (defvar YaTeX-verbatim-environments 12.206 '("verbatim" "verbatim*") 12.207 "*Assume these environments of this variable disable LaTeX commands.") 12.208 @@ -162,11 +164,11 @@ 12.209 "*Regexp of verb family. Do not contain preceding \\\\ nor \\(\\).") 12.210 (defvar YaTeX-fill-inhibit-environments 12.211 (append '("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" 12.212 - "equation" "math" "displaymath") 12.213 + "equation" "equation*" "math" "displaymath") 12.214 YaTeX-verbatim-environments) 12.215 "*In these environments, YaTeX inhibits fill-paragraph from formatting. 12.216 -Define those environments as a form of list." 12.217 -) 12.218 +Define those environments as a form of list.") 12.219 + 12.220 (defvar YaTeX-itemizing-env-regexp 12.221 "itemize\\|enumerate\\|description\\|list\\|thebibliography" 12.222 "*Regexp of itemizing environments") 12.223 @@ -176,51 +178,52 @@ 12.224 (defvar YaTeX-array-env-regexp 12.225 (concat 12.226 "array\\*?\\|eqnarray\\*?\\|tabbing\\|tabular\\*?\\|" ;LaTeX 12.227 + "matrix\\|pmatrix\\|bmatrix\\|vmatrix\\|Vmatrix\\|" ;AMS-LaTeX 12.228 "align\\*?\\|split\\*?\\|aligned\\*?\\|alignat\\*?\\|" ;AMS-LaTeX 12.229 "[bpvV]?matrix\\|smallmatrix\\|cases\\|" ;AMS-LaTeX 12.230 "xalignat\\*?\\|xxalignat\\*?") ;AMS-LaTeX 12.231 "*Regexp of environments where `&' becomes field delimiter.") 12.232 (defvar YaTeX-uncomment-once t 12.233 "*T for removing all continuous commenting character(%). 12.234 -Nil for removing only one commenting character at the beginning-of-line." 12.235 -) 12.236 +Nil for removing only one commenting character at the beginning-of-line.") 12.237 + 12.238 (defvar YaTeX-close-paren-always t 12.239 - "Close parenthesis always when YaTeX-modify-mode is nil." 12.240 -) 12.241 + "*Close parenthesis always when YaTeX-modify-mode is nil.") 12.242 + 12.243 (defvar YaTeX-greek-by-maketitle-completion nil 12.244 - "*T for greek letters completion by maketitle-type completion." 12.245 -) 12.246 + "*T for greek letters completion by maketitle-type completion.") 12.247 + 12.248 (defvar YaTeX-auto-math-mode t 12.249 "*T for changing YaTeX-math mode automatically.") 12.250 (defvar YaTeX-use-AMS-LaTeX nil 12.251 - "*T for using AMS-LaTeX" 12.252 -) 12.253 + "*T for using AMS-LaTeX") 12.254 + 12.255 (defvar yatex-mode-hook nil 12.256 - "*List of functions to be called at the end of yatex-mode initializations." 12.257 -) 12.258 + "*List of functions to be called at the end of yatex-mode initializations.") 12.259 + 12.260 ;;-- Math mode values -- 12.261 12.262 (defvar YaTeX-math-key-list-default 12.263 '((";" . YaTeX-math-sign-alist) 12.264 (":" . YaTeX-greek-key-alist)) 12.265 - "Default key sequence to invoke math-mode's image completion." 12.266 -) 12.267 + "Default key sequence to invoke math-mode's image completion.") 12.268 + 12.269 (defvar YaTeX-math-key-list-private nil 12.270 - "*User defined alist, math-mode-prefix vs completion alist." 12.271 -) 12.272 + "*User defined alist, math-mode-prefix vs completion alist.") 12.273 + 12.274 (defvar YaTeX-math-key-list 12.275 (append YaTeX-math-key-list-private YaTeX-math-key-list-default) 12.276 - "Key sequence to invoke math-mode's image completion." 12.277 -) 12.278 + "Key sequence to invoke math-mode's image completion.") 12.279 + 12.280 (defvar YaTeX-skip-default-reader nil 12.281 - "Non-nil skips default argument reader of section-type completion." 12.282 -) 12.283 + "Non-nil skips default argument reader of section-type completion.") 12.284 + 12.285 (defvar YaTeX-simple-messages nil 12.286 - "Non-nil makes minibuffer messages simpler." 12.287 -) 12.288 + "Non-nil makes minibuffer messages simpler.") 12.289 + 12.290 (defvar YaTeX-template-file "~/work/template.tex" 12.291 - "*Template TeX source file. This will be inserted to empty file." 12.292 -) 12.293 + "*Template TeX source file. This will be inserted to empty file.") 12.294 + 12.295 (defvar YaTeX-addin-prefix "YaTeX:") 12.296 ;------------ Completion table ------------ 12.297 ; Set tex-section-like command possible completion 12.298 @@ -245,8 +248,8 @@ 12.299 ;; section types in mathmode 12.300 ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") 12.301 ) 12.302 - "Default completion table for section-type completion." 12.303 -) 12.304 + "Default completion table for section-type completion.") 12.305 + 12.306 (defvar user-section-table nil) 12.307 (defvar tmp-section-table nil) 12.308 12.309 @@ -260,8 +263,8 @@ 12.310 ("thebibliography") ("theindex") ("flushleft") ("flushright") 12.311 ("minipage") 12.312 ) 12.313 - "Default completion table for begin-type completion." 12.314 -) 12.315 + "Default completion table for begin-type completion.") 12.316 + 12.317 (defvar user-env-table nil) 12.318 (defvar tmp-env-table nil) 12.319 12.320 @@ -272,8 +275,8 @@ 12.321 ("tiny") ("scriptsize") ("footnotesize") ("small")("normalsize") 12.322 ("large") ("Large") ("LARGE") ("huge") ("Huge") 12.323 ) 12.324 - "Default completion table for large-type completion." 12.325 -) 12.326 + "Default completion table for large-type completion.") 12.327 + 12.328 (defvar user-fontsize-table nil) 12.329 (defvar tmp-fontsize-table nil) 12.330 12.331 @@ -296,8 +299,8 @@ 12.332 ("upsilon") ("phi") ("varphi") ("chi") ("psi") ("omega") 12.333 ("Gamma") ("Delta") ("Theta") ("Lambda")("Xi") ("Pi") 12.334 ("Sigma") ("Upsilon") ("Phi") ("Psi") ("Omega")))) 12.335 - "Default completion table for maketitle-type completion." 12.336 -) 12.337 + "Default completion table for maketitle-type completion.") 12.338 + 12.339 (defvar user-singlecmd-table nil) 12.340 (defvar tmp-singlecmd-table nil) 12.341 12.342 @@ -307,24 +310,23 @@ 12.343 ;; Do not change this section. 12.344 ;;; 12.345 (defvar YaTeX-mode-map nil 12.346 - "Keymap used in YaTeX mode" 12.347 -) 12.348 + "Keymap used in YaTeX mode") 12.349 + 12.350 (defvar YaTeX-prefix-map nil 12.351 - "Keymap used when YaTeX-prefix key pushed" 12.352 -) 12.353 + "Keymap used when YaTeX-prefix key pushed") 12.354 + 12.355 (defvar YaTeX-user-extensional-map (make-sparse-keymap) 12.356 "*Keymap used for the user's customization") 12.357 (defvar YaTeX-current-completion-type nil 12.358 - "Has current completion type. This may be used in YaTeX addin functions." 12.359 -) 12.360 + "Has current completion type. This may be used in YaTeX addin functions.") 12.361 + 12.362 (defvar YaTeX-modify-mode nil 12.363 "*Current editing mode. 12.364 When non-nil, each opening parentheses only opens, 12.365 -nil enters both open/close parentheses when opening parentheses key pressed." 12.366 -) 12.367 +nil enters both open/close parentheses when opening parentheses key pressed.") 12.368 + 12.369 (defvar YaTeX-math-mode nil 12.370 - "Holds whether current mode is math-mode." 12.371 -) 12.372 + "Holds whether current mode is math-mode.") 12.373 ;;; 12.374 ;; Define key table 12.375 ;;; 12.376 @@ -336,6 +338,7 @@ 12.377 (define-key YaTeX-mode-map "{" 'YaTeX-insert-braces) 12.378 (define-key YaTeX-mode-map "(" 'YaTeX-insert-parens) 12.379 (define-key YaTeX-mode-map "$" 'YaTeX-insert-dollar) 12.380 + (define-key YaTeX-mode-map "|" 'YaTeX-insert-bar) 12.381 (define-key YaTeX-mode-map "&" 'YaTeX-insert-amper) 12.382 (define-key YaTeX-mode-map "[" 'YaTeX-insert-brackets) 12.383 (define-key YaTeX-mode-map YaTeX-prefix YaTeX-prefix-map) 12.384 @@ -419,8 +422,7 @@ 12.385 (function 12.386 (lambda (key) 12.387 (define-key YaTeX-mode-map (car key) 'YaTeX-math-insert-sequence))) 12.388 - YaTeX-math-key-list) 12.389 -) 12.390 + YaTeX-math-key-list)) 12.391 12.392 (defvar YaTeX-section-completion-map nil 12.393 "*Key map used at YaTeX completion in the minibuffer.") 12.394 @@ -448,8 +450,8 @@ 12.395 (defvar fontsize-name "large" "*Initial fontsize completion") 12.396 (defvar single-command "maketitle" "*Initial LaTeX single command") 12.397 (defvar YaTeX-kanji-code (if YaTeX-dos 1 2) 12.398 - "*File kanji code used by Japanese TeX." 12.399 -) 12.400 + "*File kanji code used by Japanese TeX.") 12.401 + 12.402 (defvar YaTeX-coding-system nil "File coding system used by Japanese TeX.") 12.403 (cond 12.404 (YaTeX-emacs-20 12.405 @@ -469,8 +471,7 @@ 12.406 (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table))) 12.407 (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table) 12.408 (modify-syntax-entry ?\{ "(}" YaTeX-mode-syntax-table) 12.409 - (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table) 12.410 -) 12.411 + (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table)) 12.412 12.413 ;---------- Provide YaTeX-mode ---------- 12.414 ;;; 12.415 @@ -549,19 +550,11 @@ 12.416 )) 12.417 (cond ((boundp 'MULE) 12.418 (set-file-coding-system YaTeX-coding-system)) 12.419 - ((and YaTeX-emacs-20 (fboundp 'coding-system-equal)) 12.420 - (let ((mp (buffer-modified-p)) 12.421 - (ud (memq 12.422 - buffer-file-coding-system 12.423 - '(undecided undecided-unix undecided-dos undecided-mac)))) 12.424 - (if (coding-system-equal 12.425 - YaTeX-coding-system buffer-file-coding-system) 12.426 - nil ; if coding-system is the same, do nothing 12.427 - (set-buffer-file-coding-system YaTeX-coding-system) 12.428 - (if ud (set-buffer-modified-p mp))))) 12.429 + ((and YaTeX-emacs-20 (boundp 'buffer-file-coding-system)) 12.430 + (setq buffer-file-coding-system YaTeX-coding-system)) 12.431 ((featurep 'mule) 12.432 (set-file-coding-system YaTeX-coding-system)) 12.433 - ((boundp 'NEMACS) 12.434 + ((boundp 'NEMACS) 12.435 (make-local-variable 'kanji-fileio-code) 12.436 (setq kanji-fileio-code YaTeX-kanji-code))) 12.437 (setq fill-column YaTeX-fill-column 12.438 @@ -582,8 +575,7 @@ 12.439 (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file) 12.440 (y-or-n-p (format "Insert %s?" YaTeX-template-file)) 12.441 (insert-file-contents (expand-file-name YaTeX-template-file))) 12.442 - (run-hooks 'text-mode-hook 'yatex-mode-hook) 12.443 -) 12.444 + (run-hooks 'text-mode-hook 'yatex-mode-hook)) 12.445 12.446 ;---------- Define YaTeX-mode functions ---------- 12.447 (defvar YaTeX-ec "\\" "Escape character of current mark-up language.") 12.448 @@ -625,6 +617,12 @@ 12.449 (autoload 'YaTeX-in-math-mode-p "yatexmth" "Check if in math-env." t) 12.450 (autoload 'YaTeX-toggle-math-mode "yatexmth" "YaTeX math-mode interfaces." t) 12.451 (autoload 'YaTeX-math-member-p "yatexmth" "Check if a word is math command." t) 12.452 +(autoload 'YaTeX-insert-amsparens-region "yatexmth" "AMS parens region" t) 12.453 +(autoload 'YaTeX-insert-amsbraces-region "yatexmth" "AMS braces region" t) 12.454 +(autoload 'YaTeX-insert-amsbrackets-region "yatexmth" "AMS brackets region" t) 12.455 +(autoload 'YaTeX-on-parenthesis-p "yatexmth" "Check if on math-parens" t) 12.456 +(autoload 'YaTeX-goto-open-paren "yatexmth" "Goto opening paren" t) 12.457 +(autoload 'YaTeX-change-parentheses "yatexmth" "Change corresponding parens" t) 12.458 12.459 ;;autoload from yatexhlp.el 12.460 (autoload 'YaTeX-help "yatexhlp" "YaTeX helper with LaTeX commands." t) 12.461 @@ -635,6 +633,7 @@ 12.462 (autoload 'YaTeX-generate-simple "yatexgen" "YaTeX add-in support." t) 12.463 12.464 ;;autoload from yatexsec.el 12.465 +(autoload 'YaTeX-section-overview "yatexsec" "YaTeX sectioning(view)" t) 12.466 (autoload 'YaTeX-read-section-in-minibuffer "yatexsec" "YaTeX sectioning" t) 12.467 (autoload 'YaTeX-make-section-with-overview "yatexsec" "YaTeX sectioning" t) 12.468 12.469 @@ -704,8 +703,7 @@ 12.470 (YaTeX-intelligent-newline nil) 12.471 (YaTeX-indent-line)) 12.472 (if YaTeX-current-position-register 12.473 - (point-to-register YaTeX-current-position-register))) 12.474 -) 12.475 + (point-to-register YaTeX-current-position-register)))) 12.476 12.477 (defun YaTeX-make-begin-end (arg) 12.478 "Make LaTeX environment command of \\begin{env.} ... \\end{env.} 12.479 @@ -724,14 +722,12 @@ 12.480 (setq env-name env) 12.481 (YaTeX-update-table 12.482 (list env-name) 'env-table 'user-env-table 'tmp-env-table) 12.483 - (YaTeX-insert-begin-end env-name arg)) 12.484 -) 12.485 + (YaTeX-insert-begin-end env-name arg))) 12.486 12.487 (defun YaTeX-make-begin-end-region () 12.488 "Call YaTeX-make-begin-end with ARG to specify region mode." 12.489 (interactive) 12.490 - (YaTeX-make-begin-end t) 12.491 -) 12.492 + (YaTeX-make-begin-end t)) 12.493 12.494 (defun YaTeX-make-section (arg &optional beg end cmd) 12.495 "Make LaTeX \\section{} type command with completing read. 12.496 @@ -813,14 +809,12 @@ 12.497 (forward-char -1)) 12.498 (while (string= (buffer-substring (- (point) 3) (1- (point))) "{}") 12.499 (forward-char -2))) 12.500 - (if (<= (minibuffer-depth) 0) (use-global-map global-map))) 12.501 -) 12.502 + (if (<= (minibuffer-depth) 0) (use-global-map global-map)))) 12.503 12.504 (defun YaTeX-make-section-region (args beg end) 12.505 "Call YaTeX-make-section with arguments to specify region mode." 12.506 (interactive "P\nr") 12.507 - (YaTeX-make-section args beg end) 12.508 -) 12.509 + (YaTeX-make-section args beg end)) 12.510 12.511 (defun YaTeX-make-fontsize (arg &optional fontsize) 12.512 "Make completion like {\\large ...} or {\\slant ...} in minibuffer. 12.513 @@ -856,14 +850,12 @@ 12.514 (if YaTeX-current-position-register 12.515 (point-to-register YaTeX-current-position-register)) 12.516 (save-excursion 12.517 - (insert (YaTeX-addin fontsize-name) "}")))) 12.518 -) 12.519 + (insert (YaTeX-addin fontsize-name) "}"))))) 12.520 12.521 (defun YaTeX-make-fontsize-region () 12.522 "Call function:YaTeX-make-fontsize with ARG to specify region mode." 12.523 (interactive) 12.524 - (YaTeX-make-fontsize t) 12.525 -) 12.526 + (YaTeX-make-fontsize t)) 12.527 12.528 (defvar YaTeX-singlecmd-suffix "" "*Suffix for maketitle-type commands.") 12.529 (defvar YaTeX-read-singlecmd-history nil "Holds maketitle-type history.") 12.530 @@ -895,8 +887,7 @@ 12.531 (forward-char -2) 12.532 (if (looking-at "\\[\\]") (forward-char 1) (goto-char q))) 12.533 (if YaTeX-current-position-register 12.534 - (point-to-register YaTeX-current-position-register)) 12.535 -) 12.536 + (point-to-register YaTeX-current-position-register))) 12.537 12.538 (defvar YaTeX-completion-begin-regexp "[{\\]" 12.539 "Regular expression of limit where LaTeX command's completion begins.") 12.540 @@ -957,8 +948,7 @@ 12.541 (message "Making completion list...") 12.542 (with-output-to-temp-buffer "*Help*" 12.543 (display-completion-list 12.544 - (all-completions pattern all-table)))))))))) 12.545 -) 12.546 + (all-completions pattern all-table))))))))))) 12.547 12.548 (defun YaTeX-toggle-modify-mode (&optional arg) 12.549 (interactive "P") 12.550 @@ -971,8 +961,7 @@ 12.551 (message "Modify mode")) 12.552 (setq YaTeX-modify-mode nil) 12.553 (message "Cancel modify mode.")) 12.554 - (set-buffer-modified-p (buffer-modified-p)) ;redraw mode-line 12.555 -) 12.556 + (set-buffer-modified-p (buffer-modified-p))) ;redraw mode-line 12.557 12.558 (defun YaTeX-switch-mode-menu (arg &optional char) 12.559 (interactive "P") 12.560 @@ -983,8 +972,7 @@ 12.561 ((or (= c ?$) (= c ?t)) 12.562 (if YaTeX-auto-math-mode 12.563 (message "Makes no sense in YaTeX-auto-math-mode.") 12.564 - (YaTeX-toggle-math-mode arg))))) 12.565 -) 12.566 + (YaTeX-toggle-math-mode arg)))))) 12.567 12.568 (defun YaTeX-insert-quote () 12.569 (interactive) 12.570 @@ -1001,8 +989,7 @@ 12.571 (regexp-quote (char-to-string (preceding-char))) 12.572 "、。,.?!「」『』【】()")) 12.573 "``") 12.574 - (t "''"))) 12.575 -) 12.576 + (t "''")))) 12.577 12.578 (defun YaTeX-closable-p () 12.579 (and (not YaTeX-modify-mode) 12.580 @@ -1014,7 +1001,7 @@ 12.581 ;; (and (not YaTeX-close-paren-always) (not (eolp))) 12.582 ;; (input-pending-p) 12.583 ;; (YaTeX-quick-in-environment-p "verbatim")) 12.584 -) 12.585 + ) 12.586 12.587 (defun YaTeX-insert-braces-region (beg end &optional open close) 12.588 (interactive "r") 12.589 @@ -1022,8 +1009,7 @@ 12.590 (goto-char end) 12.591 (insert (or close "}")) 12.592 (goto-char beg) 12.593 - (insert (or open "{"))) 12.594 -) 12.595 + (insert (or open "{")))) 12.596 12.597 (defun YaTeX-insert-braces (arg &optional open close) 12.598 (interactive "p") 12.599 @@ -1037,6 +1023,24 @@ 12.600 (looking-at "\\\\left\\\\")) 12.601 (insert "{\\right\\}") 12.602 (forward-char -8)) 12.603 + ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 12.604 + (and (> (- (point) (point-min)) 6) (forward-char -6)) 12.605 + (looking-at "\\\\[bB]igl\\\\")) 12.606 + (insert 12.607 + (concat 12.608 + "{" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\}")) 12.609 + (forward-char -7)) 12.610 + ((save-excursion 12.611 + (and (> (- (point) (point-min)) 7) 12.612 + (condition-case () (forward-char -7) (error nil))) 12.613 + (looking-at "\\\\[bB]iggl\\\\")) 12.614 + (insert 12.615 + (concat 12.616 + "{" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\}")) 12.617 + (forward-char -8)) 12.618 + ((= (preceding-char) ?\\ ) 12.619 + (insert "{\\}") 12.620 + (forward-char -2)) ;matsu's hack ends here 12.621 ((and (> (point) (+ (point-min) 4)) 12.622 (save-excursion (backward-char 4) (looking-at "\\\\end")) 12.623 (not (YaTeX-literal-p)) 12.624 @@ -1057,13 +1061,11 @@ 12.625 (if (and (eq (char-after (point)) ?\}) 12.626 (eq (char-after (- (point) 2)) ?\\ )) 12.627 (progn (insert "\\") (forward-char -1))) 12.628 - ))) 12.629 -) 12.630 + )))) 12.631 12.632 (defun YaTeX-jmode () 12.633 (or (and (boundp 'canna:*japanese-mode*) canna:*japanese-mode*) 12.634 - (and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*)) 12.635 -) 12.636 + (and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*))) 12.637 12.638 (defun YaTeX-jmode-off () 12.639 (cond 12.640 @@ -1072,9 +1074,11 @@ 12.641 ((and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*) 12.642 (egg:toggle-egg-mode-on-off)) 12.643 ((and (fboundp 'skk-mode) (boundp 'skk-mode) skk-mode) 12.644 - (if (fboundp 'skk-mode-off) (skk-mode-off) (j-mode-off))) 12.645 - ((and (fboundp 'fep-force-off) (fep-force-off)))) 12.646 -) 12.647 + (cond 12.648 + ((fboundp 'skk-latin-mode) (skk-latin-mode t)) 12.649 + ((fboundp 'skk-mode-off) (skk-mode-off)) 12.650 + (t (j-mode-off)))) 12.651 + ((and (fboundp 'fep-force-off) (fep-force-off))))) 12.652 12.653 (defun YaTeX-self-insert (arg) 12.654 (call-interactively (global-key-binding (char-to-string last-command-char)))) 12.655 @@ -1092,6 +1096,20 @@ 12.656 (looking-at "\\\\left")) 12.657 (insert "[\\right]") 12.658 (forward-char -7)) 12.659 + ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 12.660 + (and (> (- (point) (point-min)) 5) (forward-char -5)) 12.661 + (looking-at "\\\\[bB]igl")) 12.662 + (insert 12.663 + (concat 12.664 + "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) 12.665 + (forward-char -6)) 12.666 + ((save-excursion 12.667 + (and (> (- (point) (point-min)) 6) (forward-char -6)) 12.668 + (looking-at "\\\\[bB]iggl")) 12.669 + (insert 12.670 + (concat 12.671 + "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) 12.672 + (forward-char -7)) ;matsu's hack ends here 12.673 ((and (= (preceding-char) ?\\ ) 12.674 (/= (char-after (- (point) 2)) ?\\ ) 12.675 (not (YaTeX-in-math-mode-p))) 12.676 @@ -1106,14 +1124,11 @@ 12.677 ((YaTeX-closable-p) 12.678 (insert "[]") 12.679 (backward-char 1)) 12.680 - (t (YaTeX-self-insert arg))) 12.681 - ) 12.682 -) 12.683 + (t (YaTeX-self-insert arg))))) 12.684 12.685 (defun YaTeX-insert-brackets-region (beg end) 12.686 (interactive "r") 12.687 - (YaTeX-insert-braces-region beg end "[" "]") 12.688 -) 12.689 + (YaTeX-insert-braces-region beg end "[" "]")) 12.690 12.691 (defun YaTeX-insert-parens (arg) 12.692 "Insert parenthesis pair." 12.693 @@ -1126,19 +1141,85 @@ 12.694 (looking-at "\\\\left")) 12.695 (insert "(\\right)") 12.696 (forward-char -7)) 12.697 - ((and (= (preceding-char) ?\\ ) (not (YaTeX-in-math-mode-p))) 12.698 + ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 12.699 + (and (> (- (point) (point-min)) 5) (forward-char -5)) 12.700 + (looking-at "\\\\[bB]igl")) 12.701 + (insert 12.702 + (concat 12.703 + "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) 12.704 + (forward-char -6)) 12.705 + ((save-excursion 12.706 + (and (> (- (point) (point-min)) 6) (forward-char -6)) 12.707 + (looking-at "\\\\[bB]iggl")) 12.708 + (insert 12.709 + (concat 12.710 + "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) 12.711 + (forward-char -7)) 12.712 + ((= (preceding-char) ?\\ ) ;matsu's hack ends here 12.713 (insert "(\\)") 12.714 (backward-char 2)) 12.715 ((YaTeX-closable-p) 12.716 (insert "()") 12.717 (backward-char 1)) 12.718 - (t (YaTeX-self-insert arg))) 12.719 -) 12.720 + (t (YaTeX-self-insert arg)))) 12.721 12.722 (defun YaTeX-insert-parens-region (beg end) 12.723 (interactive "r") 12.724 - (YaTeX-insert-braces-region beg end "(" ")") 12.725 -) 12.726 + (YaTeX-insert-braces-region beg end "(" ")")) 12.727 + 12.728 +(defun YaTeX-insert-bar (arg) 12.729 + "Insert bar pair." 12.730 + (interactive "p") 12.731 + (cond 12.732 + ((YaTeX-jmode) (YaTeX-self-insert arg)) 12.733 + ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) 12.734 + ((save-excursion 12.735 + (and (> (- (point) (point-min)) 5) (forward-char -5)) 12.736 + (looking-at "\\\\left")) 12.737 + (insert "|\\right|") 12.738 + (forward-char -7)) 12.739 + ((save-excursion ;from matsu@math.s.chiba-u.ac.jp 12.740 + (and (> (- (point) (point-min)) 5) (forward-char -5)) 12.741 + (looking-at "\\\\[bB]igl")) 12.742 + (insert 12.743 + (concat 12.744 + "|" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r|")) 12.745 + (forward-char -6)) 12.746 + ((save-excursion 12.747 + (and (> (- (point) (point-min)) 6) (forward-char -6)) 12.748 + (looking-at "\\\\[bB]iggl")) 12.749 + (insert 12.750 + (concat 12.751 + "|" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r|")) 12.752 + (forward-char -7)) 12.753 + ((save-excursion ; added by Jin <MAF01011@nifty.ne.jp> 12.754 + (and (> (- (point) (point-min)) 6) (forward-char -6)) 12.755 + (looking-at "\\\\left\\\\")) 12.756 + (insert "|\\right\\|") 12.757 + (forward-char -8)) 12.758 + ((save-excursion 12.759 + (and (> (- (point) (point-min)) 6) (forward-char -6)) 12.760 + (looking-at "\\\\[bB]igl\\\\")) 12.761 + (insert 12.762 + (concat 12.763 + "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|")) 12.764 + (forward-char -7)) 12.765 + ((save-excursion 12.766 + (and (> (- (point) (point-min)) 7) (forward-char -7)) 12.767 + (looking-at "\\\\[bB]iggl\\\\")) 12.768 + (insert 12.769 + (concat 12.770 + "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|")) 12.771 + (forward-char -8)) ; added by Jin up to here. 12.772 + ((= (preceding-char) ?\\ ) 12.773 + (insert "|\\|") 12.774 + (backward-char 2)) 12.775 +; ((and (YaTeX-closable-p) 12.776 +; (/= (preceding-char) ?|) 12.777 +; (/= (following-char) ?|)) 12.778 +; (insert "||") 12.779 +; (backward-char 1)) 12.780 + (t (YaTeX-self-insert arg)))) 12.781 12.782 (defun YaTeX-insert-dollar () 12.783 (interactive) 12.784 @@ -1150,13 +1231,11 @@ 12.785 (insert "$$") 12.786 (forward-char -1) 12.787 (YaTeX-jmode-off) 12.788 - (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))) 12.789 -) 12.790 + (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1)))) 12.791 12.792 (defun YaTeX-insert-dollars-region (beg end) 12.793 (interactive "r") 12.794 - (YaTeX-insert-braces-region beg end "$" "$") 12.795 -) 12.796 + (YaTeX-insert-braces-region beg end "$" "$")) 12.797 12.798 (defun YaTeX-insert-amper () 12.799 (interactive) 12.800 @@ -1165,8 +1244,7 @@ 12.801 (= (preceding-char) 92) 12.802 (YaTeX-literal-p)) 12.803 (insert "&") 12.804 - (insert "\\&")) 12.805 -) 12.806 + (insert "\\&"))) 12.807 12.808 (defun YaTeX-version () 12.809 "Return string of the version of running YaTeX." 12.810 @@ -1175,8 +1253,7 @@ 12.811 (concat "Yet Another tex-mode " 12.812 (if YaTeX-japan "「野鳥」" "`Wild Bird'") 12.813 " Revision " 12.814 - YaTeX-revision-number)) 12.815 -) 12.816 + YaTeX-revision-number))) 12.817 12.818 (defun YaTeX-typeset-menu (arg &optional char) 12.819 "Typeset, preview, visit error and miscellaneous convenient menu. 12.820 @@ -1205,8 +1282,7 @@ 12.821 ((= c ?l) (YaTeX-lpr arg)) 12.822 ((= c ?m) (YaTeX-switch-mode-menu arg)) 12.823 ((= c ?b) (YaTeX-insert-string "\\")) 12.824 - ((= c ?s) (YaTeX-xdvi-remote-search arg)))) 12.825 -) 12.826 + ((= c ?s) (YaTeX-xdvi-remote-search arg))))) 12.827 12.828 (defun YaTeX-%-menu (&optional beg end char) 12.829 "Operate %# notation." 12.830 @@ -1248,8 +1324,7 @@ 12.831 (insert "%#END\n") 12.832 (set-marker b nil) 12.833 (set-marker e nil)) 12.834 - ))) 12.835 -) 12.836 + )))) 12.837 12.838 (defun YaTeX-goto-corresponding-label (reverse &optional otherwin) 12.839 "Jump to corresponding \\label{} and \\ref{} or \\cite and \\bibitem. 12.840 @@ -1342,8 +1417,7 @@ 12.841 (setq regexp-search-ring 12.842 (cons string (delete string regexp-search-ring))) 12.843 (setq search-last-regexp string))) 12.844 - (t nil))) 12.845 -) 12.846 + (t nil)))) 12.847 12.848 (defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr) 12.849 "Go to corresponding begin/end enclosure. 12.850 @@ -1406,8 +1480,7 @@ 12.851 (if noerr 'message 'error) 12.852 "Corresponding environment `%s' not found." env) 12.853 (sit-for 1) 12.854 - nil))))) 12.855 -) 12.856 + nil)))))) 12.857 12.858 (defun YaTeX-goto-corresponding-file (&optional other) 12.859 "Visit or switch buffer of corresponding file, 12.860 @@ -1429,8 +1502,7 @@ 12.861 (t (YaTeX-switch-to-buffer input-file))) 12.862 (or (YaTeX-get-builtin "!") 12.863 YaTeX-parent-file 12.864 - (setq YaTeX-parent-file parent)))) 12.865 -) 12.866 + (setq YaTeX-parent-file parent))))) 12.867 12.868 (defun YaTeX-goto-corresponding-BEGIN-END () 12.869 (if (not (YaTeX-on-BEGIN-END-p)) nil 12.870 @@ -1441,8 +1513,7 @@ 12.871 (not (search-backward "%#BEGIN" nil t)))) 12.872 (error "Corresponding %%#BEGIN/END not found.")) 12.873 (beginning-of-line) 12.874 - t) 12.875 -) 12.876 + t)) 12.877 12.878 (defvar YaTeX-processed-file-regexp-alist nil 12.879 "Alist of regexp of processed file regexp vs. its file name part; 12.880 @@ -1479,13 +1550,12 @@ 12.881 ("\\\\\\(psbox\\)\\(\\[[^]]+\\]\\)?{\\(\\([^,} ]*/\\)?[^} ]+\\)\\(\\.e?ps\\)}" 3) ;\psbox[options...]{hoge.eps} (97/1/11) 12.882 ("\\\\input{\\([^} ]+\\)\\(\\.tps\\)}" 1) ;tgif2tex (1998/9/16) 12.883 ) 12.884 - "See the documentation of YaTeX-processed-file-regexp-alist." 12.885 -) 12.886 + "See the documentation of YaTeX-processed-file-regexp-alist.") 12.887 12.888 (defvar YaTeX-file-processor-alist nil 12.889 "*Alist of files' processor vs. its extension; 12.890 -See also the documentation of YaTeX-processed-file-regexp-alist." 12.891 -) 12.892 +See also the documentation of YaTeX-processed-file-regexp-alist.") 12.893 + 12.894 (defvar YaTeX-file-processor-alist-default 12.895 '(("tgif" . ".obj") 12.896 ("ghostview" . ".ps") 12.897 @@ -1493,8 +1563,7 @@ 12.898 (t . ".tex") 12.899 (t . ".sty") 12.900 (t . "")) 12.901 - "See the documentation of YaTeX-file-processor-alist." 12.902 -) 12.903 + "See the documentation of YaTeX-file-processor-alist.") 12.904 12.905 (defun YaTeX-goto-corresponding-file-processor (&optional other) 12.906 "Execute corresponding file processor." 12.907 @@ -1558,8 +1627,7 @@ 12.908 (cond 12.909 ((symbol-function cmd) 12.910 (funcall cmd src other))) 12.911 - t))))))) 12.912 -) 12.913 + t)))))))) 12.914 12.915 (defun YaTeX-on-section-command-p (command) 12.916 "Check if point is on the LaTeX command: COMMAND(regexp). 12.917 @@ -1606,8 +1674,7 @@ 12.918 (>= p (match-beginning i)) (< p (match-end i))) 12.919 -1 ;return -1 if point is on optional arg 12.920 (if (< p (point)) parg)) 12.921 - )))) 12.922 -) 12.923 + ))))) 12.924 12.925 (defun YaTeX-on-maketitle-p () 12.926 "Check if point is on maketitle type commands. 12.927 @@ -1636,15 +1703,13 @@ 12.928 (YaTeX-replace-format-args 12.929 (regexp-quote YaTeX-struct-end) 12.930 (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "")) 12.931 - (point-end-of-line) t)) 12.932 -) 12.933 + (point-end-of-line) t))) 12.934 12.935 (defun YaTeX-on-includes-p () 12.936 (save-excursion 12.937 (beginning-of-line) 12.938 (re-search-forward "\\(\\(include.*\\)\\|\\(input\\)\\){.*}" 12.939 - (point-end-of-line) t)) 12.940 -) 12.941 + (point-end-of-line) t))) 12.942 12.943 (defun YaTeX-on-comment-p (&optional sw) 12.944 "Return t if current line is commented out. 12.945 @@ -1653,15 +1718,14 @@ 12.946 (save-excursion 12.947 (beginning-of-line) 12.948 (skip-chars-forward "\\s ") 12.949 - (looking-at (if sw "%" "%[^#]"))) 12.950 -) 12.951 + (looking-at (if sw "%" "%[^#]")))) 12.952 12.953 (defun YaTeX-on-BEGIN-END-p () 12.954 (save-excursion 12.955 (let ((case-fold-search nil)) 12.956 (beginning-of-line) 12.957 - (re-search-forward "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t))) 12.958 -) 12.959 + (re-search-forward 12.960 + "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t)))) 12.961 12.962 (defun YaTeX-goto-corresponding-* (arg) 12.963 "Parse current line and call suitable function." 12.964 @@ -1676,8 +1740,7 @@ 12.965 YaTeX-equation-env-regexp ;to delay loading 12.966 (or (YaTeX-inner-environment t) "document")) 12.967 (YaTeX-goto-corresponding-leftright))) 12.968 - (t (message "I don't know where to go."))) 12.969 -) 12.970 + (t (message "I don't know where to go.")))) 12.971 12.972 (defun YaTeX-goto-corresponding-*-other-window (arg) 12.973 "Parse current line and call suitable function." 12.974 @@ -1687,8 +1750,7 @@ 12.975 ;;((YaTeX-goto-corresponding-environment)) 12.976 ((YaTeX-goto-corresponding-file t)) 12.977 ;;((YaTeX-goto-corresponding-BEGIN-END)) 12.978 - (t (message "I don't know where to go."))) 12.979 -) 12.980 + (t (message "I don't know where to go.")))) 12.981 12.982 (defun YaTeX-comment-region (alt-prefix) 12.983 "Comment out region by '%'. 12.984 @@ -1700,8 +1762,7 @@ 12.985 (if alt-prefix 12.986 (read-string "Insert prefix: ") 12.987 YaTeX-comment-prefix)) 12.988 - (YaTeX-comment-uncomment-env 'comment-out-region)) 12.989 -) 12.990 + (YaTeX-comment-uncomment-env 'comment-out-region))) 12.991 12.992 (defun YaTeX-uncomment-region (alt-prefix) 12.993 "Uncomment out region by '%'." 12.994 @@ -1711,8 +1772,7 @@ 12.995 (if alt-prefix (read-string "Remove prefix: ") 12.996 YaTeX-comment-prefix) 12.997 (region-beginning) (region-end) YaTeX-uncomment-once) 12.998 - (YaTeX-comment-uncomment-env 'uncomment-region)) 12.999 -) 12.1000 + (YaTeX-comment-uncomment-env 'uncomment-region))) 12.1001 12.1002 (defun YaTeX-comment-uncomment-env (func) 12.1003 "Comment or uncomment out one LaTeX environment switching function by FUNC." 12.1004 @@ -1725,8 +1785,7 @@ 12.1005 (if (> p (point)) (setq beg (1+ beg)) (forward-char 1)) 12.1006 (funcall func YaTeX-comment-prefix beg (point) YaTeX-uncomment-once))) 12.1007 (message "%sommented out current environment." 12.1008 - (if (eq func 'comment-out-region) "C" "Un-c")) 12.1009 -) 12.1010 + (if (eq func 'comment-out-region) "C" "Un-c"))) 12.1011 12.1012 (defun YaTeX-beginning-of-environment (&optional limit-search-bound end) 12.1013 "Goto the beginning of the current environment. 12.1014 @@ -1740,16 +1799,14 @@ 12.1015 (goto-char (get 'YaTeX-inner-environment 'point)) 12.1016 (and end (YaTeX-goto-corresponding-environment)) 12.1017 (if (interactive-p) (push-mark op)) 12.1018 - t))) 12.1019 -) 12.1020 + t)))) 12.1021 12.1022 (defun YaTeX-end-of-environment (&optional limit-search-bound) 12.1023 "Goto the end of the current environment. 12.1024 Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound 12.1025 to most recent sectioning command." 12.1026 (interactive) 12.1027 - (YaTeX-beginning-of-environment limit-search-bound t) 12.1028 -) 12.1029 + (YaTeX-beginning-of-environment limit-search-bound t)) 12.1030 12.1031 (defun YaTeX-mark-environment () 12.1032 "Mark current position and move point to end of environment." 12.1033 @@ -1773,8 +1830,7 @@ 12.1034 (set-mark-command nil) 12.1035 (YaTeX-goto-corresponding-environment) 12.1036 (end-of-line) 12.1037 - (if (eobp) nil (forward-char 1)))) 12.1038 -) 12.1039 + (if (eobp) nil (forward-char 1))))) 12.1040 12.1041 (defun YaTeX-comment-paragraph () 12.1042 "Comment out current paragraph." 12.1043 @@ -1792,8 +1848,7 @@ 12.1044 (t 12.1045 (mark-paragraph) 12.1046 (if (looking-at paragraph-separate) (forward-line 1)) 12.1047 - (comment-out-region "%")))) 12.1048 -) 12.1049 + (comment-out-region "%"))))) 12.1050 12.1051 (defun YaTeX-uncomment-paragraph () 12.1052 "Uncomment current paragraph." 12.1053 @@ -1816,8 +1871,7 @@ 12.1054 (mark-paragraph) 12.1055 (if (not (bobp)) (forward-line 1)) 12.1056 (uncomment-region "%" nil nil YaTeX-uncomment-once)) 12.1057 - (message "This line is not a comment line.")))) 12.1058 -) 12.1059 + (message "This line is not a comment line."))))) 12.1060 12.1061 (defun YaTeX-remove-prefix (prefix &optional once) 12.1062 "Remove prefix on current line as far as prefix detected. But 12.1063 @@ -1826,8 +1880,7 @@ 12.1064 (beginning-of-line) 12.1065 (while (re-search-forward (concat "^" prefix) (point-end-of-line) t) 12.1066 (replace-match "") 12.1067 - (if once (end-of-line))) 12.1068 -) 12.1069 + (if once (end-of-line)))) 12.1070 12.1071 (defun YaTeX-kill-some-pairs (predicate gofunc kill-contents) 12.1072 "Kill some matching pair. 12.1073 @@ -1878,8 +1931,7 @@ 12.1074 (kill-region 12.1075 (if (bolp) (point) b1) 12.1076 e2))) 12.1077 - t)) 12.1078 -) 12.1079 + t))) 12.1080 12.1081 (defun YaTeX-kill-section-command (point kill-all) 12.1082 "Kill section-type command at POINT leaving its argument. 12.1083 @@ -1902,8 +1954,7 @@ 12.1084 (goto-char end) 12.1085 (set-marker end nil) 12.1086 (kill-append (buffer-substring (point) (1- (point))) nil) 12.1087 - (delete-backward-char 1)))) 12.1088 -) 12.1089 + (delete-backward-char 1))))) 12.1090 12.1091 (defun YaTeX-kill-paren (kill-contents) 12.1092 "Kill parentheses leaving its contents. 12.1093 @@ -1927,8 +1978,7 @@ 12.1094 (point) 12.1095 (progn (re-search-forward "\\s +" nil t) (point))) 12.1096 (delete-char 1))) 12.1097 - t)))) 12.1098 -) 12.1099 + t))))) 12.1100 12.1101 (defvar YaTeX-read-environment-history nil "Holds history of environments.") 12.1102 (put 'YaTeX-read-environment-history 'no-default t) 12.1103 @@ -1939,8 +1989,7 @@ 12.1104 prompt 12.1105 (append tmp-env-table user-env-table env-table) 12.1106 predicate must-match initial 12.1107 - 'YaTeX-read-environment-history) 12.1108 -) 12.1109 + 'YaTeX-read-environment-history)) 12.1110 12.1111 (defvar YaTeX-read-section-history nil "Holds history of section-types.") 12.1112 (put 'YaTeX-read-section-history 'no-default t) 12.1113 @@ -1951,8 +2000,7 @@ 12.1114 (append tmp-section-table user-section-table section-table))) 12.1115 (read-from-minibuffer-with-history 12.1116 prompt initial YaTeX-section-completion-map nil 12.1117 - 'YaTeX-read-section-history)) 12.1118 -) 12.1119 + 'YaTeX-read-section-history))) 12.1120 12.1121 (defun YaTeX-read-section-with-overview () 12.1122 "Read sectioning command with overview. 12.1123 @@ -1974,9 +2022,7 @@ 12.1124 (if (eq (selected-window) (minibuffer-window)) 12.1125 (erase-buffer)) 12.1126 (insert sect) 12.1127 - (exit-minibuffer) 12.1128 - ) 12.1129 -) 12.1130 + (exit-minibuffer))) 12.1131 12.1132 (defvar YaTeX-read-fontsize-history nil "Holds history of font designator.") 12.1133 (put 'YaTeX-read-fontsize-history 'no-default t) 12.1134 @@ -1985,8 +2031,7 @@ 12.1135 (YaTeX-sync-local-table 'tmp-fontsize-table) 12.1136 (completing-read-with-history 12.1137 prompt (append tmp-fontsize-table user-fontsize-table fontsize-table) 12.1138 - predicate must-match initial 'YaTeX-read-fontsize-history) 12.1139 -) 12.1140 + predicate must-match initial 'YaTeX-read-fontsize-history)) 12.1141 12.1142 (defun YaTeX-change-environment () 12.1143 "Change the name of environment." 12.1144 @@ -2010,8 +2055,7 @@ 12.1145 (exchange-point-and-mark) 12.1146 (search-forward (concat "{" env) (point-end-of-line) t) 12.1147 (replace-match (concat "{" newenv) t))) 12.1148 - t))) 12.1149 -) 12.1150 + t)))) 12.1151 12.1152 (defun YaTeX-change-section () 12.1153 "Change section-type command." 12.1154 @@ -2061,8 +2105,7 @@ 12.1155 (goto-char beg) 12.1156 (insert-before-markers new) 12.1157 ;;(goto-char (marker-position p)) 12.1158 - new)) 12.1159 -) 12.1160 + new))) 12.1161 12.1162 (defun YaTeX-change-fontsize () 12.1163 "Change large-type command." 12.1164 @@ -2091,8 +2134,7 @@ 12.1165 (insert-before-markers new) 12.1166 new) 12.1167 (t nil) 12.1168 - ))) 12.1169 -) 12.1170 + )))) 12.1171 12.1172 (defun YaTeX-change-math-image () 12.1173 "Change with image completion." 12.1174 @@ -2118,8 +2160,7 @@ 12.1175 ((YaTeX-on-section-command-p YaTeX-command-token-regexp);on any command 12.1176 (YaTeX-kill-section-command (match-beginning 0) arg)) 12.1177 ((YaTeX-kill-paren arg)) 12.1178 - (t (message "I don't know what to kill."))) 12.1179 -) 12.1180 + (t (message "I don't know what to kill.")))) 12.1181 12.1182 (defun YaTeX-change-* () 12.1183 "Parse current line and call suitable function." 12.1184 @@ -2129,8 +2170,8 @@ 12.1185 ((YaTeX-change-section)) 12.1186 ((YaTeX-change-fontsize)) 12.1187 ((YaTeX-change-math-image)) 12.1188 - (t (message "I don't know what to change."))) 12.1189 -) 12.1190 + ((YaTeX-change-parentheses)) 12.1191 + (t (message "I don't know what to change.")))) 12.1192 12.1193 ;;; 12.1194 ;Check availability of add-in functions 12.1195 @@ -2147,8 +2188,8 @@ 12.1196 (fboundp (intern-soft (concat YaTeX-addin-prefix name)))) 12.1197 (let ((s (funcall (intern (concat YaTeX-addin-prefix name))))) 12.1198 (if (stringp s) s "")) 12.1199 - "") ;Add in function is not bound. 12.1200 -) 12.1201 + "")) ;Add in function is not bound. 12.1202 + 12.1203 12.1204 (defun YaTeX-on-item-p (&optional point) 12.1205 "Return t if POINT (default is (point)) is on \\item." 12.1206 @@ -2158,8 +2199,7 @@ 12.1207 (end-of-line) 12.1208 (setq p (point)) 12.1209 (re-search-backward YaTeX-paragraph-delimiter nil t) 12.1210 - (re-search-forward YaTeX-item-regexp p t))) 12.1211 -) 12.1212 + (re-search-forward YaTeX-item-regexp p t)))) 12.1213 12.1214 (defun YaTeX-in-verb-p (&optional point) 12.1215 "Check if POINT is in verb or verb*. Default of POINT is (point)." 12.1216 @@ -2175,8 +2215,7 @@ 12.1217 (goto-char (match-end 2)) 12.1218 (skip-chars-forward 12.1219 (concat "^" (buffer-substring (match-beginning 2) (match-end 2)))) 12.1220 - (and (< (match-beginning 2) point) (< (1- point) (point))))) 12.1221 -) 12.1222 + (and (< (match-beginning 2) point) (< (1- point) (point)))))) 12.1223 12.1224 (defun YaTeX-literal-p (&optional point) 12.1225 "Check if POINT is in verb or verb* or verbatime environment family. 12.1226 @@ -2187,8 +2226,7 @@ 12.1227 (and point (goto-char point)) 12.1228 (or (YaTeX-in-verb-p (point)) 12.1229 (and (not (looking-at "\\\\end{verb")) 12.1230 - (YaTeX-quick-in-environment-p YaTeX-verbatim-environments)))))) 12.1231 -) 12.1232 + (YaTeX-quick-in-environment-p YaTeX-verbatim-environments))))))) 12.1233 12.1234 (defun YaTeX-in-environment-p (env) 12.1235 "Return if current LaTeX environment is ENV. 12.1236 @@ -2220,8 +2258,7 @@ 12.1237 (and (cdr env) (YaTeX-in-environment-p (cdr env))))))) 12.1238 (store-match-data md) 12.1239 p;(or p (YaTeX-in-verb-p (match-beginning 0))) 12.1240 - ) 12.1241 -) 12.1242 + )) 12.1243 12.1244 (defun YaTeX-quick-in-environment-p (env) 12.1245 "Check quickly but unsure if current environment is ENV. 12.1246 @@ -2242,8 +2279,7 @@ 12.1247 YaTeX-struct-end env) 12.1248 YaTeX-comment-prefix p t nil)))) 12.1249 (store-match-data md) 12.1250 - rc)))) 12.1251 -) 12.1252 + rc))))) 12.1253 12.1254 ;; Filling \item 12.1255 (defun YaTeX-remove-trailing-comment (start end) 12.1256 @@ -2253,8 +2289,7 @@ 12.1257 (goto-char start) 12.1258 (while (re-search-forward trcom end t) 12.1259 (if (/= (char-after (1- (match-beginning 0))) ?\\ ) 12.1260 - (replace-match "\\1"))))) 12.1261 -) 12.1262 + (replace-match "\\1")))))) 12.1263 12.1264 (defun YaTeX-get-item-info (&optional recent thisenv) 12.1265 "Return the list of the beginning of \\item and column of its item. 12.1266 @@ -2281,8 +2316,7 @@ 12.1267 (if (equal (following-char) ?\[) (forward-list 1)) 12.1268 (setq c 0)) 12.1269 (skip-chars-forward " \t" (point-end-of-line)) 12.1270 - (list (point-beginning-of-line) (+ c (current-column))))))) 12.1271 -) 12.1272 + (list (point-beginning-of-line) (+ c (current-column)))))))) 12.1273 12.1274 (defun YaTeX-fill-item () 12.1275 "Fill item in itemize environment." 12.1276 @@ -2334,8 +2368,7 @@ 12.1277 (if NTT-jTeX 12.1278 (while (progn(forward-line -1)(end-of-line) (> (point) start)) 12.1279 (insert ?%))) 12.1280 - (pop-mark))))) 12.1281 -) 12.1282 + (pop-mark)))))) 12.1283 12.1284 (defun YaTeX-fill-paragraph (arg) 12.1285 "YaTeX adjustment function for fill-paragraph. 12.1286 @@ -2410,8 +2443,7 @@ 12.1287 (forward-line 1)) 12.1288 (goto-char p) 12.1289 (if (looking-at "%") (delete-char 1)) ;remove last inserted `%' 12.1290 - ))))))) 12.1291 -) 12.1292 + )))))))) 12.1293 12.1294 (if (fboundp 'YaTeX-saved-indent-new-comment-line) nil 12.1295 (fset 'YaTeX-saved-indent-new-comment-line 12.1296 @@ -2421,6 +2453,7 @@ 12.1297 (defun YaTeX-indent-new-comment-line (&optional soft) 12.1298 "Tuned `indent-new-comment-line' function for yatex. 12.1299 See the documentation of `YaTeX-saved-indent-new-comment-line'." 12.1300 + (interactive) 12.1301 (cond 12.1302 ((or (not (memq major-mode '(yatex-mode yahtml-mode))) 12.1303 (string-match 12.1304 @@ -2435,16 +2468,14 @@ 12.1305 ((and (eq major-mode 'yatex-mode) ;1997/2/4 12.1306 (YaTeX-in-math-mode-p)) nil) ;1996/12/30 12.1307 (t (let (fill-prefix) 12.1308 - (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))))) 12.1309 -) 12.1310 + (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft))))))) 12.1311 12.1312 (defun YaTeX-fill-* () 12.1313 "Fill paragraph according to its condition." 12.1314 (interactive) 12.1315 (cond 12.1316 ((YaTeX-fill-item)) 12.1317 - ) 12.1318 -) 12.1319 + )) 12.1320 12.1321 ;; Accent completion 12.1322 (defun YaTeX-read-accent-char (x) 12.1323 @@ -2454,8 +2485,7 @@ 12.1324 (if (and (or (= c ?i) (= c ?j)) 12.1325 (not (string-match (regexp-quote x) "cdb"))) 12.1326 "\\" "") 12.1327 - (char-to-string c))) 12.1328 -) 12.1329 + (char-to-string c)))) 12.1330 12.1331 (defun YaTeX-make-accent () 12.1332 "Make accent usage." 12.1333 @@ -2471,8 +2501,7 @@ 12.1334 (backward-char 1) 12.1335 (insert (YaTeX-read-accent-char c)) 12.1336 (if (string= c "t") (insert (YaTeX-read-accent-char c))) 12.1337 - (forward-char 1))) 12.1338 -) 12.1339 + (forward-char 1)))) 12.1340 12.1341 ;; Indentation 12.1342 (defun YaTeX-current-indentation () 12.1343 @@ -2484,8 +2513,7 @@ 12.1344 (forward-line -1) 12.1345 (beginning-of-line) 12.1346 (skip-chars-forward " \t")) 12.1347 - (current-column)) 12.1348 -) 12.1349 + (current-column))) 12.1350 12.1351 (defun YaTeX-previous-line-indentation () 12.1352 (save-excursion 12.1353 @@ -2612,8 +2640,7 @@ 12.1354 (save-excursion 12.1355 (backward-word 1) 12.1356 (looking-at "\\sw+")) ;is not japanese string 12.1357 - (insert YaTeX-comment-prefix)))))) 12.1358 -) 12.1359 + (insert YaTeX-comment-prefix))))))) 12.1360 12.1361 (provide 'yatex) 12.1362 (defvar yatex-mode-load-hook nil
13.1 --- a/yatex.new Mon Oct 26 12:05:32 1998 +0000 13.2 +++ b/yatex.new Thu Jul 15 04:58:26 1999 +0000 13.3 @@ -1,6 +1,33 @@ 13.4 - What's new in YaTeX 13.5 + What's new in YaTeX/yahtml 13.6 野鳥/yahtml - 各バージョンの変更点について 13.7 13.8 +1.67 [[[ http://www.yatex.org/ が誕生しました ]]] 13.9 + === yahtml === 13.10 + href入力でSPCなどのunsafe-charを%エンコードに置換するかを 13.11 + yahtml-escape-chars で選べるようにした。nilならしない、tなら常に、 13.12 + 'ask なら確認する。デフォルトは 'ask。 13.13 + 初回href入力時に yahtml-urls を補完候補に入れてなかったのを修正。 13.14 + [prefix] ; でリジョン中の <>'"& をエンティティ参照に変換、 13.15 + [prefix] : で逆変換する機能を追加。 13.16 + yahtml-translate-hyphens-when-comment-region が non-nil のときに 13.17 + 領域コメントアウトで - を - に変換。 13.18 + yahtml-prefer-upcase-attributes が non-nil のとき属性名を大文字に。 13.19 + カレントまたは上位ディレクトリに .htaccess ファイルがありその中に 13.20 + AddType "text/html; charset=XXXX" .html 13.21 + 宣言があれば編集するHTMLソースの漢字コードもその宣言に合わせる。 13.22 + <style>をデフォルト補完候補にいれ type 属性を入れるアドイン作成。 13.23 + yahtml-insert-begend-region で領域を括った後の状態のリジョンが 13.24 + 括った環境全体になるようにした。つまり続けて insert-begend-region 13.25 + すると括った直後の環境をさらに括ることが出来る。 13.26 + スタイルシート(に関する補完)対応(ローカルファイルにあるもののみ)。 13.27 + [prefix] s で<link>タグ補完。type="text/css" などの補完可。 13.28 + [prefix] c で属性代入値をどこでも変更できるようにした。 13.29 + === yatex === 13.30 + 数式モードで \left の直後に ( | [ を入れたときには自動的に対応す 13.31 + る \right ) | ] を挿入するようにした。 13.32 + [prefix] c で \right\left の括弧の組をまとめて変更できるようにし 13.33 + た(by 千葉大松田さん)。 13.34 + 13.35 1.66 \section*{} などの*つきセクションコマンドでインデントがずれるの 13.36 を修正。 13.37 [prefix] g でのlabel/ref検索をre-searchにしpagerefにも飛べるよう
14.1 --- a/yatex19.el Mon Oct 26 12:05:32 1998 +0000 14.2 +++ b/yatex19.el Thu Jul 15 04:58:26 1999 +0000 14.3 @@ -1,7 +1,7 @@ 14.4 ;;; -*- Emacs-Lisp -*- 14.5 ;;; YaTeX facilities for Emacs 19 14.6 -;;; (c )1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 14.7 -;;; Last modified Thu Jan 29 10:55:12 1998 on crx 14.8 +;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org] 14.9 +;;; Last modified Thu Apr 29 18:40:26 1999 on firestorm 14.10 ;;; $Id$ 14.11 14.12 ;;; とりあえず hilit19 を使っている時に色が付くようにして 14.13 @@ -230,16 +230,23 @@ 14.14 (defun YaTeX-19-region-section-type (pattern) 14.15 "Return list of starting and end point of section-type commands of PATTERN." 14.16 (if (re-search-forward pattern nil t) 14.17 - (let ((m0 (match-beginning 0)) cmd (argc 1)) 14.18 + (let ((m0 (match-beginning 0)) (e0 (match-end 0)) cmd (argc 1)) 14.19 (setq cmd (substring (YaTeX-match-string 0) 1) 14.20 argc (or (car (cdr (YaTeX-lookup-table cmd 'section))) argc)) 14.21 - (cons m0 14.22 - (progn ;(skip-chars-backward "^{") (forward-char -2) 14.23 - (while (> argc 0) 14.24 - (skip-chars-forward "^{") 14.25 - (forward-list 1) 14.26 - (setq argc (1- argc))) 14.27 - (point)))))) 14.28 + (if (= argc 0) (cons m0 (point)) ;引数個数0ならマッチした領域 14.29 + (skip-chars-forward " \n\t*") 14.30 + (while (looking-at "\\[") (forward-list 1)) ;optionならスキップ 14.31 + (skip-chars-forward " \n\t") 14.32 + (if (looking-at "{") ;{}が始まるならちゃんとしたsection型 14.33 + (cons m0 14.34 + (progn ;(skip-chars-backward "^{") (forward-char -2) 14.35 + (while (> argc 0) 14.36 + (skip-chars-forward "^{") 14.37 + (forward-list 1) 14.38 + (setq argc (1- argc))) 14.39 + (point))) 14.40 + ;{}でないならたぶん \verb 環境などにあるダミー 14.41 + (cons m0 e0)))))) 14.42 14.43 (defun YaTeX-19-region-large-type (pattern) 14.44 "Return list of large-type contents. 14.45 @@ -379,7 +386,7 @@ 14.46 list YaTeX-sectioning-level) 14.47 (while list 14.48 (setq pat (concat YaTeX-ec-regexp (car (car list)) 14.49 - ;"\\*?\\(\\[[^]]*\\]\\)?\\>" 14.50 + ;"\\*?\\(\\[[^]]*\\]\\)?\\>" ;改行はさむと駄目 14.51 "\\>" 14.52 ) 14.53 level (cdr (car list))
15.1 --- a/yatexadd.el Mon Oct 26 12:05:32 1998 +0000 15.2 +++ b/yatexadd.el Thu Jul 15 04:58:26 1999 +0000 15.3 @@ -1,8 +1,8 @@ 15.4 ;;; -*- Emacs-Lisp -*- 15.5 ;;; YaTeX add-in functions. 15.6 ;;; yatexadd.el rev.14 15.7 -;;; (c )1991-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 15.8 -;;; Last modified Mon Sep 28 13:03:37 1998 on firestorm 15.9 +;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@gentei.org] 15.10 +;;; Last modified Tue Jul 13 13:57:45 1999 on firestorm 15.11 ;;; $Id$ 15.12 15.13 ;;; 15.14 @@ -10,14 +10,14 @@ 15.15 ;;; 15.16 (defvar YaTeX:tabular-default-rule 15.17 "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}" 15.18 - "*Your favorite default rule format." 15.19 -) 15.20 + "*Your favorite default rule format.") 15.21 + 15.22 (defvar YaTeX:tabular-thick-vrule "\\vrule width %s" 15.23 - "*Vertical thick line format (without @{}). %s'll be replaced by its width." 15.24 -) 15.25 + "*Vertical thick line format (without @{}). %s'll be replaced by its width.") 15.26 + 15.27 (defvar YaTeX:tabular-thick-hrule "\\noalign{\\hrule height %s}" 15.28 - "*Horizontal thick line format. %s will be replaced by its width." 15.29 -) 15.30 + "*Horizontal thick line format. %s will be replaced by its width.") 15.31 + 15.32 (defun YaTeX:tabular () 15.33 "YaTeX add-in function for tabular environment. 15.34 Notice that this function refers the let-variable `env' in 15.35 @@ -53,13 +53,12 @@ 15.36 (setq rule (read-string "rule format: " rule)) 15.37 (setq single-command "hline") 15.38 15.39 - (format "%s%s{%s}" width loc rule)) 15.40 -) 15.41 + (format "%s%s{%s}" width loc rule))) 15.42 + 15.43 (fset 'YaTeX:tabular* 'YaTeX:tabular) 15.44 (defun YaTeX:array () 15.45 (concat (YaTeX:read-position "tb") 15.46 - "{" (read-string "Column format: ") "}") 15.47 -) 15.48 + "{" (read-string "Column format: ") "}")) 15.49 15.50 (defun YaTeX:read-oneof (oneof) 15.51 (let ((pos "") loc (guide "")) 15.52 @@ -82,21 +81,18 @@ 15.53 (message "Please input one of `%s'." oneof) 15.54 (sit-for 3)))) 15.55 (message "") 15.56 - pos) 15.57 -) 15.58 + pos)) 15.59 15.60 (defun YaTeX:read-position (oneof) 15.61 "Read a LaTeX (optional) position format such as `[htbp]'." 15.62 (let ((pos (YaTeX:read-oneof oneof))) 15.63 - (if (string= pos "") "" (concat "[" pos "]"))) 15.64 -) 15.65 + (if (string= pos "") "" (concat "[" pos "]")))) 15.66 15.67 (defun YaTeX:table () 15.68 "YaTeX add-in function for table environment." 15.69 (setq env-name "tabular" 15.70 section-name "caption") 15.71 - (YaTeX:read-position "htbp") 15.72 -) 15.73 + (YaTeX:read-position "htbp")) 15.74 15.75 (fset 'YaTeX:figure 'YaTeX:table) 15.76 (fset 'YaTeX:figure* 'YaTeX:table) 15.77 @@ -105,28 +101,25 @@ 15.78 (defun YaTeX:description () 15.79 "Truly poor service:-)" 15.80 (setq single-command "item[]") 15.81 - "" 15.82 -) 15.83 + "") 15.84 15.85 (defun YaTeX:itemize () 15.86 "It's also poor service." 15.87 (setq single-command "item") 15.88 - "" 15.89 -) 15.90 + "") 15.91 15.92 (fset 'YaTeX:enumerate 'YaTeX:itemize) 15.93 15.94 (defun YaTeX:picture () 15.95 "Ask the size of coordinates of picture environment." 15.96 (concat (YaTeX:read-coordinates "Picture size") 15.97 - (YaTeX:read-coordinates "Initial position")) 15.98 -) 15.99 + (YaTeX:read-coordinates "Initial position"))) 15.100 15.101 (defun YaTeX:equation () 15.102 (YaTeX-jmode-off) 15.103 (if (fboundp 'YaTeX-toggle-math-mode) 15.104 - (YaTeX-toggle-math-mode t)) ;force math-mode ON. 15.105 -) 15.106 + (YaTeX-toggle-math-mode t))) ;force math-mode ON. 15.107 + 15.108 (mapcar '(lambda (f) (fset f 'YaTeX:equation)) 15.109 '(YaTeX:eqnarray YaTeX:eqnarray* YaTeX:align YaTeX:align* 15.110 YaTeX:split YaTeX:multline YaTeX:multline* YaTeX:gather YaTeX:gather* 15.111 @@ -135,18 +128,15 @@ 15.112 YaTeX:xxalignat YaTeX:xxalignat*)) 15.113 15.114 (defun YaTeX:list () 15.115 - "%\n{} %default label\n{} %formatting parameter" 15.116 -) 15.117 + "%\n{} %default label\n{} %formatting parameter") 15.118 15.119 (defun YaTeX:minipage () 15.120 (concat (YaTeX:read-position "cbt") 15.121 - "{" (read-string "Width: ") "}") 15.122 -) 15.123 + "{" (read-string "Width: ") "}")) 15.124 15.125 (defun YaTeX:thebibliography () 15.126 (setq section-name "bibitem") 15.127 - "" 15.128 -) 15.129 + "") 15.130 15.131 ;;; 15.132 ;;Sample functions for section-type command. 15.133 @@ -154,12 +144,10 @@ 15.134 (defun YaTeX:multiput () 15.135 (concat (YaTeX:read-coordinates "Pos") 15.136 (YaTeX:read-coordinates "Step") 15.137 - "{" (read-string "How many times: ") "}") 15.138 -) 15.139 + "{" (read-string "How many times: ") "}")) 15.140 15.141 (defun YaTeX:put () 15.142 - (YaTeX:read-coordinates "Pos") 15.143 -) 15.144 + (YaTeX:read-coordinates "Pos")) 15.145 15.146 (defun YaTeX:makebox () 15.147 (cond 15.148 @@ -172,18 +160,15 @@ 15.149 (progn 15.150 (or (equal (aref width 0) ?\[) 15.151 (setq width (concat "[" width "]"))) 15.152 - (concat width (YaTeX:read-position "lr"))))))) 15.153 -) 15.154 + (concat width (YaTeX:read-position "lr")))))))) 15.155 15.156 (defun YaTeX:framebox () 15.157 (if (YaTeX-quick-in-environment-p "picture") 15.158 - (YaTeX:makebox)) 15.159 -) 15.160 + (YaTeX:makebox))) 15.161 15.162 (defun YaTeX:dashbox () 15.163 (concat "{" (read-string "Dash dimension: ") "}" 15.164 - (YaTeX:read-coordinates "Dimension")) 15.165 -) 15.166 + (YaTeX:read-coordinates "Dimension"))) 15.167 15.168 (defvar YaTeX-minibuffer-quick-map nil) 15.169 (if YaTeX-minibuffer-quick-map nil 15.170 @@ -232,8 +217,7 @@ 15.171 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) 15.172 "," 15.173 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) 15.174 - ")") 15.175 -) 15.176 + ")")) 15.177 15.178 ;;; 15.179 ;;Sample functions for maketitle-type command. 15.180 @@ -241,8 +225,7 @@ 15.181 (defun YaTeX:sum () 15.182 "Read range of summation." 15.183 (YaTeX:check-completion-type 'maketitle) 15.184 - (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^")) 15.185 -) 15.186 + (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^"))) 15.187 15.188 (fset 'YaTeX:int 'YaTeX:sum) 15.189 15.190 @@ -253,47 +236,41 @@ 15.191 (if (string= "" var) "" 15.192 (setq limit (read-string "Limit ($ means infinity): ")) 15.193 (if (string= "$" limit) (setq limit "\\infty")) 15.194 - (concat "_{" var " \\rightarrow " limit "}"))) 15.195 -) 15.196 + (concat "_{" var " \\rightarrow " limit "}")))) 15.197 15.198 (defun YaTeX:gcd () 15.199 "Add-in function for \\gcd(m,n)." 15.200 (YaTeX:check-completion-type 'maketitle) 15.201 - (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)") 15.202 -) 15.203 + (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)")) 15.204 15.205 (defun YaTeX:read-boundary (ULchar) 15.206 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." 15.207 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): ")))) 15.208 (if (string= bndry "") "" 15.209 (if (string= bndry "$") (setq bndry "\\infty")) 15.210 - (concat ULchar "{" bndry "}"))) 15.211 -) 15.212 + (concat ULchar "{" bndry "}")))) 15.213 15.214 (defun YaTeX:verb () 15.215 "Enclose \\verb's contents with the same characters." 15.216 (let ((quote-char (read-string "Quoting char: " "|")) 15.217 (contents (read-string "Quoted contents: "))) 15.218 - (concat quote-char contents quote-char)) 15.219 -) 15.220 + (concat quote-char contents quote-char))) 15.221 + 15.222 (fset 'YaTeX:verb* 'YaTeX:verb) 15.223 15.224 (defun YaTeX:footnotemark () 15.225 (setq section-name "footnotetext") 15.226 - nil 15.227 -) 15.228 + nil) 15.229 15.230 (defun YaTeX:cite () 15.231 (let ((comment (read-string "Comment for citation: "))) 15.232 (if (string= comment "") "" 15.233 - (concat "[" comment "]"))) 15.234 -) 15.235 + (concat "[" comment "]")))) 15.236 15.237 (defun YaTeX:bibitem () 15.238 (let ((label (read-string "Citation label for bibitem: "))) 15.239 (if (string= label "") "" 15.240 - (concat "[" label "]"))) 15.241 -) 15.242 + (concat "[" label "]")))) 15.243 15.244 (defun YaTeX:item () 15.245 (YaTeX-indent-line) 15.246 @@ -309,8 +286,7 @@ 15.247 (setq obl (char-to-string (read-char))) 15.248 (if (string-match "[0-4]" obl) 15.249 (concat "[" obl "]") 15.250 - "")) 15.251 -) 15.252 + ""))) 15.253 (fset 'YaTeX:pagebreak 'YaTeX:linebreak) 15.254 15.255 ;;; 15.256 @@ -320,8 +296,7 @@ 15.257 (defun YaTeX:check-completion-type (type) 15.258 "Check valid completion type." 15.259 (if (not (eq type YaTeX-current-completion-type)) 15.260 - (error "This should be completed with %s-type completion." type)) 15.261 -) 15.262 + (error "This should be completed with %s-type completion." type))) 15.263 15.264 15.265 ;;; 15.266 @@ -375,8 +350,8 @@ 15.267 'YaTeX::label-search-tag) 15.268 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A))) 15.269 'YaTeX::label-search-tag) 15.270 - (setq key (1+ key))))) 15.271 -) 15.272 + (setq key (1+ key)))))) 15.273 + 15.274 (defun YaTeX::label-next () 15.275 (interactive) (forward-line 1) (message YaTeX-label-guide-msg)) 15.276 (defun YaTeX::label-previous () 15.277 @@ -394,8 +369,8 @@ 15.278 (goto-char (point-min)) 15.279 (re-search-forward (concat "^" tag) nil t)) 15.280 (goto-char (match-beginning 0)))) 15.281 - (message YaTeX-label-guide-msg)) 15.282 -) 15.283 + (message YaTeX-label-guide-msg))) 15.284 + 15.285 (defun YaTeX::ref (argp &optional labelcmd refcmd) 15.286 (cond 15.287 ((= argp 1) 15.288 @@ -415,8 +390,12 @@ 15.289 ;(message "cb=%s" buf)(sit-for 3) 15.290 )) 15.291 (save-excursion 15.292 + (set-buffer (get-buffer-create YaTeX-label-buffer)) 15.293 + (setq buffer-read-only nil) 15.294 + (erase-buffer)) 15.295 + (save-excursion 15.296 (goto-char (point-min)) 15.297 - (with-output-to-temp-buffer YaTeX-label-buffer 15.298 + (let ((standard-output (get-buffer YaTeX-label-buffer))) 15.299 (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) 15.300 (while (YaTeX-re-search-active-forward 15.301 (concat "\\\\" labelcmd "\\b") 15.302 @@ -440,7 +419,7 @@ 15.303 (princ YaTeX-label-menu-other) 15.304 (princ YaTeX-label-menu-repeat) 15.305 (princ YaTeX-label-menu-any) 15.306 - );with 15.307 + );standard-output 15.308 (goto-char p) 15.309 (or initl (setq initl lnum)) 15.310 (message "Collecting %s...Done" labelcmd) 15.311 @@ -474,10 +453,8 @@ 15.312 (setq label (read-string (format "\\%s{???}: " refcmd)))) 15.313 (t (setq label (nth (- lnum line 1) label-list))))) 15.314 (bury-buffer YaTeX-label-buffer))) 15.315 - label 15.316 - )) 15.317 - )) 15.318 -) 15.319 + label))))) 15.320 + 15.321 (fset 'YaTeX::pageref 'YaTeX::ref) 15.322 (defun YaTeX::cite (argp) 15.323 (cond 15.324 @@ -490,8 +467,7 @@ 15.325 (delq nil (mapcar (function (lambda (buf) 15.326 (set-buffer buf) 15.327 (if (eq major-mode 'yatex-mode) buf))) 15.328 - (buffer-list)))) 15.329 -) 15.330 + (buffer-list))))) 15.331 15.332 (defun YaTeX-select-other-yatex-buffer () 15.333 "Select buffer from all yatex-mode's buffers interactivelly." 15.334 @@ -501,7 +477,11 @@ 15.335 (ff "**find-file**")) 15.336 (YaTeX-showup-buffer 15.337 lbuf (function (lambda (x) 1))) ;;Select next window surely. 15.338 - (with-output-to-temp-buffer lbuf 15.339 + (save-excursion 15.340 + (set-buffer (get-buffer lbuf)) 15.341 + (setq buffer-read-only nil) 15.342 + (erase-buffer)) 15.343 + (let ((standard-output (get-buffer lbuf))) 15.344 (while blist 15.345 (princ 15.346 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A) 15.347 @@ -526,8 +506,7 @@ 15.348 (progn 15.349 (call-interactively 'find-file) 15.350 (current-buffer)) 15.351 - rv)) 15.352 -) 15.353 + rv))) 15.354 15.355 (defun YaTeX-label-other () 15.356 (let ((rv (YaTeX-select-other-yatex-buffer))) 15.357 @@ -535,9 +514,7 @@ 15.358 ((null rv) "") 15.359 (t 15.360 (set-buffer rv) 15.361 - (YaTeX::ref argp labelcmd refcmd))) 15.362 - ) 15.363 -) 15.364 + (YaTeX::ref argp labelcmd refcmd))))) 15.365 15.366 ;; 15.367 ; completion for the arguments of \newcommand 15.368 @@ -573,8 +550,7 @@ 15.369 (message "") 15.370 def ;return command name 15.371 )) 15.372 - (t "")) 15.373 -) 15.374 + (t ""))) 15.375 15.376 ;; 15.377 ; completion for the arguments of \pagestyle 15.378 @@ -583,8 +559,8 @@ 15.379 "Read the pagestyle with completion." 15.380 (completing-read 15.381 "Page style: " 15.382 - '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil)) 15.383 -) 15.384 + '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil))) 15.385 + 15.386 (fset 'YaTeX::thispagestyle 'YaTeX::pagestyle) 15.387 15.388 ;; 15.389 @@ -594,8 +570,7 @@ 15.390 "Read the numbering style." 15.391 (completing-read 15.392 "Page numbering style: " 15.393 - '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman"))) 15.394 -) 15.395 + '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman")))) 15.396 15.397 ;; 15.398 ; Length 15.399 @@ -656,8 +631,8 @@ 15.400 nil nil "\\") 15.401 ) 15.402 ((equal 2 argp) 15.403 - (read-string-with-history "Length: " nil 'YaTeX:length-history))) 15.404 -) 15.405 + (read-string-with-history "Length: " nil 'YaTeX:length-history)))) 15.406 + 15.407 (fset 'YaTeX::addtolength 'YaTeX::setlength) 15.408 15.409 (defun YaTeX::settowidth (&optional argp) 15.410 @@ -671,8 +646,8 @@ 15.411 'YaTeX:style-parameters-local 15.412 nil nil "\\")) 15.413 ((equal 2 argp) 15.414 - (read-string "Text: "))) 15.415 -) 15.416 + (read-string "Text: ")))) 15.417 + 15.418 (defun YaTeX::newlength (&optional argp) 15.419 "YaTeX add-in function for arguments of \\newlength" 15.420 (cond 15.421 @@ -684,9 +659,7 @@ 15.422 'YaTeX:style-parameters-default 15.423 'YaTeX:style-parameters-private 15.424 'YaTeX:style-parameters-local)) 15.425 - length) 15.426 - )) 15.427 -) 15.428 + length)))) 15.429 15.430 ;; \multicolumn's arguments 15.431 (defun YaTeX::multicolumn (&optional argp) 15.432 @@ -702,8 +675,7 @@ 15.433 "lrc"))) 15.434 c)) 15.435 ((equal 3 argp) 15.436 - (read-string "Item: "))) 15.437 -) 15.438 + (read-string "Item: ")))) 15.439 15.440 (defvar YaTeX:documentstyles-default 15.441 '(("article") ("jarticle") ("j-article") 15.442 @@ -773,8 +745,7 @@ 15.443 'YaTeX:documentstyles-private 15.444 'YaTeX:documentstyles-local))) 15.445 (if (string= "" sname) (setq sname YaTeX-default-document-style)) 15.446 - (setq YaTeX-default-document-style sname)))) 15.447 -) 15.448 + (setq YaTeX-default-document-style sname))))) 15.449 15.450 ;;; -------------------- LaTeX2e stuff -------------------- 15.451 (defvar YaTeX:documentclass-options-default
16.1 --- a/yatexlib.el Mon Oct 26 12:05:32 1998 +0000 16.2 +++ b/yatexlib.el Thu Jul 15 04:58:26 1999 +0000 16.3 @@ -1,8 +1,8 @@ 16.4 ;;; -*- Emacs-Lisp -*- 16.5 ;;; YaTeX and yahtml common libraries, general functions and definitions 16.6 ;;; yatexlib.el 16.7 -;;; (c )1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 16.8 -;;; Last modified Mon Oct 19 13:41:29 1998 on firestorm 16.9 +;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org] 16.10 +;;; Last modified Tue May 4 10:25:55 1999 on firestorm 16.11 ;;; $Id$ 16.12 16.13 ;; General variables 16.14 @@ -54,8 +54,8 @@ 16.15 16.16 ;----------- work variables ---------------------------------------- 16.17 (defvar YaTeX-typesetting-mode-map nil 16.18 - "Keymap used in YaTeX typesetting buffer" 16.19 -) 16.20 + "Keymap used in YaTeX typesetting buffer") 16.21 + 16.22 (if YaTeX-typesetting-mode-map nil 16.23 (setq YaTeX-typesetting-mode-map (make-keymap)) 16.24 ;(suppress-keymap YaTeX-typesetting-mode-map t) 16.25 @@ -295,25 +295,23 @@ 16.26 (beginning-of-line) 16.27 (re-search-forward cmntrx (match-beginning 0) t))))) 16.28 (store-match-data md) 16.29 - found) 16.30 -) 16.31 + found)) 16.32 16.33 (defun YaTeX-re-search-active-forward (regexp cmntrx &optional bound err cnt) 16.34 "Search REGEXP backward which is not commented out by regexp CMNTRX. 16.35 See also YaTeX-search-active-forward." 16.36 - (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-forward) 16.37 -) 16.38 + (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-forward)) 16.39 + 16.40 (defun YaTeX-search-active-backward (string cmntrx &optional bound err cnt) 16.41 "Search STRING backward which is not commented out by regexp CMNTRX. 16.42 See also YaTeX-search-active-forward." 16.43 - (YaTeX-search-active-forward string cmntrx bound err cnt 'search-backward) 16.44 -) 16.45 + (YaTeX-search-active-forward string cmntrx bound err cnt 'search-backward)) 16.46 + 16.47 (defun YaTeX-re-search-active-backward (regexp cmntrx &optional bound err cnt) 16.48 "Search REGEXP backward which is not commented out by regexp CMNTRX. 16.49 See also YaTeX-search-active-forward." 16.50 - (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-backward) 16.51 -) 16.52 - 16.53 + (YaTeX-search-active-forward 16.54 + regexp cmntrx bound err cnt 're-search-backward)) 16.55 16.56 ;;;###autoload 16.57 (defun YaTeX-switch-to-buffer (file &optional setbuf) 16.58 @@ -333,8 +331,7 @@ 16.59 (find-file file)) 16.60 (current-buffer))) 16.61 (t (message "%s was not found in this directory." file) 16.62 - nil))) 16.63 -) 16.64 + nil)))) 16.65 16.66 ;;;###autoload 16.67 (defun YaTeX-switch-to-buffer-other-window (file) 16.68 @@ -348,8 +345,7 @@ 16.69 ((or YaTeX-create-file-prefix-g (file-exists-p file)) 16.70 (find-file-other-window file) t) 16.71 (t (message "%s was not found in this directory." file) 16.72 - nil)) 16.73 -) 16.74 + nil))) 16.75 16.76 (defun YaTeX-replace-format-sub (string format repl) 16.77 (let ((beg (or (string-match (concat "^\\(%" format "\\)") string) 16.78 @@ -358,8 +354,7 @@ 16.79 (if (null beg) string ;no conversion 16.80 (concat 16.81 (substring string 0 (match-beginning 1)) repl 16.82 - (substring string (match-end 1))))) 16.83 -) 16.84 + (substring string (match-end 1)))))) 16.85 16.86 ;;;###autoload 16.87 (defun YaTeX-replace-format (string format repl) 16.88 @@ -369,8 +364,7 @@ 16.89 (while (not (string= 16.90 ans (setq string (YaTeX-replace-format-sub ans format repl)))) 16.91 (setq ans string)) 16.92 - string) 16.93 -) 16.94 + string)) 16.95 16.96 ;;;###autoload 16.97 (defun YaTeX-replace-format-args (string &rest args) 16.98 @@ -381,8 +375,7 @@ 16.99 (setq string 16.100 (YaTeX-replace-format string (int-to-string argp) (car args))) 16.101 (setq args (cdr args) argp (1+ argp)))) 16.102 - string 16.103 -) 16.104 + string) 16.105 16.106 ;;;###autoload 16.107 (defun rindex (string char) 16.108 @@ -448,8 +441,16 @@ 16.109 (switch-to-buffer (get-buffer-create buffer)) 16.110 (or select (select-window window))) 16.111 (t nil))) 16.112 - ))) 16.113 -) 16.114 + )))) 16.115 + 16.116 +(cond 16.117 + ((fboundp 'screen-height) 16.118 + (fset 'YaTeX-screen-height 'screen-height) 16.119 + (fset 'YaTeX-screen-width 'screen-width)) 16.120 + ((fboundp 'frame-height) 16.121 + (fset 'YaTeX-screen-height 'frame-height) 16.122 + (fset 'YaTeX-screen-width 'frame-width)) 16.123 + (t (error "I don't know how to run windows.el on this Emacs..."))) 16.124 16.125 ;;;###autoload 16.126 (defun split-window-calculate-height (height) 16.127 @@ -462,15 +463,14 @@ 16.128 (selected-window) 16.129 (max 16.130 (min 16.131 - (- (screen-height) 16.132 + (- (YaTeX-screen-height) 16.133 (if (numberp height) 16.134 (+ height 2) 16.135 - (/ (* (screen-height) 16.136 + (/ (* (YaTeX-screen-height) 16.137 (string-to-int height)) 16.138 100))) 16.139 - (- (screen-height) window-min-height 1)) 16.140 - window-min-height))) 16.141 -) 16.142 + (- (YaTeX-screen-height) window-min-height 1)) 16.143 + window-min-height)))) 16.144 16.145 ;;;###autoload 16.146 (defun YaTeX-window-list () 16.147 @@ -478,8 +478,7 @@ 16.148 (while (not (eq curw (setq win (next-window win)))) 16.149 (or (eq win (minibuffer-window)) 16.150 (setq wlist (cons win wlist)))) 16.151 - wlist) 16.152 -) 16.153 + wlist)) 16.154 16.155 ;;;###autoload 16.156 (defun substitute-all-key-definition (olddef newdef keymap) 16.157 @@ -497,8 +496,7 @@ 16.158 "Return (buffer-substring (match-beginning n) (match-beginning m))." 16.159 (if (match-beginning n) 16.160 (buffer-substring (match-beginning n) 16.161 - (match-end (or m n)))) 16.162 -) 16.163 + (match-end (or m n))))) 16.164 16.165 ;;;###autoload 16.166 (defun YaTeX-minibuffer-complete () 16.167 @@ -555,8 +553,7 @@ 16.168 (if (eq (try-completion compl minibuffer-completion-table) t) 16.169 (exit-minibuffer) 16.170 (funcall displist))))) 16.171 - (store-match-data md)) 16.172 -) 16.173 + (store-match-data md))) 16.174 16.175 (defun YaTeX-minibuffer-quick-complete () 16.176 "Set 'quick to 't and call YaTeX-minibuffer-complete. 16.177 @@ -577,8 +574,7 @@ 16.178 (string-match pattern (buffer-file-name))) 16.179 (and (symbolp pattern) major-mode (eq major-mode pattern))) 16.180 (eval job)) 16.181 - (setq list (cdr list))))) 16.182 -) 16.183 + (setq list (cdr list)))))) 16.184 16.185 (defun goto-buffer-window (buffer) 16.186 "Select window which is bound to BUFFER. 16.187 @@ -604,8 +600,7 @@ 16.188 (let ((w (win:get-buffer-window buffer))) 16.189 (and w (win:switch-window w)))) 16.190 (select-window (get-buffer-window buffer))) 16.191 - (t (switch-to-buffer buffer)))) 16.192 -) 16.193 + (t (switch-to-buffer buffer))))) 16.194 16.195 ;; Here starts the functions which support gmhist-vs-Emacs19 compatible 16.196 ;; reading with history. 16.197 @@ -644,6 +639,18 @@ 16.198 (read-with-history-in hsym prompt init)) 16.199 (t (read-string prompt init)))) 16.200 16.201 +;;;###autoload 16.202 +(fset 'YaTeX-rassoc 16.203 + (if (and nil (fboundp 'rassoc) (subrp (symbol-function 'rassoc))) 16.204 + (symbol-function 'rassoc) 16.205 + (lambda (key list) 16.206 + (let ((l list)) 16.207 + (catch 'found 16.208 + (while l 16.209 + (if (equal key (cdr (car l))) 16.210 + (throw 'found (car l))) 16.211 + (setq l (cdr l)))))))) 16.212 + 16.213 ;;; 16.214 ;; Interface function for windows.el 16.215 ;;; 16.216 @@ -719,8 +726,7 @@ 16.217 (throw 'begin t))))) 16.218 (buffer-substring 16.219 (progn (skip-chars-forward open) (1+ (point))) 16.220 - (progn (skip-chars-forward close) (point)))))) 16.221 -) 16.222 + (progn (skip-chars-forward close) (point))))))) 16.223 16.224 (defun YaTeX-end-environment () 16.225 "Close opening environment" 16.226 @@ -744,8 +750,7 @@ 16.227 (sit-for (if YaTeX-dos 2 1)) 16.228 (message "Matches with %s at line %d" 16.229 (YaTeX-replace-format-args YaTeX-struct-begin env "" "") 16.230 - (count-lines (point-min) (point))))))) 16.231 -) 16.232 + (count-lines (point-min) (point)))))))) 16.233 16.234 ;;;VER2 16.235 (defun YaTeX-insert-struc (what env) 16.236 @@ -755,8 +760,7 @@ 16.237 YaTeX-struct-begin env (YaTeX-addin env)))) 16.238 ((eq what 'end) 16.239 (insert (YaTeX-replace-format-args YaTeX-struct-end env))) 16.240 - (t nil)) 16.241 -) 16.242 + (t nil))) 16.243 16.244 ;;; Function for menu support 16.245 (defun YaTeX-define-menu (keymap bindlist)
17.1 --- a/yatexmth.el Mon Oct 26 12:05:32 1998 +0000 17.2 +++ b/yatexmth.el Thu Jul 15 04:58:26 1999 +0000 17.3 @@ -1,8 +1,8 @@ 17.4 ;;; -*- Emacs-Lisp -*- 17.5 ;;; YaTeX math-mode-specific functions. 17.6 ;;; yatexmth.el 17.7 -;;; (c )1993-1998 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 17.8 -;;; Last modified Wed Sep 30 21:26:29 1998 on firestorm 17.9 +;;; (c )1993-1999 by HIROSE Yuuji [yuuji@gentei.org] 17.10 +;;; Last modified Thu Apr 29 17:39:10 1999 on firestorm 17.11 ;;; $Id$ 17.12 17.13 ;;; [Customization guide] 17.14 @@ -226,6 +226,7 @@ 17.15 ("v||" "Downarrow" "||\n\\/") 17.16 ("|->" "mapsto" ("|->" "|→")) 17.17 ("<-)" "hookleftarrow" (" ,\n<--+" " ヽ\n<--/")) 17.18 + ("(->" "hookrightarrow" ("`\n+-->" "/\n\-->")) 17.19 ("/-" "leftharpoonup" "/\n~~~") 17.20 ("\\-" "leftharpoondown" "__\n\\") 17.21 ("-/" "rightharpoondown" "__\n/") 17.22 @@ -474,6 +475,7 @@ 17.23 ;; And math modes of AMS-LaTeX 17.24 '("align" "align*" "split" "multline" "multline*" "gather" 17.25 "gather*" "aligned*" "gathered" "gathered*" "alignat" 17.26 + "equation*" "cases" 17.27 "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*")))) 17.28 (let*((p (point)) (nest 0) me0 17.29 (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l")) 17.30 @@ -733,6 +735,218 @@ 17.31 (setq list (cdr list))) 17.32 (setq lists (cdr lists)))))) 17.33 17.34 +;;; ----- for AMS LaTeX (by matsu@math.s.chiba-u.ac.jp) ----- 17.35 +(defvar YaTeX-ams-paren-modifier 17.36 + '(("Biggl" . "Biggr") ("biggl" . "biggr") 17.37 + ("Bigl" . "Bigr") ("bigl" . "bigr") 17.38 + ("left" . "right") ("" . "")) 17.39 + "Alist of modifier of parentheses.") 17.40 + 17.41 +(defvar YaTeX-left-paren "(\\|\\[\\|\\\\{") 17.42 +(defvar YaTeX-right-paren ")\\|\\]\\|\\\\}") 17.43 +(defvar YaTeX-paren 17.44 + (concat YaTeX-left-paren "\\|" YaTeX-right-paren)) 17.45 + 17.46 +(defun YaTeX-on-parenthesis-p () 17.47 + "If cursor is on an (AMS-LaTeX) parenthesis, return the parenthesis." 17.48 + (interactive) 17.49 + (let* ((list YaTeX-ams-paren-modifier) 17.50 + (longest 0) ;; the longest length of parenthesis command strings 17.51 + (flag t) ;; flag for whether on braces not following \ 17.52 + (point (point)) 17.53 + (move 0) 17.54 + (paren)) 17.55 + (while list 17.56 + (setq longest 17.57 + (max longest (length (car (car list))) (length (cdr (car list))))) 17.58 + (setq list (cdr list))) 17.59 + (save-excursion 17.60 + ;; search {} and, if it does not follow `\', set flag nil. 17.61 + ;; if it is right after `\', set flag t and move to the position of \. 17.62 + ;; mmmmm. 17.63 + (if (looking-at "{\\|}") 17.64 + (if (not (equal (char-after (1- (point))) 92)) 17.65 + (setq flag nil) 17.66 + (forward-char -1))) 17.67 + ;; if flag is nil, do nothing. 17.68 + (if (and flag (re-search-forward YaTeX-paren 17.69 + (+ (point) 3 longest) t)) 17.70 + (progn 17.71 + (setq move (- (point) point)) 17.72 + (setq paren (match-string 0)) 17.73 + (setq list YaTeX-ams-paren-modifier) 17.74 + ;; criterion for whether on [] () \{\} or not. 17.75 + (if (string-match YaTeX-left-paren paren) 17.76 + (while (and list flag) 17.77 + (let* ((mod (car (car list))) 17.78 + (mod-length 0) ;; length of modifier 17.79 + paren-regexp ;; regexp of paren. 17.80 + mod-regexp) ;; regexp of modifier. 17.81 + (if (> (length mod) 0) 17.82 + (setq mod-regexp (concat "\\\\" mod) 17.83 + mod-length (1+ (length mod)))) 17.84 + (cond ((string= paren "\\{") 17.85 + (setq paren-regexp (concat "\\" paren))) 17.86 + ((string= paren "[") 17.87 + (setq paren-regexp "\\[")) 17.88 + (t (setq paren-regexp paren))) 17.89 + (save-excursion 17.90 + (if (and (>= (- (point) (point-min)) 17.91 + (+ mod-length (length paren))) 17.92 + (not (forward-char 17.93 + (- 0 mod-length (length paren)))) 17.94 + (looking-at (concat "\\(" mod-regexp "\\)\\(" 17.95 + paren-regexp "\\)"))) 17.96 + (setq flag nil))) 17.97 + (setq list (cdr list)))) 17.98 + (while (and list flag) 17.99 + (let* ((mod (cdr (car list))) 17.100 + (mod-length 0) 17.101 + paren-regexp 17.102 + mod-regexp) 17.103 + (if (> (length mod) 0) 17.104 + (setq mod-regexp (concat "\\\\" mod) 17.105 + mod-length (1+ (length mod)))) 17.106 + (cond ((string= paren "\\}") 17.107 + (setq paren-regexp (concat "\\" paren))) 17.108 + ((string= paren "]") 17.109 + (setq paren-regexp "\\]")) 17.110 + (t (setq paren-regexp paren))) 17.111 + (save-excursion 17.112 + (if (and (>= (- (point) (point-min)) 17.113 + (+ mod-length (length paren))) 17.114 + (not (forward-char 17.115 + (- 0 mod-length (length paren)))) 17.116 + (looking-at (concat "\\(" mod-regexp "\\)\\(" 17.117 + paren-regexp "\\)"))) 17.118 + (setq flag nil))) 17.119 + (setq list (cdr list))))) 17.120 + (if (<= move (length (match-string 0))) 17.121 + (match-string 0))))))) 17.122 + 17.123 +(defun YaTeX-goto-open-paren () 17.124 + "Jump to the exact position of open parenthesis" 17.125 + (interactive) 17.126 + (let ((paren) 17.127 + (backslash-syntax (char-to-string (char-syntax ?\\)))) 17.128 + (if (setq paren (YaTeX-on-parenthesis-p)) 17.129 + (if (string-match "(\\|{\\|\\[" paren (1- (length paren))) 17.130 + (progn 17.131 + (re-search-forward "(\\|{\\|\\[" (+ (point) (length paren)) t) 17.132 + (backward-char)) 17.133 + (re-search-forward ")\\|}\\|\\]" (+ (point) (length paren)) t) 17.134 + (unwind-protect 17.135 + (progn 17.136 + (modify-syntax-entry ?\\ " ") 17.137 + (backward-list)) 17.138 + (modify-syntax-entry ?\\ backslash-syntax)))))) 17.139 + 17.140 +(defun YaTeX-change-parentheses () 17.141 + "Change the size of parentheses, braces, and brackets of AMS-LaTeX." 17.142 + (interactive) 17.143 + (if (not (and YaTeX-use-AMS-LaTeX (YaTeX-on-parenthesis-p))) 17.144 + nil 17.145 + (let* ((mod (match-string 1)) ;; modifier 17.146 + (paren (if mod (match-string 2) (match-string 0))) ;; paren 17.147 + (mod-length (if (or (string= mod "\\left") (string= mod "\\right")) 17.148 + 5 ;; 5 in case left or right 17.149 + (length mod))) ;; length of modifier 17.150 + (paren-length (length paren)) ;; length of paren 17.151 + (length (+ mod-length paren-length)) ;; length of whole string 17.152 + (big-p t) ;; flag whether new modifier is "[Bb]ig+" or not. 17.153 + size ;; left, big, Big etc. 17.154 + lr ;; "l" or "r". 17.155 + char newsize newsize-length 17.156 + (backslash-syntax (char-to-string (char-syntax ?\\))) 17.157 + (case-fold-search)) 17.158 + ;; decide lr and size from mod and paren. 17.159 + (cond ((string-match "\\(\\\\[Bb]ig+\\)[lr]" mod) 17.160 + (setq size (substring mod 1 (match-end 1)) 17.161 + lr (substring mod (match-end 1) (match-end 0)))) 17.162 + ((string-match "\\\\left" mod) 17.163 + (setq size "left-right" lr "l")) 17.164 + ((string-match "\\\\right" mod) 17.165 + (setq size "left-right" lr "r")) 17.166 + ((string-match "(\\|\\[\\|\\\\{" paren) 17.167 + (setq size "null" lr "l")) 17.168 + ((string-match ")\\|\\]\\|\\\\}" paren) 17.169 + (setq size "null" lr "r")) 17.170 + (t 17.171 + (setq size nil lr nil))) 17.172 + (while (not newsize) 17.173 + (message (format (concat "Change from %s: " 17.174 + "l(big) L(Big) h(bigg) H(Bigg) " 17.175 + "r(left-right) n(NONE) ") size)) 17.176 + (setq char (read-char) 17.177 + newsize (cond ((char-equal char ?l) "\\big") 17.178 + ((char-equal char ?L) "\\Big") 17.179 + ((char-equal char ?h) "\\bigg") 17.180 + ((char-equal char ?H) "\\Bigg") 17.181 + ((char-equal char ?r) 17.182 + (setq big-p nil) "\\left") 17.183 + ((char-equal char ?n) 17.184 + (setq big-p nil) "") 17.185 + (t nil)) 17.186 + newsize-length (length newsize))) 17.187 + (YaTeX-goto-open-paren) 17.188 + (forward-char) 17.189 + (delete-region (- (point) length) (- (point) paren-length)) 17.190 + (backward-char paren-length) 17.191 + (insert-string newsize) 17.192 + (if big-p (insert ?l)) 17.193 + (forward-char (1- paren-length)) 17.194 + (unwind-protect 17.195 + (progn 17.196 + (modify-syntax-entry ?\\ " ") 17.197 + (forward-list) 17.198 + (if (string= size "left-right") (setq length (1+ length))) 17.199 + (if (eq char ?r) (setq newsize "\\right")) 17.200 + (delete-region (- (point) length) (- (point) paren-length)) 17.201 + (backward-char paren-length) 17.202 + (insert-string newsize) 17.203 + (if big-p (insert ?r)) 17.204 + (forward-char paren-length) 17.205 + (if (string= lr "l") (backward-list))) 17.206 + (modify-syntax-entry ?\\ backslash-syntax)) 17.207 + t))) 17.208 + 17.209 +(defun YaTeX-insert-amsparens-region (beg end char) 17.210 + (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ") 17.211 + (let* ((case-fold-search) 17.212 + (st (cond ((char-equal char ?l) "big") 17.213 + ((char-equal char ?L) "Big") 17.214 + ((char-equal char ?h) "bigg") 17.215 + ((char-equal char ?H) "Bigg")))) 17.216 + (if st 17.217 + (YaTeX-insert-braces-region 17.218 + beg end (concat "\\" st "l(") (concat "\\" st "r)")) 17.219 + (YaTeX-insert-braces-region beg end "(" ")")))) 17.220 + 17.221 +(defun YaTeX-insert-amsbraces-region (beg end char) 17.222 + (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ") 17.223 + (let* ((case-fold-search) 17.224 + (st (cond ((char-equal char ?l) "big") 17.225 + ((char-equal char ?L) "Big") 17.226 + ((char-equal char ?h) "bigg") 17.227 + ((char-equal char ?H) "Bigg")))) 17.228 + (if st 17.229 + (YaTeX-insert-braces-region 17.230 + beg end (concat "\\" st "l\\{") (concat "\\" st "r\\}")) 17.231 + (YaTeX-insert-braces-region beg end "\\{" "\\}")))) 17.232 + 17.233 +(defun YaTeX-insert-amsbrackets-region (beg end char) 17.234 + (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ") 17.235 + (let* ((case-fold-search) 17.236 + (st (cond ((char-equal char ?l) "big") 17.237 + ((char-equal char ?L) "Big") 17.238 + ((char-equal char ?h) "bigg") 17.239 + ((char-equal char ?H) "Bigg")))) 17.240 + (if st 17.241 + (YaTeX-insert-braces-region 17.242 + beg end (concat "\\" st "l[") (concat "\\" st "r]")) 17.243 + (YaTeX-insert-braces-region beg end "[" "]")))) 17.244 + 17.245 + 17.246 ;; 17.247 (provide 'yatexmth) 17.248
18.1 --- a/yatexprc.el Mon Oct 26 12:05:32 1998 +0000 18.2 +++ b/yatexprc.el Thu Jul 15 04:58:26 1999 +0000 18.3 @@ -1,16 +1,16 @@ 18.4 ;;; -*- Emacs-Lisp -*- 18.5 ;;; YaTeX process handler. 18.6 ;;; yatexprc.el 18.7 -;;; (c )1993-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 18.8 -;;; Last modified Mon Mar 9 11:44:29 1998 on crx 18.9 +;;; (c )1993-1999 by HIROSE Yuuji.[yuuji@gentei.org] 18.10 +;;; Last modified Tue Jul 13 13:47:46 1999 on firestorm 18.11 ;;; $Id$ 18.12 18.13 ;(require 'yatex) 18.14 (require 'yatexlib) 18.15 18.16 (defvar YaTeX-typeset-process nil 18.17 - "Process identifier for jlatex" 18.18 -) 18.19 + "Process identifier for jlatex") 18.20 + 18.21 (defvar YaTeX-typeset-buffer "*YaTeX-typesetting*" 18.22 "Process buffer for jlatex") 18.23 18.24 @@ -44,8 +44,7 @@ 18.25 (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax) 18.26 (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax) 18.27 (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax) 18.28 - (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax) 18.29 -) 18.30 + (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax)) 18.31 18.32 (defun YaTeX-typeset (command buffer &optional prcname modename) 18.33 "Execute jlatex (or other) to LaTeX typeset." 18.34 @@ -55,7 +54,7 @@ 18.35 (map YaTeX-typesetting-mode-map) 18.36 (outcode 18.37 (cond ((eq major-mode 'yatex-mode) YaTeX-coding-system) 18.38 - ((eq major-mode 'yahtml-mode) yahtml-coding-system)))) 18.39 + ((eq major-mode 'yahtml-mode) yahtml-kanji-code)))) 18.40 (if (and YaTeX-typeset-process 18.41 (eq (process-status YaTeX-typeset-process) 'run)) 18.42 ;; if tex command is halting. 18.43 @@ -118,8 +117,7 @@ 18.44 (recenter -1)) 18.45 (select-window window) 18.46 (switch-to-buffer cb) 18.47 - (YaTeX-remove-nonstopmode))) 18.48 -) 18.49 + (YaTeX-remove-nonstopmode)))) 18.50 18.51 (defun YaTeX-typeset-sentinel (proc mes) 18.52 (cond ((null (buffer-name (process-buffer proc))) 18.53 @@ -160,12 +158,10 @@ 18.54 (set-buffer-modified-p (buffer-modified-p)) 18.55 ) 18.56 (select-window owin) 18.57 - (set-buffer obuf)))) 18.58 -) 18.59 + (set-buffer obuf))))) 18.60 18.61 (defvar YaTeX-texput-file "texput.tex" 18.62 - "*File name for temporary file of typeset-region." 18.63 -) 18.64 + "*File name for temporary file of typeset-region.") 18.65 18.66 (defun YaTeX-typeset-region () 18.67 "Paste the region to the file `texput.tex' and execute typesetter. 18.68 @@ -247,9 +243,7 @@ 18.69 (switch-to-buffer buffer) ;for Emacs-19 18.70 (put 'dvi2-command 'region t) 18.71 (put 'dvi2-command 'file buffer) 18.72 - (put 'dvi2-command 'offset lineinfo) 18.73 - )) 18.74 -) 18.75 + (put 'dvi2-command 'offset lineinfo)))) 18.76 18.77 (defun YaTeX-typeset-buffer () 18.78 "Typeset whole buffer. 18.79 @@ -303,8 +297,7 @@ 18.80 (exchange-point-and-mark))) 18.81 (switch-to-buffer cb)) ;for 19 18.82 (YaTeX-typeset cmd YaTeX-typeset-buffer) 18.83 - (put 'dvi2-command 'region nil)) 18.84 -) 18.85 + (put 'dvi2-command 'region nil))) 18.86 18.87 (defvar YaTeX-call-command-history nil 18.88 "Holds history list of YaTeX-call-command-on-file.") 18.89 @@ -316,15 +309,13 @@ 18.90 "Call command: " 18.91 (concat base-cmd " " (YaTeX-get-preview-file-name)) 18.92 'YaTeX-call-command-history) 18.93 - buffer) 18.94 -) 18.95 + buffer)) 18.96 18.97 (defun YaTeX-bibtex-buffer (cmd) 18.98 "Pass the bibliography data of editing file to bibtex." 18.99 (interactive) 18.100 (YaTeX-save-buffers) 18.101 - (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" ) 18.102 -) 18.103 + (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" )) 18.104 18.105 (defun YaTeX-kill-typeset-process (proc) 18.106 "Kill process PROC after sending signal to PROC. 18.107 @@ -347,8 +338,7 @@ 18.108 (if (eq (process-status proc) 'run) 18.109 (progn 18.110 (interrupt-process proc) 18.111 - (delete-process proc))))) 18.112 -) 18.113 + (delete-process proc)))))) 18.114 18.115 (defun YaTeX-system (command buffer) 18.116 "Execute some command on buffer. Not a official function." 18.117 @@ -371,8 +361,7 @@ 18.118 (set-process-buffer 18.119 (start-process 18.120 "system" buffer shell-file-name YaTeX-shell-command-option command) 18.121 - (get-buffer buffer))))) 18.122 -) 18.123 + (get-buffer buffer)))))) 18.124 18.125 (defvar YaTeX-preview-command-history nil 18.126 "Holds minibuffer history of preview command.") 18.127 @@ -413,6 +402,12 @@ 18.128 (concat preview-command " " preview-file)) 18.129 (send-string-to-terminal "\e[>5l") ;show cursor 18.130 (redraw-display)) 18.131 + ((and (string-match "dviout" preview-command) ;maybe on `kon' 18.132 + (stringp (getenv "TERM")) 18.133 + (string-match "^kon" (getenv "TERM"))) 18.134 + (call-process shell-file-name "con" "*dvi-preview*" nil 18.135 + YaTeX-shell-command-option 18.136 + (concat preview-command " " preview-file))) 18.137 (t ;if UNIX 18.138 (set-process-buffer 18.139 (start-process "preview" "*dvi-preview*" shell-file-name 18.140 @@ -421,8 +416,7 @@ 18.141 (get-buffer pbuffer)) 18.142 (message 18.143 (concat "Starting " preview-command 18.144 - " to preview " preview-file)))))) 18.145 -) 18.146 + " to preview " preview-file))))))) 18.147 18.148 (defvar YaTeX-xdvi-remote-program "xdvi") 18.149 (defun YaTeX-xdvi-remote-search (&optional region-mode) 18.150 @@ -447,8 +441,7 @@ 18.151 "xdvi" pb YaTeX-xdvi-remote-program 18.152 "-remote" (format "SloppySearch(%s) " str) 18.153 (concat (YaTeX-get-preview-file-name) ".dvi"))) 18.154 - (message "Searching `%s'...Done" str))) 18.155 -) 18.156 + (message "Searching `%s'...Done" str)))) 18.157 18.158 (defun YaTeX-set-virtual-error-position (file-sym line-sym) 18.159 "Replace the value of FILE-SYM, LINE-SYM by virtual error position." 18.160 @@ -508,8 +501,7 @@ 18.161 (recenter (/ (window-height) 2)) 18.162 (sit-for 1) 18.163 (goto-char (match-beginning 0)) 18.164 - (select-window error-win)) 18.165 -) 18.166 + (select-window error-win))) 18.167 18.168 (defun YaTeX-jump-error-line () 18.169 "Jump to corresponding line on latex command's error message." 18.170 @@ -531,8 +523,7 @@ 18.171 (if (null error-buf) 18.172 (error "`%s' is not found in this directory." error-file)) 18.173 (YaTeX-showup-buffer error-buf nil t) 18.174 - (goto-line error-line)) 18.175 -) 18.176 + (goto-line error-line))) 18.177 18.178 (defun YaTeX-send-string () 18.179 "Send string to current typeset process." 18.180 @@ -550,8 +541,7 @@ 18.181 (insert "\n") 18.182 (set-marker (process-mark YaTeX-typeset-process) (point)) 18.183 (insert " ")) 18.184 - (ding)) 18.185 -) 18.186 + (ding))) 18.187 18.188 (defun YaTeX-view-error () 18.189 (interactive) 18.190 @@ -564,8 +554,7 @@ 18.191 ;;(goto-char (point-max)) 18.192 ;;(forward-line -1) 18.193 ;;(recenter -1) 18.194 - (select-window win))) 18.195 -) 18.196 + (select-window win)))) 18.197 18.198 (defun YaTeX-get-error-file (default) 18.199 "Get current processing file from typesetting log." 18.200 @@ -589,8 +578,7 @@ 18.201 (progn (forward-char 1) (point)) 18.202 (progn (skip-chars-forward "^ \n" (point-end-of-line)) 18.203 (point)))) 18.204 - (if (string= "" s) default s))) 18.205 -) 18.206 + (if (string= "" s) default s)))) 18.207 18.208 (defun YaTeX-put-nonstopmode () 18.209 (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) 18.210 @@ -600,9 +588,7 @@ 18.211 (YaTeX-visit-main t) 18.212 (goto-char (point-min)) 18.213 (insert "\\nonstopmode{}%_YaTeX_%\n") 18.214 - (if (buffer-file-name) (basic-save-buffer)))) 18.215 - ) 18.216 -) 18.217 + (if (buffer-file-name) (basic-save-buffer)))))) 18.218 18.219 (defun YaTeX-remove-nonstopmode () 18.220 (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) ;for speed 18.221 @@ -613,8 +599,7 @@ 18.222 (narrow-to-region (point-min) (point)) 18.223 (goto-char (point-min)) 18.224 (delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$") 18.225 - (widen))) 18.226 -) 18.227 + (widen)))) 18.228 18.229 (defun YaTeX-get-preview-file-name () 18.230 "Get file name to preview by inquiring YaTeX-get-latex-command" 18.231 @@ -627,9 +612,7 @@ 18.232 (buffer-file-name)) 18.233 0 -4)) 18.234 (setq period (rindex fname ?.)) 18.235 - (setq fname (substring fname 0 (if (eq -1 period) nil period))) 18.236 - )) 18.237 -) 18.238 + (setq fname (substring fname 0 (if (eq -1 period) nil period)))))) 18.239 18.240 (defun YaTeX-get-latex-command (&optional switch) 18.241 "Specify the latex-command name and its argument. 18.242 @@ -659,8 +642,7 @@ 18.243 (switch (if (string-match "\\s " magic) magic 18.244 (concat magic " " parent))) 18.245 (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) 18.246 - (t (concat tex-command " " (if switch parent))))) 18.247 -) 18.248 + (t (concat tex-command " " (if switch parent)))))) 18.249 18.250 (defvar YaTeX-lpr-command-history nil 18.251 "Holds command line history of YaTeX-lpr.") 18.252 @@ -720,9 +702,7 @@ 18.253 (start-process "print" "*dvi-printing*" shell-file-name 18.254 YaTeX-shell-command-option cmd) 18.255 (get-buffer lbuffer)) 18.256 - (message "Starting printing command: %s..." cmd))) 18.257 - )) 18.258 -) 18.259 + (message "Starting printing command: %s..." cmd)))))) 18.260 18.261 (defun YaTeX-main-file-p () 18.262 "Return if current buffer is main LaTeX source." 18.263 @@ -736,8 +716,7 @@ 18.264 (let ((latex-main-id 18.265 (concat "^\\s *" YaTeX-ec-regexp "document\\(style\\|class\\)"))) 18.266 (or (re-search-backward latex-main-id nil t) 18.267 - (re-search-forward latex-main-id nil t)))))) 18.268 -) 18.269 + (re-search-forward latex-main-id nil t))))))) 18.270 18.271 (defun YaTeX-visit-main (&optional setbuf) 18.272 "Switch buffer to main LaTeX source. 18.273 @@ -767,9 +746,7 @@ 18.274 (setq YaTeX-parent-file main-file) 18.275 (YaTeX-switch-to-buffer main-file setbuf)) 18.276 ))) 18.277 - nil 18.278 -) 18.279 - 18.280 + nil) 18.281 18.282 (defun YaTeX-guess-parent (command-line) 18.283 (setq command-line 18.284 @@ -780,16 +757,14 @@ 18.285 (concat (if (string-match "\\(.*\\)\\." command-line) 18.286 (substring command-line (match-beginning 1) (match-end 1)) 18.287 command-line) 18.288 - ".tex")) 18.289 -) 18.290 + ".tex"))) 18.291 18.292 (defun YaTeX-visit-main-other-window () 18.293 "Switch to buffer main LaTeX source in other window." 18.294 (interactive) 18.295 (if (YaTeX-main-file-p) (message "I think this is main LaTeX source.") 18.296 (YaTeX-switch-to-buffer-other-window 18.297 - (concat (YaTeX-get-preview-file-name) ".tex"))) 18.298 -) 18.299 + (concat (YaTeX-get-preview-file-name) ".tex")))) 18.300 18.301 (defun YaTeX-get-builtin (key) 18.302 "Read source built-in command of %# usage." 18.303 @@ -801,8 +776,7 @@ 18.304 (buffer-substring 18.305 (progn (skip-chars-forward " " (point-end-of-line))(point)) 18.306 (point-end-of-line)) 18.307 - nil)) 18.308 -) 18.309 + nil))) 18.310 18.311 (defun YaTeX-save-buffers () 18.312 "Save buffers whose major-mode is equal to current major-mode." 18.313 @@ -816,7 +790,6 @@ 18.314 (buffer-modified-p buf) 18.315 (y-or-n-p (format "Save %s" (buffer-name buf)))) 18.316 (save-buffer buf))) 18.317 - (buffer-list)))) 18.318 -) 18.319 + (buffer-list))))) 18.320 18.321 (provide 'yatexprc)