yatex
changeset 58:3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
author | yuuji |
---|---|
date | Thu, 01 Feb 1996 18:55:47 +0000 |
parents | 18f4939986e6 |
children | 48ac97a6b6ce |
files | docs/qanda.eng docs/yatex.ref docs/yatexe.tex docs/yatexj.tex help/YATEXHLP.jp yahtml.el yatex.el yatex.new yatex19.el yatexadd.el yatexenv.el yatexhks.el yatexhlp.el yatexlib.el yatexm-o.el yatexmth.el yatexprc.el yatexsec.el |
diffstat | 18 files changed, 1306 insertions(+), 267 deletions(-) [+] |
line diff
1.1 --- a/docs/qanda.eng Sat Dec 02 18:35:28 1995 +0000 1.2 +++ b/docs/qanda.eng Thu Feb 01 18:55:47 1996 +0000 1.3 @@ -52,9 +52,11 @@ 1.4 ============ 1.5 *I accidentally learned in a wrong LaTeX command. 1.6 1.7 - There should be a line with the wrong command in the .yatexrc 1.8 - file in you home or current directory. Erase that line, do M-x 1.9 - eval-current-buffer and save the results with C-x C-s. 1.10 + There should be a line with the wrong command in the .yatexrc 1.11 + file in your home or current directory. Erase or fix that line, 1.12 + and save the results with C-x C-s, then kill buffer with C-x k. 1.13 + Once you make sure the current buffer is your LaTeX source, type 1.14 + M-x YaTeX-reload-dictionary. 1.15 1.16 *I can't comment out the region. 1.17 1.18 @@ -294,6 +296,16 @@ 1.19 yatexhks.el will be read in at the end of YaTeX's 1.20 initialization, so you can overwrite definitions in yatexadd.el. 1.21 1.22 +*Can I make intelligent newline work for my `mylist' environment? 1.23 + 1.24 + Yes. See the section `Intelligent newline' in the info manual. 1.25 + But if you want the same as the intelligent newline for itemize 1.26 + environment which inserts simply `\item', the following code is 1.27 + efficient. 1.28 + 1.29 + (fset 'YaTeX-intelligent-newline-mylist 1.30 + 'YaTeX-intelligent-newline-itemize) 1.31 + 1.32 [ETC] 1.33 ===== 1.34 *Mailing lists? 1.35 @@ -315,6 +327,16 @@ 1.36 it yet, yes, this mailing list is in Japanese. But give us a 1.37 try anyway. You're always welcome. 1.38 1.39 +*How to get the up-to-date information on YaTeX? 1.40 + 1.41 + If you can access WWW, try to see; 1.42 + http://www.comp.ae.keio.ac.jp/~yuuji/yatex/ 1.43 + And if you trace the link of `yatex-current', you can get the 1.44 + really latest version of YaTeX. Since it collects the elisps in 1.45 + the author's source directory, what you'll get may contain some 1.46 + errors. The author cannot respond to your query about 1.47 + yatex-current. 1.48 + 1.49 *Help, help HELP!! 1.50 1.51 Ways of getting answers in fastest order.
2.1 --- a/docs/yatex.ref Sat Dec 02 18:35:28 1995 +0000 2.2 +++ b/docs/yatex.ref Thu Feb 01 18:55:47 1996 +0000 2.3 @@ -51,6 +51,7 @@ 2.4 ◆プリントアウト [prefix] tl 2.5 ◆プリントアウト(全ページ) C-u [prefix] tl 2.6 ◆プレビューア起動 [prefix] tp 2.7 + ◆xdvi上で文字列サーチ [prefix] ts ※※ 2.8 ◆lpq起動 [prefix] tq 2.9 ◆jlatex起動(領域指定) [prefix] tr 2.10 2.11 @@ -58,6 +59,7 @@ 2.12 は覚えなくて構いません。 2.13 2.14 ※は、MS-DOS では無効です。 2.15 + ※※は、-remote 機能付きの xdvi でのみ有効です。 2.16 2.17 [prefix] tr の領域指定は、文書中の、 %#BEGIN と書いてある行か 2.18 ら、%#END と書いてある行までです。%#END を省略すると、%#BEGINか
3.1 --- a/docs/yatexe.tex Sat Dec 02 18:35:28 1995 +0000 3.2 +++ b/docs/yatexe.tex Thu Feb 01 18:55:47 1996 +0000 3.3 @@ -25,7 +25,7 @@ 3.4 @cindex YaTeX 3.5 3.6 @menu 3.7 -* What is YaTeX?:: Introduction 3.8 +* What is YaTeX?:: 3.9 * Main features:: What YaTeX can do 3.10 * Installation:: Guide to install 3.11 * Typesetting:: Call typesetting processes 3.12 @@ -48,6 +48,12 @@ 3.13 3.14 --- The Detailed Node Listing --- 3.15 3.16 +Typesetting 3.17 + 3.18 +* Calling typesetter:: 3.19 +* Calling previewer:: 3.20 +* Printing out:: 3.21 + 3.22 %# notation 3.23 3.24 * Changing typesetter:: 3.25 @@ -91,12 +97,12 @@ 3.26 3.27 Procedure 3.28 3.29 -* How the add-in function works?:: 3.30 +* How the add-in function works:: 3.31 * How the function is called:: 3.32 * Useful functions for creating add-in:: 3.33 * Contribution:: 3.34 3.35 -How the add-in function works? 3.36 +How the add-in function works 3.37 3.38 * Defining `option add-in':: 3.39 * Defining `argument add-in':: 3.40 @@ -138,7 +144,7 @@ 3.41 @item Easy input of accent mark, math-mode's commands and Greek letters 3.42 (@kbd{C-c a}, @kbd{;}, @kbd{:}) 3.43 @item Online help for the popular La@TeX{} commands 3.44 - (@kbd{C-c ?}, @kbd{C-c /})(English help is not yet supported) 3.45 + (@kbd{C-c ?}, @kbd{C-c /}) 3.46 @item Document files hierarchy browser (@kbd{C-c d}) 3.47 @end itemize 3.48 3.49 @@ -189,25 +195,37 @@ 3.50 strokes execute typeset or preview command. 3.51 3.52 @table @kbd 3.53 -@item [prefix] tj 3.54 +@item [prefix] t j 3.55 @dots{} invoke latex 3.56 -@item [prefix] tr 3.57 +@item [prefix] t r 3.58 @dots{} invoke latex on region 3.59 -@item [prefix] tk 3.60 +@item [prefix] t k 3.61 @dots{} kill current typesetting process 3.62 -@item [prefix] tb 3.63 +@item [prefix] t b 3.64 @dots{} invoke bibtex 3.65 -@item [prefix] tp 3.66 +@item [prefix] t p 3.67 @dots{} preview 3.68 -@item [prefix] tl 3.69 +@item [prefix] t l 3.70 @dots{} lpr dvi-file 3.71 +@item [prefix] t s 3.72 + @dots{} search current string on xdvi-remote 3.73 @end table 3.74 3.75 - The current editing window will be divided horizontally when you 3.76 -invoke latex command, and log message of La@TeX{} typesetting will be 3.77 -displayed in the other window; called typesetting buffer. The 3.78 -typesetting buffer automatically scrolls up and traces La@TeX{} 3.79 -warnings and error messages. If you see latex stopping by an 3.80 +@menu 3.81 +* Calling typesetter:: 3.82 +* Calling previewer:: 3.83 +* Printing out:: 3.84 +@end menu 3.85 + 3.86 +@node Calling typesetter, Calling previewer, Typesetting, Typesetting 3.87 +@comment node-name, next, previous, up 3.88 +@section{Calling typesetter} 3.89 + 3.90 + Typing @kbd{[prefix] t j}, the current editing window will be divided 3.91 +horizontally when you invoke latex command, and log message of La@TeX{} 3.92 +typesetting will be displayed in the other window; called typesetting 3.93 +buffer. The typesetting buffer automatically scrolls up and traces 3.94 +La@TeX{} warnings and error messages. If you see latex stopping by an 3.95 error, you can send string to latex in the typesetting buffer. 3.96 3.97 If an error stops the La@TeX{} typesetting, this key stroke will 3.98 @@ -233,8 +251,23 @@ 3.99 file if you edit one file, and is the same as main file's if you 3.100 edit splitting files. 3.101 3.102 - YaTeX asks you the range of dvi-printing by default. You can 3.103 -skip this by invoking it with universal-argument as follows: 3.104 +@node Calling previewer, Printing out, Calling typesetter, Typesetting 3.105 +@comment node-name, next, previous, up 3.106 +@section{Calling previewer} 3.107 + 3.108 + @kbd{[prefix] t p} invokes the TeX previewer. And if you are using 3.109 +xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t 3.110 +s} enables you to search current string at the cursor on the running xdvi 3.111 +window. You can get xdvi with `-remote feature' from; 3.112 +@code{ftp://ftp.ae.keio.ac.jp/pub/text/xdvi/xdvi-remote}. 3.113 + 3.114 +@node Printing out, , Calling previewer, Typesetting 3.115 +@comment node-name, next, previous, up 3.116 +@section{Printing out} 3.117 + 3.118 + When you type @code{[preifx] t l}, YaTeX asks you the range of 3.119 +dvi-printing by default. You can skip this by invoking it with 3.120 +universal-argument as follows: 3.121 3.122 @example 3.123 C-u [prefix] tl 3.124 @@ -519,6 +552,10 @@ 3.125 user completion table. YaTeX automatically saves the user completion 3.126 table in the user dictionary file at exiting of emacs. 3.127 3.128 +At the completion of certain environments, the expected initial entry will 3.129 +automatically inserted such as @code{\item} for @code{itemize} 3.130 +environment. If you don't want the entry, it can be removed by undoing. 3.131 + 3.132 If you want to enclose some paragraphs which have already been 3.133 written, invoke the begin-type completion with changing the case 3.134 of @kbd{b} of key sequence upper(or invoke it with universal argument 3.135 @@ -660,6 +697,38 @@ 3.136 under certain level by 0 through 6. Type @kbd{?} in the minibuffer of 3.137 sectioning prompt for more information. 3.138 3.139 + You can generate this listing buffer (@code{*Sectioning Lines*} buffer) 3.140 +by typing 3.141 +@table @kbd 3.142 +@item M-x YaTeX-section-overview 3.143 + @dots{} Generate *Sectioning Lines* buffer 3.144 +@end table 3.145 +@cindex{Generate the listing of sectioning units} 3.146 +from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on 3.147 +the sectioning command shifts up the corresponding sectioning command in 3.148 +source text and @kbd{d} shifts down. After marking lines in the listing 3.149 +buffer, typing @kbd{U} shifts up all sectioning commands in the region, 3.150 +and @kbd{U} shifts down. Here are all the key bindings of 3.151 +@code{*Sectioning Lines*} buffer. 3.152 + 3.153 +@table @kbd 3.154 +@item SPC 3.155 + @dots{} Jump to corresponding source line 3.156 +@item . 3.157 + @dots{} Display corresponding source line 3.158 +@item u 3.159 + @dots{} Shift up a sectioning line 3.160 +@item d 3.161 + @dots{} Shift down a sectioning line 3.162 +@item U 3.163 + @dots{} Shift up sectioning lines in region 3.164 +@item D 3.165 + @dots{} Shift down sectioning lines in region 3.166 +@item 0$B!A(B6 3.167 + @dots{} Hide sectioning commands whose level is lower than n 3.168 +@end table 3.169 + 3.170 + 3.171 @node Large-type completion, Maketitle-type completion, Section-type completion, Completion 3.172 @comment node-name, next, previous, up 3.173 @section Large-type completion 3.174 @@ -849,8 +918,8 @@ 3.175 Math-mode of YaTeX provides another image completion, Greek letters 3.176 completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes 3.177 @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma} 3.178 -and so on. First, type @kbd{/TAB} to know all the correspondence of 3.179 -alphabets v.s. Greek letters. 3.180 +and so on. First, type @kbd{:TAB} to know all the correspondence of 3.181 +alphabets vs. Greek letters. 3.182 3.183 If you will find @kbd{;} or @kbd{:} doesn't work in correct position of 3.184 math environment, it may be a bug of YaTeX. Please send me a bug report 3.185 @@ -1114,7 +1183,7 @@ 3.186 ~(cursor) 3.187 @end example 3.188 3.189 -@node Filling, Updation of @code{\includeonly}, Changing and Deleting, Top 3.190 +@node Filling, Updation of includeonly, Changing and Deleting, Top 3.191 @comment node-name, next, previous, up 3.192 @chapter Filling 3.193 @cindex filling 3.194 @@ -1125,8 +1194,12 @@ 3.195 3.196 To fill a term (descriptive sentences) of @code{\item}, type 3.197 3.198 +@c @table @kbd 3.199 +@c @item [prefix] i 3.200 +@c @dots{} fill item 3.201 +@c @end table 3.202 @table @kbd 3.203 -@item [prefix] i 3.204 +@item M-q 3.205 @dots{} fill item 3.206 @end table 3.207 3.208 @@ -1139,7 +1212,7 @@ 3.209 3.210 @lisp 3.211 (setq YaTeX-item-regexp 3.212 - "\\(\\\\item\\)\\|\\(\\\\underlineitem\\)") 3.213 + "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") 3.214 @end lisp 3.215 @cindex YaTeX-item-regexp 3.216 3.217 @@ -1147,22 +1220,17 @@ 3.218 for Emacs-Lisp, name a newcommand for `itemize' beginning with 3.219 @code{\item} such as @code{\itembf}, not @code{\bfitem}. 3.220 3.221 - This function -- YaTeX-fill-item -- reformats the @code{\item} into 3.222 -`hang-indented' style. When you separate the topic word and its 3.223 -description, use @kbd{M-q} instead. For example: 3.224 + This function reformats the @code{\item} into `hang-indented' style. 3.225 +For example: 3.226 3.227 @example 3.228 -Hang indentation: 3.229 +itemize, enumerate environment: 3.230 > 3.231 >\item[foo] `foo' is the typical word for describing an 3.232 > arbitrarily written.... 3.233 - 3.234 -Normal indentation: 3.235 - > 3.236 - > \item bar 3.237 - > 3.238 - > When the word `for' is used as an arbitrarily word, `bar' 3.239 - > is bound to follow it. 3.240 +description environment: 3.241 + > \item[bar] When the word `for' is used as an arbitrarily 3.242 + > word, `bar' is bound to follow it. 3.243 @end example 3.244 3.245 Note that the indent depth of an @code{\item} word and its descriptive 3.246 @@ -1214,7 +1282,7 @@ 3.247 by the current file, and type @kbd{%} to comment out the 3.248 @code{\includeonly} line. 3.249 3.250 -@node What column?, Intelligent newline, Updation of @code{\includeonly}, Top 3.251 +@node What column?, Intelligent newline, Updation of includeonly, Top 3.252 @comment node-name, next, previous, up 3.253 @chapter What column? 3.254 @cindex what column 3.255 @@ -1259,7 +1327,8 @@ 3.256 @cindex ESC RET 3.257 @cindex M-C-m 3.258 3.259 - In tabular[*], array, itemize, enumerate or tabbing environment, 3.260 + At the end of begin-type completion of tabular[*], array, itemize, 3.261 +enumerate or tabbing environment, or typing 3.262 3.263 @table @kbd 3.264 @item ESC RET 3.265 @@ -1267,11 +1336,12 @@ 3.266 @end table 3.267 3.268 @noindent 3.269 -inserts the contents corresponding to the current environment in the next 3.270 -line. In @code{tabular} environment, for example, @kbd{ESC RET} inserts 3.271 -the certain number of @code{&} and trailing @code{\\}, and @code{\hline} 3.272 -if other @code{\hline} is found in backward. Here are the list of 3.273 -contents v.s. environments. 3.274 +in these environments inserts the contents corresponding to the current 3.275 +environment in the next line. (At the begin-type completion, this 3.276 +contents can be removed by `undo'.) In @code{tabular} environment, for 3.277 +example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing 3.278 +@code{\\}, and @code{\hline} if other @code{\hline} is found in backward. 3.279 +Here are the list of contents vs. environments. 3.280 3.281 @itemize 3.282 @item @code{tabular}, @code{tabular*}, @code{array} 3.283 @@ -1505,11 +1575,6 @@ 3.284 Fill-prefix used in yatex-mode (@code{nil}) 3.285 @end defvar 3.286 3.287 -@defvar YaTeX-open-lines 3.288 - Number of blank lines between cursor and @code{\begin@{@}}, 3.289 - @code{\@code{end}@{@}} (0) 3.290 -@end defvar 3.291 - 3.292 @defvar YaTeX-user-completion-table 3.293 Name of user dictionary where learned completion table will be stored. 3.294 (@code{"~/.yatexrc"}) 3.295 @@ -1688,6 +1753,9 @@ 3.296 See also $B!#(B@code{YaTeX-hilit-sectioning-face}. 3.297 @end defvar 3.298 3.299 +@defvar YaTeX-use-AMS-LaTeX 3.300 +If you use AMS-LaTeX, set to @code{t}(@code{nil}). 3.301 +@end defvar 3.302 3.303 @node Sample definitions, Hook variables, All customizable variables, Lisp variables 3.304 @comment node-name, next, previous, up 3.305 @@ -1731,7 +1799,7 @@ 3.306 @subsection Hook file 3.307 @cindex hook file 3.308 3.309 - You can stuff all of YaTeX relating expressions into a file named 3.310 + You can stuff all of YaTeX related expressions into a file named 3.311 @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load 3.312 this file at the initialization of itself. Using @file{yatexhks.el} 3.313 makes @code{yatex-mode-load-hook} unnecessary. 3.314 @@ -1766,15 +1834,15 @@ 3.315 @end enumerate 3.316 3.317 @menu 3.318 -* How the add-in function works?:: 3.319 +* How the add-in function works:: 3.320 * How the function is called:: 3.321 * Useful functions for creating add-in:: 3.322 * Contribution:: 3.323 @end menu 3.324 3.325 -@node How the add-in function works?, How the function is called, Add-in functions, Add-in functions 3.326 +@node How the add-in function works, How the function is called, Add-in functions, Add-in functions 3.327 @comment node-name, next, previous, up 3.328 -@subsection How the add-in function works? 3.329 +@subsection How the add-in function works 3.330 3.331 There are two kinds of add-in. @dfn{Option add-in} returns the 3.332 La@TeX{}'s optional parameters such as optional strings after 3.333 @@ -1814,7 +1882,7 @@ 3.334 * Defining `argument add-in':: 3.335 @end menu 3.336 3.337 -@node Defining `option add-in', Defining `argument add-in', How the add-in function works?, How the add-in function works? 3.338 +@node Defining `option add-in', Defining `argument add-in', How the add-in function works, How the add-in function works 3.339 @comment node-name, next, previous, up 3.340 @subsubsection Defining `option add-in' 3.341 3.342 @@ -1841,7 +1909,7 @@ 3.343 (concat "{" (read-string "Rule: ") "}")) 3.344 @end lisp 3.345 3.346 -@node Defining `argument add-in', , Defining `option add-in', How the add-in function works? 3.347 +@node Defining `argument add-in', , Defining `option add-in', How the add-in function works 3.348 @comment node-name, next, previous, up 3.349 @subsubsection Defining `argument add-in' 3.350 3.351 @@ -1864,7 +1932,7 @@ 3.352 Note that when the `argument add-in' function return `nil', normal 3.353 argument reader will be called. 3.354 3.355 -@node How the function is called, Useful functions for creating add-in, How the add-in function works?, Add-in functions 3.356 +@node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions 3.357 @comment node-name, next, previous, up 3.358 @subsection How the function is called 3.359
4.1 --- a/docs/yatexj.tex Sat Dec 02 18:35:28 1995 +0000 4.2 +++ b/docs/yatexj.tex Thu Feb 01 18:55:47 1996 +0000 4.3 @@ -38,6 +38,7 @@ 4.4 * Intelligent newline:: おまかせ改行 4.5 * Changing mode of YaTeX:: 野鳥動作モード変更 4.6 * Online help:: LaTeXオンラインヘルプ 4.7 +* Inclusion hierarchy browser:: ファイル分割階層構造の表示 4.8 * Cooperation with other packages:: 他パッケージとの連携 4.9 * Customizations:: カスタマイズ 4.10 * Etc:: その他 4.11 @@ -49,6 +50,7 @@ 4.12 latexコマンド起動 4.13 4.14 * Calling typesetter:: タイプセッタ起動 4.15 +* Calling previewer:: プレヴューア起動 4.16 * Print out:: プリントアウト用コマンドの起動 4.17 4.18 %#記法 4.19 @@ -74,7 +76,7 @@ 4.20 section型補完 4.21 4.22 * 2個以上の引数をとる section型コマンド:: 4.23 -* Enclose region-type command:: 4.24 +* Enclose section-type command:: 括り補完 4.25 * Recursive completion:: 再帰補完 4.26 * view-sectioning:: セクション区切りのアウトライン表示 4.27 4.28 @@ -267,10 +269,13 @@ 4.29 @dots{} プレヴューア起動 4.30 @item [prefix] t l 4.31 @dots{} lpr(プリントアウト用)コマンド起動 4.32 +@item [prefix] t s 4.33 + @dots{} xdvi -remote でのサーチ 4.34 @end table 4.35 4.36 @menu 4.37 * Calling typesetter:: タイプセッタ起動 4.38 +* Calling previewer:: プレヴューア起動 4.39 * Print out:: プリントアウト用コマンドの起動 4.40 @end menu 4.41 4.42 @@ -313,6 +318,17 @@ 4.43 メインファイルのあるディレクトリの@file{texput.tex}という臨時ファイルに出 4.44 力されますので、上書きには注意してください。 4.45 4.46 +@node Calling previewer, Print out, Calling typesetter, Invocation 4.47 +@comment node-name, next, previous, up 4.48 +@section プレヴューア起動 4.49 + @kbd{[prefix] t p} によりプレヴューアの起動ができます。さらに、もしあな 4.50 +たが、-remote 機能つきのxdviを利用している場合は @kbd{[prefix] t s} を押す 4.51 +ことによりカーソル位置の文字列を検索してそのページを表示するようにすでに起 4.52 +動中のxdviに命令を送ります。これにより、現在編集中の箇所のタイプセット結果 4.53 +を即座に見ることができます。なお、-remote 機能付きの xdvi は 4.54 +@code{ftp://ftp.ae.keio.ac.jp/pub/text/xdvi/xdvi-remote} 4.55 +などから入手することができます。 4.56 + 4.57 @node Print out, , Calling typesetter, Invocation 4.58 @comment node-name, next, previous, up 4.59 @section プリントアウト 4.60 @@ -635,6 +651,10 @@ 4.61 入力の手間が省けます。内部テーブルに存在しない環境名を入力した時はユーザ専 4.62 用のテーブルに登録され、さらにそのテーブルを自動的に、ユーザ辞書(デフォル 4.63 トでは @file{~/.yatexrc})に保存します。 4.64 + 4.65 +さらに、特定の環境を補完入力した時にはその環境で必ず用いられるエントリを自 4.66 +動挿入します(例: @code{itemize}環境における@code{\item}など)。挿入されたエ 4.67 +ントリが不要な場合にはundoによって消去して下さい。 4.68 @cindex ユーザ辞書[ゆうさししよ] 4.69 4.70 @subsection 既に書いたテキストを環境で括る 4.71 @@ -727,12 +747,12 @@ 4.72 4.73 @menu 4.74 * 2個以上の引数をとる section型コマンド:: 4.75 -* Enclose region-type command:: 4.76 +* Enclose section-type command:: 括り補完 4.77 * Recursive completion:: 再帰補完 4.78 * view-sectioning:: セクション区切りのアウトライン表示 4.79 @end menu 4.80 4.81 -@node 2個以上の引数をとる section型コマンド, Enclose region-type command, section型補完, section型補完 4.82 +@node 2個以上の引数をとる section型コマンド, Recursive completion, section型補完, section型補完 4.83 @comment node-name, next, previous, up 4.84 @subsection 2個以上の引数をとる section型コマンド 4.85 @cindex 引数[ひきすう] 4.86 @@ -766,15 +786,14 @@ 4.87 @cindex 引数の個数を変える[ひきすうのこすうをかえる] 4.88 4.89 4.90 -@node Enclose region-type command, Recursive completion, 2個以上の引数をとる section型コマンド, section型補完 4.91 -@comment node-name, next, previous, up 4.92 +@node Enclose section-type command, Recursive completion, 2個以上の引数をとる section型コマンド, section型補完 4.93 @subsection 既に書いたテキストを括る 4.94 @cindex 括る[くくる] 4.95 4.96 また、起動コマンドの@kbd{s}を大文字に変えて起動すると、あらかじめ書 4.97 いた文章を section 型コマンドの第一引数として括ります。 4.98 4.99 -@node Recursive completion, view-sectioning, Enclose region-type command, section型補完 4.100 +@node Recursive completion, view-sectioning, 2個以上の引数をとる section型コマンド, section型補完 4.101 @comment node-name, next, previous, up 4.102 @subsection 再帰補完 4.103 @cindex 再帰補完[さいきほかん] 4.104 @@ -790,14 +809,46 @@ 4.105 @cindex アウトライン[あうとらいん] 4.106 4.107 通常のsection型補完の時にミニバッファで@kbd{C-v}を押すと現在存在するセク 4.108 -ション区切りコマンド全てを一覧表示します(「<<--」のついている行がもっとも 4.109 -近いセクション区切り)。この時ミニバッファで@kbd{C-p}, @kbd{C-n} を押すと 4.110 -@samp{part}, @samp{chapter}, ..., @samp{subparagraph} のコマンドが論理階層 4.111 -の高さにしたがって上下します。また、@kbd{C-v}, @kbd{M-v} を押すとセクショ 4.112 -ン区切り一覧バッファがスクロールし、数字の@kbd{0}〜@kbd{7}を押すとある高さ 4.113 -以上のセクション区切りだけを選んで表示します(実際にやって見れば分かります)。 4.114 -この一覧バッファにカーソルを移しスペースを押すと、該当するセクション区切り 4.115 -のある本文中の場所にジャンプします。 4.116 +ション区切りコマンド全てを @code{*Sectioning Lines*}というバッファに一覧表 4.117 +示します(「<<--」のついている行がもっとも近いセクション区切り)。この時ミニ 4.118 +バッファで@kbd{C-p}, @kbd{C-n} を押すと@samp{part}, @samp{chapter}, ..., 4.119 +@samp{subparagraph} のコマンドが論理階層の高さにしたがって上下します。また、 4.120 +@kbd{C-v}, @kbd{M-v} を押すとセクション区切り一覧バッファがスクロールし、 4.121 +数字の@kbd{0}〜@kbd{7}を押すとある高さ以上のセクション区切りだけを選んで表 4.122 +示します(実際にやって見れば分かります)。 4.123 + 4.124 +@code{*Sectioning Lines*}バッファは、 4.125 +@table @kbd 4.126 +@item M-x YaTeX-section-overview 4.127 + @dots{} セクション区切り一覧バッファを生成 4.128 +@end table 4.129 +@cindex セクション区切り一覧バッファ[せくしよんくきりいちらんはつは] 4.130 +で作成することができます。このバッファをを選択し任意の行でスペースを押すと、 4.131 +該当するセクション区切りのある本文中の場所にジャンプします。さらに、同バッ 4.132 +ファで @kbd{u} を押すと、ソーステキストの対応するセクションコマンドが一階 4.133 +層上がり(例: subsection が section に変わる)、@kbd{d}を押すと一階層下がり 4.134 +ます。@code{*Sectioning Lines*}バッファにあるセクション区切りの行をマーク 4.135 +しておいて@kbd{U}を押すとリジョン内のものに対応するソーステキストのセクショ 4.136 +ンコマンドすべてが一階層上がり、@kbd{D}を押すと下がります。セクション区切 4.137 +り一覧バッファで利用できるキーコマンドには以下のものがあります。 4.138 + 4.139 +@table @kbd 4.140 +@item SPC 4.141 + @dots{} 対応するソース行へジャンプ 4.142 +@item . 4.143 + @dots{} 対応するソース行を表示 4.144 +@item u 4.145 + @dots{} カーソル位置に対応するセクションコマンドを一階層上げる 4.146 +@item d 4.147 + @dots{} カーソル位置に対応するセクションコマンドを一階層下げる 4.148 +@item U 4.149 + @dots{} マークしたセクションコマンドを一階層上げる 4.150 +@item D 4.151 + @dots{} マークしたセクションコマンドを一階層上げる 4.152 +@item 0〜6 4.153 + @dots{} レベル n 以下のセクションコマンドを隠して表示 4.154 +@end table 4.155 + 4.156 @cindex 論理階層[ろんりかいそう] 4.157 @cindex セクション区切り[せくしよんくきり] 4.158 @cindex ジャンプ[しやんふ] 4.159 @@ -1305,16 +1356,21 @@ 4.160 itemize 環境中にある@code{\item}の項目(文章)が複数行に渡る場合に、項 4.161 目の先頭を桁揃えしたい場合には、 4.162 4.163 +@c @table @kbd 4.164 +@c @item [prefix] i 4.165 +@c @dots{} itemの桁揃え 4.166 +@c @end table 4.167 + 4.168 @table @kbd 4.169 -@item [prefix] i 4.170 - @dots{} itemの桁揃え 4.171 +@item M-q 4.172 + @dots{} 桁揃え 4.173 @end table 4.174 4.175 @cindex NTT-jTeX[えぬていいていいしえいてつく] 4.176 @noindent 4.177 -によって、その item のインデントの深さに応じて fill されます。なお、NTT 4.178 -jTeX を使用している場合には、Lisp 変数@code{NTT-jTeX}を@code{t}にセットし 4.179 -て下さい。 4.180 +によって、その item のインデントの深さに応じて fill されます。なお、古い 4.181 +NTT jTeX を使用している場合には、Lisp 変数@code{NTT-jTeX}を@code{t}にセッ 4.182 +トして下さい。 4.183 4.184 @cindex YaTeX-item-regexp 4.185 このとき、変数@code{YaTeX-item-regexp}の値(標準では @code{"\\\\item"})を 4.186 @@ -1324,44 +1380,37 @@ 4.187 4.188 @lisp 4.189 (setq YaTeX-item-regexp 4.190 - "\\(\\\\item\\)\\|\\(\\\\underlineitem\\)") 4.191 + "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") 4.192 @end lisp 4.193 4.194 @noindent 4.195 この変数の指定の仕方がよく分からない場合は、独自の項目列挙コマンドの名前を 4.196 @code{@code{"\item"}で始まるものにして下さい(例えば"\itembf"})。 4.197 4.198 - @kbd{[prefix] i} では@code{\item} を「ハングインデント」に整形します。も 4.199 -し@code{\item}とその説明用パラグラフを切り離す時は通常の 4.200 -@kbd{M-q}(他のモードではfill-paragraphが割り当てられている)を使ってくださ 4.201 -い。(つまり以下のような場合:) 4.202 +野鳥の @kbd{M-q} では @code{\item} を環境に応じて以下のように「ハングイン 4.203 +デント」します。 4.204 4.205 @example 4.206 -ハングインデント: 4.207 +itemize, enumerate環境: 4.208 >\item[ほげほげ] 英語では、特に意味のない単語を `foo' であらわしま 4.209 > すが、これの日本語版ともいえる単語が「ほげほげ」 4.210 > です。 4.211 -通常インデント: 4.212 - > \item へろへろ 4.213 - > 4.214 - > 「ほげほげ」をでたらめが単語として使った時に、第2のでたら 4.215 - > めな単語として「へろへろ」が使われることが多いようです。 4.216 +description環境: 4.217 + > \item[へろへろ] 「ほげほげ」をでたらめが単語として使った時に、第 4.218 + > 2のでたらめな単語として「へろへろ」が使われることが多 4.219 + > いようです。 4.220 @end example 4.221 4.222 - 上の通常インデントの場合、説明パラグラフのインデントは \item の見出しと 4.223 -同じ深さとする必要があります。ただし、@kbd{M-q}を行の最初の非空白文字の位 4.224 -置で押すことにより深さを変えることができます(後述)。 4.225 - 4.226 @section パラグラフの桁揃え 4.227 @cindex パラグラフの桁揃え[はらくらふのけたそろえ] 4.228 @cindex M-q 4.229 4.230 - パラグラフの桁揃え(fill)は、基本的に通常通り機能しますが、verbatim環境や、 4.231 -tabular環境など桁揃えをすると悲惨な状況になるような環境中では機能しません。 4.232 -また、\verb で括ってあるものは決して行分割されません(変数 4.233 -@code{YaTeX-verb-regexp} で制御) )。さらに、一時的にインデントの深さを変え 4.234 -てある箇所では、そのインデントの先頭で@kbd{M-q}を押すことにより 4.235 -fill-prefix をいちいち変更しなくて桁揃えができます。 4.236 + itemize環境以外でのパラグラフの桁揃え(fill)は、基本的に他のモードと同じ 4.237 +ように機能しますが、verbatim環境や、tabular環境など桁揃えをすると悲惨な状 4.238 +況になるような環境中では機能しません。また、\verb で括ってあるものは決して 4.239 +行分割されません(変数 @code{YaTeX-verb-regexp} で制御) )。さらに、一時的に 4.240 +インデントの深さを変えてある箇所では、そのインデントの先頭で@kbd{M-q}を押 4.241 +すことにより fill-prefix をいちいち変更しなくて桁揃えができます。 4.242 4.243 4.244 @node Includeonly, What column, Filling, Top 4.245 @@ -1443,7 +1492,8 @@ 4.246 @cindex &入力[&にゅうりょく] 4.247 @cindex prefix & 4.248 4.249 - tabular[*], array, itemize, enumerate, tabbing 環境で 4.250 + tabular[*], array, itemize, enumerate, tabbing 環境をbegin型補完で入力し 4.251 +た時、または各環境内で 4.252 4.253 @table @kbd 4.254 @item ESC RET 4.255 @@ -1451,10 +1501,11 @@ 4.256 @end table 4.257 4.258 @noindent 4.259 -を押すと、その環境に応じた行エントリを次の行に挿入します。例えば、tabular 4.260 -環境では、その環境のカラム数に対応した個数の @code{&} に加え、行末の 4.261 -@code{\\} を入れます。この時それ以前に @code{\hline} があればそれも付け加 4.262 -えます。環境とそれに応じて自動入力するものの対応は以下のようになります。 4.263 +を押すと、その環境に応じた行エントリを次の行に挿入します(begin型補完時に自 4.264 +動挿入されたエントリが不要な場合は undo によって消去できます)。例えば、 4.265 +tabular環境では、その環境のカラム数に対応した個数の @code{&} に加え、行末 4.266 +の @code{\\} を入れます。この時それ以前に @code{\hline} があればそれも付け 4.267 +加えます。環境とそれに応じて自動入力するものの対応は以下のようになります。 4.268 4.269 @itemize 4.270 @item @code{tabular}, @code{tabular*}, @code{array} 4.271 @@ -1478,8 +1529,8 @@ 4.272 します。定義した関数は、現在の行に改行を挿入した直後の行頭の位置で呼ばれま 4.273 す。関数 @code{YaTeX-indent-line} を呼ぶと現在の環境のネストに応じた深さに 4.274 インデントされるので、これを呼んでから何かを挿入するようなコードを書くとよ 4.275 -いでしょう。関数 @code{YaTeX-intelligent-newline-itemize} の定義などを参考 4.276 -にしてください。 4.277 +いでしょう。@file{yatexenv.el}内の関数 4.278 +@code{YaTeX-intelligent-newline-itemize} の定義などを参考にしてください。 4.279 4.280 @node Changing mode of YaTeX, Online help, Intelligent newline, Top 4.281 @comment node-name, next, previous, up 4.282 @@ -1705,10 +1756,6 @@ 4.283 本文を書く時の行頭に挿入する接頭辞すなわち fill-prefix (@code{""(nil)}) 4.284 @end defvar 4.285 4.286 -@defvar YaTeX-open-lines 4.287 -\begin{環境}と\end{環境}のあいだの空白行数 (0) 4.288 -@end defvar 4.289 - 4.290 @defvar YaTeX-user-completion-table 4.291 学習したLa@TeX{}コマンド保存ファイル名(@code{"~/.yatexrc"}) 4.292 @end defvar 4.293 @@ -1893,6 +1940,10 @@ 4.294 の項参照。 4.295 @end defvar 4.296 4.297 +@defvar YaTeX-use-AMS-LaTeX 4.298 +AMS-LaTeX を使用する場合は @code{t} に設定する(@code{nil})。 4.299 +@end defvar 4.300 + 4.301 @node Sample definitions, Hook variables, All customizable variables, Lisp variables 4.302 @comment node-name, next, previous, up 4.303 @subsection カスタマイズ変数設定例
5.1 --- a/help/YATEXHLP.jp Sat Dec 02 18:35:28 1995 +0000 5.2 +++ b/help/YATEXHLP.jp Thu Feb 01 18:55:47 1996 +0000 5.3 @@ -652,6 +652,7 @@ 5.4 description 5.5 \begin{description} \item[見出し単語] 説明 ... \end{description} 5.6 [見出し単語]を見出しとする 5.7 +<refer itemize> 5.8 5.9 subitem 5.10 \subitem 項目 5.11 @@ -1199,20 +1200,44 @@ 5.12 二段組みページでぶち抜きタイトルを作成する時に用いるとよい。 5.13 5.14 LaiTeX 5.15 -a Little Assistant Interface for TeX 5.16 +a Little Assistant Interface for TeX on Vz 5.17 おそらくあなたが今 Vz 上で使っているこのモード。 5.18 LaTeXを効率的に使うための多くの機能を盛り込んでいます。 5.19 5.20 【発音について】 5.21 - 5.22 laitex.defなどプログラムを指す時は「らいてっく」、システムを指す時は「ら 5.23 いちょう」と読みます。 5.24 5.25 【補足】 5.26 「雷鳥」の旧仮名遣いは「らいてう」だそうです。 5.27 5.28 +【謝辞】 5.29 +以下の方々の御協力を頂きました。ここに感謝申し上げます。 5.30 + 5.31 +(順不同/代表項目のみ) 5.32 +横田一也さん(マツダ) 5.33 + 転載を行って頂きました。 5.34 + 5.35 +北岸隆史さん(豊橋技術科学大) 5.36 +小林克志さん(広島大) 5.37 +保甫恒喜さん(立命館大) 5.38 +小島昭二さん(静岡大) 5.39 +小林肇さん(金沢工業大) 5.40 +坂田一生さん(niftyserve) 5.41 +山際直之さん(niftyserve) 5.42 +並川仁さん(niftyserve) 5.43 + バグの指摘や、要望、励ましのメールを頂きました。 5.44 + (まとめてでごめんなさい -- 桂川) 5.45 + 5.46 +柴田みゆきさん(京都ソフトウェアリサーチ) 5.47 + Software Design 誌で本ソフトをご紹介いただきました。 5.48 + 5.49 +バッキー"毒ラッコ"トミザワさん(筑波大) 5.50 + 雷鳥の為にノートパソコンを無償で貸与して下さいました。 5.51 + 彼のおかげで、雷鳥ははばたくことが出来ました。 5.52 + 5.53 laitex 5.54 -a Little Assistant Interface for TeX 5.55 +a Little Assistant Interface for TeX on Vz 5.56 <refer LaiTeX> 5.57 5.58 YaTeX 5.59 @@ -1227,7 +1252,7 @@ 5.60 【謝辞】 5.61 以下の方々の御協力を頂きました。ここに感謝申し上げます。 5.62 5.63 -(順不同) 5.64 +(順不同/代表項目のみ) 5.65 峯恒憲さん(九州大) 5.66 Bibtex起動、typeset process の kill、エラー箇所の正しい判定 5.67 の要望その他を頂きました。 5.68 @@ -1258,9 +1283,11 @@ 5.69 5.70 るねきちさん(asciinet) 5.71 占い師だそうです。 5.72 + http://www.comp.ae.keio.ac.jp/~yuuji/lune/astrology/ 5.73 5.74 柱川さん(prc) 5.75 各所で暴れています。 5.76 + http://www.prc.tsukuba.ac.jp/~katsura/ 5.77 5.78 三平善郎さん(慶應大) 5.79 開き括弧の入力時の処理のモード分けのアイデアを頂きました。 5.80 @@ -1326,6 +1353,8 @@ 5.81 竹中浩さん(東京大) 5.82 M-q (YaTeX-fill-paragraph) のバグを報告して頂きました。 5.83 YaTeX-insert-amper をcontributeして頂きました。 5.84 + 作者の数多くの凡ミスを丁寧に拾って下さいました。 5.85 + YaTeX-shift-section-undo の実現方法を教えていただきました。 5.86 5.87 佐藤圭さん(慶應大) 5.88 ネストした同種のitemize環境でのindentationの不具合を指摘して頂き 5.89 @@ -1347,6 +1376,24 @@ 5.90 label/ref補完で、labelやrefで始まる単語全てを候補にいれてしまう 5.91 バグを報告して頂きました。 5.92 5.93 +上田佳明さん(豊橋技科大) 5.94 + Emacs 19.29 以降で生じるYaTeX-indent-new-comment-lineの不具合を 5.95 + 指摘して頂きました。 5.96 + 5.97 +成宮隆之さん(富山大学) 5.98 + 「初めて使うYaTeX」というCoolなWWWページを作成して下さいました。 5.99 + 5.100 +田中敏さん(富山大学) 5.101 + AMS-LaTeX に対応するためのパッチを送って頂きました。 5.102 + 5.103 +西澤幸司さん(東北大学) 5.104 +田仲稔さん([株]ケイケンエンジニアリングシステム) 5.105 + begin型補完でおまかせ改行関数があれば、補完時に初期エントリを挿 5.106 + 入するというアイデアを提供していただきました。 5.107 + 5.108 +葛西澄人さん(慶應大) 5.109 + YaTeX-default-pop-window-height の原案を頂きました。 5.110 + $ \% $ のような場合の数式モード終了判定のミスを指摘して頂きました。 5.111 yatex 5.112 (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist)) 5.113 <refer YaTeX>
6.1 --- a/yahtml.el Sat Dec 02 18:35:28 1995 +0000 6.2 +++ b/yahtml.el Thu Feb 01 18:55:47 1996 +0000 6.3 @@ -1,9 +1,24 @@ 6.4 ;;; -*- Emacs-Lisp -*- 6.5 -;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net.or.jp] 6.6 -;;; Last modified Mon Nov 20 11:26:38 1995 on inspire 6.7 -;;; This is PURELY tentative. 6.8 +;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@asciinet.or.jp] 6.9 +;;; Last modified Fri Feb 2 02:37:23 1996 on supra 6.10 +;;; This package is no longer tentative. 6.11 ;;; $Id$ 6.12 6.13 +;;;[Installation] 6.14 +;;; 6.15 +;;; First, you have to install YaTeX and make sure it works fine. Then 6.16 +;;; put these expressions into your ~/.emacs 6.17 +;;; 6.18 +;;; (setq auto-mode-alist 6.19 +;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) 6.20 +;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) 6.21 +;;; (setq yahtml-www-browser "netscape") 6.22 +;;; ;Write your favorite browser. But netscape is advantageous. 6.23 +;;; (setq yahtml-path-url-alist 6.24 +;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji") 6.25 +;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji"))) 6.26 +;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path. 6.27 +;;; 6.28 ;;;[Commentary] 6.29 ;;; 6.30 ;;; It is assumed you are already familiar with YaTeX. The following 6.31 @@ -19,10 +34,19 @@ 6.32 ;;; * [prefix] l Complete typeface-changing commands such as 6.33 ;;; `<i> ... </i>' or `<samp> ... </samp>' 6.34 ;;; * [prefix] m Complete single commands such as 6.35 -;;; `<br>' or `<hr>' 6.36 +;;; `<br>' or `<hr> or <li>...' 6.37 ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I 6.38 ;;; hate menu, this is most useful) 6.39 -;;; 6.40 +;;; * [prefix] g Goto corresponding Tag or HREF such as 6.41 +;;; <dl> <-> </dl> or href="xxx" 6.42 +;;; * [prefix] k Kill html tags on the point. If you provide 6.43 +;;; universal-argument, kill surrounded contents too. 6.44 +;;; * [prefix] c Change html tags on the point. 6.45 +;;; * [prefix] t b View current html with WWW browser 6.46 +;;; (To activate this, never fail to set the lisp 6.47 +;;; variable yahtml-www-browser. Recommended value 6.48 +;;; is "netscape") 6.49 +;;; 6.50 ;;; NOTE! This program is truly tentative. If you find some bright 6.51 ;;; future with this, please send me a mail to drive me to maintain this :) 6.52 6.53 @@ -30,6 +54,20 @@ 6.54 (require 'yatex) 6.55 (defvar yahtml-prefix-map nil) 6.56 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") 6.57 +(defvar yahtml-image-viewer "xv" "*Image viewer program") 6.58 +(defvar yahtml-www-browser "netscape" 6.59 + "*WWW Browser command") 6.60 +(defvar yahtml-kanji-code 2 6.61 + "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc") 6.62 +;;(defvar yahtml-www-server "www" "*Host name of your domain's WWW server") 6.63 +(defvar yahtml-path-url-alist nil 6.64 + "*Alist of unix path name vs. URL name of WWW server. 6.65 +Ex. 6.66 +'((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\") 6.67 + (\"/usr/home/yuuji/darts/http\" . \"http://inspire.comp.ae.keio.ac.jp/~darts\"))") 6.68 +(defvar yahtml-directory-index "index.html" 6.69 + "*Directory index file name; 6.70 +Consult your site's WWW administrator.") 6.71 6.72 (defun yahtml-define-begend-key-normal (key env &optional map) 6.73 "Define short cut yahtml-insert-begin-end key." 6.74 @@ -57,10 +95,13 @@ 6.75 (setq yahtml-mode-map (make-sparse-keymap) 6.76 yahtml-prefix-map (make-sparse-keymap)) 6.77 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) 6.78 - (define-key yahtml-mode-map "\M-\C-@" 'YaTeX-mark-environment) 6.79 + (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend) 6.80 + (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19) 6.81 + (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend)) 6.82 (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment) 6.83 (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment) 6.84 - (define-key yahtml-mode-map "\C-i" 'YaTeX-indent-line) 6.85 + (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline) 6.86 + (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line) 6.87 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) 6.88 (let ((map yahtml-prefix-map)) 6.89 (YaTeX-define-key "^" 'yahtml-visit-main map) 6.90 @@ -96,18 +137,22 @@ 6.91 (yahtml-define-begend-key "bf" "form" map) 6.92 (yahtml-define-begend-key "bs" "select" map) 6.93 (YaTeX-define-key "b " 'yahtml-insert-begend map) 6.94 - (YaTeX-define-key "B " 'yahtml-insert-begend map) 6.95 + (YaTeX-define-key "B " 'yahtml-insert-begend-region map) 6.96 ) 6.97 - (YaTeX-define-key "e" 'yahtml-end-environment map) 6.98 + (YaTeX-define-key "e" 'YaTeX-end-environment map) 6.99 (YaTeX-define-key ">" 'yahtml-comment-region map) 6.100 (YaTeX-define-key "<" 'yahtml-uncomment-region map) 6.101 (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map) 6.102 + (YaTeX-define-key "k" 'yahtml-kill-* map) 6.103 + (YaTeX-define-key "c" 'yahtml-change-* map) 6.104 + (YaTeX-define-key "t" 'yahtml-browse-menu map) 6.105 + ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map) 6.106 ) 6.107 ) 6.108 6.109 (defvar yahtml-paragraph-separate 6.110 (concat 6.111 - "^$\\|<br>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|dl\\|dd\\|dt\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>") 6.112 + "^$\\|<[bh]r>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|dl\\|dd\\|dt\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>") 6.113 "*Regexp of html paragraph separater") 6.114 (defvar yahtml-syntax-table nil 6.115 "*Syntax table for typesetting buffer") 6.116 @@ -120,8 +165,6 @@ 6.117 ) 6.118 (defvar yahtml-command-regexp "[A-Za-z0-9]+" 6.119 "Regexp of constituent of html commands.") 6.120 -(defvar yahtml-kanji-code 2 6.121 - "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc") 6.122 6.123 ;;; Completion tables for `form' 6.124 (defvar yahtml-form-table 6.125 @@ -131,8 +174,15 @@ 6.126 6.127 (defvar yahtml-env-table 6.128 '(("html") ("head") ("title") ("body") ("dl") ("a") ("form") ("select") 6.129 + ("OrderedList" . "ol") 6.130 + ("UnorderedList" . "ul") 6.131 + ("DefinitionList" . "dl") 6.132 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ("ul"))) 6.133 6.134 +(defvar yahtml-itemizing-regexp 6.135 + "\\(ul\\|ul\\|dl\\)" 6.136 + "Regexp of itemizing forms") 6.137 + 6.138 (defvar yahtml-user-env-table nil) 6.139 (defvar yahtml-tmp-env-table nil) 6.140 6.141 @@ -143,9 +193,18 @@ 6.142 "Default completion table of typeface designator") 6.143 (defvar yahtml-user-typeface-table nil) 6.144 (defvar yahtml-tmp-typeface-table nil) 6.145 +(defvar yahtml-last-typeface-cmd "address") 6.146 6.147 (defvar yahtml-single-cmd-table 6.148 - '(("hr") ("br") ("option") ("p")) 6.149 + '(("hr") ("br") ("option") ("p") 6.150 + ("HorizontalLine" . "hr") 6.151 + ("BreakLine" . "br") 6.152 + ("Paragraph" . "p") 6.153 + ("Item" . "li") 6.154 + ("DefineTerm" . "dt") 6.155 + ("Description" . "dd") 6.156 + ("dd") ("dt") ("li") 6.157 + ) 6.158 "Default completion table of HTML single command.") 6.159 (defvar yahtml-user-single-cmd-table nil) 6.160 (defvar yahtml-tmp-single-cmd-table nil) 6.161 @@ -165,7 +224,7 @@ 6.162 yahtml-typeface-table)))) 6.163 6.164 (defvar yahtml-struct-name-regexp 6.165 - "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\)") 6.166 + "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\|table\\|t[rhd]\\)") 6.167 6.168 6.169 (defun yahtml-mode () 6.170 @@ -188,8 +247,8 @@ 6.171 (make-local-variable 'YaTeX-prefix-map) 6.172 (make-local-variable 'YaTeX-command-token-regexp) 6.173 (setq YaTeX-command-token-regexp yahtml-command-regexp) 6.174 - (make-local-variable 'YaTeX-environment-indent) 6.175 - (setq YaTeX-environment-indent 0) 6.176 + ;;(make-local-variable 'YaTeX-environment-indent) 6.177 + ;;(setq YaTeX-environment-indent 0) 6.178 (make-local-variable 'fill-prefix) 6.179 (setq fill-prefix nil) 6.180 (make-local-variable 'paragraph-separate) 6.181 @@ -198,6 +257,10 @@ 6.182 (make-local-variable 'comment-start) 6.183 (make-local-variable 'comment-end) 6.184 (setq comment-start "<!-- " comment-end " -->") 6.185 + (make-local-variable 'indent-line-function) 6.186 + (setq indent-line-function 'yahtml-indent-line) 6.187 + (make-local-variable 'YaTeX-item-regexp) 6.188 + (setq YaTeX-item-regexp "<\\(li\\|d[td]\\)>") 6.189 (set-syntax-table yahtml-syntax-table) 6.190 (use-local-map yahtml-mode-map) 6.191 (run-hooks 'yahtml-mode-hook)) 6.192 @@ -227,57 +290,57 @@ 6.193 (yahtml-define-menu 6.194 yahtml-menu-map-sectioning 6.195 (nreverse 6.196 - '((1 "H1" . (lambda () (interactive) (yahtml-insert-begin-end "H1" nil))) 6.197 - (2 "H2" . (lambda () (interactive) (yahtml-insert-begin-end "H2" nil))) 6.198 - (3 "H3" . (lambda () (interactive) (yahtml-insert-begin-end "H3" nil))) 6.199 - (4 "H4" . (lambda () (interactive) (yahtml-insert-begin-end "H4" nil))) 6.200 - (5 "H5" . (lambda () (interactive) (yahtml-insert-begin-end "H5" nil))) 6.201 - (6 "H6" . (lambda () (interactive) (yahtml-insert-begin-end "H6" nil))) 6.202 + '((1 "H1" . (lambda () (interactive) (yahtml-insert-begend nil "H1"))) 6.203 + (2 "H2" . (lambda () (interactive) (yahtml-insert-begend nil "H2"))) 6.204 + (3 "H3" . (lambda () (interactive) (yahtml-insert-begend nil "H3"))) 6.205 + (4 "H4" . (lambda () (interactive) (yahtml-insert-begend nil "H4"))) 6.206 + (5 "H5" . (lambda () (interactive) (yahtml-insert-begend nil "H5"))) 6.207 + (6 "H6" . (lambda () (interactive) (yahtml-insert-begend nil "H6"))) 6.208 ))) 6.209 (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags")) 6.210 (yahtml-define-menu 6.211 yahtml-menu-map-logical 6.212 (nreverse 6.213 '((em "Embolden" . 6.214 - (lambda () (interactive) (yahtml-insert-tag "EM"))) 6.215 + (lambda () (interactive) (yahtml-insert-tag nil "EM"))) 6.216 (defn "Define a word" . 6.217 - (lambda () (interactive) (yahtml-insert-tag "DEFN"))) 6.218 + (lambda () (interactive) (yahtml-insert-tag nil "DEFN"))) 6.219 (cite "Citation" . 6.220 - (lambda () (interactive) (yahtml-insert-tag "CITE"))) 6.221 + (lambda () (interactive) (yahtml-insert-tag nil "CITE"))) 6.222 (code "Code" . 6.223 - (lambda () (interactive) (yahtml-insert-tag "CODE"))) 6.224 + (lambda () (interactive) (yahtml-insert-tag nil "CODE"))) 6.225 (kbd "Keyboard" . 6.226 - (lambda () (interactive) (yahtml-insert-tag "KBD"))) 6.227 + (lambda () (interactive) (yahtml-insert-tag nil "KBD"))) 6.228 (samp "Sample display" . 6.229 - (lambda () (interactive) (yahtml-insert-tag "SAMP"))) 6.230 + (lambda () (interactive) (yahtml-insert-tag nil "SAMP"))) 6.231 (strong "Strong" . 6.232 - (lambda () (interactive) (yahtml-insert-tag "STRONG"))) 6.233 + (lambda () (interactive) (yahtml-insert-tag nil "STRONG"))) 6.234 (VAR "Variable notation" . 6.235 - (lambda () (interactive) (yahtml-insert-tag "VAR"))) 6.236 + (lambda () (interactive) (yahtml-insert-tag nil "VAR"))) 6.237 ))) 6.238 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags")) 6.239 (yahtml-define-menu 6.240 yahtml-menu-map-typeface 6.241 (nreverse 6.242 '((b "Bold" . 6.243 - (lambda () (interactive) (yahtml-insert-tag "B"))) 6.244 + (lambda () (interactive) (yahtml-insert-tag nil "B"))) 6.245 (i "Italic" . 6.246 - (lambda () (interactive) (yahtml-insert-tag "I"))) 6.247 + (lambda () (interactive) (yahtml-insert-tag nil "I"))) 6.248 (tt "Typewriter" . 6.249 - (lambda () (interactive) (yahtml-insert-tag "TT"))) 6.250 + (lambda () (interactive) (yahtml-insert-tag nil "TT"))) 6.251 (u "Underlined" . 6.252 - (lambda () (interactive) (yahtml-insert-tag "U"))) 6.253 + (lambda () (interactive) (yahtml-insert-tag nil "U"))) 6.254 ))) 6.255 (setq yahtml-menu-map-listing (make-sparse-keymap "listing")) 6.256 (yahtml-define-menu 6.257 yahtml-menu-map-listing 6.258 (nreverse 6.259 - '((ul "Unnumbered" . 6.260 - (lambda () (interactive) (yahtml-insert-begin-end "UL" nil))) 6.261 - (ol "Numbered" . 6.262 - (lambda () (interactive) (yahtml-insert-begin-end "OL" nil))) 6.263 - (dl "Description" . 6.264 - (lambda () (interactive) (yahtml-insert-begin-end "DL" nil))) 6.265 + '((ul "Unordered" . 6.266 + (lambda () (interactive) (yahtml-insert-begend nil "UL"))) 6.267 + (ol "Ordered" . 6.268 + (lambda () (interactive) (yahtml-insert-begend nil "OL"))) 6.269 + (dl "Definition" . 6.270 + (lambda () (interactive) (yahtml-insert-begend nil "DL"))) 6.271 ))) 6.272 (setq yahtml-menu-map-item (make-sparse-keymap "item")) 6.273 (yahtml-define-menu 6.274 @@ -292,6 +355,10 @@ 6.275 ))) 6.276 (define-key yahtml-mode-map [menu-bar yahtml] 6.277 (cons "yahtml" yahtml-menu-map)) 6.278 + (let ((keys (where-is-internal 'fill-paragraph global-map))) 6.279 + (while keys 6.280 + (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph) 6.281 + (setq keys (cdr keys)))) 6.282 (yahtml-define-menu 6.283 yahtml-menu-map 6.284 (nreverse 6.285 @@ -329,14 +396,22 @@ 6.286 6.287 ;;; ----------- Completion ---------- 6.288 (defvar yahtml-last-begend "html") 6.289 -(defun yahtml-insert-begend (&optional region) 6.290 +(defun yahtml-insert-begend (&optional region env) 6.291 "Insert <cmd> ... </cmd>." 6.292 (interactive "P") 6.293 - (let ((cmd (YaTeX-cplread-with-learning 6.294 + (let*((completion-ignore-case t) 6.295 + (cmd 6.296 + (or env 6.297 + (YaTeX-cplread-with-learning 6.298 (format "Environment(default %s): " yahtml-last-begend) 6.299 - 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table)) 6.300 - (bolp (bolp))) 6.301 + 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table))) 6.302 + (bolp (save-excursion 6.303 + (skip-chars-backward " \t" (point-beginning-of-line)) (bolp))) 6.304 + (cc (current-column))) 6.305 (if (string< "" cmd) (setq yahtml-last-begend cmd)) 6.306 + (setq yahtml-last-begend 6.307 + (or (cdr (assoc yahtml-last-begend yahtml-env-table)) 6.308 + yahtml-last-begend)) 6.309 (setq cmd yahtml-last-begend) 6.310 (if region 6.311 (let ((beg (region-beginning)) 6.312 @@ -346,11 +421,14 @@ 6.313 (insert (format "</%s>%s" cmd (if bolp "\n" ""))) 6.314 (goto-char beg) 6.315 (insert (format "<%s%s>%s" cmd addin (if bolp "\n" "")))) 6.316 - (insert (format "<%s%s" cmd (yahtml-addin cmd))) 6.317 - (if bolp (progn (insert (format ">\n</%s>\n" cmd cmd)) 6.318 - (forward-line -1)) 6.319 - (insert ">") 6.320 - (save-excursion (insert (format "</%s>" cmd))))))) 6.321 + (insert (format "<%s%s>" cmd (yahtml-addin cmd))) 6.322 + (save-excursion 6.323 + (if bolp (progn 6.324 + (insert "\n") 6.325 + (indent-to-column cc) 6.326 + (insert (format "</%s>" cmd))) 6.327 + (insert (format "</%s>" cmd)))) 6.328 + (if bolp (yahtml-intelligent-newline nil))))) 6.329 6.330 (defun yahtml-insert-begend-region () 6.331 "Call yahtml-insert-begend in the region mode." 6.332 @@ -368,7 +446,7 @@ 6.333 'yahtml-form-table 'yahtml-user-form-table 6.334 'yahtml-tmp-form-table))) 6.335 (let ((p (point)) q) 6.336 - (insert (format "<%s%s>" form (yahtml-addin (downcase form)))) 6.337 + (insert (format "<%s%s>" form (yahtml-addin form))) 6.338 ;;(indent-relative-maybe) 6.339 (if (cdr (assoc form yahtml-form-table)) 6.340 (save-excursion (insert (format "</%s>" form)))) 6.341 @@ -376,24 +454,81 @@ 6.342 6.343 (defun yahtml-addin (form) 6.344 "Check add-in function's existence and call it if exists." 6.345 - (let ((addin (concat "yahtml:" form))) 6.346 - (if (and (intern-soft addin) (fboundp (intern-soft addin))) 6.347 - (concat " " (funcall (intern addin))) 6.348 + (let ((addin (concat "yahtml:" (downcase form))) s) 6.349 + (if (and (intern-soft addin) (fboundp (intern-soft addin)) 6.350 + (stringp (setq s (funcall (intern addin)))) 6.351 + (string< "" s)) 6.352 + (concat " " s) 6.353 ""))) 6.354 6.355 +(defvar yahtml-url-completion-map nil "Key map used in URL completion buffer") 6.356 +(if yahtml-url-completion-map nil 6.357 + (setq yahtml-url-completion-map 6.358 + (copy-keymap minibuffer-local-completion-map)) 6.359 + (define-key yahtml-url-completion-map "\t" 'yahtml-complete-url) 6.360 + (define-key yahtml-url-completion-map " " 'yahtml-complete-url) 6.361 +) 6.362 + 6.363 +(defun yahtml-complete-url () 6.364 + "Complete external URL from history or local file name." 6.365 + (interactive) 6.366 + (let (initial cmpl path dir file listfunc beg (p (point))) 6.367 + (setq initial (buffer-string)) 6.368 + (cond 6.369 + ((string-match "^http:" initial) 6.370 + (setq cmpl (try-completion initial yahtml-urls) 6.371 + listfunc (list 'lambda nil 6.372 + (list 'all-completions initial 'yahtml-urls)) 6.373 + beg (point-min))) 6.374 + (t 6.375 + (setq path (if (string-match "^/" initial) 6.376 + (yahtml-url-to-path initial) 6.377 + initial)) 6.378 + (setq dir (or (file-name-directory path) ".") 6.379 + file (file-name-nondirectory path) 6.380 + initial file 6.381 + cmpl (file-name-completion file dir) 6.382 + listfunc (list 'lambda nil 6.383 + (list 'file-name-all-completions 6.384 + file dir)) 6.385 + beg (save-excursion (skip-chars-backward "^/") (point))))) 6.386 + (cond 6.387 + ((stringp cmpl) 6.388 + (if (string= initial cmpl) 6.389 + (with-output-to-temp-buffer "*Completions*" 6.390 + (princ "Possible completinos are:\n") 6.391 + (princ 6.392 + (mapconcat '(lambda (x) x) (funcall listfunc) "\n"))) 6.393 + (delete-region (point) beg) 6.394 + (insert cmpl))) 6.395 + ((null cmpl) 6.396 + (ding)) 6.397 + ((eq t cmpl) 6.398 + (save-excursion 6.399 + (unwind-protect 6.400 + (progn 6.401 + (goto-char p) 6.402 + (insert " [Sole completion]")) 6.403 + (delete-region p (point-max)))))))) 6.404 + 6.405 (defun yahtml:a () 6.406 "Add-in function for <a>" 6.407 -; (or yahtml-urls (yahtml-collect-url-history)) 6.408 + (or yahtml-urls (yahtml-collect-url-history)) 6.409 ; (concat "href=\"" 6.410 ; (completing-read "href: " yahtml-urls) 6.411 ; "\"") 6.412 - (concat "href=\"" (read-file-name "href: " "" nil nil "") "\"") 6.413 -) 6.414 + (message "(H)ref (N)ame?") 6.415 + (cond 6.416 + ((string-match "[hH]" (char-to-string (read-char))) 6.417 + (concat "href=\"" 6.418 + (read-from-minibuffer "href: " "" yahtml-url-completion-map) 6.419 + "\"")) 6.420 + (t (concat "name=\"" (read-string "name: ") "\"")))) 6.421 6.422 (defun yahtml:img () 6.423 "Add-in function for <img>" 6.424 (or yahtml-urls (yahtml-collect-url-history)) 6.425 - (let ((src (read-file-name "src: " "" nil t "")) 6.426 + (let ((src (read-file-name "src: " "" nil nil "")) 6.427 (alg (completing-read "align: " '(("top") ("middle") ("bottom"))))) 6.428 (concat "src=\"" src "\"" 6.429 (if (string< "" alg) (concat " align=\"" alg "\""))))) 6.430 @@ -410,6 +545,16 @@ 6.431 (setq yahtml-last-single-cmd "option") 6.432 (concat " name=\"" (read-string "name: ") "\"")) 6.433 6.434 +(defun yahtml:ol () 6.435 + (setq yahtml-last-single-cmd "li") "") 6.436 +(defun yahtml:ul () 6.437 + (setq yahtml-last-single-cmd "li") "") 6.438 +(defun yahtml:dl () 6.439 + (setq yahtml-last-single-cmd "dt") "") 6.440 +(defun yahtml:dt () 6.441 + (setq yahtml-last-single-cmd "dd") "") 6.442 + 6.443 + 6.444 (defvar yahtml-input-types 6.445 '(("text") ("password") ("checkbox") ("radio") ("submit") 6.446 ("reset") ("image") ("hidden"))) 6.447 @@ -432,36 +577,46 @@ 6.448 (if (string< "" maxlength) (concat " maxlength=\"" maxlength "\"")) 6.449 ))) 6.450 6.451 - 6.452 -(defun yahtml-insert-begin-end (env &optional region-mode) 6.453 - "Insert <ENV> \\n </ENV> by calling YaTeX-insert-begin-end." 6.454 - (interactive "sEnv: ") 6.455 - (setq env (funcall (if yahtml-prefer-upcases 'upcase 'downcase) env)) 6.456 - (YaTeX-insert-begin-end env region-mode)) 6.457 - 6.458 -(defun yahtml-insert-tag (tag) 6.459 +(defun yahtml-insert-tag (region-mode &optional tag) 6.460 "Insert <TAG> </TAG> and put cursor inside of them." 6.461 - (interactive 6.462 - (list 6.463 - (YaTeX-cplread-with-learning 6.464 - "Tag: " 6.465 - 'yahtml-typeface-table 'yahtml-user-typeface-table 6.466 - 'yahtml-tmp-typeface-table))) 6.467 - (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag)) 6.468 - (insert (format "<%s> " tag)) 6.469 - (save-excursion (insert (format "</%s>" tag)))) 6.470 + (interactive "P") 6.471 + (or tag 6.472 + (setq tag 6.473 + (YaTeX-cplread-with-learning 6.474 + (format "Tag %s(default %s): " 6.475 + (if region-mode "region: " "") yahtml-last-typeface-cmd) 6.476 + 'yahtml-typeface-table 'yahtml-user-typeface-table 6.477 + 'yahtml-tmp-typeface-table))) 6.478 + (if (string= "" tag) (setq tag yahtml-last-typeface-cmd)) 6.479 + (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag) 6.480 + yahtml-last-typeface-cmd tag) 6.481 + (if region-mode 6.482 + (if (if (string< "19" emacs-version) (mark t) (mark)) 6.483 + (save-excursion 6.484 + (if (> (point) (mark)) (exchange-point-and-mark)) 6.485 + (insert "<" tag ">") 6.486 + (exchange-point-and-mark) 6.487 + (insert "</" tag ">")) 6.488 + (message "No mark set now")) 6.489 + (insert (format "<%s> " tag)) 6.490 + (save-excursion (insert (format "</%s>" tag))))) 6.491 6.492 (defun yahtml-insert-single (cmd) 6.493 "Insert <CMD>." 6.494 (interactive 6.495 - (list (YaTeX-cplread-with-learning 6.496 - (format "Command%s: " 6.497 - (if yahtml-last-single-cmd 6.498 - (concat "(default " yahtml-last-single-cmd ")") "")) 6.499 - 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table 6.500 - 'yahtml-tmp-single-cmd-table))) 6.501 + (list 6.502 + (let ((completion-ignore-case t)) 6.503 + (YaTeX-cplread-with-learning 6.504 + (format "Command%s: " 6.505 + (if yahtml-last-single-cmd 6.506 + (concat "(default " yahtml-last-single-cmd ")") "")) 6.507 + 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table 6.508 + 'yahtml-tmp-single-cmd-table)))) 6.509 + (if (string< "" cmd) (setq yahtml-last-single-cmd cmd)) 6.510 (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd)) 6.511 - (if (string< "" cmd) (setq yahtml-last-single-cmd cmd)) 6.512 + (setq yahtml-last-single-cmd 6.513 + (or (cdr (assoc yahtml-last-single-cmd yahtml-single-cmd-table)) 6.514 + yahtml-last-single-cmd)) 6.515 (insert (format "<%s>" yahtml-last-single-cmd))) 6.516 6.517 ;;; ---------- Jump ---------- 6.518 @@ -469,25 +624,73 @@ 6.519 "Check if point is on href clause." 6.520 (let ((p (point)) cmd) 6.521 (save-excursion 6.522 - (or (bobp) (skip-chars-backward "^ \t")) 6.523 - (and (looking-at "href\\s *=\\s *\"?\\([^\"]+\\)\"?") 6.524 + (or (bobp) (skip-chars-backward "^ \t\n")) 6.525 + (and (looking-at "href\\s *=\\s *\"?\\([^\"> \t\n]+\\)\"?") 6.526 (< p (match-end 0)) 6.527 (YaTeX-match-string 1))))) 6.528 6.529 +(defun yahtml-netscape-sentinel (proc mes) 6.530 + (cond 6.531 + ((null (buffer-name (process-buffer proc))) 6.532 + (set-process-buffer proc nil)) 6.533 + ((eq (process-status proc) 'exit) 6.534 + (let ((cb (current-buffer))) 6.535 + (set-buffer (process-buffer proc)) 6.536 + (goto-char (point-min)) 6.537 + (if (search-forward "not running" nil t) 6.538 + (progn 6.539 + (message "Starting netscape...") 6.540 + (start-process 6.541 + "browser" (process-buffer proc) shell-file-name "-c" 6.542 + (format "%s %s" yahtml-www-browser 6.543 + (get 'yahtml-netscape-sentinel 'url))) 6.544 + (message "Starting netscape...Done"))) 6.545 + (set-buffer cb))))) 6.546 + 6.547 +(defvar yahtml-browser-process nil) 6.548 + 6.549 +(defun yahtml-browse-html (href) 6.550 + "Call WWW Browser to see HREF." 6.551 + (let ((pb "* WWW Browser *") (cb (current-buffer))) 6.552 + (cond 6.553 + ((string-match "[Nn]etscape" yahtml-www-browser) 6.554 + (if (get-buffer pb) 6.555 + (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) 6.556 + (put 'yahtml-netscape-sentinel 'url href) 6.557 + (set-process-sentinel 6.558 + (setq yahtml-browser-process 6.559 + (start-process 6.560 + "browser" pb shell-file-name "-c" 6.561 + (format "%s -remote 'openURL(%s)'" yahtml-www-browser href))) 6.562 + 'yahtml-netscape-sentinel)) 6.563 + ((and (string= "w3" yahtml-www-browser) (fboundp 'w3-fetch)) 6.564 + (w3-fetch href)) 6.565 + ((stringp yahtml-www-browser) 6.566 + (if (eq (process-status yahtml-browser-process) 'run) 6.567 + (message "%s is already running" yahtml-www-browser) 6.568 + (setq yahtml-browser-process 6.569 + (start-process 6.570 + "browser" "* WWW Browser *" shell-file-name 6.571 + (format "%s %s" yahtml-www-browser href))))) 6.572 + (t 6.573 + (message "Sorry, jump across http is not supported."))))) 6.574 + 6.575 (defun yahtml-goto-corresponding-href (&optional other) 6.576 "Go to corresponding name." 6.577 (let ((href (yahtml-on-href-p)) file name) 6.578 (if href 6.579 (cond 6.580 ((string-match "^http:" href) 6.581 - (message "Sorry, jump across http is not supported.")) 6.582 + (yahtml-browse-html href)) 6.583 (t (setq file (substring href 0 (string-match "#" href))) 6.584 (if (string-match "#" href) 6.585 (setq name (substring href (1+ (string-match "#" href))))) 6.586 (if (string< "" file) 6.587 (progn 6.588 (if (string-match "/$" file) 6.589 - (setq file (concat file "index.html"))) 6.590 + (setq file (concat file yahtml-directory-index))) 6.591 + (if (string-match "^/" file) 6.592 + (setq file (yahtml-url-to-path file))) 6.593 (if other (YaTeX-switch-to-buffer-other-window file) 6.594 (YaTeX-switch-to-buffer file)))) 6.595 (if name 6.596 @@ -503,33 +706,87 @@ 6.597 6.598 (defun yahtml-on-begend-p (&optional p) 6.599 "Check if point is on begend clause." 6.600 - (let ((p (point)) cmd) 6.601 + (let ((p (point)) cmd (case-fold-search t)) 6.602 (save-excursion 6.603 (if p (goto-char p)) 6.604 - (if (= (char-after (point)) ?<) (forward-char 1)) 6.605 + (if (equal (char-after (point)) ?<) (forward-char 1)) 6.606 (if (and (re-search-backward "<" nil t) 6.607 (looking-at 6.608 (concat "<\\(/?" yahtml-command-regexp "\\)\\b")) 6.609 (condition-case nil 6.610 - (forward-list 1)) 6.611 + (forward-list 1) 6.612 + (error nil)) 6.613 (< p (point))) 6.614 (YaTeX-match-string 1))))) 6.615 6.616 -(defun yahtml-goto-corresponding-begend () 6.617 - (let ((cmd (yahtml-on-begend-p))) 6.618 - (if cmd 6.619 - (progn 6.620 - (if (= (aref cmd 0) ?/) ;on </cmd> line 6.621 - (re-search-backward (format "<%s" (substring cmd 1))) 6.622 - (re-search-forward (format "</%s" cmd))) 6.623 - (if (match-beginning 0) (goto-char (match-beginning 0))))))) 6.624 +(defun yahtml-goto-corresponding-begend (&optional noerr) 6.625 + "Go to corresponding opening/closing tag. 6.626 +Optional argument NOERR causes no error for unballanced tag." 6.627 + (let ((cmd (yahtml-on-begend-p)) m0 6.628 + (p (point)) (case-fold-search t) func str (nest 0)) 6.629 + (cond 6.630 + (cmd 6.631 + (setq m0 (match-beginning 0)) 6.632 + (if (= (aref cmd 0) ?/) ;on </cmd> line 6.633 + (setq cmd (substring cmd 1) 6.634 + str (format "\\(<%s\\)\\|\\(</%s\\)" cmd cmd) 6.635 + func 're-search-backward) 6.636 + (setq str (format "\\(</%s\\)\\|\\(<%s\\)" cmd cmd) 6.637 + func 're-search-forward)) 6.638 + (while (and (>= nest 0) (funcall func str nil t)) 6.639 + (if (equal m0 (match-beginning 0)) 6.640 + nil 6.641 + (setq nest (+ nest (if (match-beginning 1) -1 1))))) 6.642 + (if (< nest 0) 6.643 + (goto-char (match-beginning 0)) 6.644 + (funcall 6.645 + (if noerr 'message 'error) 6.646 + "Corresponding tag of `%s' not found." cmd) 6.647 + (goto-char p) 6.648 + nil)) 6.649 + (t nil)))) 6.650 + 6.651 +(defun yahtml-current-tag () 6.652 + "Return the current tag name." 6.653 + (save-excursion 6.654 + (let ((p (point)) b tag) 6.655 + (or (bobp) 6.656 + (looking-at "<") 6.657 + (progn (skip-chars-backward "^<") (forward-char -1))) 6.658 + (setq b (point)) 6.659 + (skip-chars-forward "<") 6.660 + (setq tag (buffer-substring 6.661 + (point) (progn (skip-chars-forward "^ \t\n") (point)))) 6.662 + (goto-char b) 6.663 + (forward-list 1) 6.664 + (and (< p (point)) tag)))) 6.665 + 6.666 + 6.667 +(defun yahtml-goto-corresponding-img () 6.668 + "View image on point" 6.669 + (let ((tag (yahtml-current-tag)) image (p (point)) (case-fold-search t)) 6.670 + (if (and tag 6.671 + (string-match "img" tag) 6.672 + (save-excursion 6.673 + (re-search-backward "<\\s *img" nil t) 6.674 + (re-search-forward "src=\"?\\([^\"> ]+\\)\"?>") 6.675 + (match-beginning 1) 6.676 + (setq image 6.677 + (buffer-substring (match-beginning 1) (match-end 1))))) 6.678 + (progn 6.679 + (message "Invoking %s %s..." yahtml-image-viewer image) 6.680 + (start-process 6.681 + "Viewer" " * Image Viewer *" shell-file-name "-c" 6.682 + (concat yahtml-image-viewer " " image)) 6.683 + (message "Invoking %s %s...Done" yahtml-image-viewer image))))) 6.684 6.685 (defun yahtml-goto-corresponding-* (&optional other) 6.686 "Go to corresponding object." 6.687 (interactive) 6.688 (cond 6.689 ((yahtml-goto-corresponding-href other)) 6.690 - ((yahtml-goto-corresponding-begend other)) 6.691 + ((yahtml-goto-corresponding-img)) 6.692 + ((yahtml-goto-corresponding-begend)) 6.693 )) 6.694 6.695 (defun yahtml-goto-corresponding-*-other-window () 6.696 @@ -537,6 +794,82 @@ 6.697 (interactive) 6.698 (yahtml-goto-corresponding-* t)) 6.699 6.700 +;;; ---------- killing ---------- 6.701 +(defun yahtml-kill-begend (&optional whole) 6.702 + (let ((tag (yahtml-on-begend-p)) (p (make-marker)) (q (make-marker))) 6.703 + (if tag 6.704 + (progn 6.705 + (or (looking-at "<") 6.706 + (progn (skip-chars-backward "^<") (forward-char -1))) 6.707 + (set-marker p (point)) 6.708 + (yahtml-goto-corresponding-begend) 6.709 + (or (looking-at "<") 6.710 + (progn (skip-chars-backward "^<") (forward-char -1))) 6.711 + (delete-region (point) (progn (forward-list 1) (point))) 6.712 + (set-marker q (point)) 6.713 + (beginning-of-line) 6.714 + (if (looking-at "^\\s *$") 6.715 + (delete-region (point) (progn (forward-line 1) (point)))) 6.716 + (goto-char p) 6.717 + (delete-region (point) (progn (forward-list 1) (point))) 6.718 + (if (looking-at "^\\s *$") 6.719 + (delete-region (point) (progn (forward-line 1) (point)))) 6.720 + (if whole (delete-region p q)) 6.721 + tag)))) 6.722 + 6.723 +(defun yahtml-kill-* (whole) 6.724 + "Kill current position's HTML tag (set)." 6.725 + (interactive "P") 6.726 + (cond 6.727 + ((yahtml-kill-begend whole)) 6.728 + )) 6.729 + 6.730 + 6.731 +;;; ---------- changing ---------- 6.732 +(defun yahtml-change-begend () 6.733 + (let ((tag (yahtml-on-begend-p)) 6.734 + (completion-ignore-case t) 6.735 + (p (point)) (q (make-marker)) 6.736 + (default (append yahtml-env-table yahtml-typeface-table)) 6.737 + (user (append yahtml-user-env-table yahtml-user-typeface-table)) 6.738 + (tmp (append yahtml-tmp-env-table yahtml-tmp-typeface-table)) 6.739 + ) 6.740 + (if tag 6.741 + (save-excursion 6.742 + (if (= (aref tag 0) ?/) (setq tag (substring tag 1))) 6.743 + (or (= (char-after (point)) ?<) (skip-chars-backward "^<")) 6.744 + (skip-chars-forward "^A-Za-z") 6.745 + (set-marker q (point)) 6.746 + (setq p (point)) 6.747 + (yahtml-goto-corresponding-begend) 6.748 + (or (= (char-after (point)) ?<) 6.749 + (skip-chars-backward "^<")) 6.750 + (skip-chars-forward "^A-Za-z") 6.751 + (if (= (char-after (1- (point))) ?/) 6.752 + (progn 6.753 + (set-marker q (point)) 6.754 + (goto-char p))) 6.755 + (setq tag (YaTeX-cplread-with-learning 6.756 + (format "Change `%s' to(default %s): " 6.757 + tag yahtml-last-begend) 6.758 + 'default 'user 'tmp)) 6.759 + (delete-region (point) (progn (skip-chars-forward "^>") (point))) 6.760 + (if (string= "" tag) (setq tag yahtml-last-begend)) 6.761 + (setq yahtml-last-begend 6.762 + (or (cdr (assoc tag yahtml-env-table)) tag) 6.763 + tag yahtml-last-begend) 6.764 + (insert (format "%s%s" tag (yahtml-addin tag))) 6.765 + (goto-char q) 6.766 + (delete-region (point) (progn (skip-chars-forward "^>") (point))) 6.767 + (insert tag))))) 6.768 + 6.769 +(defun yahtml-change-* () 6.770 + "Change current position's HTML tag (set)." 6.771 + (interactive) 6.772 + (cond 6.773 + ((yahtml-change-begend)) 6.774 + )) 6.775 + 6.776 ;;; ---------- commenting ---------- 6.777 (defun yahtml-comment-region (beg end) 6.778 (interactive "r") 6.779 @@ -548,6 +881,238 @@ 6.780 6.781 6.782 6.783 +;;; ---------- filling ---------- 6.784 +(defun yahtml-fill-paragraph (arg) 6.785 + (interactive "P") 6.786 + (let ((case-fold-search t) (p (point))) 6.787 + (save-excursion 6.788 + (fill-region-as-paragraph 6.789 + (progn (re-search-backward paragraph-start nil t) 6.790 + (or (save-excursion 6.791 + (goto-char (match-end 0)) 6.792 + (if (looking-at "[ \t]*$") 6.793 + (progn (forward-line 1) (point)))) 6.794 + (point))) 6.795 + (progn (goto-char p) 6.796 + (re-search-forward paragraph-start nil t) 6.797 + (match-beginning 0)))))) 6.798 + 6.799 +;;; 6.800 +;;; ---------- indentation ---------- 6.801 +;;; 6.802 +(defvar yahtml-hate-too-deep-indentation nil) 6.803 +(defun yahtml-indent-line () 6.804 + (interactive) 6.805 + (let ((envs "[uod]l\\|table\\|t[rhd]") 6.806 + (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\)>") 6.807 + inenv p col peol (case-fold-search t)) 6.808 + (save-excursion 6.809 + (beginning-of-line) 6.810 + (setq inenv (or (YaTeX-inner-environment) "html") 6.811 + col (get 'YaTeX-inner-environment 'indent) 6.812 + p (get 'YaTeX-inner-environment 'point) 6.813 + op)) 6.814 + (save-excursion 6.815 + (cond 6.816 + ((string-match envs inenv) 6.817 + (save-excursion 6.818 + (beginning-of-line) 6.819 + (skip-chars-forward " \t") 6.820 + (cond 6.821 + ((looking-at (concat "</\\(" envs "\\)>")) 6.822 + (YaTeX-reindent col)) 6.823 + ((or (looking-at itms) 6.824 + (and yahtml-hate-too-deep-indentation 6.825 + (looking-at (concat "<" envs)))) 6.826 + (YaTeX-reindent (+ col YaTeX-environment-indent))) 6.827 + ((and (< p (point)) 6.828 + (save-excursion 6.829 + (and 6.830 + ;;(re-search-backward itms p t) 6.831 + (setq op (point)) 6.832 + (goto-char p) 6.833 + (re-search-forward itms op t) 6.834 + (goto-char (match-end 0)) 6.835 + (skip-chars-forward " \t") 6.836 + (setq col (current-column))))) 6.837 + (YaTeX-reindent col)) 6.838 + (t 6.839 + (YaTeX-reindent (+ col YaTeX-environment-indent))))))) 6.840 + (and (bolp) (skip-chars-forward " \t")) 6.841 + (if (and (setq inenv (yahtml-on-begend-p)) 6.842 + (string-match (concat "^\\(" envs "\\)") inenv)) 6.843 + (save-excursion 6.844 + (setq peol (point-end-of-line)) 6.845 + (or (= (char-after (point)) ?<) 6.846 + (progn (skip-chars-backward "^<") (forward-char -1))) 6.847 + (setq col (current-column)) 6.848 + (if (and (yahtml-goto-corresponding-begend t) 6.849 + (> (point) peol)) ;if on the different line 6.850 + (YaTeX-reindent col))))) 6.851 + (and (bolp) (skip-chars-forward " \t")))) 6.852 + 6.853 +;(defun yahtml-fill-item () 6.854 +; "Fill item HTML version" 6.855 +; (interactive) 6.856 +; (let (inenv p fill-prefix peol (case-fold-search t)) 6.857 +; (setq inenv (or (YaTeX-inner-environment) "html") 6.858 +; p (get 'YaTeX-inner-environment 'point)) 6.859 +; (cond 6.860 +; ((string-match "^[uod]l" inenv) 6.861 +; (save-excursion 6.862 +; (if (re-search-backward "<\\(d[td]\\|li\\)>[ \t\n]*" p t) 6.863 +; (progn 6.864 +; (goto-char (match-end 0)) 6.865 +; (setq col (current-column))) 6.866 +; (error "No <li>, <dt>, <dd>"))) 6.867 +; (save-excursion 6.868 +; (end-of-line) 6.869 +; (setq peol (point)) 6.870 +; (newline) 6.871 +; (indent-to-column col) 6.872 +; (setq fill-prefix (buffer-substring (point) (1+ peol))) 6.873 +; (delete-region (point) peol) 6.874 +; (fill-region-as-paragraph 6.875 +; (progn (re-search-backward paragraph-start nil t) (point)) 6.876 +; (progn (re-search-forward paragraph-start nil t 2) 6.877 +; (match-beginning 0))))) 6.878 +; (t nil)))) 6.879 + 6.880 +;;; 6.881 +;;; ---------- Browsing ---------- 6.882 +;;; 6.883 +(defun yahtml-browse-menu () 6.884 + "Browsing menu" 6.885 + (interactive) 6.886 + (message "B)rowse R)eload...") 6.887 + (let ((c (char-to-string (read-char)))) 6.888 + (cond 6.889 + ((string-match "[bj]" c) 6.890 + (yahtml-browse-current-file)) 6.891 + ((string-match "r" c) 6.892 + (yahtml-browse-reload))))) 6.893 + 6.894 +(defun yahtml-file-to-url (file) 6.895 + "Convert local unix file name to URL. 6.896 +If no matches found in yahtml-path-url-alist, return raw file name." 6.897 + (let ((list yahtml-path-url-alist) p url) 6.898 + (if (file-directory-p file) 6.899 + (setq file (expand-file-name yahtml-directory-index file)) 6.900 + (setq file (expand-file-name file))) 6.901 + (while list 6.902 + (if (string-match (concat "^" (regexp-quote (car (car list)))) file) 6.903 + (setq url (cdr (car list)) 6.904 + file (substring file (match-end 0)) 6.905 + url (concat url file) 6.906 + list nil)) 6.907 + (setq list (cdr list))) 6.908 + (or url (concat "file:" file)))) 6.909 + 6.910 +(defun yahtml-url-to-path (file &optional basedir) 6.911 + "Convert local URL name to unix file name." 6.912 + (let ((list yahtml-path-url-alist) url realpath docroot 6.913 + (dirsufp (string-match "/$" file))) 6.914 + (setq basedir (or basedir 6.915 + (file-name-directory 6.916 + (expand-file-name default-directory)))) 6.917 + (cond 6.918 + ((string-match "^/" file) 6.919 + (while list 6.920 + (if (string-match (concat "^" (regexp-quote (car (car list)))) basedir) 6.921 + (progn 6.922 + (setq url (cdr (car list))) 6.923 + (if (string-match "\\(http://[^/]*\\)/" url) 6.924 + (setq docroot (substring url (match-end 1))) 6.925 + (setq docroot url)) 6.926 + (if (string-match (regexp-quote docroot) file) 6.927 + (setq realpath 6.928 + (expand-file-name 6.929 + (substring 6.930 + file (min (1+ (match-end 0)) (length file))) 6.931 + (car (car list))))) 6.932 + (if realpath 6.933 + (progn (setq list nil) 6.934 + (if (and dirsufp (not (string-match "/$" realpath))) 6.935 + (setq realpath (concat realpath "/"))))))) 6.936 + (setq list (cdr list))) 6.937 + realpath) 6.938 + (t file)))) 6.939 + 6.940 +(defun yahtml-browse-current-file () 6.941 + "Call WWW browser on current file." 6.942 + (interactive) 6.943 + (basic-save-buffer) 6.944 + (yahtml-browse-html (yahtml-file-to-url (buffer-file-name)))) 6.945 + 6.946 +(defun yahtml-browse-reload () 6.947 + "Send `reload' event to netzscape." 6.948 + (let ((pb "* WWW Browser *") (cb (current-buffer))) 6.949 + (cond 6.950 + ((string-match "[Nn]etscape" yahtml-www-browser) 6.951 + (if (get-buffer pb) 6.952 + (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) 6.953 + ;;(or (get 'yahtml-netscape-sentinel 'url) 6.954 + ;; (error "Reload should be called after Browsing.")) 6.955 + (put 'yahtml-netscape-sentinel 'url 6.956 + (yahtml-file-to-url (buffer-file-name))) 6.957 + (basic-save-buffer) 6.958 + (set-process-sentinel 6.959 + (setq yahtml-browser-process 6.960 + (start-process 6.961 + "browser" pb shell-file-name "-c" 6.962 + (format "%s -remote 'reload'" yahtml-www-browser))) 6.963 + 'yahtml-netscape-sentinel)) 6.964 + (t 6.965 + (message "Sorry, RELOAD is supported only for Netscape."))))) 6.966 + 6.967 +;;; ---------- Intelligent newline ---------- 6.968 +(defun yahtml-intelligent-newline (arg) 6.969 + "Intelligent newline for HTML" 6.970 + (interactive "P") 6.971 + (let ((env (downcase (or (YaTeX-inner-environment) "html"))) func) 6.972 + (setq func (intern-soft (concat "yahtml-intelligent-newline-" env))) 6.973 + (end-of-line) 6.974 + (newline) 6.975 + (if (and env func (fboundp func)) 6.976 + (funcall func)))) 6.977 + 6.978 +(defun yahtml-intelligent-newline-ul () 6.979 + (interactive) 6.980 + (insert (if yahtml-prefer-upcases "<LI> " "<li> ")) 6.981 + (yahtml-indent-line)) 6.982 + 6.983 +(fset 'yahtml-intelligent-newline-ol 'yahtml-intelligent-newline-ul) 6.984 + 6.985 +(defun yahtml-intelligent-newline-dl () 6.986 + (interactive) 6.987 + (let ((case-fold-search t)) 6.988 + (if (save-excursion 6.989 + (re-search-backward "<\\(\\(dt\\)\\|\\(dd\\)\\)>" 6.990 + (get 'YaTeX-inner-environment 'point) t)) 6.991 + (cond 6.992 + ((match-beginning 2) 6.993 + (insert (if yahtml-prefer-upcases "<DD> " "<dd> ")) 6.994 + (setq yahtml-last-single-cmd "dt")) 6.995 + ((match-beginning 3) 6.996 + (insert (if yahtml-prefer-upcases "<DT> " "<dt> ")) 6.997 + (setq yahtml-last-single-cmd "dd"))) 6.998 + (insert (if yahtml-prefer-upcases "<DT> " "<dt> "))) 6.999 + (yahtml-indent-line))) 6.1000 + 6.1001 +;;; ---------- Marking ---------- 6.1002 +(defun yahtml-mark-begend () 6.1003 + "Mark current tag" 6.1004 + (interactive) 6.1005 + (YaTeX-beginning-of-environment) 6.1006 + (let ((p (point))) 6.1007 + (save-excursion 6.1008 + (skip-chars-backward " \t" (point-beginning-of-line)) 6.1009 + (if (bolp) (setq p (point)))) 6.1010 + (push-mark p t)) 6.1011 + (yahtml-goto-corresponding-begend) 6.1012 + (forward-list 1) 6.1013 + (if (eolp) (forward-char 1))) 6.1014 + 6.1015 ;;; ---------- ---------- 6.1016 ;;; ---------- ---------- 6.1017 ;;; ---------- ---------- 6.1018 @@ -582,7 +1147,7 @@ 6.1019 (skip-chars-forward " \t\n") 6.1020 (cons (point) 6.1021 (progn (re-search-forward (concat "</" tag ">") nil t) 6.1022 - (1- (match-beginning 0))))))) 6.1023 + (match-beginning 0)))))) 6.1024 6.1025 ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist)) 6.1026 (cond
7.1 Binary file yatex.el has changed
8.1 --- a/yatex.new Sat Dec 02 18:35:28 1995 +0000 8.2 +++ b/yatex.new Thu Feb 01 18:55:47 1996 +0000 8.3 @@ -1,5 +1,32 @@ 8.4 What's new in YaTeX 8.5 - yatex.el 各バージョンの変更点について 8.6 + 野鳥 - 各バージョンの変更点について 8.7 + 8.8 +1.61 AMS-LaTeX 対応 8.9 + xdvi -remote によるサーチに対応 [prefix] t s 8.10 + begin型補完終了直後に自動的におまかせ改行を実行するようにした 8.11 + yahtmlで <p>, <br> が行末にある時に fill-paragraph した時のバグ修正 8.12 + htmlタグそのものではなく、意味を表す文字列で補完できるようにした 8.13 + yahtml で [prefix] g を <img src=..> の上で押したらViewer(xv)を起動 8.14 + するようにし、<a href="http://外部リンク">の上で押したらnetscape 8.15 + を起動(またはプロセスコントロール)するようにした 8.16 + yahtml に [preix] t (野鳥でいうタイプセットメニュー)を設け、 8.17 + [prefix] t b でカレントファイルをWWWブラウザで見られるようにした 8.18 + [prefix] t r で Netscape に reload コマンドを送れるようにした 8.19 + html の括り補完をまともにした 8.20 + yahtml-indent-line を作成。リスティング環境のインデントのみ少し 8.21 + まともにした 8.22 + yahtml におまかせ改行を追加 8.23 + html <a> の補完を、http:// で始まっていればヒストリからの補完、/ 8.24 + で始まっていればWWWサーバ内のURL名補完、いずれでもなければUNIXファ 8.25 + イルシステムでのファイル名補完となるようにした 8.26 + html3 この期に及んでまだ未調査。だれかおしえてー 8.27 + \pagebreak, \linebreak のアドイン関数の追加 8.28 + セクション区切りアウトライン表示のバッファで u, d を押すことによ 8.29 + り、対応するセクションコマンドのレベルを上げる/下げる。U, D を押 8.30 + すと領域内のセクションコマンドを一括シフト 8.31 + 変数 YaTeX-open-lines を廃止 8.32 + [prefix] i の YaTeX-fill-item を廃止 8.33 + $$ 中に \% があった場合の数式モード終了判定ミスを修正 8.34 8.35 1.60 LaTeX2e 対応 8.36 documentclass パラメータを修正し、ASCII 版 jLaTeX2e に対応
9.1 --- a/yatex19.el Sat Dec 02 18:35:28 1995 +0000 9.2 +++ b/yatex19.el Thu Feb 01 18:55:47 1996 +0000 9.3 @@ -1,7 +1,7 @@ 9.4 ;;; -*- Emacs-Lisp -*- 9.5 ;;; YaTeX facilities for Emacs 19 9.6 ;;; (c )1994-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 9.7 -;;; Last modified Sun Dec 3 03:29:56 1995 on inspire 9.8 +;;; Last modified Wed Dec 20 22:32:21 1995 on supra 9.9 ;;; $Id$ 9.10 9.11 ;;; とりあえず hilit19 を使っている時に色が付くようにして 9.12 @@ -263,11 +263,11 @@ 9.13 '( 9.14 ;; comments 9.15 (YaTeX-19-region-comment "\\([^\\]\\|^\\)\\(%\\).*$" comment) 9.16 - 9.17 + 9.18 (YaTeX-19-region-section-type "\\\\footnote\\(mark\\|text\\)?{" keyword) 9.19 ("\\\\[a-z]+box" 0 keyword) 9.20 (YaTeX-19-region-section-type "\\\\\\(v\\|h\\)space\\(\*\\)?{" keyword) 9.21 - 9.22 + 9.23 ;; (re-)define new commands/environments/counters 9.24 (YaTeX-19-region-section-type 9.25 "\\\\\\(re\\)?new\\(environment\\|command\\|theorem\\){" defun) 9.26 @@ -299,8 +299,10 @@ 9.27 ;; formulas 9.28 ("[^\\]\\\\(" "\\\\)" formula) ; \( \) 9.29 ("[^\\]\\\\\\[" "\\\\\\]" formula) ; \[ \] 9.30 - ("\\\\begin{\\(eqn\\|equation\\)" "\\\\end{\\(eqn\\|equation\\)" formula) 9.31 - ("[^\\$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula) ; '$...$' or '$$...$$' 9.32 + ("\\\\begin{\\(eqn\\|equation\\|x?x?align\\|split\\|multiline\\|gather\\)" 9.33 + "\\\\end{\\(eqn\\|equation\\|x?x?align\\|split\\|multiline\\|gather\\).*}" 9.34 + formula) 9.35 + ("[^\\$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula); '$...$' or '$$...$$' 9.36 9.37 ;; things that bring in external files 9.38 ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) 9.39 @@ -316,9 +318,8 @@ 9.40 ;; things that do some sort of cross-reference 9.41 (YaTeX-19-region-section-type 9.42 "\\\\\\(\\(no\\)?cite\\|\\(page\\)?ref\\|label\\|index\\|glossary\\){" 9.43 - crossref) 9.44 - ) 9.45 - "*Hiliting pattern alist for LaTeX text.") 9.46 + crossref)) 9.47 +"*Hiliting pattern alist for LaTeX text.") 9.48 9.49 ;;(defvar YaTeX-hilit-pattern-adjustment-default nil) 9.50 ;; ↑いらなくなった。 9.51 @@ -505,9 +506,9 @@ 9.52 ;;; formula 'khaki 9.53 ;;; label 'yellow-underlined)) 9.54 (and YaTeX-emacs-19 9.55 - (eval-when-compile 9.56 - (if (and (boundp 'window-system) window-system) 9.57 - (require 'hilit19) 9.58 - (error "Byte compile this file on window system! Not `-nw'!")))) 9.59 + (boundp 'byte-compile-current-file) 9.60 + (if (and (boundp 'window-system) window-system) 9.61 + (require 'hilit19) 9.62 + (error "Byte compile this file on window system! Not `-nw'!"))) 9.63 9.64 (provide 'yatex19)
10.1 --- a/yatexadd.el Sat Dec 02 18:35:28 1995 +0000 10.2 +++ b/yatexadd.el Thu Feb 01 18:55:47 1996 +0000 10.3 @@ -2,7 +2,7 @@ 10.4 ;;; YaTeX add-in functions. 10.5 ;;; yatexadd.el rev.13 10.6 ;;; (c )1991-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 10.7 -;;; Last modified Mon Nov 6 14:30:25 1995 on inspire 10.8 +;;; Last modified Thu Dec 21 21:47:34 1995 on supra 10.9 ;;; $Id$ 10.10 10.11 ;;; 10.12 @@ -51,14 +51,9 @@ 10.13 hline "\\hline")))) 10.14 10.15 (setq rule (read-string "rule format: " rule)) 10.16 + (setq single-command "hline") 10.17 10.18 - (message "Dont forget to remove null line at the end of tabular.") 10.19 - (format "%s%s{%s}%s" 10.20 - width loc rule 10.21 - (if (and (boundp 'region-mode) region-mode) 10.22 - "" ;do nothing in region-mode 10.23 - (format "\n%s\n%s \\\\ \\hline\n%s\n\\\\ %s" 10.24 - hline and and hline)))) 10.25 + (format "%s%s{%s}" width loc rule)) 10.26 ) 10.27 (fset 'YaTeX:tabular* 'YaTeX:tabular) 10.28 (defun YaTeX:array () 10.29 @@ -294,6 +289,16 @@ 10.30 (fset 'YaTeX:subitem 'YaTeX:item) 10.31 (fset 'YaTeX:subsubitem 'YaTeX:item) 10.32 10.33 +(defun YaTeX:linebreak () 10.34 + (let (obl) 10.35 + (message "Break strength 0,1,2,3,4 (default: 4): ") 10.36 + (setq obl (char-to-string (read-char))) 10.37 + (if (string-match "[0-4]" obl) 10.38 + (concat "[" obl "]") 10.39 + "")) 10.40 +) 10.41 +(fset 'YaTeX:pagebreak 'YaTeX:linebreak) 10.42 + 10.43 ;;; 10.44 ;;Subroutine 10.45 ;;;
11.1 --- a/yatexenv.el Sat Dec 02 18:35:28 1995 +0000 11.2 +++ b/yatexenv.el Thu Feb 01 18:55:47 1996 +0000 11.3 @@ -2,7 +2,7 @@ 11.4 ;;; YaTeX environment-specific functions. 11.5 ;;; yatexenv.el 11.6 ;;; (c ) 1994, 1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 11.7 -;;; Last modified Thu May 18 11:52:05 1995 on inspire 11.8 +;;; Last modified Fri Feb 2 03:47:14 1996 on supra 11.9 ;;; $Id$ 11.10 11.11 ;;; 11.12 @@ -116,18 +116,23 @@ 11.13 (let*((p (point)) (format (YaTeX-tabular-parse-format tabular*)) 11.14 (cols (car format)) (beg (car (cdr format))) 11.15 space hline) 11.16 - (setq hline (search-backward "\\hline" beg t)) 11.17 + (cond 11.18 + ((search-backward "&" beg t) 11.19 + (goto-char p) 11.20 + (setq hline (search-backward "\\hline" beg t)) 11.21 + (setq space (if (search-backward "\t&" beg t) "\t" " ")) 11.22 + (goto-char p)) 11.23 + (t ;;(insert "\\hline\n") 11.24 + (setq space " "))) 11.25 (goto-char p) 11.26 - (setq space (if (search-backward "\t&" beg t) "\t" " ")) 11.27 - (goto-char p) 11.28 - (YaTeX-indent-line) 11.29 - (setq p (point)) 11.30 (while (> (1- cols) 0) 11.31 (insert "&" space) 11.32 (setq cols (1- cols))) 11.33 (insert "\\\\") 11.34 (if hline (insert " \\hline")) 11.35 - (goto-char p)) 11.36 + (goto-char p) 11.37 + (YaTeX-indent-line) 11.38 +) 11.39 ) 11.40 11.41 (defun YaTeX-intelligent-newline-tabular* () 11.42 @@ -160,17 +165,17 @@ 11.43 (insert "\\>\t") 11.44 (setq tabcount (1- tabcount)))) 11.45 (forward-char 2)) 11.46 - (insert "\\="))) 11.47 + (insert "\\= \\\\") 11.48 + (forward-char -5))) 11.49 ) 11.50 11.51 ;;; 11.52 ;; Functions for itemize/enumerate/list environments 11.53 ;;; 11.54 11.55 -(defvar YaTeX-item-for-insert "\\item ") 11.56 (defun YaTeX-intelligent-newline-itemize () 11.57 "Insert '\\item '." 11.58 - (insert YaTeX-item-for-insert) 11.59 + (insert "\\item ") 11.60 (YaTeX-indent-line) 11.61 ) 11.62 (fset 'YaTeX-intelligent-newline-enumerate 'YaTeX-intelligent-newline-itemize) 11.63 @@ -199,6 +204,7 @@ 11.64 (setq func (intern-soft (concat "YaTeX-intelligent-newline-" env))) 11.65 (end-of-line) 11.66 (newline) 11.67 + (undo-boundary) 11.68 (if (and env func (fboundp func)) 11.69 (funcall func))) 11.70 )
12.1 --- a/yatexhks.el Sat Dec 02 18:35:28 1995 +0000 12.2 +++ b/yatexhks.el Thu Feb 01 18:55:47 1996 +0000 12.3 @@ -8,7 +8,7 @@ 12.4 ;;; named `yatexhks.el'. The file `yatexhks.el' will be automatically 12.5 ;;; loaded at the end of loading `yatex.el'. 12.6 12.7 -;Private definitions begins from here. 12.8 +;Private definitions begin from here. 12.9 12.10 (define-key YaTeX-user-extensional-map "0" 12.11 '(lambda () (interactive) (YaTeX-make-section nil nil nil "part")))
13.1 --- a/yatexhlp.el Sat Dec 02 18:35:28 1995 +0000 13.2 +++ b/yatexhlp.el Thu Feb 01 18:55:47 1996 +0000 13.3 @@ -2,7 +2,7 @@ 13.4 ;;; YaTeX helper with LaTeX commands and macros. 13.5 ;;; yatexhlp.el 13.6 ;;; (c )1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 13.7 -;;; Last modified Mon Jan 23 10:17:11 1995 on pajero 13.8 +;;; Last modified Tue Dec 26 00:02:02 1995 on inspire 13.9 ;;; $Id$ 13.10 13.11 (let ((help-file (concat "YATEXHLP." 13.12 @@ -261,6 +261,7 @@ 13.13 ;;;###autoload 13.14 (defun YaTeX-apropos (key) 13.15 (interactive "sLaTeX apropos (regexp): ") 13.16 + (if (string= "" key) (error "Nothing to show")) 13.17 (or (YaTeX-apropos-file key YaTeX-help-file) 13.18 (YaTeX-apropos-file key YaTeX-help-file-private t) 13.19 (message "No matches found."))
14.1 --- a/yatexlib.el Sat Dec 02 18:35:28 1995 +0000 14.2 +++ b/yatexlib.el Thu Feb 01 18:55:47 1996 +0000 14.3 @@ -2,7 +2,7 @@ 14.4 ;;; YaTeX library of general functions. 14.5 ;;; yatexlib.el 14.6 ;;; (c )1994-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 14.7 -;;; Last modified Fri Apr 28 16:17:44 1995 on VFR 14.8 +;;; Last modified Thu Feb 1 22:34:57 1996 on nsr 14.9 ;;; $Id$ 14.10 14.11 ;;;###autoload 14.12 @@ -369,4 +369,11 @@ 14.13 (or (featurep 'windows) (error "Why don't you use `windows.el'?")) 14.14 (win-switch-to-window 1 (- last-command-char win:base-key))) 14.15 14.16 +(defun bcf-and-exit () 14.17 + "Byte compile rest of argument and kill-emacs." 14.18 + (if command-line-args-left 14.19 + (progn 14.20 + (mapcar 'byte-compile-file command-line-args-left) 14.21 + (kill-emacs)))) 14.22 + 14.23 (provide 'yatexlib)
15.1 --- a/yatexm-o.el Sat Dec 02 18:35:28 1995 +0000 15.2 +++ b/yatexm-o.el Thu Feb 01 18:55:47 1996 +0000 15.3 @@ -1,7 +1,7 @@ 15.4 ;;; -*- Emacs-Lisp -*- 15.5 ;;; Sample startup file to invoke yatex-mode with outline-minor mode. 15.6 ;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 15.7 -;;; Last modified Wed May 4 19:44:53 1994 on 98fa 15.8 +;;; Last modified Mon Jan 29 21:38:26 1996 on pajero 15.9 15.10 ;;; 15.11 ;; outline-minor-mode(使用しない場合は不要です) 15.12 @@ -12,10 +12,11 @@ 15.13 (setq default-outline-regexp "[*\^l]+") 15.14 (make-variable-buffer-local 'outline-level-function) 15.15 (setq-default outline-level-function 'outline-level-default) 15.16 -(defvar LaTeX-outline-regexp 15.17 +(setq LaTeX-outline-regexp 15.18 (concat "[ \t]*" (regexp-quote "\\") 15.19 "\\(appendix\\|documentstyle\\|part\\|chapter\\|section\\|" 15.20 - "subsection\\|subsubsection\\|paragraph\\|subparagraph\\)")) 15.21 + "subsection\\|subsubsection\\|paragraph\\|subparagraph\\)" 15.22 + "\\*?[ \t]*[[{]")) 15.23 15.24 ;;; 15.25 ;; yatex-mode 15.26 @@ -32,6 +33,9 @@ 15.27 '(lambda () 15.28 (setq-default outline-prefix-char (concat YaTeX-prefix "\C-o"));;@ 15.29 (require 'min-out) ;;@ 15.30 - (define-key outline-minor-keymap "\C-?" 'hide-subtree) ;;@ 15.31 + ;;auctex 付属の min-out.el の場合これ↓ 15.32 + ;(define-key outline-minor-keymap "\C-?" 'hide-subtree) ;;@ 15.33 + ;;Emacs 付属の outline.el の場合これ↓ 15.34 + (define-key outline-mode-prefix-map "\C-?" 'hide-subtree) 15.35 (YaTeX-define-begend-key "ba" "abstract") 15.36 ))
16.1 --- a/yatexmth.el Sat Dec 02 18:35:28 1995 +0000 16.2 +++ b/yatexmth.el Thu Feb 01 18:55:47 1996 +0000 16.3 @@ -2,7 +2,7 @@ 16.4 ;;; YaTeX math-mode-specific functions. 16.5 ;;; yatexmth.el rev.4 16.6 ;;; (c )1993-1995 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 16.7 -;;; Last modified Wed Aug 16 12:45:55 1995 on inspire 16.8 +;;; Last modified Thu Feb 1 13:04:16 1996 on supra 16.9 ;;; $Id$ 16.10 16.11 ;;; [Customization guide] 16.12 @@ -439,11 +439,16 @@ 16.13 (defun YaTeX-math-get-sign (list) 16.14 (YaTeX-math-gets (car (cdr-safe (cdr-safe list)))) 16.15 ) 16.16 - 16.17 (defun YaTeX-in-math-mode-p () 16.18 "If current position is supposed to be in LaTeX-math-mode, return t." 16.19 (or (YaTeX-quick-in-environment-p 16.20 - '("math" "eqnarray" "equation" "eqnarray*" "displaymath")) 16.21 + (append 16.22 + '("math" "eqnarray" "equation" "eqnarray*" "displaymath");LaTeX 16.23 + (if YaTeX-use-AMS-LaTeX 16.24 + ;; And math modes of AMS-LaTeX 16.25 + '("align" "align*" "split" "multline" "multline*" "gather" 16.26 + "gather*" "aligned*" "gathered" "gathered*" "alignat" 16.27 + "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*")))) 16.28 (let*((p (point)) (nest 0) me0 16.29 (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l")) 16.30 (boundary 16.31 @@ -473,7 +478,7 @@ 16.32 (t (catch 'dollar 16.33 (while ;(search-backward "$" boundary t);little bit fast. 16.34 (YaTeX-re-search-active-backward ;;;;;; Too slow??? 16.35 - "\\$" YaTeX-comment-prefix boundary t) 16.36 + "\\$" (concat "[^\\\\]" YaTeX-comment-prefix) boundary t) 16.37 (cond 16.38 ((equal (char-after (1- (point))) ?$) ; $$ equation $$ 16.39 (backward-char 1)
17.1 --- a/yatexprc.el Sat Dec 02 18:35:28 1995 +0000 17.2 +++ b/yatexprc.el Thu Feb 01 18:55:47 1996 +0000 17.3 @@ -2,7 +2,7 @@ 17.4 ;;; YaTeX process handler. 17.5 ;;; yatexprc.el 17.6 ;;; (c )1993-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 17.7 -;;; Last modified Thu Nov 2 19:35:16 1995 on inspire 17.8 +;;; Last modified Fri Feb 2 02:09:57 1996 on supra 17.9 ;;; $Id$ 17.10 17.11 (require 'yatex) 17.12 @@ -350,7 +350,9 @@ 17.13 (interactive 17.14 (list 17.15 (read-string-with-history 17.16 - "Preview command: " dvi2-command 'YaTeX-preview-command-history) 17.17 + "Preview command: " 17.18 + (or (YaTeX-get-builtin "PREVIEW") dvi2-command) 17.19 + 'YaTeX-preview-command-history) 17.20 (read-string-with-history 17.21 "Preview file[.dvi]: " 17.22 (if (get 'dvi2-command 'region) 17.23 @@ -386,6 +388,32 @@ 17.24 " to preview " preview-file)))))) 17.25 ) 17.26 17.27 +(defvar YaTeX-xdvi-remote-program "xdvi") 17.28 +(defun YaTeX-xdvi-remote-search (&optional region-mode) 17.29 + "Search string at the point on xdvi -remote window. 17.30 +Non-nil for optional argument REGION-MODE specifies the search string 17.31 +by region." 17.32 + (interactive "P") 17.33 + (let ((pb " *xdvi*") str proc) 17.34 + (save-excursion 17.35 + (if region-mode 17.36 + (setq str (buffer-substring (region-beginning) (region-end))) 17.37 + (setq str (buffer-substring 17.38 + (point) 17.39 + (progn (skip-chars-forward "^\n\\\\}") (point))))) 17.40 + (message "Searching `%s'..." str) 17.41 + (if (boundp 'MULE) 17.42 + (define-program-coding-system 17.43 + (regexp-quote pb) (regexp-quote YaTeX-xdvi-remote-program) 17.44 + *euc-japan*)) 17.45 + (setq proc 17.46 + (start-process 17.47 + "xdvi" pb YaTeX-xdvi-remote-program 17.48 + "-remote" (format "SloppySearch(%s) " str) 17.49 + (concat (YaTeX-get-preview-file-name) ".dvi"))) 17.50 + (message "Searching `%s'...Done" str))) 17.51 +) 17.52 + 17.53 (defun YaTeX-set-virtual-error-position (file-sym line-sym) 17.54 "Replace the value of FILE-SYM, LINE-SYM by virtual error position." 17.55 (cond
18.1 --- a/yatexsec.el Sat Dec 02 18:35:28 1995 +0000 18.2 +++ b/yatexsec.el Thu Feb 01 18:55:47 1996 +0000 18.3 @@ -2,7 +2,7 @@ 18.4 ;;; YaTeX sectioning browser. 18.5 ;;; yatexsec.el 18.6 ;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 18.7 -;;; Last modified Tue Jan 24 23:19:14 1995 on VFR 18.8 +;;; Last modified Thu Jan 11 01:07:53 1996 on VFR 18.9 ;;; $Id$ 18.10 18.11 (defvar YaTeX-sectioning-level 18.12 @@ -69,28 +69,79 @@ 18.13 "Key map used in YaTeX-sectioning-buffer.") 18.14 (if YaTeX-sectioning-buffer-map nil 18.15 (setq YaTeX-sectioning-buffer-map (make-sparse-keymap)) 18.16 - (define-key YaTeX-sectioning-buffer-map " " 18.17 - 'YaTeX-sectioning-buffer-jump) 18.18 + (define-key YaTeX-sectioning-buffer-map " " 'YaTeX-sectioning-buffer-jump) 18.19 + (define-key YaTeX-sectioning-buffer-map "." 'YaTeX-sectioning-buffer-show) 18.20 (define-key YaTeX-sectioning-buffer-map (concat YaTeX-prefix "\C-c") 18.21 'YaTeX-sectioning-buffer-jump) 18.22 + (define-key YaTeX-sectioning-buffer-map "u" 'YaTeX-shift-section-up) 18.23 + (define-key YaTeX-sectioning-buffer-map "d" 'YaTeX-shift-section-down) 18.24 + (define-key YaTeX-sectioning-buffer-map "U" 'YaTeX-shift-section-up-region) 18.25 + (define-key YaTeX-sectioning-buffer-map "D" 'YaTeX-shift-section-down-region) 18.26 + (define-key YaTeX-sectioning-buffer-map "s" 'YaTeX-sync-section-buffer) 18.27 + (define-key YaTeX-sectioning-buffer-map "n" 18.28 + 'YaTeX-sectioning-buffer-next-line) 18.29 + (define-key YaTeX-sectioning-buffer-map "p" 18.30 + 'YaTeX-sectioning-buffer-prev-line) 18.31 + (define-key YaTeX-sectioning-buffer-map "h" 'describe-mode) 18.32 + (define-key YaTeX-sectioning-buffer-map "o" 'other-window) 18.33 + (define-key YaTeX-sectioning-buffer-map "-" 'shrink-window) 18.34 + (define-key YaTeX-sectioning-buffer-map "+" 'enlarge-window) 18.35 + (define-key YaTeX-sectioning-buffer-map "\C-_" 'YaTeX-shift-section-undo) 18.36 + (and YaTeX-emacs-19 (boundp 'window-system) (eq window-system 'x) 18.37 + (define-key YaTeX-sectioning-buffer-map [?\C-/] 18.38 + 'YaTeX-shift-section-undo)) 18.39 (YaTeX-sectioning-map-hide YaTeX-sectioning-buffer-map) 18.40 ) 18.41 18.42 +(defun YaTeX-sectioning-mode () 18.43 + "Mode for browsing document's sectioning structure. 18.44 +\\[YaTeX-shift-section-up] Shift up a sectioning command 18.45 +\\[YaTeX-shift-section-down] Shift down a sectioning command 18.46 +\\[YaTeX-shift-section-up-region] Shift up sectioning commands in region 18.47 +\\[YaTeX-shift-section-down-region] Shift down sectioning commands in region 18.48 +\\[YaTeX-shift-section-undo] Undo changes of shifting 18.49 +\\[YaTeX-sync-section-buffer] Synchronize sectioning buffer with source 18.50 +\\[YaTeX-sectioning-buffer-next-line] Next line 18.51 +\\[YaTeX-sectioning-buffer-prev-line] Previous line 18.52 +\\[YaTeX-sectioning-buffer-jump] Previous line 18.53 +\\[YaTeX-sectioning-buffer-show] Show curresponding source line 18.54 +" 18.55 + (interactive) 18.56 + (setq major-mode 'YaTeX-sectioning-mode 18.57 + mode-name "sectioning") 18.58 + (use-local-map YaTeX-sectioning-buffer-map) 18.59 +) 18.60 + 18.61 (defvar YaTeX-sectioning-buffer-parent nil) 18.62 -(defun YaTeX-sectioning-buffer-jump () 18.63 +(defun YaTeX-sectioning-buffer-jump-internal (&optional keep) 18.64 + (let (ptn (p (point))) ;save-excursion is NG because 18.65 + (beginning-of-line) ;this function should switch buffer 18.66 + (if (re-search-forward YaTeX-sectioning-regexp) 18.67 + (progn (setq ptn (buffer-substring 18.68 + (1- (match-beginning 0)) 18.69 + (progn (skip-chars-forward "^}") (1+ (point))))) 18.70 + (goto-char p) 18.71 + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t) 18.72 + (goto-char (point-max)) 18.73 + (search-backward ptn) 18.74 + (if keep (goto-buffer-window YaTeX-sectioning-buffer)) 18.75 + (current-buffer)) 18.76 + nil)) 18.77 +) 18.78 +(defun YaTeX-sectioning-buffer-jump (&optional keep) 18.79 + "Goto corresponding sectioning unit with current line in the next window. 18.80 +If optional argument KEEP is non-nil, only shows the line." 18.81 (interactive) 18.82 (if (and YaTeX-sectioning-buffer-parent 18.83 (get-buffer YaTeX-sectioning-buffer-parent)) 18.84 - (let (ptn) 18.85 - (beginning-of-line) 18.86 - (if (re-search-forward YaTeX-sectioning-regexp) 18.87 - (progn (setq ptn (buffer-substring 18.88 - (1- (match-beginning 0)) 18.89 - (progn (skip-chars-forward "^}") (1+ (point))))) 18.90 - (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t) 18.91 - (goto-char (point-max)) 18.92 - (search-backward ptn)) 18.93 - (message "No line number expression.")))) 18.94 + (YaTeX-sectioning-buffer-jump-internal keep) 18.95 + (message "No line number expression.")) 18.96 +) 18.97 + 18.98 +(defun YaTeX-sectioning-buffer-show () 18.99 + "Show corresponding sectioning unit with current line." 18.100 + (interactive) 18.101 + (YaTeX-sectioning-buffer-jump-internal t) 18.102 ) 18.103 18.104 (defun YaTeX-sectioning-hide-under (n) 18.105 @@ -232,6 +283,9 @@ 18.106 "\\(" YaTeX-sectioning-regexp "\\)\\*?{")) 18.107 (cb (current-buffer))) 18.108 (save-excursion 18.109 + (set-buffer (get-buffer-create YaTeX-sectioning-buffer)) 18.110 + (setq buffer-read-only nil) 18.111 + (set-buffer cb) 18.112 (YaTeX-showup-buffer YaTeX-sectioning-buffer) ;show buffer 18.113 (goto-char (point-min)) 18.114 (with-output-to-temp-buffer YaTeX-sectioning-buffer 18.115 @@ -251,6 +305,7 @@ 18.116 (princ "\n"))) 18.117 (set-buffer YaTeX-sectioning-buffer) 18.118 (make-local-variable 'YaTeX-sectioning-buffer-parent) 18.119 + (YaTeX-sectioning-mode) 18.120 (use-local-map YaTeX-sectioning-buffer-map) 18.121 (setq YaTeX-sectioning-buffer-parent cb) 18.122 (if (numberp selective-display) 18.123 @@ -258,15 +313,17 @@ 18.124 YaTeX-sectioning-buffer)) 18.125 ) 18.126 18.127 +(defvar YaTeX-pending-undo nil) 18.128 (defun YaTeX-section-overview () 18.129 "Show section overview. Return the nearest sectioning command." 18.130 (interactive) 18.131 (let ((cw (selected-window)) (ln (count-lines (point-min) (point))) 18.132 (pattern "(line:\\([0-9]+\\))") 18.133 - (secbuf YaTeX-sectioning-buffer) (command "")) 18.134 + secbuf (command "")) 18.135 (save-excursion 18.136 (setq secbuf (YaTeX-colloect-sections)) 18.137 (YaTeX-showup-buffer secbuf nil t) 18.138 + (set-buffer secbuf) 18.139 (goto-char (point-max)) 18.140 (while (re-search-backward pattern nil t) 18.141 (if (< ln (string-to-int (YaTeX-match-string 1))) nil 18.142 @@ -278,6 +335,8 @@ 18.143 (insert " <<--") 18.144 (setq pattern (concat "HackyRegexp" "ForFailure")))) 18.145 (set-buffer-modified-p nil) 18.146 + (setq buffer-read-only t buffer-undo-list nil) 18.147 + (make-local-variable 'YaTeX-pending-undo) 18.148 (forward-line 1) 18.149 (if (eobp) (recenter -1) (recenter -3)) 18.150 (select-window cw) 18.151 @@ -297,4 +356,145 @@ 18.152 (forward-char -1) 18.153 ) 18.154 18.155 +(defun YaTeX-shifted-section (sc n) 18.156 + "Get SC's N-shifted sectioning command." 18.157 + (let (lv) 18.158 + (setq lv (- (cdr (assoc sc YaTeX-sectioning-level)) n) 18.159 + lv (max (min YaTeX-sectioning-max-level lv) 0)) 18.160 + (car (nth lv YaTeX-sectioning-level))) 18.161 +) 18.162 + 18.163 +(defun YaTeX-shift-section-up (n) 18.164 + "Shift sectioning command down by level N." 18.165 + (interactive "p") 18.166 + (let ((cb (current-buffer)) sc nsc lv) 18.167 + (if (and YaTeX-sectioning-buffer-parent 18.168 + (get-buffer YaTeX-sectioning-buffer-parent) 18.169 + (save-excursion 18.170 + (or (= (char-after (point)) ?\\ ) 18.171 + (skip-chars-backward "^\\\\" (point-beginning-of-line))) 18.172 + (YaTeX-on-section-command-p YaTeX-sectioning-regexp))) 18.173 + (save-excursion 18.174 + (or (buffer-name (get-buffer YaTeX-sectioning-buffer-parent)) 18.175 + (error "This buffer is obsolete.")) 18.176 + (setq nsc (YaTeX-shifted-section (YaTeX-match-string 1) n)) 18.177 + (YaTeX-sectioning-buffer-jump-internal) 18.178 + (undo-boundary) 18.179 + (goto-char (match-beginning 0)) 18.180 + (skip-chars-forward "\\\\") 18.181 + (delete-region 18.182 + (point) (progn (skip-chars-forward "^*{") (point))) 18.183 + (insert nsc) 18.184 + (undo-boundary) 18.185 + ;; Return to *Sectioning Lines* buffer 18.186 + (select-window (get-buffer-window cb)) 18.187 + (beginning-of-line) 18.188 + (let (buffer-read-only) 18.189 + (delete-region 18.190 + (point) (progn (skip-chars-forward " \t") (point))) 18.191 + (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level))) 18.192 + (skip-chars-forward "^\\\\") 18.193 + (delete-region 18.194 + (1+ (point)) (progn (skip-chars-forward "^*{") (point))) 18.195 + (insert nsc) 18.196 + (undo-boundary)) 18.197 + (set-buffer-modified-p nil) 18.198 + (setq YaTeX-pending-undo pending-undo-list) 18.199 + ))) 18.200 +) 18.201 +(defun YaTeX-shift-section-down (n) 18.202 + "Shift sectioning command down by level N." 18.203 + (interactive "p") 18.204 + (YaTeX-shift-section-up (- n)) 18.205 +) 18.206 +(defun YaTeX-shift-section-undo (arg) 18.207 + "Undo YaTeX-shift-section-up/down." 18.208 + (interactive "p") 18.209 + (and YaTeX-sectioning-buffer-parent 18.210 + (get-buffer YaTeX-sectioning-buffer-parent) 18.211 + (equal (current-buffer) (get-buffer YaTeX-sectioning-buffer)) 18.212 + (let ((cb (current-buffer)) 18.213 + (lc (if (eq last-command 'YaTeX-shift-section-undo) 'undo t))) 18.214 + (let ((pending-undo-list YaTeX-pending-undo) 18.215 + buffer-read-only (last-command lc)) 18.216 + (undo arg) 18.217 + (setq YaTeX-pending-undo pending-undo-list)) 18.218 + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent) 18.219 + (goto-buffer-window YaTeX-sectioning-buffer-parent) 18.220 + (undo-boundary) 18.221 + (let ((last-command lc) 18.222 + (pending-undo-list 18.223 + (if (eq lc 'undo) YaTeX-pending-undo pending-undo-list))) 18.224 + (undo arg) 18.225 + (setq YaTeX-pending-undo pending-undo-list)) 18.226 + (goto-buffer-window cb) 18.227 + (setq this-command 'YaTeX-shift-section-undo))) 18.228 +) 18.229 +(defun YaTeX-sync-section-buffer () 18.230 + "Synchronize *Sectioning Lines* buffer with parent buffer." 18.231 + (interactive) 18.232 + (if (and YaTeX-sectioning-buffer-parent 18.233 + (get-buffer YaTeX-sectioning-buffer-parent)) 18.234 + (let ((cb (current-buffer)) (p (point))) 18.235 + (set-buffer (get-buffer YaTeX-sectioning-buffer-parent)) 18.236 + (YaTeX-section-overview) 18.237 + (switch-to-buffer cb) 18.238 + (goto-char p))) 18.239 +) 18.240 +(defun YaTeX-shift-section-up-region (beg end n) 18.241 + "Shift sectioning commands in region down by level N." 18.242 + (interactive "r\np") 18.243 + (or YaTeX-sectioning-buffer-parent 18.244 + (get-buffer YaTeX-sectioning-buffer-parent) 18.245 + (error "Can't find corresponding LaTeX buffer")) 18.246 + (save-excursion 18.247 + (goto-char beg) 18.248 + (let ((cb (current-buffer)) nsc from to repllist (e (make-marker))) 18.249 + (set-marker e end) 18.250 + (while (progn (skip-chars-forward "^\\\\") (< (point) e)) 18.251 + (YaTeX-on-section-command-p YaTeX-sectioning-regexp) 18.252 + (setq from (YaTeX-match-string 0) 18.253 + nsc (YaTeX-shifted-section (YaTeX-match-string 1) n)) 18.254 + (goto-char (match-beginning 0)) 18.255 + (let (buffer-read-only) 18.256 + (delete-region (point) (progn (beginning-of-line) (point))) 18.257 + (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level))) 18.258 + (delete-region 18.259 + (1+ (point)) (progn (skip-chars-forward "^*{") (point))) 18.260 + (insert nsc)) 18.261 + (YaTeX-on-section-command-p YaTeX-sectioning-regexp) 18.262 + (setq to (YaTeX-match-string 0) 18.263 + repllist (cons (cons from to) repllist)) 18.264 + (forward-line 1)) 18.265 + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent) 18.266 + (goto-buffer-window YaTeX-sectioning-buffer-parent) 18.267 + (save-excursion 18.268 + (goto-char (point-max)) 18.269 + (undo-boundary) 18.270 + (while repllist 18.271 + (if (search-backward (car (car repllist)) nil t) 18.272 + (progn 18.273 + (goto-char (match-beginning 0)) ;confirm 18.274 + (delete-region (point) (match-end 0)) 18.275 + (insert (cdr (car repllist))) 18.276 + (goto-char (match-beginning 0)))) 18.277 + (setq repllist (cdr repllist)))) 18.278 + (goto-buffer-window cb))) 18.279 +) 18.280 +(defun YaTeX-shift-section-down-region (beg end n) 18.281 + "Shift sectioning commands in region down by level N." 18.282 + (interactive "r\np") 18.283 + (YaTeX-shift-section-up-region beg end (- n)) 18.284 +) 18.285 +(defun YaTeX-sectioning-buffer-next-line (n) 18.286 + "Move to next line in *Sectioning Lines* buffer." 18.287 + (interactive "p") 18.288 + (forward-line n) 18.289 + (skip-chars-forward " \t%") 18.290 +) 18.291 +(defun YaTeX-sectioning-buffer-prev-line (n) 18.292 + "Move to previous line in *Sectioning Lines* buffer." 18.293 + (interactive "p") 18.294 + (YaTeX-sectioning-buffer-next-line (- n)) 18.295 +) 18.296 (provide 'yatexsec)