yatex

changeset 517:668632d9392e dev

Initial implementation of SpecialFilterRegion
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 06 Jan 2018 23:54:17 +0900
parents 603acc1caec7
children dfb71acdec98
files docs/yatexe docs/yatexe.tex docs/yatexj docs/yatexj.tex yatex.el yatex.new yatexprc.el
diffstat 7 files changed, 365 insertions(+), 172 deletions(-) [+]
line diff
     1.1 --- a/docs/yatexe	Fri Jan 05 00:23:36 2018 +0900
     1.2 +++ b/docs/yatexe	Sat Jan 06 23:54:17 2018 +0900
     1.3 @@ -249,6 +249,7 @@
     1.4  * Changing typesetter::
     1.5  * Splitting input files::
     1.6  * Static region for typesetting::
     1.7 +* Special Filtering Region::
     1.8  * Lpr format::
     1.9  * Controlling which command to invoke::
    1.10  * Editing %# notation::
    1.11 @@ -337,6 +338,30 @@
    1.12  
    1.13  
    1.14  
    1.15 +File: yatexe, Node: Special Filtering Region, Next: Lpr format, Prev: Static region for typesetting, Up: %#notation
    1.16 +
    1.17 +Special Filtering Region
    1.18 +========================
    1.19 +  A region like below will be passed to external filter command.
    1.20 +     %#BEGIN FILTER{foo.pdf}{dot -T %t -o %o}
    1.21 +     \if0
    1.22 +     ....blah blah blah...
    1.23 +     ....blah blah blah...
    1.24 +     ....blah blah blah...
    1.25 +     \fi
    1.26 +     %#END
    1.27 +
    1.28 +In this case, typing `[prefix] t e' send three `blah' lines
    1.29 +to "dot -T pdf -o foo.pdf" as standard-input.  It is useful to
    1.30 +have source of text-origin graphic generated by such tools as
    1.31 +graphviz or blockdiag, in LaTeX source.  This special form of region
    1.32 +can be inserted via feeding `.dot' into environment completion by
    1.33 +`[prefix] t b'.
    1.34 +
    1.35 +
    1.36 +
    1.37 +
    1.38 +
    1.39  File: yatexe, Node: Lpr format, Next: Controlling which command to invoke, Prev: Static region for typesetting, Up: %#notation
    1.40  
    1.41  Lpr format
    1.42 @@ -535,7 +560,7 @@
    1.43  
    1.44  
    1.45  
    1.46 -File: yatexe, Node: Section-type completion, Prev: Begin-type completion, Up: Completion
    1.47 +File: yatexe, Node: Section-type completion, Next: Label Generation, Prev: Begin-type completion, Up: Completion
    1.48  
    1.49  Section-type completion
    1.50  =======================
    1.51 @@ -2314,60 +2339,61 @@
    1.52  Node: Calling previewer8016
    1.53  Node: Printing out8377
    1.54  Node: %#notation8669
    1.55 -Node: Changing typesetter9040
    1.56 -Node: Splitting input files9404
    1.57 -Node: Static region for typesetting10833
    1.58 -Node: Lpr format11962
    1.59 -Node: Controlling which command to invoke13035
    1.60 -Node: Editing %# notation13992
    1.61 -Node: Completion14536
    1.62 -Node: Begin-type completion15072
    1.63 -Node: Section-type completion17926
    1.64 -Node: view-sectioning20318
    1.65 -Node: Label Generation21897
    1.66 -Node: Large-type completion22797
    1.67 -Node: Maketitle-type completion23443
    1.68 -Node: Arbitrary completion23995
    1.69 -Node: End completion24385
    1.70 -Node: Accent completion24855
    1.71 -Node: Image completion25472
    1.72 -Node: Greek letters completion27727
    1.73 -Node: Inserting parentheses28483
    1.74 -Node: Local dictionaries28890
    1.75 -Node: Commenting out29827
    1.76 -Node: Cursor jump31286
    1.77 -Node: Jump to corresponding object31577
    1.78 -Node: Invoking image processor32977
    1.79 -Node: Jump to main file34320
    1.80 -Node: Jumping around the environment34686
    1.81 -Node: Jumping to last completion position35104
    1.82 -Node: Changing and Deleting35613
    1.83 -Node: Changing LaTeX commands35994
    1.84 -Node: Killing LaTeX commands37171
    1.85 -Node: Filling38356
    1.86 -Node: Updation of includeonly40211
    1.87 -Node: What column41008
    1.88 -Node: Intelligent newline42093
    1.89 -Node: Usepackage checker43754
    1.90 -Node: Online help44345
    1.91 -Node: Browsing file hierarchy46020
    1.92 -Node: Cooperation with other packages47757
    1.93 -Node: Customizations48462
    1.94 -Node: Lisp variables48758
    1.95 -Node: All customizable variables49717
    1.96 -Node: Sample definitions61682
    1.97 -Node: Hook variables62195
    1.98 -Node: Hook file62899
    1.99 -Node: Add-in functions63238
   1.100 -Node: How the add-in function works64076
   1.101 -Node: Defining option-add-in66262
   1.102 -Node: Defining argument-add-in66984
   1.103 -Node: Defining enclosing-add-in67865
   1.104 -Node: How the function is called68721
   1.105 -Node: Useful functions for creating add-in69397
   1.106 -Node: Contribution70807
   1.107 -Node: Add-in generator71081
   1.108 -Node: Etcetera76657
   1.109 -Node: Copying77262
   1.110 +Node: Changing typesetter9069
   1.111 +Node: Splitting input files9433
   1.112 +Node: Static region for typesetting10862
   1.113 +Node: Special Filtering Region11991
   1.114 +Node: Lpr format12723
   1.115 +Node: Controlling which command to invoke13796
   1.116 +Node: Editing %# notation14753
   1.117 +Node: Completion15297
   1.118 +Node: Begin-type completion15833
   1.119 +Node: Section-type completion18687
   1.120 +Node: view-sectioning21103
   1.121 +Node: Label Generation22682
   1.122 +Node: Large-type completion23582
   1.123 +Node: Maketitle-type completion24228
   1.124 +Node: Arbitrary completion24780
   1.125 +Node: End completion25170
   1.126 +Node: Accent completion25640
   1.127 +Node: Image completion26257
   1.128 +Node: Greek letters completion28512
   1.129 +Node: Inserting parentheses29268
   1.130 +Node: Local dictionaries29675
   1.131 +Node: Commenting out30612
   1.132 +Node: Cursor jump32071
   1.133 +Node: Jump to corresponding object32362
   1.134 +Node: Invoking image processor33762
   1.135 +Node: Jump to main file35105
   1.136 +Node: Jumping around the environment35471
   1.137 +Node: Jumping to last completion position35889
   1.138 +Node: Changing and Deleting36398
   1.139 +Node: Changing LaTeX commands36779
   1.140 +Node: Killing LaTeX commands37956
   1.141 +Node: Filling39141
   1.142 +Node: Updation of includeonly40996
   1.143 +Node: What column41793
   1.144 +Node: Intelligent newline42878
   1.145 +Node: Usepackage checker44539
   1.146 +Node: Online help45130
   1.147 +Node: Browsing file hierarchy46805
   1.148 +Node: Cooperation with other packages48542
   1.149 +Node: Customizations49247
   1.150 +Node: Lisp variables49543
   1.151 +Node: All customizable variables50502
   1.152 +Node: Sample definitions62467
   1.153 +Node: Hook variables62980
   1.154 +Node: Hook file63684
   1.155 +Node: Add-in functions64023
   1.156 +Node: How the add-in function works64861
   1.157 +Node: Defining option-add-in67047
   1.158 +Node: Defining argument-add-in67769
   1.159 +Node: Defining enclosing-add-in68650
   1.160 +Node: How the function is called69506
   1.161 +Node: Useful functions for creating add-in70182
   1.162 +Node: Contribution71592
   1.163 +Node: Add-in generator71866
   1.164 +Node: Etcetera77442
   1.165 +Node: Copying78047
   1.166  
   1.167  End tag table
     2.1 --- a/docs/yatexe.tex	Fri Jan 05 00:23:36 2018 +0900
     2.2 +++ b/docs/yatexe.tex	Sat Jan 06 23:54:17 2018 +0900
     2.3 @@ -8,7 +8,7 @@
     2.4  
     2.5  @iftex
     2.6  @c @syncodeindex fn cp
     2.7 -@c Last modified Sat Sep  9 23:41:37 2017 on firestorm
     2.8 +@c Last modified Sat Jan  6 23:42:24 2018 on firestorm
     2.9  @syncodeindex vr cp
    2.10  @end iftex
    2.11  
    2.12 @@ -265,6 +265,7 @@
    2.13  * Changing typesetter::
    2.14  * Splitting input files::
    2.15  * Static region for typesetting::
    2.16 +* Special Filtering Region::
    2.17  * Lpr format::
    2.18  * Controlling which command to invoke::
    2.19  * Editing %# notation::
    2.20 @@ -377,6 +378,28 @@
    2.21  @code{%#BEGIN} alone at the middle of very long text.  Do not forget to
    2.22  erase @code{%#BEGIN} @code{%#END} pair.
    2.23  
    2.24 +@node Special Filtering Region, Lpr format, Static region for typesetting, %#notation
    2.25 +@section Special Filtering Region
    2.26 +  A region like below will be passed to external filter command.
    2.27 +@example
    2.28 +%#BEGIN FILTER{foo.pdf}{dot -T %t -o %o}
    2.29 +\if0
    2.30 +....blah blah blah...
    2.31 +....blah blah blah...
    2.32 +....blah blah blah...
    2.33 +\fi
    2.34 +%#END
    2.35 +@end example
    2.36 +
    2.37 +In this case, typing @kbd{[prefix] t e} send three `blah' lines
    2.38 +to "dot -T pdf -o foo.pdf" as standard-input.  It is useful to
    2.39 +have source of text-origin graphic generated by such tools as
    2.40 +graphviz or blockdiag, in La@TeX{} source.  This special form of region
    2.41 +can be inserted via feeding @code{.dot} into environment completion by
    2.42 +@kbd{[prefix] t b}.
    2.43 +
    2.44 +
    2.45 +
    2.46  @node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation
    2.47  @comment  node-name,  next,  previous,  up
    2.48  @section Lpr format
    2.49 @@ -587,7 +610,7 @@
    2.50  begin-type completion to enclose text into a environment.
    2.51  
    2.52  
    2.53 -@node Section-type completion, , Begin-type completion, Completion
    2.54 +@node Section-type completion, Label Generation, Begin-type completion, Completion
    2.55  @comment  node-name,  next,  previous,  up
    2.56  @section Section-type completion
    2.57  @cindex section-type completion
     3.1 --- a/docs/yatexj	Fri Jan 05 00:23:36 2018 +0900
     3.2 +++ b/docs/yatexj	Sat Jan 06 23:54:17 2018 +0900
     3.3 @@ -21,7 +21,7 @@
     3.4  * Main features::               主な機能
     3.5  * Installation::                インストール
     3.6  * Invocation::                  プロセス起動
     3.7 -* %#notation ::                 %#記法
     3.8 +* %#notation ::
     3.9  * Completion::                  補完入力
    3.10  * Local dictionary::            ローカル辞書
    3.11  * Commenting out::              コメントアウト
    3.12 @@ -326,9 +326,10 @@
    3.13  * Changing typesetter::         タイプセット用コマンドの変更
    3.14  * Splitting input files::       入力ファイル分割
    3.15  * Fix region for typesetting::  領域の固定
    3.16 +* Special Filtering Region::
    3.17  * lpr format::                  プリントアウトコマンド用フォーマット
    3.18  * Controlling which command to invoke::  その他の起動コマンド制御
    3.19 -* Editing %# notation::         %#記法の編集
    3.20 +* Editing %# notation::
    3.21  
    3.22  
    3.23  
    3.24 @@ -424,6 +425,33 @@
    3.25  し忘れには十分ご注意下さい。
    3.26  
    3.27  
    3.28 +
    3.29 +File: yatexj, Node: Special Filtering Region, Next: lpr format, Prev: Fix region for typesetting, Up: %#notation
    3.30 +
    3.31 +自動外部フィルタ
    3.32 +================
    3.33 +
    3.34 +たとえば、テキストファイルから画像を生成するようなツールに与えるソース
    3.35 +をLaTeXソース中に埋め込み、その部分だけをツールの標準入力に渡すことが
    3.36 +できます。そのためには以下のようなソースを文書中に書きます。
    3.37 +
    3.38 +     %#BEGIN FILTER{foo.pdf}{blockdiag -T %t -o %o}
    3.39 +     \if0
    3.40 +     ---
    3.41 +     ....blah blah blah...
    3.42 +     ....blah blah blah...
    3.43 +     ....blah blah blah...
    3.44 +     ---
    3.45 +     \fi
    3.46 +     %#END
    3.47 +
    3.48 +この領域内で `[prefix] t e' をタイプすると、この例であればblahのある3
    3.49 +行が外部コマンド `"blockdiag -T pdf -o foo.pdf"' の標準入力に渡され、
    3.50 +結果として foo.pdf が生成されます。この特別なブロックは`[prefix] tb'
    3.51 +の環境補完で、`.blockdiag' のようなピリオドで始まる特殊環境名を入力す
    3.52 +ることで自動的に挿入されます。
    3.53 +
    3.54 +
    3.55  
    3.56  
    3.57  File: yatexj, Node: lpr format, Next: Controlling which command to invoke, Prev: Fix region for typesetting, Up: %#notation
    3.58 @@ -2255,66 +2283,67 @@
    3.59  
    3.60  Tag table:
    3.61  Node: Top257
    3.62 -Node: Intro1311
    3.63 -Node: Terminology1614
    3.64 -Node: Main features2254
    3.65 -Node: Installation3376
    3.66 -Node: Invocation4636
    3.67 -Node: Calling typesetter5512
    3.68 -Node: Calling previewer6973
    3.69 -Node: Print out7289
    3.70 -Node: %#notation7555
    3.71 -Node: Changing typesetter7983
    3.72 -Node: Splitting input files8241
    3.73 -Node: Fix region for typesetting9197
    3.74 -Node: lpr format10105
    3.75 -Node: Controlling which command to invoke10915
    3.76 -Node: Editing %# notation11629
    3.77 -Node: Completion12087
    3.78 -Node: begin型補完12498
    3.79 -Node: section型補完15247
    3.80 -Node: 2個以上の引数をとる section型コマンド16340
    3.81 -Node: Enclose section-type command17156
    3.82 -Node: Recursive completion17480
    3.83 -Node: view-sectioning17785
    3.84 -Node: label-generation18981
    3.85 -Node: large型補完19655
    3.86 -Node: maketitle型補完20189
    3.87 -Node: Arbitrary completion20488
    3.88 -Node: end補完20801
    3.89 -Node: Accent mark completion21142
    3.90 -Node: Image completion21567
    3.91 -Node: Greek letter completion23382
    3.92 -Node: Inserting parens23866
    3.93 -Node: Local dictionary24214
    3.94 -Node: Commenting out24818
    3.95 -Node: Cursor jump25978
    3.96 -Node: 対応オブジェクトへのジャンプ26195
    3.97 -Node: お絵描きツール起動27181
    3.98 -Node: メインファイルへのジャンプ28099
    3.99 -Node: 環境を単位としたジャンプ28435
   3.100 -Node: 最後の補完位置へのジャンプ28792
   3.101 -Node: Modifying/Deleting29029
   3.102 -Node: Changing LaTeX command29435
   3.103 -Node: Killing LaTeX command29985
   3.104 -Node: Filling30857
   3.105 -Node: Includeonly32187
   3.106 -Node: What column32748
   3.107 -Node: Intelligent newline33528
   3.108 -Node: Usepackage cheker34560
   3.109 -Node: Changing mode of YaTeX34987
   3.110 -Node: Online help35563
   3.111 -Node: Inclusion hierarchy browser36540
   3.112 -Node: Cooperation with other packages37818
   3.113 -Node: Customizations38273
   3.114 -Node: Lisp variables38570
   3.115 -Node: All customizable variables39177
   3.116 -Node: Sample definitions48157
   3.117 -Node: Hook variables48591
   3.118 -Node: Hook file49486
   3.119 -Node: Add-in functions49692
   3.120 -Node: Etc49919
   3.121 -Node: Copying50204
   3.122 -Node: Concept Index50828
   3.123 +Node: Intro1290
   3.124 +Node: Terminology1593
   3.125 +Node: Main features2233
   3.126 +Node: Installation3355
   3.127 +Node: Invocation4615
   3.128 +Node: Calling typesetter5491
   3.129 +Node: Calling previewer6952
   3.130 +Node: Print out7268
   3.131 +Node: %#notation7534
   3.132 +Node: Changing typesetter7975
   3.133 +Node: Splitting input files8233
   3.134 +Node: Fix region for typesetting9189
   3.135 +Node: Special Filtering Region10096
   3.136 +Node: lpr format10732
   3.137 +Node: Controlling which command to invoke11542
   3.138 +Node: Editing %# notation12256
   3.139 +Node: Completion12714
   3.140 +Node: begin型補完13125
   3.141 +Node: section型補完15874
   3.142 +Node: 2個以上の引数をとる section型コマンド16967
   3.143 +Node: Enclose section-type command17783
   3.144 +Node: Recursive completion18107
   3.145 +Node: view-sectioning18412
   3.146 +Node: label-generation19608
   3.147 +Node: large型補完20282
   3.148 +Node: maketitle型補完20816
   3.149 +Node: Arbitrary completion21115
   3.150 +Node: end補完21428
   3.151 +Node: Accent mark completion21769
   3.152 +Node: Image completion22194
   3.153 +Node: Greek letter completion24009
   3.154 +Node: Inserting parens24493
   3.155 +Node: Local dictionary24841
   3.156 +Node: Commenting out25445
   3.157 +Node: Cursor jump26605
   3.158 +Node: 対応オブジェクトへのジャンプ26822
   3.159 +Node: お絵描きツール起動27808
   3.160 +Node: メインファイルへのジャンプ28726
   3.161 +Node: 環境を単位としたジャンプ29062
   3.162 +Node: 最後の補完位置へのジャンプ29419
   3.163 +Node: Modifying/Deleting29656
   3.164 +Node: Changing LaTeX command30062
   3.165 +Node: Killing LaTeX command30612
   3.166 +Node: Filling31484
   3.167 +Node: Includeonly32814
   3.168 +Node: What column33375
   3.169 +Node: Intelligent newline34155
   3.170 +Node: Usepackage cheker35187
   3.171 +Node: Changing mode of YaTeX35614
   3.172 +Node: Online help36190
   3.173 +Node: Inclusion hierarchy browser37167
   3.174 +Node: Cooperation with other packages38445
   3.175 +Node: Customizations38900
   3.176 +Node: Lisp variables39197
   3.177 +Node: All customizable variables39804
   3.178 +Node: Sample definitions48784
   3.179 +Node: Hook variables49218
   3.180 +Node: Hook file50113
   3.181 +Node: Add-in functions50319
   3.182 +Node: Etc50546
   3.183 +Node: Copying50831
   3.184 +Node: Concept Index51455
   3.185  
   3.186  End tag table
     4.1 --- a/docs/yatexj.tex	Fri Jan 05 00:23:36 2018 +0900
     4.2 +++ b/docs/yatexj.tex	Sat Jan 06 23:54:17 2018 +0900
     4.3 @@ -13,7 +13,7 @@
     4.4  @c ノードいじったら C-l C-u C-n 全部のノード更新 C-l C-u C-e
     4.5  @c メニュー増やしたら C-l C-u C-m 全部のメニュー更新 C-l C-u C-a
     4.6  @c フォーマットするときは C-l C-e C-b
     4.7 -@c Last modified Sat Sep  9 23:43:04 2017 on firestorm
     4.8 +@c Last modified Sat Jan  6 23:49:50 2018 on firestorm
     4.9  @syncodeindex vr cp
    4.10  @end iftex
    4.11  
    4.12 @@ -35,7 +35,7 @@
    4.13  * Main features::               主な機能
    4.14  * Installation::                インストール
    4.15  * Invocation::                  プロセス起動
    4.16 -* %#notation ::                 %#記法
    4.17 +* %#notation ::
    4.18  * Completion::                  補完入力
    4.19  * Local dictionary::            ローカル辞書
    4.20  * Commenting out::              コメントアウト
    4.21 @@ -357,9 +357,10 @@
    4.22  * Changing typesetter::         タイプセット用コマンドの変更
    4.23  * Splitting input files::       入力ファイル分割
    4.24  * Fix region for typesetting::  領域の固定
    4.25 +* Special Filtering Region::
    4.26  * lpr format::                  プリントアウトコマンド用フォーマット
    4.27  * Controlling which command to invoke::  その他の起動コマンド制御
    4.28 -* Editing %# notation::         %#記法の編集
    4.29 +* Editing %# notation::
    4.30  @end menu
    4.31  
    4.32  @node Changing typesetter, Splitting input files, %#notation , %#notation
    4.33 @@ -479,6 +480,31 @@
    4.34  の消し忘れには十分ご注意下さい。
    4.35  @cindex 長いファイルの編集[なかいふあいるのへんしゆう]
    4.36  
    4.37 +@node Special Filtering Region, lpr format, Fix region for typesetting, %#notation
    4.38 +@section 自動外部フィルタ
    4.39 +
    4.40 +たとえば、テキストファイルから画像を生成するようなツールに与えるソースを
    4.41 +La@TeX{}ソース中に埋め込み、その部分だけをツールの標準入力に渡すことができ
    4.42 +ます。そのためには以下のようなソースを文書中に書きます。
    4.43 +
    4.44 +@example
    4.45 +%#BEGIN FILTER{foo.pdf}{blockdiag -T %t -o %o}
    4.46 +\if0
    4.47 +---
    4.48 +....blah blah blah...
    4.49 +....blah blah blah...
    4.50 +....blah blah blah...
    4.51 +---
    4.52 +\fi
    4.53 +%#END
    4.54 +@end example
    4.55 +
    4.56 +この領域内で @kbd{[prefix] t e} をタイプすると、この例であればblahのある3行が
    4.57 +外部コマンド @code{"blockdiag -T pdf -o foo.pdf"} の標準入力に渡され、
    4.58 +結果として foo.pdf が生成されます。この特別なブロックは
    4.59 +@kbd{[prefix] tb} の環境補完で、@code{.blockdiag} のようなピリオドで始まる
    4.60 +特殊環境名を入力することで自動的に挿入されます。
    4.61 +
    4.62  @c @node  Require, lpr format, Fix region for typesetting, %#notation
    4.63  @comment  node-name,  next,  previous,  up
    4.64  
    4.65 @@ -778,7 +804,7 @@
    4.66  だけが挿入され、改行はせずカーソルは自動的に中括弧の内側に移動します。
    4.67  
    4.68  @menu
    4.69 -* 2個以上の引数をとる section型コマンド::  
    4.70 +* 2個以上の引数をとる section型コマンド::
    4.71  * Enclose section-type command::  括り補完
    4.72  * Recursive completion::        再帰補完
    4.73  * view-sectioning::             セクション区切りのアウトライン表示
    4.74 @@ -1261,11 +1287,11 @@
    4.75  
    4.76  
    4.77  @menu
    4.78 -* 対応オブジェクトへのジャンプ::  
    4.79 -* お絵描きツール起動::          
    4.80 -* メインファイルへのジャンプ::  
    4.81 -* 環境を単位としたジャンプ::    
    4.82 -* 最後の補完位置へのジャンプ::  
    4.83 +* 対応オブジェクトへのジャンプ::
    4.84 +* お絵描きツール起動::
    4.85 +* メインファイルへのジャンプ::
    4.86 +* 環境を単位としたジャンプ::
    4.87 +* 最後の補完位置へのジャンプ::
    4.88  @end menu
    4.89  
    4.90  @node 対応オブジェクトへのジャンプ, お絵描きツール起動, Cursor jump, Cursor jump
     5.1 --- a/yatex.el	Fri Jan 05 00:23:36 2018 +0900
     5.2 +++ b/yatex.el	Sat Jan 06 23:54:17 2018 +0900
     5.3 @@ -1,6 +1,6 @@
     5.4  ;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*-
     5.5  ;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org]
     5.6 -;;; Last modified Wed Jan  3 23:56:34 2018 on firestorm
     5.7 +;;; Last modified Sat Jan  6 22:52:02 2018 on firestorm
     5.8  ;;; $Id$
     5.9  ;;; The latest version of this software is always available at;
    5.10  ;;; https://www.yatex.org/
    5.11 @@ -376,6 +376,61 @@
    5.12    (append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist)
    5.13    "*Standard AMS-LaTeX(2e) environment completion table.")
    5.14  
    5.15 +(defvar YaTeX-use-dot-env-extension t
    5.16 +  "*Use YaTeX's dot-env filter special environment.")
    5.17 +(defvar YaTeX-filter-special-env-alist-default
    5.18 +  '((".blockdiag"
    5.19 +     "blockdiag -T %t -o %o -"
    5.20 +     "blockdiag {
    5.21 +  default_fontsize = 32;
    5.22 +  A -> B;
    5.23 +}")
    5.24 +    (".seqdiag" "seqdiag -T %t -o %o -"
    5.25 +     "seqdiag {
    5.26 +  client -> server [label = \"SYN\"];
    5.27 +  client <- server [label = \"SYN/ACK\"];
    5.28 +  client -> server [label = \"ACK\"];}")
    5.29 +    (".actdiag" "actdiag -T %t -o %o -"
    5.30 +     "actdiag {
    5.31 +  sayHo -> ho -> hohoho
    5.32 +  lane dj {
    5.33 +    label = \"DJ\"
    5.34 +    sayHo [label = \"Say Ho\"]; hohoho [label = \"Ho Ho Ho!\"]; }
    5.35 +  lane mc { label = \"MC\"; ho [label = \"Hooooh!\"]}}")
    5.36 +    (".nwdiag" "nwdiag -T %t -o %o -"
    5.37 +     "nwdiag {
    5.38 +  network ext {
    5.39 +    address = \"10.1.2.0/24\"
    5.40 +    router [address = \"10.1.2.1\"]
    5.41 +  }
    5.42 +  network int {
    5.43 +    address = \"192.168.22.0/24\"
    5.44 +    router [address = \"192.168.22.1\"]
    5.45 +    websrv [address = \"192.168.22.80\"]
    5.46 +    cli-1; cli-2
    5.47 +  }
    5.48 +}")
    5.49 +    (".rackdiag" "rackdiag -T %t -o %o -"
    5.50 +     "rackdiag {
    5.51 +  16U;
    5.52 +  1: UPS [4U]; 5: Storage [3U]; 8: PC [2U]; 8: PC [2U];
    5.53 +}")
    5.54 +    (".dot"
    5.55 +     "dot -T %t -o %o"
    5.56 +     "digraph {
    5.57 +  graph [charset=\"utf-8\"]
    5.58 +}
    5.59 +bigraph {
    5.60 +  graph [charset=\"utf-8\"]}"
    5.61 +     )))
    5.62 +
    5.63 +(defvar YaTeX-filter-special-env-alist-private nil)
    5.64 +(defvar YaTeX-filter-special-env-alist
    5.65 +  (append YaTeX-filter-special-env-alist-private
    5.66 +	  YaTeX-filter-special-env-alist-default))
    5.67 +
    5.68 +
    5.69 +
    5.70  ; Set tex-environment possible completion
    5.71  (defvar env-table
    5.72    (append
    5.73 @@ -399,7 +454,11 @@
    5.74  	 ("multicols")			;defined in multicol
    5.75  	 ("breakbox")))			;defined in eclbkbox
    5.76     (if YaTeX-use-AMS-LaTeX YaTeX-ams-env-table)
    5.77 -   YaTeX-math-other-env-alist)
    5.78 +   YaTeX-math-other-env-alist
    5.79 +   (if YaTeX-use-dot-env-extension
    5.80 +       '((".blockdiag") (".nwdiag") (".seqdiag") (".rackdiag") (".packetdiag")
    5.81 +	 (".dot"))
    5.82 +     ))
    5.83    "Default completion table for begin-type completion.")
    5.84  
    5.85  (defvar user-env-table nil)
    5.86 @@ -920,7 +979,10 @@
    5.87  by completing read.
    5.88   If you invoke this command with universal argument,
    5.89  \(key binding for universal-argument is \\[universal-argument]\)
    5.90 -you can put REGION into that environment between \\begin and \\end."
    5.91 +you can put REGION into that environment between \\begin and \\end.
    5.92 +If the environment name begins with `.'(dot),
    5.93 +that environment will be treated as `special environment', which
    5.94 +enables special feature such as text conversion."
    5.95    (interactive "P")
    5.96    (let*
    5.97        ((region-p (or arg (YaTeX-region-active-p)))
    5.98 @@ -928,13 +990,17 @@
    5.99         (env
   5.100  	(save-excursion		;for Emacs24 work-around to avoid point warp 
   5.101  	  (YaTeX-read-environment
   5.102 -	   (format "Begin environment%s(default %s): " mode YaTeX-env-name)))))
   5.103 +	   (format "Begin environment%s(default %s): " mode YaTeX-env-name))))
   5.104 +       special)
   5.105      (if (string= env "")
   5.106  	(setq env YaTeX-env-name))
   5.107 -    (setq YaTeX-env-name env)
   5.108 +    (setq special (assoc env YaTeX-filter-special-env-alist)
   5.109 +	  YaTeX-env-name env)
   5.110      (YaTeX-update-table
   5.111       (list YaTeX-env-name) 'env-table 'user-env-table 'tmp-env-table)
   5.112 -    (YaTeX-insert-begin-end YaTeX-env-name region-p)))
   5.113 +    (if special
   5.114 +	(YaTeX-insert-filter-special YaTeX-env-name (cdr special) region-p)
   5.115 +      (YaTeX-insert-begin-end YaTeX-env-name region-p))))
   5.116  
   5.117  (defun YaTeX-make-begin-end-region ()
   5.118    "Call YaTeX-make-begin-end with ARG to specify region mode."
   5.119 @@ -1261,6 +1327,17 @@
   5.120      ((YaTeX-literal-p) ?\")
   5.121      ((= (preceding-char) ?\\ ) ?\")
   5.122      ;((= (preceding-char) ?\( ) ?\")
   5.123 +    ((save-excursion (beginning-of-line)
   5.124 +		     (skip-chars-forward "\t ")
   5.125 +		     (looking-at "%#"))
   5.126 +     ?\")
   5.127 +    ((let ((ovl (overlays-at (point))))
   5.128 +       (and ovl
   5.129 +	    (catch 'found
   5.130 +	      (while ovl
   5.131 +		(if (overlay-get (car ovl) 'filter-input) (throw 'found t))
   5.132 +		(setq ovl (cdr ovl))))))
   5.133 +     ?\")
   5.134      ((or (= (preceding-char) 32)
   5.135  	 (= (preceding-char) 9)
   5.136  	 (= (preceding-char) ?\n)
     6.1 --- a/yatex.new	Fri Jan 05 00:23:36 2018 +0900
     6.2 +++ b/yatex.new	Sat Jan 06 23:54:17 2018 +0900
     6.3 @@ -3,6 +3,7 @@
     6.4  
     6.5  1.81	== yatex ==
     6.6  	タイプセットコマンド定義中の %k を漢字コード名に変換(-kanji=%k)
     6.7 +	ドット環境で外部フィルタを自動起動する機能を追加。
     6.8  
     6.9  1.80	string-to-int除外と同時に emacs-18 をサポート外に。
    6.10  	2-Clause BSDでもOKという風に書いてみた。
     7.1 --- a/yatexprc.el	Fri Jan 05 00:23:36 2018 +0900
     7.2 +++ b/yatexprc.el	Sat Jan 06 23:54:17 2018 +0900
     7.3 @@ -1,7 +1,7 @@
     7.4  ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*-
     7.5  ;;; 
     7.6  ;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org]
     7.7 -;;; Last modified Thu Jan  4 00:09:28 2018 on firestorm
     7.8 +;;; Last modified Fri Jan  5 22:48:43 2018 on firestorm
     7.9  ;;; $Id$
    7.10  
    7.11  ;;; Code:
    7.12 @@ -353,7 +353,7 @@
    7.13  	 reg-begin reg-end lineinfo)
    7.14        (setq ppcmd (if (stringp pp) (concat pp " " texputroot) pp))
    7.15        (save-excursion
    7.16 -	(if (search-backward "%#BEGIN" nil t)
    7.17 +	(if (re-search-backward "%#BEGIN\\s *$" nil t)
    7.18  	    (progn
    7.19  	      (setq typeout "--- Region from BEGIN to "
    7.20  		    end "the end of the buffer ---"
    7.21 @@ -478,6 +478,36 @@
    7.22  The value is generated from YaTeX-typeset-pdf2image-chain and
    7.23  YaTeX-typeset-dvi2image-chain.")
    7.24  
    7.25 +(defun YaTeX-popup-image (imagesrc buffer &optional func)
    7.26 +  (let ((sw (selected-window)) image
    7.27 +	(data-p (and (> (length imagesrc) 128)
    7.28 +		     (not (file-readable-p imagesrc)))))
    7.29 +    (save-excursion
    7.30 +      (cond
    7.31 +       ((featurep 'image) window-system
    7.32 +	(YaTeX-showup-buffer		;showup and select
    7.33 +	 (get-buffer-create buffer)
    7.34 +	 (or func 'YaTeX-showup-buffer-bottom-most)
    7.35 +	 t)
    7.36 +	(remove-images (point-min) (point-max))
    7.37 +	(erase-buffer)
    7.38 +	(insert-image
    7.39 +	 (setq image (create-image
    7.40 +		      (if data-p imagesrc (expand-file-name imagesrc))
    7.41 +		      nil data-p)))
    7.42 +	(YaTeX-preview-image-mode)
    7.43 +	(let ((height (1+ (cdr (image-size image)))))
    7.44 +	  (enlarge-window
    7.45 +	   (- (ceiling (min height (/ (frame-height) 2)))
    7.46 +	      (window-height))))
    7.47 +	(select-window sw))
    7.48 +       (t	;; Without direct image, display image with image viewer
    7.49 +	(YaTeX-system
    7.50 +	 (format "%s %s" YaTeX-cmd-view-images target)
    7.51 +	 "YaTeX-region-image"
    7.52 +	 'noask)))
    7.53 +  )))
    7.54 +
    7.55  (defvar YaTeX-typeset-conv2image-process nil "Process of conv2image chain")
    7.56  (defun YaTeX-typeset-conv2image-chain ()
    7.57    (let*((proc (or YaTeX-typeset-process YaTeX-typeset-conv2image-process))
    7.58 @@ -531,39 +561,11 @@
    7.59  			     'YaTeX-typeset-conv2image-chain)
    7.60  		       (get 'YaTeX-typeset-process 'ppcmd))))
    7.61  	;; After all chain executed, display image in current window
    7.62 -	(cond
    7.63 -	 ((and (featurep 'image) window-system)
    7.64 -	  ;; If direct image displaying available in running Emacs,
    7.65 -	  ;; display target image into the next window in Emacs.
    7.66 -	  (select-window w)
    7.67 -	  ;(setq foo (selected-window))
    7.68 -	  (YaTeX-showup-buffer
    7.69 -	   (get-buffer-create " *YaTeX-region-image*")
    7.70 -	   'YaTeX-showup-buffer-bottom-most t)
    7.71 -	  (remove-images (point-min) (point-max))
    7.72 -	  (erase-buffer)
    7.73 -	  (cd pwd)			;when reuse from other source
    7.74 -					;(put-image (create-image (expand-file-name target)) (point))
    7.75 -	  (insert-image-file target)
    7.76 -	  (setq img (plist-get (text-properties-at (point)) 'intangible))
    7.77 -	  (YaTeX-preview-image-mode)
    7.78 -	  (if img
    7.79 -	      (let ((height (1+ (cdr (image-size img)))))
    7.80 -		(enlarge-window
    7.81 -		 (- (ceiling (min height (/ (frame-height) 2)))
    7.82 -		    (window-height)))))
    7.83 -	  ;; Remember elapsed time, which will be threshold in onthefly-preview
    7.84 -	  (put 'YaTeX-typeset-conv2image-chain 'elapse
    7.85 -	       (YaTeX-elapsed-time
    7.86 -		(get 'YaTeX-typeset-conv2image-chain 'start) (current-time))))
    7.87 -	 (t
    7.88 -	  ;; Without direct image, display image with image viewer
    7.89 -	  (YaTeX-system
    7.90 -	   (format "%s %s" YaTeX-cmd-view-images target)
    7.91 -	   "YaTeX-region-image"
    7.92 -	   'noask)
    7.93 -	  )
    7.94 -	 )))))
    7.95 +	(YaTeX-popup-image target " *YaTeX-popup-image*")
    7.96 +	(put 'YaTeX-typeset-conv2image-chain 'elapse
    7.97 +	     (YaTeX-elapsed-time
    7.98 +	      (get 'YaTeX-typeset-conv2image-chain 'start) (current-time)))
    7.99 +	))))
   7.100  
   7.101  
   7.102  (defvar YaTeX-typeset-environment-timer nil)
   7.103 @@ -657,6 +659,14 @@
   7.104  	  (if usetimer (YaTeX-typeset-environment-auto b e)))
   7.105        (YaTeX-typeset-region))))
   7.106  
   7.107 +(defun YaTeX-filter-BEGEND ()
   7.108 +  (let ((begend-info (YaTeX-in-BEGEND-p)))
   7.109 +    (if begend-info
   7.110 +	(progn
   7.111 +	  (require 'yatexflt)
   7.112 +	  (YaTeX-filter-pass-to-filter begend-info)
   7.113 +	  ))))
   7.114 +
   7.115  (defun YaTeX-typeset-environment ()
   7.116    "Typeset current environment or paragraph.
   7.117  If region activated, use it."
   7.118 @@ -664,7 +674,8 @@
   7.119    (let ((md (match-data)))
   7.120      (unwind-protect
   7.121  	(save-excursion
   7.122 -	  (YaTeX-typeset-environment-1))
   7.123 +	  (or (YaTeX-filter-BEGEND)
   7.124 +	      (YaTeX-typeset-environment-1)))
   7.125        (store-match-data md))))
   7.126  
   7.127