# HG changeset patch # User yuuji # Date 823200947 0 # Node ID 3a7c0c2bf16dc909de8a3e4516002bc72c8f0ad4 # Parent 18f4939986e6022afdf1e955ec0613723a6da7c3 Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape diff -r 18f4939986e6 -r 3a7c0c2bf16d docs/qanda.eng --- a/docs/qanda.eng Sat Dec 02 18:35:28 1995 +0000 +++ b/docs/qanda.eng Thu Feb 01 18:55:47 1996 +0000 @@ -52,9 +52,11 @@ ============ *I accidentally learned in a wrong LaTeX command. - There should be a line with the wrong command in the .yatexrc - file in you home or current directory. Erase that line, do M-x - eval-current-buffer and save the results with C-x C-s. + There should be a line with the wrong command in the .yatexrc + file in your home or current directory. Erase or fix that line, + and save the results with C-x C-s, then kill buffer with C-x k. + Once you make sure the current buffer is your LaTeX source, type + M-x YaTeX-reload-dictionary. *I can't comment out the region. @@ -294,6 +296,16 @@ yatexhks.el will be read in at the end of YaTeX's initialization, so you can overwrite definitions in yatexadd.el. +*Can I make intelligent newline work for my `mylist' environment? + + Yes. See the section `Intelligent newline' in the info manual. + But if you want the same as the intelligent newline for itemize + environment which inserts simply `\item', the following code is + efficient. + + (fset 'YaTeX-intelligent-newline-mylist + 'YaTeX-intelligent-newline-itemize) + [ETC] ===== *Mailing lists? @@ -315,6 +327,16 @@ it yet, yes, this mailing list is in Japanese. But give us a try anyway. You're always welcome. +*How to get the up-to-date information on YaTeX? + + If you can access WWW, try to see; + http://www.comp.ae.keio.ac.jp/~yuuji/yatex/ + And if you trace the link of `yatex-current', you can get the + really latest version of YaTeX. Since it collects the elisps in + the author's source directory, what you'll get may contain some + errors. The author cannot respond to your query about + yatex-current. + *Help, help HELP!! Ways of getting answers in fastest order. diff -r 18f4939986e6 -r 3a7c0c2bf16d docs/yatex.ref --- a/docs/yatex.ref Sat Dec 02 18:35:28 1995 +0000 +++ b/docs/yatex.ref Thu Feb 01 18:55:47 1996 +0000 @@ -51,6 +51,7 @@ ◆プリントアウト [prefix] tl ◆プリントアウト(全ページ) C-u [prefix] tl ◆プレビューア起動 [prefix] tp + ◆xdvi上で文字列サーチ [prefix] ts ※※ ◆lpq起動 [prefix] tq ◆jlatex起動(領域指定) [prefix] tr @@ -58,6 +59,7 @@ は覚えなくて構いません。 ※は、MS-DOS では無効です。 + ※※は、-remote 機能付きの xdvi でのみ有効です。 [prefix] tr の領域指定は、文書中の、 %#BEGIN と書いてある行か ら、%#END と書いてある行までです。%#END を省略すると、%#BEGINか diff -r 18f4939986e6 -r 3a7c0c2bf16d docs/yatexe.tex --- a/docs/yatexe.tex Sat Dec 02 18:35:28 1995 +0000 +++ b/docs/yatexe.tex Thu Feb 01 18:55:47 1996 +0000 @@ -25,7 +25,7 @@ @cindex YaTeX @menu -* What is YaTeX?:: Introduction +* What is YaTeX?:: * Main features:: What YaTeX can do * Installation:: Guide to install * Typesetting:: Call typesetting processes @@ -48,6 +48,12 @@ --- The Detailed Node Listing --- +Typesetting + +* Calling typesetter:: +* Calling previewer:: +* Printing out:: + %# notation * Changing typesetter:: @@ -91,12 +97,12 @@ Procedure -* How the add-in function works?:: +* How the add-in function works:: * How the function is called:: * Useful functions for creating add-in:: * Contribution:: -How the add-in function works? +How the add-in function works * Defining `option add-in':: * Defining `argument add-in':: @@ -138,7 +144,7 @@ @item Easy input of accent mark, math-mode's commands and Greek letters (@kbd{C-c a}, @kbd{;}, @kbd{:}) @item Online help for the popular La@TeX{} commands - (@kbd{C-c ?}, @kbd{C-c /})(English help is not yet supported) + (@kbd{C-c ?}, @kbd{C-c /}) @item Document files hierarchy browser (@kbd{C-c d}) @end itemize @@ -189,25 +195,37 @@ strokes execute typeset or preview command. @table @kbd -@item [prefix] tj +@item [prefix] t j @dots{} invoke latex -@item [prefix] tr +@item [prefix] t r @dots{} invoke latex on region -@item [prefix] tk +@item [prefix] t k @dots{} kill current typesetting process -@item [prefix] tb +@item [prefix] t b @dots{} invoke bibtex -@item [prefix] tp +@item [prefix] t p @dots{} preview -@item [prefix] tl +@item [prefix] t l @dots{} lpr dvi-file +@item [prefix] t s + @dots{} search current string on xdvi-remote @end table - The current editing window will be divided horizontally when you -invoke latex command, and log message of La@TeX{} typesetting will be -displayed in the other window; called typesetting buffer. The -typesetting buffer automatically scrolls up and traces La@TeX{} -warnings and error messages. If you see latex stopping by an +@menu +* Calling typesetter:: +* Calling previewer:: +* Printing out:: +@end menu + +@node Calling typesetter, Calling previewer, Typesetting, Typesetting +@comment node-name, next, previous, up +@section{Calling typesetter} + + Typing @kbd{[prefix] t j}, the current editing window will be divided +horizontally when you invoke latex command, and log message of La@TeX{} +typesetting will be displayed in the other window; called typesetting +buffer. The typesetting buffer automatically scrolls up and traces +La@TeX{} warnings and error messages. If you see latex stopping by an error, you can send string to latex in the typesetting buffer. If an error stops the La@TeX{} typesetting, this key stroke will @@ -233,8 +251,23 @@ file if you edit one file, and is the same as main file's if you edit splitting files. - YaTeX asks you the range of dvi-printing by default. You can -skip this by invoking it with universal-argument as follows: +@node Calling previewer, Printing out, Calling typesetter, Typesetting +@comment node-name, next, previous, up +@section{Calling previewer} + + @kbd{[prefix] t p} invokes the TeX previewer. And if you are using +xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t +s} enables you to search current string at the cursor on the running xdvi +window. You can get xdvi with `-remote feature' from; +@code{ftp://ftp.ae.keio.ac.jp/pub/text/xdvi/xdvi-remote}. + +@node Printing out, , Calling previewer, Typesetting +@comment node-name, next, previous, up +@section{Printing out} + + When you type @code{[preifx] t l}, YaTeX asks you the range of +dvi-printing by default. You can skip this by invoking it with +universal-argument as follows: @example C-u [prefix] tl @@ -519,6 +552,10 @@ user completion table. YaTeX automatically saves the user completion table in the user dictionary file at exiting of emacs. +At the completion of certain environments, the expected initial entry will +automatically inserted such as @code{\item} for @code{itemize} +environment. If you don't want the entry, it can be removed by undoing. + If you want to enclose some paragraphs which have already been written, invoke the begin-type completion with changing the case of @kbd{b} of key sequence upper(or invoke it with universal argument @@ -660,6 +697,38 @@ under certain level by 0 through 6. Type @kbd{?} in the minibuffer of sectioning prompt for more information. + You can generate this listing buffer (@code{*Sectioning Lines*} buffer) +by typing +@table @kbd +@item M-x YaTeX-section-overview + @dots{} Generate *Sectioning Lines* buffer +@end table +@cindex{Generate the listing of sectioning units} +from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on +the sectioning command shifts up the corresponding sectioning command in +source text and @kbd{d} shifts down. After marking lines in the listing +buffer, typing @kbd{U} shifts up all sectioning commands in the region, +and @kbd{U} shifts down. Here are all the key bindings of +@code{*Sectioning Lines*} buffer. + +@table @kbd +@item SPC + @dots{} Jump to corresponding source line +@item . + @dots{} Display corresponding source line +@item u + @dots{} Shift up a sectioning line +@item d + @dots{} Shift down a sectioning line +@item U + @dots{} Shift up sectioning lines in region +@item D + @dots{} Shift down sectioning lines in region +@item 0$B!A(B6 + @dots{} Hide sectioning commands whose level is lower than n +@end table + + @node Large-type completion, Maketitle-type completion, Section-type completion, Completion @comment node-name, next, previous, up @section Large-type completion @@ -849,8 +918,8 @@ Math-mode of YaTeX provides another image completion, Greek letters completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma} -and so on. First, type @kbd{/TAB} to know all the correspondence of -alphabets v.s. Greek letters. +and so on. First, type @kbd{:TAB} to know all the correspondence of +alphabets vs. Greek letters. If you will find @kbd{;} or @kbd{:} doesn't work in correct position of math environment, it may be a bug of YaTeX. Please send me a bug report @@ -1114,7 +1183,7 @@ ~(cursor) @end example -@node Filling, Updation of @code{\includeonly}, Changing and Deleting, Top +@node Filling, Updation of includeonly, Changing and Deleting, Top @comment node-name, next, previous, up @chapter Filling @cindex filling @@ -1125,8 +1194,12 @@ To fill a term (descriptive sentences) of @code{\item}, type +@c @table @kbd +@c @item [prefix] i +@c @dots{} fill item +@c @end table @table @kbd -@item [prefix] i +@item M-q @dots{} fill item @end table @@ -1139,7 +1212,7 @@ @lisp (setq YaTeX-item-regexp - "\\(\\\\item\\)\\|\\(\\\\underlineitem\\)") + "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") @end lisp @cindex YaTeX-item-regexp @@ -1147,22 +1220,17 @@ for Emacs-Lisp, name a newcommand for `itemize' beginning with @code{\item} such as @code{\itembf}, not @code{\bfitem}. - This function -- YaTeX-fill-item -- reformats the @code{\item} into -`hang-indented' style. When you separate the topic word and its -description, use @kbd{M-q} instead. For example: + This function reformats the @code{\item} into `hang-indented' style. +For example: @example -Hang indentation: +itemize, enumerate environment: > >\item[foo] `foo' is the typical word for describing an > arbitrarily written.... - -Normal indentation: - > - > \item bar - > - > When the word `for' is used as an arbitrarily word, `bar' - > is bound to follow it. +description environment: + > \item[bar] When the word `for' is used as an arbitrarily + > word, `bar' is bound to follow it. @end example Note that the indent depth of an @code{\item} word and its descriptive @@ -1214,7 +1282,7 @@ by the current file, and type @kbd{%} to comment out the @code{\includeonly} line. -@node What column?, Intelligent newline, Updation of @code{\includeonly}, Top +@node What column?, Intelligent newline, Updation of includeonly, Top @comment node-name, next, previous, up @chapter What column? @cindex what column @@ -1259,7 +1327,8 @@ @cindex ESC RET @cindex M-C-m - In tabular[*], array, itemize, enumerate or tabbing environment, + At the end of begin-type completion of tabular[*], array, itemize, +enumerate or tabbing environment, or typing @table @kbd @item ESC RET @@ -1267,11 +1336,12 @@ @end table @noindent -inserts the contents corresponding to the current environment in the next -line. In @code{tabular} environment, for example, @kbd{ESC RET} inserts -the certain number of @code{&} and trailing @code{\\}, and @code{\hline} -if other @code{\hline} is found in backward. Here are the list of -contents v.s. environments. +in these environments inserts the contents corresponding to the current +environment in the next line. (At the begin-type completion, this +contents can be removed by `undo'.) In @code{tabular} environment, for +example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing +@code{\\}, and @code{\hline} if other @code{\hline} is found in backward. +Here are the list of contents vs. environments. @itemize @item @code{tabular}, @code{tabular*}, @code{array} @@ -1505,11 +1575,6 @@ Fill-prefix used in yatex-mode (@code{nil}) @end defvar -@defvar YaTeX-open-lines - Number of blank lines between cursor and @code{\begin@{@}}, - @code{\@code{end}@{@}} (0) -@end defvar - @defvar YaTeX-user-completion-table Name of user dictionary where learned completion table will be stored. (@code{"~/.yatexrc"}) @@ -1688,6 +1753,9 @@ See also $B!#(B@code{YaTeX-hilit-sectioning-face}. @end defvar +@defvar YaTeX-use-AMS-LaTeX +If you use AMS-LaTeX, set to @code{t}(@code{nil}). +@end defvar @node Sample definitions, Hook variables, All customizable variables, Lisp variables @comment node-name, next, previous, up @@ -1731,7 +1799,7 @@ @subsection Hook file @cindex hook file - You can stuff all of YaTeX relating expressions into a file named + You can stuff all of YaTeX related expressions into a file named @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load this file at the initialization of itself. Using @file{yatexhks.el} makes @code{yatex-mode-load-hook} unnecessary. @@ -1766,15 +1834,15 @@ @end enumerate @menu -* How the add-in function works?:: +* How the add-in function works:: * How the function is called:: * Useful functions for creating add-in:: * Contribution:: @end menu -@node How the add-in function works?, How the function is called, Add-in functions, Add-in functions +@node How the add-in function works, How the function is called, Add-in functions, Add-in functions @comment node-name, next, previous, up -@subsection How the add-in function works? +@subsection How the add-in function works There are two kinds of add-in. @dfn{Option add-in} returns the La@TeX{}'s optional parameters such as optional strings after @@ -1814,7 +1882,7 @@ * Defining `argument add-in':: @end menu -@node Defining `option add-in', Defining `argument add-in', How the add-in function works?, How the add-in function works? +@node Defining `option add-in', Defining `argument add-in', How the add-in function works, How the add-in function works @comment node-name, next, previous, up @subsubsection Defining `option add-in' @@ -1841,7 +1909,7 @@ (concat "{" (read-string "Rule: ") "}")) @end lisp -@node Defining `argument add-in', , Defining `option add-in', How the add-in function works? +@node Defining `argument add-in', , Defining `option add-in', How the add-in function works @comment node-name, next, previous, up @subsubsection Defining `argument add-in' @@ -1864,7 +1932,7 @@ Note that when the `argument add-in' function return `nil', normal argument reader will be called. -@node How the function is called, Useful functions for creating add-in, How the add-in function works?, Add-in functions +@node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions @comment node-name, next, previous, up @subsection How the function is called diff -r 18f4939986e6 -r 3a7c0c2bf16d docs/yatexj.tex --- a/docs/yatexj.tex Sat Dec 02 18:35:28 1995 +0000 +++ b/docs/yatexj.tex Thu Feb 01 18:55:47 1996 +0000 @@ -38,6 +38,7 @@ * Intelligent newline:: おまかせ改行 * Changing mode of YaTeX:: 野鳥動作モード変更 * Online help:: LaTeXオンラインヘルプ +* Inclusion hierarchy browser:: ファイル分割階層構造の表示 * Cooperation with other packages:: 他パッケージとの連携 * Customizations:: カスタマイズ * Etc:: その他 @@ -49,6 +50,7 @@ latexコマンド起動 * Calling typesetter:: タイプセッタ起動 +* Calling previewer:: プレヴューア起動 * Print out:: プリントアウト用コマンドの起動 %#記法 @@ -74,7 +76,7 @@ section型補完 * 2個以上の引数をとる section型コマンド:: -* Enclose region-type command:: +* Enclose section-type command:: 括り補完 * Recursive completion:: 再帰補完 * view-sectioning:: セクション区切りのアウトライン表示 @@ -267,10 +269,13 @@ @dots{} プレヴューア起動 @item [prefix] t l @dots{} lpr(プリントアウト用)コマンド起動 +@item [prefix] t s + @dots{} xdvi -remote でのサーチ @end table @menu * Calling typesetter:: タイプセッタ起動 +* Calling previewer:: プレヴューア起動 * Print out:: プリントアウト用コマンドの起動 @end menu @@ -313,6 +318,17 @@ メインファイルのあるディレクトリの@file{texput.tex}という臨時ファイルに出 力されますので、上書きには注意してください。 +@node Calling previewer, Print out, Calling typesetter, Invocation +@comment node-name, next, previous, up +@section プレヴューア起動 + @kbd{[prefix] t p} によりプレヴューアの起動ができます。さらに、もしあな +たが、-remote 機能つきのxdviを利用している場合は @kbd{[prefix] t s} を押す +ことによりカーソル位置の文字列を検索してそのページを表示するようにすでに起 +動中のxdviに命令を送ります。これにより、現在編集中の箇所のタイプセット結果 +を即座に見ることができます。なお、-remote 機能付きの xdvi は +@code{ftp://ftp.ae.keio.ac.jp/pub/text/xdvi/xdvi-remote} +などから入手することができます。 + @node Print out, , Calling typesetter, Invocation @comment node-name, next, previous, up @section プリントアウト @@ -635,6 +651,10 @@ 入力の手間が省けます。内部テーブルに存在しない環境名を入力した時はユーザ専 用のテーブルに登録され、さらにそのテーブルを自動的に、ユーザ辞書(デフォル トでは @file{~/.yatexrc})に保存します。 + +さらに、特定の環境を補完入力した時にはその環境で必ず用いられるエントリを自 +動挿入します(例: @code{itemize}環境における@code{\item}など)。挿入されたエ +ントリが不要な場合にはundoによって消去して下さい。 @cindex ユーザ辞書[ゆうさししよ] @subsection 既に書いたテキストを環境で括る @@ -727,12 +747,12 @@ @menu * 2個以上の引数をとる section型コマンド:: -* Enclose region-type command:: +* Enclose section-type command:: 括り補完 * Recursive completion:: 再帰補完 * view-sectioning:: セクション区切りのアウトライン表示 @end menu -@node 2個以上の引数をとる section型コマンド, Enclose region-type command, section型補完, section型補完 +@node 2個以上の引数をとる section型コマンド, Recursive completion, section型補完, section型補完 @comment node-name, next, previous, up @subsection 2個以上の引数をとる section型コマンド @cindex 引数[ひきすう] @@ -766,15 +786,14 @@ @cindex 引数の個数を変える[ひきすうのこすうをかえる] -@node Enclose region-type command, Recursive completion, 2個以上の引数をとる section型コマンド, section型補完 -@comment node-name, next, previous, up +@node Enclose section-type command, Recursive completion, 2個以上の引数をとる section型コマンド, section型補完 @subsection 既に書いたテキストを括る @cindex 括る[くくる] また、起動コマンドの@kbd{s}を大文字に変えて起動すると、あらかじめ書 いた文章を section 型コマンドの第一引数として括ります。 -@node Recursive completion, view-sectioning, Enclose region-type command, section型補完 +@node Recursive completion, view-sectioning, 2個以上の引数をとる section型コマンド, section型補完 @comment node-name, next, previous, up @subsection 再帰補完 @cindex 再帰補完[さいきほかん] @@ -790,14 +809,46 @@ @cindex アウトライン[あうとらいん] 通常のsection型補完の時にミニバッファで@kbd{C-v}を押すと現在存在するセク -ション区切りコマンド全てを一覧表示します(「<<--」のついている行がもっとも -近いセクション区切り)。この時ミニバッファで@kbd{C-p}, @kbd{C-n} を押すと -@samp{part}, @samp{chapter}, ..., @samp{subparagraph} のコマンドが論理階層 -の高さにしたがって上下します。また、@kbd{C-v}, @kbd{M-v} を押すとセクショ -ン区切り一覧バッファがスクロールし、数字の@kbd{0}〜@kbd{7}を押すとある高さ -以上のセクション区切りだけを選んで表示します(実際にやって見れば分かります)。 -この一覧バッファにカーソルを移しスペースを押すと、該当するセクション区切り -のある本文中の場所にジャンプします。 +ション区切りコマンド全てを @code{*Sectioning Lines*}というバッファに一覧表 +示します(「<<--」のついている行がもっとも近いセクション区切り)。この時ミニ +バッファで@kbd{C-p}, @kbd{C-n} を押すと@samp{part}, @samp{chapter}, ..., +@samp{subparagraph} のコマンドが論理階層の高さにしたがって上下します。また、 +@kbd{C-v}, @kbd{M-v} を押すとセクション区切り一覧バッファがスクロールし、 +数字の@kbd{0}〜@kbd{7}を押すとある高さ以上のセクション区切りだけを選んで表 +示します(実際にやって見れば分かります)。 + +@code{*Sectioning Lines*}バッファは、 +@table @kbd +@item M-x YaTeX-section-overview + @dots{} セクション区切り一覧バッファを生成 +@end table +@cindex セクション区切り一覧バッファ[せくしよんくきりいちらんはつは] +で作成することができます。このバッファをを選択し任意の行でスペースを押すと、 +該当するセクション区切りのある本文中の場所にジャンプします。さらに、同バッ +ファで @kbd{u} を押すと、ソーステキストの対応するセクションコマンドが一階 +層上がり(例: subsection が section に変わる)、@kbd{d}を押すと一階層下がり +ます。@code{*Sectioning Lines*}バッファにあるセクション区切りの行をマーク +しておいて@kbd{U}を押すとリジョン内のものに対応するソーステキストのセクショ +ンコマンドすべてが一階層上がり、@kbd{D}を押すと下がります。セクション区切 +り一覧バッファで利用できるキーコマンドには以下のものがあります。 + +@table @kbd +@item SPC + @dots{} 対応するソース行へジャンプ +@item . + @dots{} 対応するソース行を表示 +@item u + @dots{} カーソル位置に対応するセクションコマンドを一階層上げる +@item d + @dots{} カーソル位置に対応するセクションコマンドを一階層下げる +@item U + @dots{} マークしたセクションコマンドを一階層上げる +@item D + @dots{} マークしたセクションコマンドを一階層上げる +@item 0〜6 + @dots{} レベル n 以下のセクションコマンドを隠して表示 +@end table + @cindex 論理階層[ろんりかいそう] @cindex セクション区切り[せくしよんくきり] @cindex ジャンプ[しやんふ] @@ -1305,16 +1356,21 @@ itemize 環境中にある@code{\item}の項目(文章)が複数行に渡る場合に、項 目の先頭を桁揃えしたい場合には、 +@c @table @kbd +@c @item [prefix] i +@c @dots{} itemの桁揃え +@c @end table + @table @kbd -@item [prefix] i - @dots{} itemの桁揃え +@item M-q + @dots{} 桁揃え @end table @cindex NTT-jTeX[えぬていいていいしえいてつく] @noindent -によって、その item のインデントの深さに応じて fill されます。なお、NTT -jTeX を使用している場合には、Lisp 変数@code{NTT-jTeX}を@code{t}にセットし -て下さい。 +によって、その item のインデントの深さに応じて fill されます。なお、古い +NTT jTeX を使用している場合には、Lisp 変数@code{NTT-jTeX}を@code{t}にセッ +トして下さい。 @cindex YaTeX-item-regexp このとき、変数@code{YaTeX-item-regexp}の値(標準では @code{"\\\\item"})を @@ -1324,44 +1380,37 @@ @lisp (setq YaTeX-item-regexp - "\\(\\\\item\\)\\|\\(\\\\underlineitem\\)") + "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") @end lisp @noindent この変数の指定の仕方がよく分からない場合は、独自の項目列挙コマンドの名前を @code{@code{"\item"}で始まるものにして下さい(例えば"\itembf"})。 - @kbd{[prefix] i} では@code{\item} を「ハングインデント」に整形します。も -し@code{\item}とその説明用パラグラフを切り離す時は通常の -@kbd{M-q}(他のモードではfill-paragraphが割り当てられている)を使ってくださ -い。(つまり以下のような場合:) +野鳥の @kbd{M-q} では @code{\item} を環境に応じて以下のように「ハングイン +デント」します。 @example -ハングインデント: +itemize, enumerate環境: >\item[ほげほげ] 英語では、特に意味のない単語を `foo' であらわしま > すが、これの日本語版ともいえる単語が「ほげほげ」 > です。 -通常インデント: - > \item へろへろ - > - > 「ほげほげ」をでたらめが単語として使った時に、第2のでたら - > めな単語として「へろへろ」が使われることが多いようです。 +description環境: + > \item[へろへろ] 「ほげほげ」をでたらめが単語として使った時に、第 + > 2のでたらめな単語として「へろへろ」が使われることが多 + > いようです。 @end example - 上の通常インデントの場合、説明パラグラフのインデントは \item の見出しと -同じ深さとする必要があります。ただし、@kbd{M-q}を行の最初の非空白文字の位 -置で押すことにより深さを変えることができます(後述)。 - @section パラグラフの桁揃え @cindex パラグラフの桁揃え[はらくらふのけたそろえ] @cindex M-q - パラグラフの桁揃え(fill)は、基本的に通常通り機能しますが、verbatim環境や、 -tabular環境など桁揃えをすると悲惨な状況になるような環境中では機能しません。 -また、\verb で括ってあるものは決して行分割されません(変数 -@code{YaTeX-verb-regexp} で制御) )。さらに、一時的にインデントの深さを変え -てある箇所では、そのインデントの先頭で@kbd{M-q}を押すことにより -fill-prefix をいちいち変更しなくて桁揃えができます。 + itemize環境以外でのパラグラフの桁揃え(fill)は、基本的に他のモードと同じ +ように機能しますが、verbatim環境や、tabular環境など桁揃えをすると悲惨な状 +況になるような環境中では機能しません。また、\verb で括ってあるものは決して +行分割されません(変数 @code{YaTeX-verb-regexp} で制御) )。さらに、一時的に +インデントの深さを変えてある箇所では、そのインデントの先頭で@kbd{M-q}を押 +すことにより fill-prefix をいちいち変更しなくて桁揃えができます。 @node Includeonly, What column, Filling, Top @@ -1443,7 +1492,8 @@ @cindex &入力[&にゅうりょく] @cindex prefix & - tabular[*], array, itemize, enumerate, tabbing 環境で + tabular[*], array, itemize, enumerate, tabbing 環境をbegin型補完で入力し +た時、または各環境内で @table @kbd @item ESC RET @@ -1451,10 +1501,11 @@ @end table @noindent -を押すと、その環境に応じた行エントリを次の行に挿入します。例えば、tabular -環境では、その環境のカラム数に対応した個数の @code{&} に加え、行末の -@code{\\} を入れます。この時それ以前に @code{\hline} があればそれも付け加 -えます。環境とそれに応じて自動入力するものの対応は以下のようになります。 +を押すと、その環境に応じた行エントリを次の行に挿入します(begin型補完時に自 +動挿入されたエントリが不要な場合は undo によって消去できます)。例えば、 +tabular環境では、その環境のカラム数に対応した個数の @code{&} に加え、行末 +の @code{\\} を入れます。この時それ以前に @code{\hline} があればそれも付け +加えます。環境とそれに応じて自動入力するものの対応は以下のようになります。 @itemize @item @code{tabular}, @code{tabular*}, @code{array} @@ -1478,8 +1529,8 @@ します。定義した関数は、現在の行に改行を挿入した直後の行頭の位置で呼ばれま す。関数 @code{YaTeX-indent-line} を呼ぶと現在の環境のネストに応じた深さに インデントされるので、これを呼んでから何かを挿入するようなコードを書くとよ -いでしょう。関数 @code{YaTeX-intelligent-newline-itemize} の定義などを参考 -にしてください。 +いでしょう。@file{yatexenv.el}内の関数 +@code{YaTeX-intelligent-newline-itemize} の定義などを参考にしてください。 @node Changing mode of YaTeX, Online help, Intelligent newline, Top @comment node-name, next, previous, up @@ -1705,10 +1756,6 @@ 本文を書く時の行頭に挿入する接頭辞すなわち fill-prefix (@code{""(nil)}) @end defvar -@defvar YaTeX-open-lines -\begin{環境}と\end{環境}のあいだの空白行数 (0) -@end defvar - @defvar YaTeX-user-completion-table 学習したLa@TeX{}コマンド保存ファイル名(@code{"~/.yatexrc"}) @end defvar @@ -1893,6 +1940,10 @@ の項参照。 @end defvar +@defvar YaTeX-use-AMS-LaTeX +AMS-LaTeX を使用する場合は @code{t} に設定する(@code{nil})。 +@end defvar + @node Sample definitions, Hook variables, All customizable variables, Lisp variables @comment node-name, next, previous, up @subsection カスタマイズ変数設定例 diff -r 18f4939986e6 -r 3a7c0c2bf16d help/YATEXHLP.jp --- a/help/YATEXHLP.jp Sat Dec 02 18:35:28 1995 +0000 +++ b/help/YATEXHLP.jp Thu Feb 01 18:55:47 1996 +0000 @@ -652,6 +652,7 @@ description \begin{description} \item[見出し単語] 説明 ... \end{description} [見出し単語]を見出しとする + subitem \subitem 項目 @@ -1199,20 +1200,44 @@ 二段組みページでぶち抜きタイトルを作成する時に用いるとよい。 LaiTeX -a Little Assistant Interface for TeX +a Little Assistant Interface for TeX on Vz おそらくあなたが今 Vz 上で使っているこのモード。 LaTeXを効率的に使うための多くの機能を盛り込んでいます。 【発音について】 - laitex.defなどプログラムを指す時は「らいてっく」、システムを指す時は「ら いちょう」と読みます。 【補足】 「雷鳥」の旧仮名遣いは「らいてう」だそうです。 +【謝辞】 +以下の方々の御協力を頂きました。ここに感謝申し上げます。 + +(順不同/代表項目のみ) +横田一也さん(マツダ) + 転載を行って頂きました。 + +北岸隆史さん(豊橋技術科学大) +小林克志さん(広島大) +保甫恒喜さん(立命館大) +小島昭二さん(静岡大) +小林肇さん(金沢工業大) +坂田一生さん(niftyserve) +山際直之さん(niftyserve) +並川仁さん(niftyserve) + バグの指摘や、要望、励ましのメールを頂きました。 + (まとめてでごめんなさい -- 桂川) + +柴田みゆきさん(京都ソフトウェアリサーチ) + Software Design 誌で本ソフトをご紹介いただきました。 + +バッキー"毒ラッコ"トミザワさん(筑波大) + 雷鳥の為にノートパソコンを無償で貸与して下さいました。 + 彼のおかげで、雷鳥ははばたくことが出来ました。 + laitex -a Little Assistant Interface for TeX +a Little Assistant Interface for TeX on Vz YaTeX @@ -1227,7 +1252,7 @@ 【謝辞】 以下の方々の御協力を頂きました。ここに感謝申し上げます。 -(順不同) +(順不同/代表項目のみ) 峯恒憲さん(九州大) Bibtex起動、typeset process の kill、エラー箇所の正しい判定 の要望その他を頂きました。 @@ -1258,9 +1283,11 @@ るねきちさん(asciinet) 占い師だそうです。 + http://www.comp.ae.keio.ac.jp/~yuuji/lune/astrology/ 柱川さん(prc) 各所で暴れています。 + http://www.prc.tsukuba.ac.jp/~katsura/ 三平善郎さん(慶應大) 開き括弧の入力時の処理のモード分けのアイデアを頂きました。 @@ -1326,6 +1353,8 @@ 竹中浩さん(東京大) M-q (YaTeX-fill-paragraph) のバグを報告して頂きました。 YaTeX-insert-amper をcontributeして頂きました。 + 作者の数多くの凡ミスを丁寧に拾って下さいました。 + YaTeX-shift-section-undo の実現方法を教えていただきました。 佐藤圭さん(慶應大) ネストした同種のitemize環境でのindentationの不具合を指摘して頂き @@ -1347,6 +1376,24 @@ label/ref補完で、labelやrefで始まる単語全てを候補にいれてしまう バグを報告して頂きました。 +上田佳明さん(豊橋技科大) + Emacs 19.29 以降で生じるYaTeX-indent-new-comment-lineの不具合を + 指摘して頂きました。 + +成宮隆之さん(富山大学) + 「初めて使うYaTeX」というCoolなWWWページを作成して下さいました。 + +田中敏さん(富山大学) + AMS-LaTeX に対応するためのパッチを送って頂きました。 + +西澤幸司さん(東北大学) +田仲稔さん([株]ケイケンエンジニアリングシステム) + begin型補完でおまかせ改行関数があれば、補完時に初期エントリを挿 + 入するというアイデアを提供していただきました。 + +葛西澄人さん(慶應大) + YaTeX-default-pop-window-height の原案を頂きました。 + $ \% $ のような場合の数式モード終了判定のミスを指摘して頂きました。 yatex (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist)) diff -r 18f4939986e6 -r 3a7c0c2bf16d yahtml.el --- a/yahtml.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yahtml.el Thu Feb 01 18:55:47 1996 +0000 @@ -1,9 +1,24 @@ ;;; -*- Emacs-Lisp -*- -;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net.or.jp] -;;; Last modified Mon Nov 20 11:26:38 1995 on inspire -;;; This is PURELY tentative. +;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@asciinet.or.jp] +;;; Last modified Fri Feb 2 02:37:23 1996 on supra +;;; This package is no longer tentative. ;;; $Id$ +;;;[Installation] +;;; +;;; First, you have to install YaTeX and make sure it works fine. Then +;;; put these expressions into your ~/.emacs +;;; +;;; (setq auto-mode-alist +;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) +;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) +;;; (setq yahtml-www-browser "netscape") +;;; ;Write your favorite browser. But netscape is advantageous. +;;; (setq yahtml-path-url-alist +;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji") +;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji"))) +;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path. +;;; ;;;[Commentary] ;;; ;;; It is assumed you are already familiar with YaTeX. The following @@ -19,10 +34,19 @@ ;;; * [prefix] l Complete typeface-changing commands such as ;;; ` ... ' or ` ... ' ;;; * [prefix] m Complete single commands such as -;;; `
' or `
' +;;; `
' or `
or
  • ...' ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I ;;; hate menu, this is most useful) -;;; +;;; * [prefix] g Goto corresponding Tag or HREF such as +;;;
    <->
    or href="xxx" +;;; * [prefix] k Kill html tags on the point. If you provide +;;; universal-argument, kill surrounded contents too. +;;; * [prefix] c Change html tags on the point. +;;; * [prefix] t b View current html with WWW browser +;;; (To activate this, never fail to set the lisp +;;; variable yahtml-www-browser. Recommended value +;;; is "netscape") +;;; ;;; NOTE! This program is truly tentative. If you find some bright ;;; future with this, please send me a mail to drive me to maintain this :) @@ -30,6 +54,20 @@ (require 'yatex) (defvar yahtml-prefix-map nil) (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") +(defvar yahtml-image-viewer "xv" "*Image viewer program") +(defvar yahtml-www-browser "netscape" + "*WWW Browser command") +(defvar yahtml-kanji-code 2 + "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc") +;;(defvar yahtml-www-server "www" "*Host name of your domain's WWW server") +(defvar yahtml-path-url-alist nil + "*Alist of unix path name vs. URL name of WWW server. +Ex. +'((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\") + (\"/usr/home/yuuji/darts/http\" . \"http://inspire.comp.ae.keio.ac.jp/~darts\"))") +(defvar yahtml-directory-index "index.html" + "*Directory index file name; +Consult your site's WWW administrator.") (defun yahtml-define-begend-key-normal (key env &optional map) "Define short cut yahtml-insert-begin-end key." @@ -57,10 +95,13 @@ (setq yahtml-mode-map (make-sparse-keymap) yahtml-prefix-map (make-sparse-keymap)) (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) - (define-key yahtml-mode-map "\M-\C-@" 'YaTeX-mark-environment) + (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend) + (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19) + (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend)) (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment) (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment) - (define-key yahtml-mode-map "\C-i" 'YaTeX-indent-line) + (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline) + (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line) (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map) (let ((map yahtml-prefix-map)) (YaTeX-define-key "^" 'yahtml-visit-main map) @@ -96,18 +137,22 @@ (yahtml-define-begend-key "bf" "form" map) (yahtml-define-begend-key "bs" "select" map) (YaTeX-define-key "b " 'yahtml-insert-begend map) - (YaTeX-define-key "B " 'yahtml-insert-begend map) + (YaTeX-define-key "B " 'yahtml-insert-begend-region map) ) - (YaTeX-define-key "e" 'yahtml-end-environment map) + (YaTeX-define-key "e" 'YaTeX-end-environment map) (YaTeX-define-key ">" 'yahtml-comment-region map) (YaTeX-define-key "<" 'yahtml-uncomment-region map) (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map) + (YaTeX-define-key "k" 'yahtml-kill-* map) + (YaTeX-define-key "c" 'yahtml-change-* map) + (YaTeX-define-key "t" 'yahtml-browse-menu map) + ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map) ) ) (defvar yahtml-paragraph-separate (concat - "^$\\|
    \\|

    \\|^[ \t]*") + "^$\\|<[bh]r>\\|

    \\|^[ \t]*") "*Regexp of html paragraph separater") (defvar yahtml-syntax-table nil "*Syntax table for typesetting buffer") @@ -120,8 +165,6 @@ ) (defvar yahtml-command-regexp "[A-Za-z0-9]+" "Regexp of constituent of html commands.") -(defvar yahtml-kanji-code 2 - "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc") ;;; Completion tables for `form' (defvar yahtml-form-table @@ -131,8 +174,15 @@ (defvar yahtml-env-table '(("html") ("head") ("title") ("body") ("dl") ("a") ("form") ("select") + ("OrderedList" . "ol") + ("UnorderedList" . "ul") + ("DefinitionList" . "dl") ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ("ul"))) +(defvar yahtml-itemizing-regexp + "\\(ul\\|ul\\|dl\\)" + "Regexp of itemizing forms") + (defvar yahtml-user-env-table nil) (defvar yahtml-tmp-env-table nil) @@ -143,9 +193,18 @@ "Default completion table of typeface designator") (defvar yahtml-user-typeface-table nil) (defvar yahtml-tmp-typeface-table nil) +(defvar yahtml-last-typeface-cmd "address") (defvar yahtml-single-cmd-table - '(("hr") ("br") ("option") ("p")) + '(("hr") ("br") ("option") ("p") + ("HorizontalLine" . "hr") + ("BreakLine" . "br") + ("Paragraph" . "p") + ("Item" . "li") + ("DefineTerm" . "dt") + ("Description" . "dd") + ("dd") ("dt") ("li") + ) "Default completion table of HTML single command.") (defvar yahtml-user-single-cmd-table nil) (defvar yahtml-tmp-single-cmd-table nil) @@ -165,7 +224,7 @@ yahtml-typeface-table)))) (defvar yahtml-struct-name-regexp - "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\)") + "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\|table\\|t[rhd]\\)") (defun yahtml-mode () @@ -188,8 +247,8 @@ (make-local-variable 'YaTeX-prefix-map) (make-local-variable 'YaTeX-command-token-regexp) (setq YaTeX-command-token-regexp yahtml-command-regexp) - (make-local-variable 'YaTeX-environment-indent) - (setq YaTeX-environment-indent 0) + ;;(make-local-variable 'YaTeX-environment-indent) + ;;(setq YaTeX-environment-indent 0) (make-local-variable 'fill-prefix) (setq fill-prefix nil) (make-local-variable 'paragraph-separate) @@ -198,6 +257,10 @@ (make-local-variable 'comment-start) (make-local-variable 'comment-end) (setq comment-start "") + (make-local-variable 'indent-line-function) + (setq indent-line-function 'yahtml-indent-line) + (make-local-variable 'YaTeX-item-regexp) + (setq YaTeX-item-regexp "<\\(li\\|d[td]\\)>") (set-syntax-table yahtml-syntax-table) (use-local-map yahtml-mode-map) (run-hooks 'yahtml-mode-hook)) @@ -227,57 +290,57 @@ (yahtml-define-menu yahtml-menu-map-sectioning (nreverse - '((1 "H1" . (lambda () (interactive) (yahtml-insert-begin-end "H1" nil))) - (2 "H2" . (lambda () (interactive) (yahtml-insert-begin-end "H2" nil))) - (3 "H3" . (lambda () (interactive) (yahtml-insert-begin-end "H3" nil))) - (4 "H4" . (lambda () (interactive) (yahtml-insert-begin-end "H4" nil))) - (5 "H5" . (lambda () (interactive) (yahtml-insert-begin-end "H5" nil))) - (6 "H6" . (lambda () (interactive) (yahtml-insert-begin-end "H6" nil))) + '((1 "H1" . (lambda () (interactive) (yahtml-insert-begend nil "H1"))) + (2 "H2" . (lambda () (interactive) (yahtml-insert-begend nil "H2"))) + (3 "H3" . (lambda () (interactive) (yahtml-insert-begend nil "H3"))) + (4 "H4" . (lambda () (interactive) (yahtml-insert-begend nil "H4"))) + (5 "H5" . (lambda () (interactive) (yahtml-insert-begend nil "H5"))) + (6 "H6" . (lambda () (interactive) (yahtml-insert-begend nil "H6"))) ))) (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags")) (yahtml-define-menu yahtml-menu-map-logical (nreverse '((em "Embolden" . - (lambda () (interactive) (yahtml-insert-tag "EM"))) + (lambda () (interactive) (yahtml-insert-tag nil "EM"))) (defn "Define a word" . - (lambda () (interactive) (yahtml-insert-tag "DEFN"))) + (lambda () (interactive) (yahtml-insert-tag nil "DEFN"))) (cite "Citation" . - (lambda () (interactive) (yahtml-insert-tag "CITE"))) + (lambda () (interactive) (yahtml-insert-tag nil "CITE"))) (code "Code" . - (lambda () (interactive) (yahtml-insert-tag "CODE"))) + (lambda () (interactive) (yahtml-insert-tag nil "CODE"))) (kbd "Keyboard" . - (lambda () (interactive) (yahtml-insert-tag "KBD"))) + (lambda () (interactive) (yahtml-insert-tag nil "KBD"))) (samp "Sample display" . - (lambda () (interactive) (yahtml-insert-tag "SAMP"))) + (lambda () (interactive) (yahtml-insert-tag nil "SAMP"))) (strong "Strong" . - (lambda () (interactive) (yahtml-insert-tag "STRONG"))) + (lambda () (interactive) (yahtml-insert-tag nil "STRONG"))) (VAR "Variable notation" . - (lambda () (interactive) (yahtml-insert-tag "VAR"))) + (lambda () (interactive) (yahtml-insert-tag nil "VAR"))) ))) (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags")) (yahtml-define-menu yahtml-menu-map-typeface (nreverse '((b "Bold" . - (lambda () (interactive) (yahtml-insert-tag "B"))) + (lambda () (interactive) (yahtml-insert-tag nil "B"))) (i "Italic" . - (lambda () (interactive) (yahtml-insert-tag "I"))) + (lambda () (interactive) (yahtml-insert-tag nil "I"))) (tt "Typewriter" . - (lambda () (interactive) (yahtml-insert-tag "TT"))) + (lambda () (interactive) (yahtml-insert-tag nil "TT"))) (u "Underlined" . - (lambda () (interactive) (yahtml-insert-tag "U"))) + (lambda () (interactive) (yahtml-insert-tag nil "U"))) ))) (setq yahtml-menu-map-listing (make-sparse-keymap "listing")) (yahtml-define-menu yahtml-menu-map-listing (nreverse - '((ul "Unnumbered" . - (lambda () (interactive) (yahtml-insert-begin-end "UL" nil))) - (ol "Numbered" . - (lambda () (interactive) (yahtml-insert-begin-end "OL" nil))) - (dl "Description" . - (lambda () (interactive) (yahtml-insert-begin-end "DL" nil))) + '((ul "Unordered" . + (lambda () (interactive) (yahtml-insert-begend nil "UL"))) + (ol "Ordered" . + (lambda () (interactive) (yahtml-insert-begend nil "OL"))) + (dl "Definition" . + (lambda () (interactive) (yahtml-insert-begend nil "DL"))) ))) (setq yahtml-menu-map-item (make-sparse-keymap "item")) (yahtml-define-menu @@ -292,6 +355,10 @@ ))) (define-key yahtml-mode-map [menu-bar yahtml] (cons "yahtml" yahtml-menu-map)) + (let ((keys (where-is-internal 'fill-paragraph global-map))) + (while keys + (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph) + (setq keys (cdr keys)))) (yahtml-define-menu yahtml-menu-map (nreverse @@ -329,14 +396,22 @@ ;;; ----------- Completion ---------- (defvar yahtml-last-begend "html") -(defun yahtml-insert-begend (&optional region) +(defun yahtml-insert-begend (&optional region env) "Insert ... ." (interactive "P") - (let ((cmd (YaTeX-cplread-with-learning + (let*((completion-ignore-case t) + (cmd + (or env + (YaTeX-cplread-with-learning (format "Environment(default %s): " yahtml-last-begend) - 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table)) - (bolp (bolp))) + 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table))) + (bolp (save-excursion + (skip-chars-backward " \t" (point-beginning-of-line)) (bolp))) + (cc (current-column))) (if (string< "" cmd) (setq yahtml-last-begend cmd)) + (setq yahtml-last-begend + (or (cdr (assoc yahtml-last-begend yahtml-env-table)) + yahtml-last-begend)) (setq cmd yahtml-last-begend) (if region (let ((beg (region-beginning)) @@ -346,11 +421,14 @@ (insert (format "%s" cmd (if bolp "\n" ""))) (goto-char beg) (insert (format "<%s%s>%s" cmd addin (if bolp "\n" "")))) - (insert (format "<%s%s" cmd (yahtml-addin cmd))) - (if bolp (progn (insert (format ">\n\n" cmd cmd)) - (forward-line -1)) - (insert ">") - (save-excursion (insert (format "" cmd))))))) + (insert (format "<%s%s>" cmd (yahtml-addin cmd))) + (save-excursion + (if bolp (progn + (insert "\n") + (indent-to-column cc) + (insert (format "" cmd))) + (insert (format "" cmd)))) + (if bolp (yahtml-intelligent-newline nil))))) (defun yahtml-insert-begend-region () "Call yahtml-insert-begend in the region mode." @@ -368,7 +446,7 @@ 'yahtml-form-table 'yahtml-user-form-table 'yahtml-tmp-form-table))) (let ((p (point)) q) - (insert (format "<%s%s>" form (yahtml-addin (downcase form)))) + (insert (format "<%s%s>" form (yahtml-addin form))) ;;(indent-relative-maybe) (if (cdr (assoc form yahtml-form-table)) (save-excursion (insert (format "" form)))) @@ -376,24 +454,81 @@ (defun yahtml-addin (form) "Check add-in function's existence and call it if exists." - (let ((addin (concat "yahtml:" form))) - (if (and (intern-soft addin) (fboundp (intern-soft addin))) - (concat " " (funcall (intern addin))) + (let ((addin (concat "yahtml:" (downcase form))) s) + (if (and (intern-soft addin) (fboundp (intern-soft addin)) + (stringp (setq s (funcall (intern addin)))) + (string< "" s)) + (concat " " s) ""))) +(defvar yahtml-url-completion-map nil "Key map used in URL completion buffer") +(if yahtml-url-completion-map nil + (setq yahtml-url-completion-map + (copy-keymap minibuffer-local-completion-map)) + (define-key yahtml-url-completion-map "\t" 'yahtml-complete-url) + (define-key yahtml-url-completion-map " " 'yahtml-complete-url) +) + +(defun yahtml-complete-url () + "Complete external URL from history or local file name." + (interactive) + (let (initial cmpl path dir file listfunc beg (p (point))) + (setq initial (buffer-string)) + (cond + ((string-match "^http:" initial) + (setq cmpl (try-completion initial yahtml-urls) + listfunc (list 'lambda nil + (list 'all-completions initial 'yahtml-urls)) + beg (point-min))) + (t + (setq path (if (string-match "^/" initial) + (yahtml-url-to-path initial) + initial)) + (setq dir (or (file-name-directory path) ".") + file (file-name-nondirectory path) + initial file + cmpl (file-name-completion file dir) + listfunc (list 'lambda nil + (list 'file-name-all-completions + file dir)) + beg (save-excursion (skip-chars-backward "^/") (point))))) + (cond + ((stringp cmpl) + (if (string= initial cmpl) + (with-output-to-temp-buffer "*Completions*" + (princ "Possible completinos are:\n") + (princ + (mapconcat '(lambda (x) x) (funcall listfunc) "\n"))) + (delete-region (point) beg) + (insert cmpl))) + ((null cmpl) + (ding)) + ((eq t cmpl) + (save-excursion + (unwind-protect + (progn + (goto-char p) + (insert " [Sole completion]")) + (delete-region p (point-max)))))))) + (defun yahtml:a () "Add-in function for " -; (or yahtml-urls (yahtml-collect-url-history)) + (or yahtml-urls (yahtml-collect-url-history)) ; (concat "href=\"" ; (completing-read "href: " yahtml-urls) ; "\"") - (concat "href=\"" (read-file-name "href: " "" nil nil "") "\"") -) + (message "(H)ref (N)ame?") + (cond + ((string-match "[hH]" (char-to-string (read-char))) + (concat "href=\"" + (read-from-minibuffer "href: " "" yahtml-url-completion-map) + "\"")) + (t (concat "name=\"" (read-string "name: ") "\"")))) (defun yahtml:img () "Add-in function for " (or yahtml-urls (yahtml-collect-url-history)) - (let ((src (read-file-name "src: " "" nil t "")) + (let ((src (read-file-name "src: " "" nil nil "")) (alg (completing-read "align: " '(("top") ("middle") ("bottom"))))) (concat "src=\"" src "\"" (if (string< "" alg) (concat " align=\"" alg "\""))))) @@ -410,6 +545,16 @@ (setq yahtml-last-single-cmd "option") (concat " name=\"" (read-string "name: ") "\"")) +(defun yahtml:ol () + (setq yahtml-last-single-cmd "li") "") +(defun yahtml:ul () + (setq yahtml-last-single-cmd "li") "") +(defun yahtml:dl () + (setq yahtml-last-single-cmd "dt") "") +(defun yahtml:dt () + (setq yahtml-last-single-cmd "dd") "") + + (defvar yahtml-input-types '(("text") ("password") ("checkbox") ("radio") ("submit") ("reset") ("image") ("hidden"))) @@ -432,36 +577,46 @@ (if (string< "" maxlength) (concat " maxlength=\"" maxlength "\"")) ))) - -(defun yahtml-insert-begin-end (env &optional region-mode) - "Insert \\n by calling YaTeX-insert-begin-end." - (interactive "sEnv: ") - (setq env (funcall (if yahtml-prefer-upcases 'upcase 'downcase) env)) - (YaTeX-insert-begin-end env region-mode)) - -(defun yahtml-insert-tag (tag) +(defun yahtml-insert-tag (region-mode &optional tag) "Insert and put cursor inside of them." - (interactive - (list - (YaTeX-cplread-with-learning - "Tag: " - 'yahtml-typeface-table 'yahtml-user-typeface-table - 'yahtml-tmp-typeface-table))) - (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag)) - (insert (format "<%s> " tag)) - (save-excursion (insert (format "" tag)))) + (interactive "P") + (or tag + (setq tag + (YaTeX-cplread-with-learning + (format "Tag %s(default %s): " + (if region-mode "region: " "") yahtml-last-typeface-cmd) + 'yahtml-typeface-table 'yahtml-user-typeface-table + 'yahtml-tmp-typeface-table))) + (if (string= "" tag) (setq tag yahtml-last-typeface-cmd)) + (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag) + yahtml-last-typeface-cmd tag) + (if region-mode + (if (if (string< "19" emacs-version) (mark t) (mark)) + (save-excursion + (if (> (point) (mark)) (exchange-point-and-mark)) + (insert "<" tag ">") + (exchange-point-and-mark) + (insert "")) + (message "No mark set now")) + (insert (format "<%s> " tag)) + (save-excursion (insert (format "" tag))))) (defun yahtml-insert-single (cmd) "Insert ." (interactive - (list (YaTeX-cplread-with-learning - (format "Command%s: " - (if yahtml-last-single-cmd - (concat "(default " yahtml-last-single-cmd ")") "")) - 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table - 'yahtml-tmp-single-cmd-table))) + (list + (let ((completion-ignore-case t)) + (YaTeX-cplread-with-learning + (format "Command%s: " + (if yahtml-last-single-cmd + (concat "(default " yahtml-last-single-cmd ")") "")) + 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table + 'yahtml-tmp-single-cmd-table)))) + (if (string< "" cmd) (setq yahtml-last-single-cmd cmd)) (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd)) - (if (string< "" cmd) (setq yahtml-last-single-cmd cmd)) + (setq yahtml-last-single-cmd + (or (cdr (assoc yahtml-last-single-cmd yahtml-single-cmd-table)) + yahtml-last-single-cmd)) (insert (format "<%s>" yahtml-last-single-cmd))) ;;; ---------- Jump ---------- @@ -469,25 +624,73 @@ "Check if point is on href clause." (let ((p (point)) cmd) (save-excursion - (or (bobp) (skip-chars-backward "^ \t")) - (and (looking-at "href\\s *=\\s *\"?\\([^\"]+\\)\"?") + (or (bobp) (skip-chars-backward "^ \t\n")) + (and (looking-at "href\\s *=\\s *\"?\\([^\"> \t\n]+\\)\"?") (< p (match-end 0)) (YaTeX-match-string 1))))) +(defun yahtml-netscape-sentinel (proc mes) + (cond + ((null (buffer-name (process-buffer proc))) + (set-process-buffer proc nil)) + ((eq (process-status proc) 'exit) + (let ((cb (current-buffer))) + (set-buffer (process-buffer proc)) + (goto-char (point-min)) + (if (search-forward "not running" nil t) + (progn + (message "Starting netscape...") + (start-process + "browser" (process-buffer proc) shell-file-name "-c" + (format "%s %s" yahtml-www-browser + (get 'yahtml-netscape-sentinel 'url))) + (message "Starting netscape...Done"))) + (set-buffer cb))))) + +(defvar yahtml-browser-process nil) + +(defun yahtml-browse-html (href) + "Call WWW Browser to see HREF." + (let ((pb "* WWW Browser *") (cb (current-buffer))) + (cond + ((string-match "[Nn]etscape" yahtml-www-browser) + (if (get-buffer pb) + (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) + (put 'yahtml-netscape-sentinel 'url href) + (set-process-sentinel + (setq yahtml-browser-process + (start-process + "browser" pb shell-file-name "-c" + (format "%s -remote 'openURL(%s)'" yahtml-www-browser href))) + 'yahtml-netscape-sentinel)) + ((and (string= "w3" yahtml-www-browser) (fboundp 'w3-fetch)) + (w3-fetch href)) + ((stringp yahtml-www-browser) + (if (eq (process-status yahtml-browser-process) 'run) + (message "%s is already running" yahtml-www-browser) + (setq yahtml-browser-process + (start-process + "browser" "* WWW Browser *" shell-file-name + (format "%s %s" yahtml-www-browser href))))) + (t + (message "Sorry, jump across http is not supported."))))) + (defun yahtml-goto-corresponding-href (&optional other) "Go to corresponding name." (let ((href (yahtml-on-href-p)) file name) (if href (cond ((string-match "^http:" href) - (message "Sorry, jump across http is not supported.")) + (yahtml-browse-html href)) (t (setq file (substring href 0 (string-match "#" href))) (if (string-match "#" href) (setq name (substring href (1+ (string-match "#" href))))) (if (string< "" file) (progn (if (string-match "/$" file) - (setq file (concat file "index.html"))) + (setq file (concat file yahtml-directory-index))) + (if (string-match "^/" file) + (setq file (yahtml-url-to-path file))) (if other (YaTeX-switch-to-buffer-other-window file) (YaTeX-switch-to-buffer file)))) (if name @@ -503,33 +706,87 @@ (defun yahtml-on-begend-p (&optional p) "Check if point is on begend clause." - (let ((p (point)) cmd) + (let ((p (point)) cmd (case-fold-search t)) (save-excursion (if p (goto-char p)) - (if (= (char-after (point)) ?<) (forward-char 1)) + (if (equal (char-after (point)) ?<) (forward-char 1)) (if (and (re-search-backward "<" nil t) (looking-at (concat "<\\(/?" yahtml-command-regexp "\\)\\b")) (condition-case nil - (forward-list 1)) + (forward-list 1) + (error nil)) (< p (point))) (YaTeX-match-string 1))))) -(defun yahtml-goto-corresponding-begend () - (let ((cmd (yahtml-on-begend-p))) - (if cmd - (progn - (if (= (aref cmd 0) ?/) ;on line - (re-search-backward (format "<%s" (substring cmd 1))) - (re-search-forward (format " line + (setq cmd (substring cmd 1) + str (format "\\(<%s\\)\\|\\(= nest 0) (funcall func str nil t)) + (if (equal m0 (match-beginning 0)) + nil + (setq nest (+ nest (if (match-beginning 1) -1 1))))) + (if (< nest 0) + (goto-char (match-beginning 0)) + (funcall + (if noerr 'message 'error) + "Corresponding tag of `%s' not found." cmd) + (goto-char p) + nil)) + (t nil)))) + +(defun yahtml-current-tag () + "Return the current tag name." + (save-excursion + (let ((p (point)) b tag) + (or (bobp) + (looking-at "<") + (progn (skip-chars-backward "^<") (forward-char -1))) + (setq b (point)) + (skip-chars-forward "<") + (setq tag (buffer-substring + (point) (progn (skip-chars-forward "^ \t\n") (point)))) + (goto-char b) + (forward-list 1) + (and (< p (point)) tag)))) + + +(defun yahtml-goto-corresponding-img () + "View image on point" + (let ((tag (yahtml-current-tag)) image (p (point)) (case-fold-search t)) + (if (and tag + (string-match "img" tag) + (save-excursion + (re-search-backward "<\\s *img" nil t) + (re-search-forward "src=\"?\\([^\"> ]+\\)\"?>") + (match-beginning 1) + (setq image + (buffer-substring (match-beginning 1) (match-end 1))))) + (progn + (message "Invoking %s %s..." yahtml-image-viewer image) + (start-process + "Viewer" " * Image Viewer *" shell-file-name "-c" + (concat yahtml-image-viewer " " image)) + (message "Invoking %s %s...Done" yahtml-image-viewer image))))) (defun yahtml-goto-corresponding-* (&optional other) "Go to corresponding object." (interactive) (cond ((yahtml-goto-corresponding-href other)) - ((yahtml-goto-corresponding-begend other)) + ((yahtml-goto-corresponding-img)) + ((yahtml-goto-corresponding-begend)) )) (defun yahtml-goto-corresponding-*-other-window () @@ -537,6 +794,82 @@ (interactive) (yahtml-goto-corresponding-* t)) +;;; ---------- killing ---------- +(defun yahtml-kill-begend (&optional whole) + (let ((tag (yahtml-on-begend-p)) (p (make-marker)) (q (make-marker))) + (if tag + (progn + (or (looking-at "<") + (progn (skip-chars-backward "^<") (forward-char -1))) + (set-marker p (point)) + (yahtml-goto-corresponding-begend) + (or (looking-at "<") + (progn (skip-chars-backward "^<") (forward-char -1))) + (delete-region (point) (progn (forward-list 1) (point))) + (set-marker q (point)) + (beginning-of-line) + (if (looking-at "^\\s *$") + (delete-region (point) (progn (forward-line 1) (point)))) + (goto-char p) + (delete-region (point) (progn (forward-list 1) (point))) + (if (looking-at "^\\s *$") + (delete-region (point) (progn (forward-line 1) (point)))) + (if whole (delete-region p q)) + tag)))) + +(defun yahtml-kill-* (whole) + "Kill current position's HTML tag (set)." + (interactive "P") + (cond + ((yahtml-kill-begend whole)) + )) + + +;;; ---------- changing ---------- +(defun yahtml-change-begend () + (let ((tag (yahtml-on-begend-p)) + (completion-ignore-case t) + (p (point)) (q (make-marker)) + (default (append yahtml-env-table yahtml-typeface-table)) + (user (append yahtml-user-env-table yahtml-user-typeface-table)) + (tmp (append yahtml-tmp-env-table yahtml-tmp-typeface-table)) + ) + (if tag + (save-excursion + (if (= (aref tag 0) ?/) (setq tag (substring tag 1))) + (or (= (char-after (point)) ?<) (skip-chars-backward "^<")) + (skip-chars-forward "^A-Za-z") + (set-marker q (point)) + (setq p (point)) + (yahtml-goto-corresponding-begend) + (or (= (char-after (point)) ?<) + (skip-chars-backward "^<")) + (skip-chars-forward "^A-Za-z") + (if (= (char-after (1- (point))) ?/) + (progn + (set-marker q (point)) + (goto-char p))) + (setq tag (YaTeX-cplread-with-learning + (format "Change `%s' to(default %s): " + tag yahtml-last-begend) + 'default 'user 'tmp)) + (delete-region (point) (progn (skip-chars-forward "^>") (point))) + (if (string= "" tag) (setq tag yahtml-last-begend)) + (setq yahtml-last-begend + (or (cdr (assoc tag yahtml-env-table)) tag) + tag yahtml-last-begend) + (insert (format "%s%s" tag (yahtml-addin tag))) + (goto-char q) + (delete-region (point) (progn (skip-chars-forward "^>") (point))) + (insert tag))))) + +(defun yahtml-change-* () + "Change current position's HTML tag (set)." + (interactive) + (cond + ((yahtml-change-begend)) + )) + ;;; ---------- commenting ---------- (defun yahtml-comment-region (beg end) (interactive "r") @@ -548,6 +881,238 @@ +;;; ---------- filling ---------- +(defun yahtml-fill-paragraph (arg) + (interactive "P") + (let ((case-fold-search t) (p (point))) + (save-excursion + (fill-region-as-paragraph + (progn (re-search-backward paragraph-start nil t) + (or (save-excursion + (goto-char (match-end 0)) + (if (looking-at "[ \t]*$") + (progn (forward-line 1) (point)))) + (point))) + (progn (goto-char p) + (re-search-forward paragraph-start nil t) + (match-beginning 0)))))) + +;;; +;;; ---------- indentation ---------- +;;; +(defvar yahtml-hate-too-deep-indentation nil) +(defun yahtml-indent-line () + (interactive) + (let ((envs "[uod]l\\|table\\|t[rhd]") + (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\)>") + inenv p col peol (case-fold-search t)) + (save-excursion + (beginning-of-line) + (setq inenv (or (YaTeX-inner-environment) "html") + col (get 'YaTeX-inner-environment 'indent) + p (get 'YaTeX-inner-environment 'point) + op)) + (save-excursion + (cond + ((string-match envs inenv) + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (cond + ((looking-at (concat "")) + (YaTeX-reindent col)) + ((or (looking-at itms) + (and yahtml-hate-too-deep-indentation + (looking-at (concat "<" envs)))) + (YaTeX-reindent (+ col YaTeX-environment-indent))) + ((and (< p (point)) + (save-excursion + (and + ;;(re-search-backward itms p t) + (setq op (point)) + (goto-char p) + (re-search-forward itms op t) + (goto-char (match-end 0)) + (skip-chars-forward " \t") + (setq col (current-column))))) + (YaTeX-reindent col)) + (t + (YaTeX-reindent (+ col YaTeX-environment-indent))))))) + (and (bolp) (skip-chars-forward " \t")) + (if (and (setq inenv (yahtml-on-begend-p)) + (string-match (concat "^\\(" envs "\\)") inenv)) + (save-excursion + (setq peol (point-end-of-line)) + (or (= (char-after (point)) ?<) + (progn (skip-chars-backward "^<") (forward-char -1))) + (setq col (current-column)) + (if (and (yahtml-goto-corresponding-begend t) + (> (point) peol)) ;if on the different line + (YaTeX-reindent col))))) + (and (bolp) (skip-chars-forward " \t")))) + +;(defun yahtml-fill-item () +; "Fill item HTML version" +; (interactive) +; (let (inenv p fill-prefix peol (case-fold-search t)) +; (setq inenv (or (YaTeX-inner-environment) "html") +; p (get 'YaTeX-inner-environment 'point)) +; (cond +; ((string-match "^[uod]l" inenv) +; (save-excursion +; (if (re-search-backward "<\\(d[td]\\|li\\)>[ \t\n]*" p t) +; (progn +; (goto-char (match-end 0)) +; (setq col (current-column))) +; (error "No

  • ,
    ,
    "))) +; (save-excursion +; (end-of-line) +; (setq peol (point)) +; (newline) +; (indent-to-column col) +; (setq fill-prefix (buffer-substring (point) (1+ peol))) +; (delete-region (point) peol) +; (fill-region-as-paragraph +; (progn (re-search-backward paragraph-start nil t) (point)) +; (progn (re-search-forward paragraph-start nil t 2) +; (match-beginning 0))))) +; (t nil)))) + +;;; +;;; ---------- Browsing ---------- +;;; +(defun yahtml-browse-menu () + "Browsing menu" + (interactive) + (message "B)rowse R)eload...") + (let ((c (char-to-string (read-char)))) + (cond + ((string-match "[bj]" c) + (yahtml-browse-current-file)) + ((string-match "r" c) + (yahtml-browse-reload))))) + +(defun yahtml-file-to-url (file) + "Convert local unix file name to URL. +If no matches found in yahtml-path-url-alist, return raw file name." + (let ((list yahtml-path-url-alist) p url) + (if (file-directory-p file) + (setq file (expand-file-name yahtml-directory-index file)) + (setq file (expand-file-name file))) + (while list + (if (string-match (concat "^" (regexp-quote (car (car list)))) file) + (setq url (cdr (car list)) + file (substring file (match-end 0)) + url (concat url file) + list nil)) + (setq list (cdr list))) + (or url (concat "file:" file)))) + +(defun yahtml-url-to-path (file &optional basedir) + "Convert local URL name to unix file name." + (let ((list yahtml-path-url-alist) url realpath docroot + (dirsufp (string-match "/$" file))) + (setq basedir (or basedir + (file-name-directory + (expand-file-name default-directory)))) + (cond + ((string-match "^/" file) + (while list + (if (string-match (concat "^" (regexp-quote (car (car list)))) basedir) + (progn + (setq url (cdr (car list))) + (if (string-match "\\(http://[^/]*\\)/" url) + (setq docroot (substring url (match-end 1))) + (setq docroot url)) + (if (string-match (regexp-quote docroot) file) + (setq realpath + (expand-file-name + (substring + file (min (1+ (match-end 0)) (length file))) + (car (car list))))) + (if realpath + (progn (setq list nil) + (if (and dirsufp (not (string-match "/$" realpath))) + (setq realpath (concat realpath "/"))))))) + (setq list (cdr list))) + realpath) + (t file)))) + +(defun yahtml-browse-current-file () + "Call WWW browser on current file." + (interactive) + (basic-save-buffer) + (yahtml-browse-html (yahtml-file-to-url (buffer-file-name)))) + +(defun yahtml-browse-reload () + "Send `reload' event to netzscape." + (let ((pb "* WWW Browser *") (cb (current-buffer))) + (cond + ((string-match "[Nn]etscape" yahtml-www-browser) + (if (get-buffer pb) + (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) + ;;(or (get 'yahtml-netscape-sentinel 'url) + ;; (error "Reload should be called after Browsing.")) + (put 'yahtml-netscape-sentinel 'url + (yahtml-file-to-url (buffer-file-name))) + (basic-save-buffer) + (set-process-sentinel + (setq yahtml-browser-process + (start-process + "browser" pb shell-file-name "-c" + (format "%s -remote 'reload'" yahtml-www-browser))) + 'yahtml-netscape-sentinel)) + (t + (message "Sorry, RELOAD is supported only for Netscape."))))) + +;;; ---------- Intelligent newline ---------- +(defun yahtml-intelligent-newline (arg) + "Intelligent newline for HTML" + (interactive "P") + (let ((env (downcase (or (YaTeX-inner-environment) "html"))) func) + (setq func (intern-soft (concat "yahtml-intelligent-newline-" env))) + (end-of-line) + (newline) + (if (and env func (fboundp func)) + (funcall func)))) + +(defun yahtml-intelligent-newline-ul () + (interactive) + (insert (if yahtml-prefer-upcases "
  • " "
  • ")) + (yahtml-indent-line)) + +(fset 'yahtml-intelligent-newline-ol 'yahtml-intelligent-newline-ul) + +(defun yahtml-intelligent-newline-dl () + (interactive) + (let ((case-fold-search t)) + (if (save-excursion + (re-search-backward "<\\(\\(dt\\)\\|\\(dd\\)\\)>" + (get 'YaTeX-inner-environment 'point) t)) + (cond + ((match-beginning 2) + (insert (if yahtml-prefer-upcases "
    " "
    ")) + (setq yahtml-last-single-cmd "dt")) + ((match-beginning 3) + (insert (if yahtml-prefer-upcases "
    " "
    ")) + (setq yahtml-last-single-cmd "dd"))) + (insert (if yahtml-prefer-upcases "
    " "
    "))) + (yahtml-indent-line))) + +;;; ---------- Marking ---------- +(defun yahtml-mark-begend () + "Mark current tag" + (interactive) + (YaTeX-beginning-of-environment) + (let ((p (point))) + (save-excursion + (skip-chars-backward " \t" (point-beginning-of-line)) + (if (bolp) (setq p (point)))) + (push-mark p t)) + (yahtml-goto-corresponding-begend) + (forward-list 1) + (if (eolp) (forward-char 1))) + ;;; ---------- ---------- ;;; ---------- ---------- ;;; ---------- ---------- @@ -582,7 +1147,7 @@ (skip-chars-forward " \t\n") (cons (point) (progn (re-search-forward (concat "") nil t) - (1- (match-beginning 0))))))) + (match-beginning 0)))))) ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist)) (cond diff -r 18f4939986e6 -r 3a7c0c2bf16d yatex.el Binary file yatex.el has changed diff -r 18f4939986e6 -r 3a7c0c2bf16d yatex.new --- a/yatex.new Sat Dec 02 18:35:28 1995 +0000 +++ b/yatex.new Thu Feb 01 18:55:47 1996 +0000 @@ -1,5 +1,32 @@ What's new in YaTeX - yatex.el 各バージョンの変更点について + 野鳥 - 各バージョンの変更点について + +1.61 AMS-LaTeX 対応 + xdvi -remote によるサーチに対応 [prefix] t s + begin型補完終了直後に自動的におまかせ改行を実行するようにした + yahtmlで

    ,
    が行末にある時に fill-paragraph した時のバグ修正 + htmlタグそのものではなく、意味を表す文字列で補完できるようにした + yahtml で [prefix] g を の上で押したらViewer(xv)を起動 + するようにし、
    の上で押したらnetscape + を起動(またはプロセスコントロール)するようにした + yahtml に [preix] t (野鳥でいうタイプセットメニュー)を設け、 + [prefix] t b でカレントファイルをWWWブラウザで見られるようにした + [prefix] t r で Netscape に reload コマンドを送れるようにした + html の括り補完をまともにした + yahtml-indent-line を作成。リスティング環境のインデントのみ少し + まともにした + yahtml におまかせ改行を追加 + html の補完を、http:// で始まっていればヒストリからの補完、/ + で始まっていればWWWサーバ内のURL名補完、いずれでもなければUNIXファ + イルシステムでのファイル名補完となるようにした + html3 この期に及んでまだ未調査。だれかおしえてー + \pagebreak, \linebreak のアドイン関数の追加 + セクション区切りアウトライン表示のバッファで u, d を押すことによ + り、対応するセクションコマンドのレベルを上げる/下げる。U, D を押 + すと領域内のセクションコマンドを一括シフト + 変数 YaTeX-open-lines を廃止 + [prefix] i の YaTeX-fill-item を廃止 + $$ 中に \% があった場合の数式モード終了判定ミスを修正 1.60 LaTeX2e 対応 documentclass パラメータを修正し、ASCII 版 jLaTeX2e に対応 diff -r 18f4939986e6 -r 3a7c0c2bf16d yatex19.el --- a/yatex19.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatex19.el Thu Feb 01 18:55:47 1996 +0000 @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX facilities for Emacs 19 ;;; (c )1994-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Sun Dec 3 03:29:56 1995 on inspire +;;; Last modified Wed Dec 20 22:32:21 1995 on supra ;;; $Id$ ;;; とりあえず hilit19 を使っている時に色が付くようにして @@ -263,11 +263,11 @@ '( ;; comments (YaTeX-19-region-comment "\\([^\\]\\|^\\)\\(%\\).*$" comment) - + (YaTeX-19-region-section-type "\\\\footnote\\(mark\\|text\\)?{" keyword) ("\\\\[a-z]+box" 0 keyword) (YaTeX-19-region-section-type "\\\\\\(v\\|h\\)space\\(\*\\)?{" keyword) - + ;; (re-)define new commands/environments/counters (YaTeX-19-region-section-type "\\\\\\(re\\)?new\\(environment\\|command\\|theorem\\){" defun) @@ -299,8 +299,10 @@ ;; formulas ("[^\\]\\\\(" "\\\\)" formula) ; \( \) ("[^\\]\\\\\\[" "\\\\\\]" formula) ; \[ \] - ("\\\\begin{\\(eqn\\|equation\\)" "\\\\end{\\(eqn\\|equation\\)" formula) - ("[^\\$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula) ; '$...$' or '$$...$$' + ("\\\\begin{\\(eqn\\|equation\\|x?x?align\\|split\\|multiline\\|gather\\)" + "\\\\end{\\(eqn\\|equation\\|x?x?align\\|split\\|multiline\\|gather\\).*}" + formula) + ("[^\\$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula); '$...$' or '$$...$$' ;; things that bring in external files ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) @@ -316,9 +318,8 @@ ;; things that do some sort of cross-reference (YaTeX-19-region-section-type "\\\\\\(\\(no\\)?cite\\|\\(page\\)?ref\\|label\\|index\\|glossary\\){" - crossref) - ) - "*Hiliting pattern alist for LaTeX text.") + crossref)) +"*Hiliting pattern alist for LaTeX text.") ;;(defvar YaTeX-hilit-pattern-adjustment-default nil) ;; ↑いらなくなった。 @@ -505,9 +506,9 @@ ;;; formula 'khaki ;;; label 'yellow-underlined)) (and YaTeX-emacs-19 - (eval-when-compile - (if (and (boundp 'window-system) window-system) - (require 'hilit19) - (error "Byte compile this file on window system! Not `-nw'!")))) + (boundp 'byte-compile-current-file) + (if (and (boundp 'window-system) window-system) + (require 'hilit19) + (error "Byte compile this file on window system! Not `-nw'!"))) (provide 'yatex19) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexadd.el --- a/yatexadd.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexadd.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX add-in functions. ;;; yatexadd.el rev.13 ;;; (c )1991-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Mon Nov 6 14:30:25 1995 on inspire +;;; Last modified Thu Dec 21 21:47:34 1995 on supra ;;; $Id$ ;;; @@ -51,14 +51,9 @@ hline "\\hline")))) (setq rule (read-string "rule format: " rule)) + (setq single-command "hline") - (message "Dont forget to remove null line at the end of tabular.") - (format "%s%s{%s}%s" - width loc rule - (if (and (boundp 'region-mode) region-mode) - "" ;do nothing in region-mode - (format "\n%s\n%s \\\\ \\hline\n%s\n\\\\ %s" - hline and and hline)))) + (format "%s%s{%s}" width loc rule)) ) (fset 'YaTeX:tabular* 'YaTeX:tabular) (defun YaTeX:array () @@ -294,6 +289,16 @@ (fset 'YaTeX:subitem 'YaTeX:item) (fset 'YaTeX:subsubitem 'YaTeX:item) +(defun YaTeX:linebreak () + (let (obl) + (message "Break strength 0,1,2,3,4 (default: 4): ") + (setq obl (char-to-string (read-char))) + (if (string-match "[0-4]" obl) + (concat "[" obl "]") + "")) +) +(fset 'YaTeX:pagebreak 'YaTeX:linebreak) + ;;; ;;Subroutine ;;; diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexenv.el --- a/yatexenv.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexenv.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX environment-specific functions. ;;; yatexenv.el ;;; (c ) 1994, 1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Thu May 18 11:52:05 1995 on inspire +;;; Last modified Fri Feb 2 03:47:14 1996 on supra ;;; $Id$ ;;; @@ -116,18 +116,23 @@ (let*((p (point)) (format (YaTeX-tabular-parse-format tabular*)) (cols (car format)) (beg (car (cdr format))) space hline) - (setq hline (search-backward "\\hline" beg t)) + (cond + ((search-backward "&" beg t) + (goto-char p) + (setq hline (search-backward "\\hline" beg t)) + (setq space (if (search-backward "\t&" beg t) "\t" " ")) + (goto-char p)) + (t ;;(insert "\\hline\n") + (setq space " "))) (goto-char p) - (setq space (if (search-backward "\t&" beg t) "\t" " ")) - (goto-char p) - (YaTeX-indent-line) - (setq p (point)) (while (> (1- cols) 0) (insert "&" space) (setq cols (1- cols))) (insert "\\\\") (if hline (insert " \\hline")) - (goto-char p)) + (goto-char p) + (YaTeX-indent-line) +) ) (defun YaTeX-intelligent-newline-tabular* () @@ -160,17 +165,17 @@ (insert "\\>\t") (setq tabcount (1- tabcount)))) (forward-char 2)) - (insert "\\="))) + (insert "\\= \\\\") + (forward-char -5))) ) ;;; ;; Functions for itemize/enumerate/list environments ;;; -(defvar YaTeX-item-for-insert "\\item ") (defun YaTeX-intelligent-newline-itemize () "Insert '\\item '." - (insert YaTeX-item-for-insert) + (insert "\\item ") (YaTeX-indent-line) ) (fset 'YaTeX-intelligent-newline-enumerate 'YaTeX-intelligent-newline-itemize) @@ -199,6 +204,7 @@ (setq func (intern-soft (concat "YaTeX-intelligent-newline-" env))) (end-of-line) (newline) + (undo-boundary) (if (and env func (fboundp func)) (funcall func))) ) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexhks.el --- a/yatexhks.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexhks.el Thu Feb 01 18:55:47 1996 +0000 @@ -8,7 +8,7 @@ ;;; named `yatexhks.el'. The file `yatexhks.el' will be automatically ;;; loaded at the end of loading `yatex.el'. -;Private definitions begins from here. +;Private definitions begin from here. (define-key YaTeX-user-extensional-map "0" '(lambda () (interactive) (YaTeX-make-section nil nil nil "part"))) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexhlp.el --- a/yatexhlp.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexhlp.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX helper with LaTeX commands and macros. ;;; yatexhlp.el ;;; (c )1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Mon Jan 23 10:17:11 1995 on pajero +;;; Last modified Tue Dec 26 00:02:02 1995 on inspire ;;; $Id$ (let ((help-file (concat "YATEXHLP." @@ -261,6 +261,7 @@ ;;;###autoload (defun YaTeX-apropos (key) (interactive "sLaTeX apropos (regexp): ") + (if (string= "" key) (error "Nothing to show")) (or (YaTeX-apropos-file key YaTeX-help-file) (YaTeX-apropos-file key YaTeX-help-file-private t) (message "No matches found.")) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexlib.el --- a/yatexlib.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexlib.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX library of general functions. ;;; yatexlib.el ;;; (c )1994-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Fri Apr 28 16:17:44 1995 on VFR +;;; Last modified Thu Feb 1 22:34:57 1996 on nsr ;;; $Id$ ;;;###autoload @@ -369,4 +369,11 @@ (or (featurep 'windows) (error "Why don't you use `windows.el'?")) (win-switch-to-window 1 (- last-command-char win:base-key))) +(defun bcf-and-exit () + "Byte compile rest of argument and kill-emacs." + (if command-line-args-left + (progn + (mapcar 'byte-compile-file command-line-args-left) + (kill-emacs)))) + (provide 'yatexlib) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexm-o.el --- a/yatexm-o.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexm-o.el Thu Feb 01 18:55:47 1996 +0000 @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- ;;; Sample startup file to invoke yatex-mode with outline-minor mode. ;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Wed May 4 19:44:53 1994 on 98fa +;;; Last modified Mon Jan 29 21:38:26 1996 on pajero ;;; ;; outline-minor-mode(使用しない場合は不要です) @@ -12,10 +12,11 @@ (setq default-outline-regexp "[*\^l]+") (make-variable-buffer-local 'outline-level-function) (setq-default outline-level-function 'outline-level-default) -(defvar LaTeX-outline-regexp +(setq LaTeX-outline-regexp (concat "[ \t]*" (regexp-quote "\\") "\\(appendix\\|documentstyle\\|part\\|chapter\\|section\\|" - "subsection\\|subsubsection\\|paragraph\\|subparagraph\\)")) + "subsection\\|subsubsection\\|paragraph\\|subparagraph\\)" + "\\*?[ \t]*[[{]")) ;;; ;; yatex-mode @@ -32,6 +33,9 @@ '(lambda () (setq-default outline-prefix-char (concat YaTeX-prefix "\C-o"));;@ (require 'min-out) ;;@ - (define-key outline-minor-keymap "\C-?" 'hide-subtree) ;;@ + ;;auctex 付属の min-out.el の場合これ↓ + ;(define-key outline-minor-keymap "\C-?" 'hide-subtree) ;;@ + ;;Emacs 付属の outline.el の場合これ↓ + (define-key outline-mode-prefix-map "\C-?" 'hide-subtree) (YaTeX-define-begend-key "ba" "abstract") )) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexmth.el --- a/yatexmth.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexmth.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX math-mode-specific functions. ;;; yatexmth.el rev.4 ;;; (c )1993-1995 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Wed Aug 16 12:45:55 1995 on inspire +;;; Last modified Thu Feb 1 13:04:16 1996 on supra ;;; $Id$ ;;; [Customization guide] @@ -439,11 +439,16 @@ (defun YaTeX-math-get-sign (list) (YaTeX-math-gets (car (cdr-safe (cdr-safe list)))) ) - (defun YaTeX-in-math-mode-p () "If current position is supposed to be in LaTeX-math-mode, return t." (or (YaTeX-quick-in-environment-p - '("math" "eqnarray" "equation" "eqnarray*" "displaymath")) + (append + '("math" "eqnarray" "equation" "eqnarray*" "displaymath");LaTeX + (if YaTeX-use-AMS-LaTeX + ;; And math modes of AMS-LaTeX + '("align" "align*" "split" "multline" "multline*" "gather" + "gather*" "aligned*" "gathered" "gathered*" "alignat" + "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*")))) (let*((p (point)) (nest 0) me0 (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l")) (boundary @@ -473,7 +478,7 @@ (t (catch 'dollar (while ;(search-backward "$" boundary t);little bit fast. (YaTeX-re-search-active-backward ;;;;;; Too slow??? - "\\$" YaTeX-comment-prefix boundary t) + "\\$" (concat "[^\\\\]" YaTeX-comment-prefix) boundary t) (cond ((equal (char-after (1- (point))) ?$) ; $$ equation $$ (backward-char 1) diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexprc.el --- a/yatexprc.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexprc.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX process handler. ;;; yatexprc.el ;;; (c )1993-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Thu Nov 2 19:35:16 1995 on inspire +;;; Last modified Fri Feb 2 02:09:57 1996 on supra ;;; $Id$ (require 'yatex) @@ -350,7 +350,9 @@ (interactive (list (read-string-with-history - "Preview command: " dvi2-command 'YaTeX-preview-command-history) + "Preview command: " + (or (YaTeX-get-builtin "PREVIEW") dvi2-command) + 'YaTeX-preview-command-history) (read-string-with-history "Preview file[.dvi]: " (if (get 'dvi2-command 'region) @@ -386,6 +388,32 @@ " to preview " preview-file)))))) ) +(defvar YaTeX-xdvi-remote-program "xdvi") +(defun YaTeX-xdvi-remote-search (&optional region-mode) + "Search string at the point on xdvi -remote window. +Non-nil for optional argument REGION-MODE specifies the search string +by region." + (interactive "P") + (let ((pb " *xdvi*") str proc) + (save-excursion + (if region-mode + (setq str (buffer-substring (region-beginning) (region-end))) + (setq str (buffer-substring + (point) + (progn (skip-chars-forward "^\n\\\\}") (point))))) + (message "Searching `%s'..." str) + (if (boundp 'MULE) + (define-program-coding-system + (regexp-quote pb) (regexp-quote YaTeX-xdvi-remote-program) + *euc-japan*)) + (setq proc + (start-process + "xdvi" pb YaTeX-xdvi-remote-program + "-remote" (format "SloppySearch(%s) " str) + (concat (YaTeX-get-preview-file-name) ".dvi"))) + (message "Searching `%s'...Done" str))) +) + (defun YaTeX-set-virtual-error-position (file-sym line-sym) "Replace the value of FILE-SYM, LINE-SYM by virtual error position." (cond diff -r 18f4939986e6 -r 3a7c0c2bf16d yatexsec.el --- a/yatexsec.el Sat Dec 02 18:35:28 1995 +0000 +++ b/yatexsec.el Thu Feb 01 18:55:47 1996 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX sectioning browser. ;;; yatexsec.el ;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Tue Jan 24 23:19:14 1995 on VFR +;;; Last modified Thu Jan 11 01:07:53 1996 on VFR ;;; $Id$ (defvar YaTeX-sectioning-level @@ -69,28 +69,79 @@ "Key map used in YaTeX-sectioning-buffer.") (if YaTeX-sectioning-buffer-map nil (setq YaTeX-sectioning-buffer-map (make-sparse-keymap)) - (define-key YaTeX-sectioning-buffer-map " " - 'YaTeX-sectioning-buffer-jump) + (define-key YaTeX-sectioning-buffer-map " " 'YaTeX-sectioning-buffer-jump) + (define-key YaTeX-sectioning-buffer-map "." 'YaTeX-sectioning-buffer-show) (define-key YaTeX-sectioning-buffer-map (concat YaTeX-prefix "\C-c") 'YaTeX-sectioning-buffer-jump) + (define-key YaTeX-sectioning-buffer-map "u" 'YaTeX-shift-section-up) + (define-key YaTeX-sectioning-buffer-map "d" 'YaTeX-shift-section-down) + (define-key YaTeX-sectioning-buffer-map "U" 'YaTeX-shift-section-up-region) + (define-key YaTeX-sectioning-buffer-map "D" 'YaTeX-shift-section-down-region) + (define-key YaTeX-sectioning-buffer-map "s" 'YaTeX-sync-section-buffer) + (define-key YaTeX-sectioning-buffer-map "n" + 'YaTeX-sectioning-buffer-next-line) + (define-key YaTeX-sectioning-buffer-map "p" + 'YaTeX-sectioning-buffer-prev-line) + (define-key YaTeX-sectioning-buffer-map "h" 'describe-mode) + (define-key YaTeX-sectioning-buffer-map "o" 'other-window) + (define-key YaTeX-sectioning-buffer-map "-" 'shrink-window) + (define-key YaTeX-sectioning-buffer-map "+" 'enlarge-window) + (define-key YaTeX-sectioning-buffer-map "\C-_" 'YaTeX-shift-section-undo) + (and YaTeX-emacs-19 (boundp 'window-system) (eq window-system 'x) + (define-key YaTeX-sectioning-buffer-map [?\C-/] + 'YaTeX-shift-section-undo)) (YaTeX-sectioning-map-hide YaTeX-sectioning-buffer-map) ) +(defun YaTeX-sectioning-mode () + "Mode for browsing document's sectioning structure. +\\[YaTeX-shift-section-up] Shift up a sectioning command +\\[YaTeX-shift-section-down] Shift down a sectioning command +\\[YaTeX-shift-section-up-region] Shift up sectioning commands in region +\\[YaTeX-shift-section-down-region] Shift down sectioning commands in region +\\[YaTeX-shift-section-undo] Undo changes of shifting +\\[YaTeX-sync-section-buffer] Synchronize sectioning buffer with source +\\[YaTeX-sectioning-buffer-next-line] Next line +\\[YaTeX-sectioning-buffer-prev-line] Previous line +\\[YaTeX-sectioning-buffer-jump] Previous line +\\[YaTeX-sectioning-buffer-show] Show curresponding source line +" + (interactive) + (setq major-mode 'YaTeX-sectioning-mode + mode-name "sectioning") + (use-local-map YaTeX-sectioning-buffer-map) +) + (defvar YaTeX-sectioning-buffer-parent nil) -(defun YaTeX-sectioning-buffer-jump () +(defun YaTeX-sectioning-buffer-jump-internal (&optional keep) + (let (ptn (p (point))) ;save-excursion is NG because + (beginning-of-line) ;this function should switch buffer + (if (re-search-forward YaTeX-sectioning-regexp) + (progn (setq ptn (buffer-substring + (1- (match-beginning 0)) + (progn (skip-chars-forward "^}") (1+ (point))))) + (goto-char p) + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t) + (goto-char (point-max)) + (search-backward ptn) + (if keep (goto-buffer-window YaTeX-sectioning-buffer)) + (current-buffer)) + nil)) +) +(defun YaTeX-sectioning-buffer-jump (&optional keep) + "Goto corresponding sectioning unit with current line in the next window. +If optional argument KEEP is non-nil, only shows the line." (interactive) (if (and YaTeX-sectioning-buffer-parent (get-buffer YaTeX-sectioning-buffer-parent)) - (let (ptn) - (beginning-of-line) - (if (re-search-forward YaTeX-sectioning-regexp) - (progn (setq ptn (buffer-substring - (1- (match-beginning 0)) - (progn (skip-chars-forward "^}") (1+ (point))))) - (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t) - (goto-char (point-max)) - (search-backward ptn)) - (message "No line number expression.")))) + (YaTeX-sectioning-buffer-jump-internal keep) + (message "No line number expression.")) +) + +(defun YaTeX-sectioning-buffer-show () + "Show corresponding sectioning unit with current line." + (interactive) + (YaTeX-sectioning-buffer-jump-internal t) ) (defun YaTeX-sectioning-hide-under (n) @@ -232,6 +283,9 @@ "\\(" YaTeX-sectioning-regexp "\\)\\*?{")) (cb (current-buffer))) (save-excursion + (set-buffer (get-buffer-create YaTeX-sectioning-buffer)) + (setq buffer-read-only nil) + (set-buffer cb) (YaTeX-showup-buffer YaTeX-sectioning-buffer) ;show buffer (goto-char (point-min)) (with-output-to-temp-buffer YaTeX-sectioning-buffer @@ -251,6 +305,7 @@ (princ "\n"))) (set-buffer YaTeX-sectioning-buffer) (make-local-variable 'YaTeX-sectioning-buffer-parent) + (YaTeX-sectioning-mode) (use-local-map YaTeX-sectioning-buffer-map) (setq YaTeX-sectioning-buffer-parent cb) (if (numberp selective-display) @@ -258,15 +313,17 @@ YaTeX-sectioning-buffer)) ) +(defvar YaTeX-pending-undo nil) (defun YaTeX-section-overview () "Show section overview. Return the nearest sectioning command." (interactive) (let ((cw (selected-window)) (ln (count-lines (point-min) (point))) (pattern "(line:\\([0-9]+\\))") - (secbuf YaTeX-sectioning-buffer) (command "")) + secbuf (command "")) (save-excursion (setq secbuf (YaTeX-colloect-sections)) (YaTeX-showup-buffer secbuf nil t) + (set-buffer secbuf) (goto-char (point-max)) (while (re-search-backward pattern nil t) (if (< ln (string-to-int (YaTeX-match-string 1))) nil @@ -278,6 +335,8 @@ (insert " <<--") (setq pattern (concat "HackyRegexp" "ForFailure")))) (set-buffer-modified-p nil) + (setq buffer-read-only t buffer-undo-list nil) + (make-local-variable 'YaTeX-pending-undo) (forward-line 1) (if (eobp) (recenter -1) (recenter -3)) (select-window cw) @@ -297,4 +356,145 @@ (forward-char -1) ) +(defun YaTeX-shifted-section (sc n) + "Get SC's N-shifted sectioning command." + (let (lv) + (setq lv (- (cdr (assoc sc YaTeX-sectioning-level)) n) + lv (max (min YaTeX-sectioning-max-level lv) 0)) + (car (nth lv YaTeX-sectioning-level))) +) + +(defun YaTeX-shift-section-up (n) + "Shift sectioning command down by level N." + (interactive "p") + (let ((cb (current-buffer)) sc nsc lv) + (if (and YaTeX-sectioning-buffer-parent + (get-buffer YaTeX-sectioning-buffer-parent) + (save-excursion + (or (= (char-after (point)) ?\\ ) + (skip-chars-backward "^\\\\" (point-beginning-of-line))) + (YaTeX-on-section-command-p YaTeX-sectioning-regexp))) + (save-excursion + (or (buffer-name (get-buffer YaTeX-sectioning-buffer-parent)) + (error "This buffer is obsolete.")) + (setq nsc (YaTeX-shifted-section (YaTeX-match-string 1) n)) + (YaTeX-sectioning-buffer-jump-internal) + (undo-boundary) + (goto-char (match-beginning 0)) + (skip-chars-forward "\\\\") + (delete-region + (point) (progn (skip-chars-forward "^*{") (point))) + (insert nsc) + (undo-boundary) + ;; Return to *Sectioning Lines* buffer + (select-window (get-buffer-window cb)) + (beginning-of-line) + (let (buffer-read-only) + (delete-region + (point) (progn (skip-chars-forward " \t") (point))) + (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level))) + (skip-chars-forward "^\\\\") + (delete-region + (1+ (point)) (progn (skip-chars-forward "^*{") (point))) + (insert nsc) + (undo-boundary)) + (set-buffer-modified-p nil) + (setq YaTeX-pending-undo pending-undo-list) + ))) +) +(defun YaTeX-shift-section-down (n) + "Shift sectioning command down by level N." + (interactive "p") + (YaTeX-shift-section-up (- n)) +) +(defun YaTeX-shift-section-undo (arg) + "Undo YaTeX-shift-section-up/down." + (interactive "p") + (and YaTeX-sectioning-buffer-parent + (get-buffer YaTeX-sectioning-buffer-parent) + (equal (current-buffer) (get-buffer YaTeX-sectioning-buffer)) + (let ((cb (current-buffer)) + (lc (if (eq last-command 'YaTeX-shift-section-undo) 'undo t))) + (let ((pending-undo-list YaTeX-pending-undo) + buffer-read-only (last-command lc)) + (undo arg) + (setq YaTeX-pending-undo pending-undo-list)) + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent) + (goto-buffer-window YaTeX-sectioning-buffer-parent) + (undo-boundary) + (let ((last-command lc) + (pending-undo-list + (if (eq lc 'undo) YaTeX-pending-undo pending-undo-list))) + (undo arg) + (setq YaTeX-pending-undo pending-undo-list)) + (goto-buffer-window cb) + (setq this-command 'YaTeX-shift-section-undo))) +) +(defun YaTeX-sync-section-buffer () + "Synchronize *Sectioning Lines* buffer with parent buffer." + (interactive) + (if (and YaTeX-sectioning-buffer-parent + (get-buffer YaTeX-sectioning-buffer-parent)) + (let ((cb (current-buffer)) (p (point))) + (set-buffer (get-buffer YaTeX-sectioning-buffer-parent)) + (YaTeX-section-overview) + (switch-to-buffer cb) + (goto-char p))) +) +(defun YaTeX-shift-section-up-region (beg end n) + "Shift sectioning commands in region down by level N." + (interactive "r\np") + (or YaTeX-sectioning-buffer-parent + (get-buffer YaTeX-sectioning-buffer-parent) + (error "Can't find corresponding LaTeX buffer")) + (save-excursion + (goto-char beg) + (let ((cb (current-buffer)) nsc from to repllist (e (make-marker))) + (set-marker e end) + (while (progn (skip-chars-forward "^\\\\") (< (point) e)) + (YaTeX-on-section-command-p YaTeX-sectioning-regexp) + (setq from (YaTeX-match-string 0) + nsc (YaTeX-shifted-section (YaTeX-match-string 1) n)) + (goto-char (match-beginning 0)) + (let (buffer-read-only) + (delete-region (point) (progn (beginning-of-line) (point))) + (indent-to-column (cdr (assoc nsc YaTeX-sectioning-level))) + (delete-region + (1+ (point)) (progn (skip-chars-forward "^*{") (point))) + (insert nsc)) + (YaTeX-on-section-command-p YaTeX-sectioning-regexp) + (setq to (YaTeX-match-string 0) + repllist (cons (cons from to) repllist)) + (forward-line 1)) + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent) + (goto-buffer-window YaTeX-sectioning-buffer-parent) + (save-excursion + (goto-char (point-max)) + (undo-boundary) + (while repllist + (if (search-backward (car (car repllist)) nil t) + (progn + (goto-char (match-beginning 0)) ;confirm + (delete-region (point) (match-end 0)) + (insert (cdr (car repllist))) + (goto-char (match-beginning 0)))) + (setq repllist (cdr repllist)))) + (goto-buffer-window cb))) +) +(defun YaTeX-shift-section-down-region (beg end n) + "Shift sectioning commands in region down by level N." + (interactive "r\np") + (YaTeX-shift-section-up-region beg end (- n)) +) +(defun YaTeX-sectioning-buffer-next-line (n) + "Move to next line in *Sectioning Lines* buffer." + (interactive "p") + (forward-line n) + (skip-chars-forward " \t%") +) +(defun YaTeX-sectioning-buffer-prev-line (n) + "Move to previous line in *Sectioning Lines* buffer." + (interactive "p") + (YaTeX-sectioning-buffer-next-line (- n)) +) (provide 'yatexsec)