yatex

changeset 70:44e3a5e1e883

Fix makefile for Windows Brush up label completion \cite completion Support much more about LaTeX2e --- [yahtml] English Info (By Jun Ohya) Automatic pixel size detection for <img src="..."> Aware global-class of css definition & for char-entity reference
author yuuji
date Sun, 09 Apr 2000 03:37:47 +0000
parents 807c1e7e68b7
children 52f11338970f
files docs/htmlqa docs/htmlqa.eng docs/qanda.eng docs/yahtmle.tex docs/yahtmlj.tex docs/yatex.ref docs/yatexadd.doc docs/yatexe.tex docs/yatexgen.doc docs/yatexj.tex docs/yatexref.eng help/YATEXHLP.eng help/YATEXHLP.jp yahtml.el yatex.el yatex.new yatex19.el yatexadd.el yatexenv.el yatexgen.el yatexhie.el yatexhlp.el yatexlib.el yatexm-o.el yatexmth.el yatexprc.el yatexsec.el
diffstat 27 files changed, 2048 insertions(+), 394 deletions(-) [+]
line diff
     1.1 --- a/docs/htmlqa	Thu Jul 15 04:58:26 1999 +0000
     1.2 +++ b/docs/htmlqa	Sun Apr 09 03:37:47 2000 +0000
     1.3 @@ -39,6 +39,16 @@
     1.4  	ただし、Emacs-20 や XEmacs の場合、漢字コードのシンボルの両端の*
     1.5  	は付きません。
     1.6  	
     1.7 +・<li>の直後に空白入るとhtmllintに怒られるから空白なしにしたいんだけど…
     1.8 +	
     1.9 +	それ、htmllintがやりすぎなんです。タグ直後の空白に対して文句いう
    1.10 +	のは
    1.11 +	http://www.cre.canon.co.uk/%7Eneilb/weblint/www5-paper.html
    1.12 +	によると、空白があることで変なレイアウトになってしまうへぼブラウ
    1.13 +	ザへの配慮によるものなのでHTML的にはまるで問題ないんです。とかく
    1.14 +	htmllintを使うとhtmllintに怒られないこと自体が目的となりがちです
    1.15 +	が、わたしはそれは本末転倒であると思います。
    1.16 +	
    1.17  ■どうにかならんかなあ関連
    1.18  ・長い文書の下の方だとインデントがめちゃ遅いんだけど。
    1.19  	
    1.20 @@ -100,7 +110,7 @@
    1.21  
    1.22  	・近くにいる詳しい人に聞く
    1.23  	・メイリングリストに質問を出す
    1.24 -	・yuuji@gentei.org に質問を出す
    1.25 +	・yuuji@yatex.org に質問を出す
    1.26  	
    1.27  	でしょうか。お好きな方法でどうぞ。
    1.28  	
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/docs/htmlqa.eng	Sun Apr 09 03:37:47 2000 +0000
     2.3 @@ -0,0 +1,123 @@
     2.4 +%%
     2.5 +%% Q and A on yahtml
     2.6 +%%
     2.7 +%% C-u C-x $ shows only questions.  C-x $ shows all.
     2.8 +%%
     2.9 +
    2.10 +[Installation]
    2.11 +==============
    2.12 +*Must I install YaTeX even if I don't use LaTeX?
    2.13 +	
    2.14 +	No.  Get the files starting with "yahtml" from
    2.15 +	ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/text/yatex/
    2.16 +	and that's all you will need.
    2.17 +
    2.18 +[Customization]
    2.19 +==============
    2.20 +*I usually use EUC, but need JIS coding on some files.
    2.21 +	
    2.22 +	Write
    2.23 +	(setq yahtml-kanji-code 3) ;3 for EUC
    2.24 +	and your default kanji code for HTML files will be EUC.
    2.25 +	Now to change codings foe selected files.  If your server is
    2.26 +	Apache, then prepare a file named ".htaccess" in the directory
    2.27 +	and write
    2.28 +
    2.29 +	    AddType "text/html; charset=iso-2020-jp" .html
    2.30 +
    2.31 +	Apache will now inform all your visitors that the html files
    2.32 +	in this directory are in iso-2022-jp, aka JIS.  yahtml will
    2.33 +	also follow this and encode all files in this directory with JIS.
    2.34 +
    2.35 +	Not using Apache? Then adding the following to the end of your
    2.36 +	html source will make this files coding system JIS.
    2.37 +
    2.38 +	<!-- Local Variables: -->
    2.39 +	<!-- file-coding-system: *junet* -->
    2.40 +	<!-- End: -->
    2.41 +
    2.42 +	Note that Emacs-20 and XEmacs do not need the "*" in the kanji
    2.43 +	code symbol.
    2.44 +
    2.45 +[What about...]
    2.46 +==============
    2.47 +*Indentation for a large file is slow
    2.48 +       
    2.49 +	Should be fixed.
    2.50 +	
    2.51 +*Inserting template.html
    2.52 +	
    2.53 +	Use autoinsert.el that comes with Emacs19/Mule2.  Another
    2.54 +	option is to use auto-insert-tkld.  The latter can be found at
    2.55 +	ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/auto-inset-tkld.tar.Z
    2.56 +	Examples in Japanese are at
    2.57 +	http://www-nagao.kuee.kyoto-u.ac.jp/member/tsuchiya/elisp/yahtml-mode.html
    2.58 +	
    2.59 +[ETC]
    2.60 +============
    2.61 +*How do I pronounce yahtml
    2.62 +	
    2.63 +	A real FAQ.  The author doesn't know either.  Any ideas?
    2.64 +	... It hits on me!  We define the official name of yahtml as;
    2.65 +	
    2.66 +		HTML-Ya
    2.67 +	
    2.68 +	"Ya" is the Japanese word whose meaning is `shop', and sometimes
    2.69 +	`enthusiast' of something.  With  HTML-Ya, do the publishment of
    2.70 +	your thought efficiently and beautifully!
    2.71 +	
    2.72 +*Mailing lists?
    2.73 +	
    2.74 +	A  question, so  an answer.   The mailing  list for  YaTeX (Wild
    2.75 +	Bird)  and it's  implementation to  Vz; Raicho  (by KATSURAGAWA,
    2.76 +	Naoki),  implementation  to Wz  Editor;  HackTeX (by  TAKKENAKA,
    2.77 +	Hiroshi),   implementation  to   Hidemaru;  HiTeX   (by  YASUDA,
    2.78 +	Haruyuki) is "fj Wild Bird Society".  Send a mail like
    2.79 +	
    2.80 +		To: yatex@yatex.org
    2.81 +		Subject: append
    2.82 +		-----
    2.83 +		Hi!
    2.84 +		My name is yuuji.
    2.85 +		See any birds fly by?
    2.86 +	
    2.87 +	and you're in.  Once you're in, you'll get a reply with lists of
    2.88 +	commands used in  the mailing list.  Join along  and help adding
    2.89 +	new feathers to Wild Bird.   BTW, if you haven't guessed it yet,
    2.90 +	yes,  this mailing  list  is in  Japanese.   But give  us a  try
    2.91 +	anyway.  You're always welcome.
    2.92 +	
    2.93 +*How to get the up-to-date information on yahtml?
    2.94 +	
    2.95 +	If you can access WWW, try to see;
    2.96 +	http://www.yatex.org/
    2.97 +	And if  you trace the link  of `yatex-current', you  can get the
    2.98 +	really latest version of yahtml.  Since it collects the elisps in
    2.99 +	the author's source directory, what  you'll get may contain some
   2.100 +	errors.  The author   cannot    respond to  your  query    about
   2.101 +	yatex-current.
   2.102 +	
   2.103 +*Help, help HELP!!
   2.104 +	
   2.105 +	Ways of getting answers in fastest order.
   2.106 +
   2.107 +	*Look for someone near you who knows what's he/she's doing.
   2.108 +	*Post a question to the mailing list.
   2.109 +	*Send mail to yuuji@yatex.org
   2.110 +	
   2.111 +	take a pick.
   2.112 +	
   2.113 +*Picking a question in this file with C-u C-x $ and hitting C-x $ takes
   2.114 + me to a weird world.
   2.115 +	
   2.116 +	You too?  Try  marking the question before  C-x $ and to C-x C-x
   2.117 +	to take you back to  it.  (Mule2 doesn't  seem to have the  same
   2.118 +	problem)
   2.119 +
   2.120 +
   2.121 +Local Variables:
   2.122 +mode: indented-text
   2.123 +fill-column: 72
   2.124 +fill-prefix: "	"
   2.125 +End:
   2.126 +
     3.1 --- a/docs/qanda.eng	Thu Jul 15 04:58:26 1999 +0000
     3.2 +++ b/docs/qanda.eng	Sun Apr 09 03:37:47 2000 +0000
     3.3 @@ -19,6 +19,17 @@
     3.4  	(After that, M-x info  [RET] m yatex  [RET]  will give you  Wild
     3.5  	Bird's manual.  Hitting ? will show how to use info)
     3.6  
     3.7 +*I'm a Meadow(Emacs on Win32) user.  I don't have `make' utility
     3.8 +	
     3.9 +	Make program is needed only for byte-compiling.  So if you do
    3.10 +	not care the subtle speed difference, you don't have to
    3.11 +	byte-compile.  You don't have to look for `make' utility.  The
    3.12 +	simplest way to install yatex without `make'.
    3.13 +	
    3.14 +	1 Extract this yatex*tar.gz to your Meadow's site-lisp dir.
    3.15 +	2 Add the yatex installed path to your load-path according to
    3.16 +	  `install' file in this package.
    3.17 +	
    3.18  *I ain't got the privilege to write in the Info directory...
    3.19  	
    3.20  	 Get yourself made root.  If you can't, have them install Mule2
    3.21 @@ -352,23 +363,22 @@
    3.22  	
    3.23  	A  question, so  an answer.   The mailing  list for  YaTeX (Wild
    3.24  	Bird)  and it's  implementation to  Vz; Raicho  (by KATSURAGAWA,
    3.25 -	Naoki; katsura@prc.tsukuba.ac.jp),  implementation to Wz Editor;
    3.26 -	HackTeX  (by TAKKENAKA,  Hiroshi),  implementation to  Hidemaru;
    3.27 -	HiTeX (by YASUDA,  Haruyuki) is "fj Wild Bird  Society".  Send a
    3.28 -	mail like
    3.29 +	Naoki),  implementation  to Wz  Editor;  HackTeX (by  TAKKENAKA,
    3.30 +	Hiroshi),   implementation  to   Hidemaru;  HiTeX   (by  YASUDA,
    3.31 +	Haruyuki) is "fj Wild Bird Society".  Send a mail like
    3.32  	
    3.33 -		To: yatex@jaist.ac.jp
    3.34 +		To: yatex@yatex.org
    3.35  		Subject: append
    3.36  		-----
    3.37 -		Hi!  My name is yuuji.
    3.38 +		Hi!
    3.39 +		My name is yuuji.
    3.40  		See any birds fly by?
    3.41  	
    3.42 -	and you're in.  The text will be used as  your profile. (you can
    3.43 -	change it later) Once  you're in, you'll get  a reply with lists
    3.44 -	of  commands  used in the  mailing   list.  Join along and  help
    3.45 -	adding new feathers to  Wild Bird.  BTW,  if you haven't guessed
    3.46 -	it yet, yes, this mailing  list is in  Japanese.  But give us  a
    3.47 -	try anyway.  You're always welcome.
    3.48 +	and you're in.  Once you're in, you'll get a reply with lists of
    3.49 +	commands used in  the mailing list.  Join along  and help adding
    3.50 +	new feathers to Wild Bird.   BTW, if you haven't guessed it yet,
    3.51 +	yes,  this mailing  list  is in  Japanese.   But give  us a  try
    3.52 +	anyway.  You're always welcome.
    3.53  	
    3.54  *How to get the up-to-date information on YaTeX?
    3.55  	
    3.56 @@ -386,7 +396,7 @@
    3.57  
    3.58  	*Look for someone near you who knows what's he/she's doing.
    3.59  	*Post a question to the mailing list.
    3.60 -	*Send mail to yuuji@gentei.org
    3.61 +	*Send mail to yuuji@yatex.org
    3.62  	
    3.63  	take a pick.
    3.64  	
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/docs/yahtmle.tex	Sun Apr 09 03:37:47 2000 +0000
     4.3 @@ -0,0 +1,485 @@
     4.4 +\def\lang{eng} % -*- texinfo -*- for Texinfo V.3.1 
     4.5 +\input texinfo
     4.6 +@setfilename yahtmle
     4.7 +@settitle Yet Another html-mode for Emacs
     4.8 +
     4.9 +@iftex
    4.10 +@c @syncodeindex fn cp
    4.11 +@c Do people really read this INFO?
    4.12 +@c Still not finished
    4.13 +@c Last modified Mon Nov 29 16:01:00 1999 on buell
    4.14 +@syncodeindex vr cp
    4.15 +@end iftex
    4.16 +
    4.17 +@titlepage
    4.18 +@sp 10
    4.19 +@center
    4.20 +@subtitle Yet Another html-mode for emacs
    4.21 +@title // yahtml //
    4.22 +%@subtitle // yahtml //
    4.23 +@author @copyright{} 1994-1997 by    HIROSE, Yuuji [yuuji@@yatex.org]
    4.24 +@end titlepage
    4.25 +
    4.26 +@node Top, Intro, (dir), (dir)
    4.27 +@comment  node-name,  next,  previous,  up
    4.28 +
    4.29 +@menu
    4.30 +* Intro::                       Introduction
    4.31 +* Installation::                Installing yahtml
    4.32 +* Command Invocation::          Using External Commands
    4.33 +* Completion::                  Input with Completion
    4.34 +* Jump::                        Moving the Cursor
    4.35 +* Changing and Deleting::       Changing and Deleting
    4.36 +* CSS Support::                 Style Sheet Support
    4.37 +* Customizations::              List of Customize Variables
    4.38 +* Copying::                     Copyright
    4.39 +* Concept Index::               Index
    4.40 +@end menu
    4.41 +
    4.42 +@node Intro, Installation, Top, Top
    4.43 +@comment  node-name,  next,  previous,  up
    4.44 +@chapter Introduction
    4.45 +@cindex Demacs
    4.46 +@cindex Mule
    4.47 +@cindex LaTeX
    4.48 +@cindex yahtml
    4.49 +
    4.50 +yahtml is a package to support creating HTML documents on Emacsens.  Easy
    4.51 +input of elements (tags) by completion, syntax checking with programs like
    4.52 +weblint, and invoking the appropriate browser or image viewer depending on
    4.53 +the cursor position is its main features.
    4.54 +
    4.55 +(This Info is still incomplete)
    4.56 +
    4.57 +@node Installation, Command Invocation, Intro, Top
    4.58 +@comment  node-name,  next,  previous,  up
    4.59 +@chapter Installing yahtml
    4.60 +@menu
    4.61 +* Setting up yahtml::           
    4.62 +* Setting environments for weblint browsers and image viewers::  
    4.63 +* Setting environment variables for WWW pages::  
    4.64 +@end menu
    4.65 +
    4.66 +@node Setting up yahtml, Setting environments for weblint browsers and image viewers, Installation, Installation
    4.67 +@comment  node-name,  next,  previous,  up
    4.68 +@section Setting up yahtml
    4.69 +
    4.70 +
    4.71 +Add the following to @file{~/.emacs}
    4.72 +
    4.73 +@lisp
    4.74 +(setq auto-mode-alist
    4.75 +      (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
    4.76 +(autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
    4.77 +@end lisp
    4.78 +
    4.79 +Next, add to load-path the directory with the yahtml files
    4.80 +(@file{yahtml.el}, @file{yatexlib.el}, @file{yatexprc.el}).  For example,
    4.81 +if you put them in @file{~/src/emacs/yahtml},
    4.82 +
    4.83 +@lisp
    4.84 +(setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path))
    4.85 +@end lisp
    4.86 +
    4.87 +@noindent 
    4.88 +is what you add.
    4.89 +
    4.90 +By this, yahtml will be automatically loaded when editing files with .html
    4.91 +extensions.  "yahtml" will be displayed on the mode line if no errors
    4.92 +occurred. 
    4.93 +
    4.94 +@node Setting environments for weblint browsers and image viewers, Setting environment variables for WWW pages, Setting up yahtml, Installation
    4.95 +@comment  node-name,  next,  previous,  up
    4.96 +@section Setting environments for weblint, browsers, and image viewers
    4.97 +
    4.98 +Check the variables for invoking external commands and modify as needed.
    4.99 +Defaults are in parenthesis.
   4.100 +
   4.101 +@table @code
   4.102 +@item yahtml-www-browser
   4.103 +        @dots{} browser command name (netscape)
   4.104 +@item yahtml-image-viewer
   4.105 +        @dots{} image viewer command name (xv)
   4.106 +@item yahtml-lint-program
   4.107 +        @dots{} syntax check programs command name (jweblint)
   4.108 +@item yahtml-kanji-code
   4.109 +        @dots{} kanji code for HTML files
   4.110 +@end table
   4.111 +
   4.112 +@node Setting environment variables for WWW pages,  , Setting environments for weblint browsers and image viewers, Installation
   4.113 +@comment  node-name,  next,  previous,  up
   4.114 +@section Setting environment variables for WWW pages
   4.115 +
   4.116 +Variables regarding path names for files that will be your home page.
   4.117 +@table @code
   4.118 +@item yahtml-path-url-alist
   4.119 +        @dots{} list of matching path name on file system and URLs
   4.120 +@item yahtml-directory-index
   4.121 +        @dots{} index file displayed when none is given in URL.  Usually
   4.122 +        @file{index.html} on NCSA type httpd and @file{Welcome.html} on
   4.123 +        CERN types. 
   4.124 +@end table
   4.125 +
   4.126 +Examples for  @code{yahtml-path-url-alist}.  If @file{/home/yuuji/http/}
   4.127 +is @code{http://localhost/~yuuji} at home and @file{/usr/home/yuuji/www/}
   4.128 +is @code{http://www.keio.ac.jp/~yuuji/} at work, then
   4.129 +
   4.130 +@lisp
   4.131 +(setq yahtml-path-url-alist
   4.132 +      '(("/home/yuuji/http" . "http://localhost/~yuuji")
   4.133 +        ("/usr/home/yuuji/www" . "http://www.keio.ac.jp/~yuuji")))
   4.134 +@end lisp
   4.135 +
   4.136 +Any number of additions can be made to this list.
   4.137 +
   4.138 +@node Command Invocation, Completion, Installation, Top
   4.139 +@comment  node-name,  next,  previous,  up
   4.140 +@chapter Invoking external commands
   4.141 +
   4.142 +For easy use of commands that are handy when editing HTML files.
   4.143 +@table @kbd
   4.144 +@item [prefix] t j
   4.145 +        @dots{} Invoke HTML syntax checker (jweblint)
   4.146 +@item [prefix] t p
   4.147 +        @dots{} Display current page in browser
   4.148 +@item [prefix] t r
   4.149 +        @dots{} Reload current page if browser is already running
   4.150 +@end table
   4.151 +
   4.152 +@node Completion, Jump, Command Invocation, Top
   4.153 +@comment  node-name,  next,  previous,  up
   4.154 +@chapter Completion Input
   4.155 +
   4.156 +Completion input of HTML elements is done through the same key strokes as
   4.157 +YaTeX's begin-type completion, section-type completion, large-type
   4.158 +completion, maketitle-type completion, and accent completion.
   4.159 +Corresponding elements in this order is; elements that span multiple
   4.160 +lines, empty elements such as img, tags that start and end in a
   4.161 +single line, elements with no attributes or contents, and special or
   4.162 +symbol entities.
   4.163 +
   4.164 +@table @kbd
   4.165 +@item [prefix] b (YaTeX begin-type completion)
   4.166 +@dots{}
   4.167 +@example
   4.168 +<ul>
   4.169 +</ul>
   4.170 +@end example
   4.171 +
   4.172 +@noindent
   4.173 +Completion for elements that the start tag and the end tag span multiple
   4.174 +lines. Mostly block-level elements.
   4.175 +
   4.176 +@item [prefix] s (YateX section-type completion)
   4.177 +@dots{}
   4.178 +@example
   4.179 +<img src="foo.gif" alt="photo">
   4.180 +@end example
   4.181 +
   4.182 +@noindent
   4.183 +Completion for elements that do not have end tags and require only
   4.184 +attributes.  Possible completions are, <img>, <input>.
   4.185 +
   4.186 +@item [prefix] l (YaTeX large-type completion)
   4.187 +@dots{} 
   4.188 +
   4.189 +@example
   4.190 +<big> 〜 </big>
   4.191 +@end example
   4.192 +
   4.193 +@noindent
   4.194 +Similar to begin-type completion but used for elements that start and end
   4.195 +on a single line.
   4.196 +
   4.197 +
   4.198 +@item [prefix] m (YaTeX maketitle-type completion)
   4.199 +@dots{} Completion for elements without attributes or contents.  Possible
   4.200 +completion is <br>
   4.201 +
   4.202 +@item [prefix] a (YaTeX accent completion)
   4.203 +@dots{} Used to enter special or symbol entities.  By default completion
   4.204 +for < (&lt;), > (&gt;), & (&amp;), " (&quot;), ' (&apos;), blank (&nbsp;)
   4.205 +is possible.
   4.206 +@end table
   4.207 +
   4.208 +@node Jump, Changing and Deleting, Completion, Top
   4.209 +@comment  node-name,  next,  previous,  up
   4.210 +@chapter Cursor Movement
   4.211 +By using 
   4.212 +
   4.213 +@table @kbd
   4.214 +@item [prefix] g
   4.215 +        @dots{} move to corresponding object
   4.216 +@end table
   4.217 +
   4.218 +@noindent 
   4.219 +the cursor will go to the corresponding object according to the context.
   4.220 +Recognized contexts are
   4.221 +
   4.222 +@itemize @bullet
   4.223 +@item @code{<TAG>} <--> @code{</TAG>}
   4.224 +@item @code{<img src="image.file">} -> invoke viewer
   4.225 +@item @code{<a href="link.to.somewhere">} -> move cursor to linked target
   4.226 +@item @code{<applet code="program">} -> open Java source
   4.227 +@c @item @code{\include(\input)} → 対応するファイル
   4.228 +@end itemize
   4.229 +
   4.230 +@node Changing and Deleting, CSS Support, Jump, Top
   4.231 +@comment  node-name,  next,  previous,  up
   4.232 +@chapter Changing and Deleting
   4.233 +
   4.234 +@menu
   4.235 +* Changing tags in pairs::      
   4.236 +* Changing entities::           
   4.237 +* URLencoding of strings within region::  
   4.238 +@end menu
   4.239 +
   4.240 +@node Changing tags in pairs, Changing entities, Changing and Deleting, Changing and Deleting
   4.241 +@comment  node-name,  next,  previous,  up
   4.242 +@section Changing tags in pairs
   4.243 +By using
   4.244 +
   4.245 +@table @kbd
   4.246 +@item [prefix] c
   4.247 +        @dots{} change tags in matching pairs
   4.248 +@end table
   4.249 +
   4.250 +@noindent 
   4.251 +the content can be changed according to the context of the HTML document
   4.252 +where the cursor is located.
   4.253 +
   4.254 +@itemize @bullet
   4.255 +@item @code{<TAG>}〜@code{</TAG>}
   4.256 +@dots{} change @code{TAG} element name
   4.257 +@item attributes such as @code{<img src="image.file" alt="photo">}
   4.258 +@dots{} change attributes
   4.259 +@end itemize
   4.260 +
   4.261 +@node Changing entities, URLencoding of strings within region, Changing tags in pairs, Changing and Deleting
   4.262 +@comment  node-name,  next,  previous,  up
   4.263 +@section Changing entities
   4.264 +Special characters such as < or > must be written as &lt; and &gt;.  Easy
   4.265 +conversion of these characters can be done when importing text from non
   4.266 +HTML files.
   4.267 +
   4.268 +
   4.269 +@table @kbd
   4.270 +@item [prefix] ;
   4.271 +        @dots{} convert char to special entity in marked region
   4.272 +@item [prefix] :
   4.273 +        @dots{} convert special entity to original char in marked region
   4.274 +        (reverse of [prefix] ;)
   4.275 +@end table
   4.276 +
   4.277 +
   4.278 +@node URLencoding of strings within region,  , Changing entities, Changing and Deleting
   4.279 +@comment  node-name,  next,  previous,  up
   4.280 +@section URLencoding of strings within region
   4.281 +
   4.282 +@table @kbd
   4.283 +@item [prefix] #
   4.284 +	@dots{} encode chars that needs to be URLencoded within region
   4.285 +@end table
   4.286 +
   4.287 +@node CSS Support, Customizations, Changing and Deleting, Top
   4.288 +@comment  node-name,  next,  previous,  up
   4.289 +@chapter CSS(Style Sheets) Support
   4.290 +
   4.291 +@menu
   4.292 +* CSS-class completion::        
   4.293 +* Reread CSS definition::       
   4.294 +@end menu
   4.295 +
   4.296 +@node CSS-class completion, Reread CSS definition, CSS Support, CSS Support
   4.297 +@comment  node-name,  next,  previous,  up
   4.298 +@section CSS class-name completion
   4.299 +You can input a class name in your CSS definition with completion.
   4.300 +If you have CSS defined as below;
   4.301 +
   4.302 +@display
   4.303 + h1.foo, h2.foo @{ background-color: 0xffffff; @}
   4.304 + h1.bar, h2.bar @{ font-size: 120%; @}
   4.305 +@end display
   4.306 +
   4.307 +when you input h1(or h2) tag with completing-read by [prefix] b or
   4.308 +[prefix] l, yahtml prompts you to input class name with completion from
   4.309 +the words which are effective to h1 or h2.  And if you defined 
   4.310 +global class like this;
   4.311 +
   4.312 +@display
   4.313 + .caution @{ font-size: 120%; background-color: 0xc00000;@}
   4.314 +@end display
   4.315 +
   4.316 +when you input any tags via completing-read, yahtml prompts you to input
   4.317 +class name.  If this is bothering, typing @kbd{C-j} instead of
   4.318 +@kbd{RET} (or @kbd{C-m}) cancels the next prompt to class name completion.
   4.319 +
   4.320 +@node Reread CSS definition,  , CSS-class completion, CSS Support
   4.321 +@comment  node-name,  next,  previous,  up
   4.322 +@section Re-reading CSS definition
   4.323 +If you add some class to your CSS file and you want yahtml to load
   4.324 +new definitions, type @kbd{M-x yahtml-mode RET} to make yahtml do.
   4.325 +
   4.326 +@node Customizations, Copying, CSS Support, Top
   4.327 +@comment  node-name,  next,  previous,  up
   4.328 +@chapter Customizations
   4.329 +@cindex Customize
   4.330 +@cindex Key Assign
   4.331 +
   4.332 +Variables that modify yahtml's behavior.
   4.333 +
   4.334 +@menu
   4.335 +* All customizable variables::  List of customizable variables
   4.336 +* Hook variables::              hook variables
   4.337 +@end menu
   4.338 +
   4.339 +@node All customizable variables, Hook variables, Customizations, Customizations
   4.340 +@comment  node-name,  next,  previous,  up
   4.341 +@section List of customizable variables.  Defaults in parenthesis
   4.342 +
   4.343 +@defvar yahtml-prefix
   4.344 +Prefix key for yahtml-mode.  (@kbd{\C-c})
   4.345 +@end defvar
   4.346 +
   4.347 +@defvar yahtml-image-viewer
   4.348 +Command to view image files refered by img. (xv)
   4.349 +@end defvar
   4.350 +
   4.351 +@defvar yahtml-www-browser
   4.352 +Browser to view external pages with @kbd{[prefix]g}. (netscape)
   4.353 +@end defvar
   4.354 +
   4.355 +@defvar yahtml-kanji-code
   4.356 +Default kanji code. 1=sjis, 2=jis, 3=euc (2)
   4.357 +If
   4.358 +@quotation
   4.359 + AddType "text/html; charset=xxx" .html
   4.360 +@end quotation
   4.361 +is written in .htaccess, this will override yahtml-kanji-code.
   4.362 +@end defvar
   4.363 +
   4.364 +@defvar yahtml-fill-column
   4.365 +Columns to auto-fill (72)
   4.366 +@end defvar
   4.367 +
   4.368 +@defvar yahtml-fill-prefix
   4.369 +fill-prefix specific to yahtml-mode. (@code{nil})
   4.370 +@end defvar
   4.371 +
   4.372 +@defvar yahtml-path-url-alist
   4.373 +Matching list of URL and full path name on OS's file system.
   4.374 +@end defvar
   4.375 +
   4.376 +@defvar yahtml-directory-index
   4.377 +Default index filed opened when accessing a server without a filename,
   4.378 +usually index.html. (@code{"index.html"})
   4.379 +@end defvar
   4.380 +
   4.381 +@defvar yahtml-lint-program
   4.382 +HTML syntax check program. (@code{"jweblint"})
   4.383 +@end defvar
   4.384 +
   4.385 +@defvar yahtml-hate-too-deep-indentation
   4.386 +setq to t when indentations for nested enumerate elements are too deep.
   4.387 +(@code{nil})
   4.388 +@end defvar
   4.389 +
   4.390 +@defvar yahtml-always-/p
   4.391 +setq to t if you always want @code{</p>} after @code{</p>}. @code{nil}
   4.392 +@end defvar
   4.393 +
   4.394 +@defvar yahtml-p-prefered-env-regexp
   4.395 +Elements that @code{<p>} will be automatically inserted. @code{^\(body\|dl\)}
   4.396 +@end defvar
   4.397 +
   4.398 +@defvar yahtml-template-file
   4.399 +File to automatically insert when editing a new HTML file.
   4.400 +@file{"~/http/template.html"}
   4.401 +@end defvar
   4.402 +
   4.403 +@defvar yahtml-prefer-upcases
   4.404 +Use uppercase for tags. @code{nil}
   4.405 +@end defvar
   4.406 +
   4.407 +@defvar yahtml-prefer-upcase-attributes
   4.408 +Use uppercase for attributes. @code{nil}
   4.409 +@end defvar
   4.410 +
   4.411 +@defvar yahtml-server-type
   4.412 +setq to 'apache if using a Apache server, and will refer ./.htaccess.
   4.413 +@code{'apache}
   4.414 +@end defvar
   4.415 +
   4.416 +@defvar yahtml-apache-access-file
   4.417 +When @code{yahtml-server-type} is @code{'apache}, define name of access
   4.418 +restriction file. @file{".htaccess"}
   4.419 +@end defvar
   4.420 +
   4.421 +@defvar yahtml-shell-command-option
   4.422 +Options needed to invoke shell commands.
   4.423 +@end defvar
   4.424 +
   4.425 +@defvar yahtml-translate-hyphens-when-comment-region
   4.426 +Whether to change hyphens to @code{&#45;} when commenting out region.
   4.427 +(@code{t})
   4.428 +@end defvar
   4.429 +
   4.430 +@defvar yahtml-entity-reference-chars-alist
   4.431 +alist of characters that needs to be written by Entity Reference.  Enter
   4.432 +as @code{'(?char . "EntityReference")}.  By default, @code{<}, @code{>},
   4.433 +@code{&}, @code{'}, is set.  Add as needed.  Do not include @code{&} at
   4.434 +beginning and @code{;} at end of cdr portion of @code{"EntityReference"}.
   4.435 +@end defvar
   4.436 +
   4.437 +@defvar yahtml-faithful-to-htmllint
   4.438 +When using htmllint to check syntax, it will complain about excess spaces.
   4.439 +setq to @code{t} to avoid this.
   4.440 +@end defvar
   4.441 +
   4.442 +
   4.443 +@node Hook variables,  , All customizable variables, Customizations
   4.444 +@comment  node-name,  next,  previous,  up
   4.445 +@section hook variables
   4.446 +
   4.447 +
   4.448 +@node Copying, Concept Index, Customizations, Top
   4.449 +@comment  node-name,  next,  previous,  up
   4.450 +@chapter Copying
   4.451 +
   4.452 +This program is distributed as freesoftware.  The author will take no
   4.453 +responsibility to any damages due to the usage of this software
   4.454 +whatsoever.  There are no restrictions to its redistribution, just use
   4.455 +common sense.  Mail me your thoughts on this program and I will be more
   4.456 +than willing to help.
   4.457 +
   4.458 +Complaints, requests, bug reports and comments are welcome.  Make contacts
   4.459 +to yuuji@@yatex.org (as of July 1999)
   4.460 +
   4.461 +If you like this program and use it on a regular basis, please join the
   4.462 +mailing list "fj Wild Bird Society".  Procedures can be found in the "etc"
   4.463 +section of @file{docs/yahtmlqa} in this package.
   4.464 +
   4.465 +
   4.466 +@flushright
   4.467 +HIROSE, Yuuji
   4.468 +@end flushright
   4.469 +
   4.470 +
   4.471 +@node    Concept Index,  , Copying, Top
   4.472 +@comment node-name, next, previous, up
   4.473 +@unnumbered Index
   4.474 +@printindex cp
   4.475 +
   4.476 +
   4.477 +@contents
   4.478 +
   4.479 +@bye
   4.480 +
   4.481 +@c Local Variables:
   4.482 +@c fill-column: 74
   4.483 +@c fill-prefix: nil
   4.484 +@c End:
   4.485 +
   4.486 +Tag table:
   4.487 +
   4.488 +End tag table
     5.1 --- a/docs/yahtmlj.tex	Thu Jul 15 04:58:26 1999 +0000
     5.2 +++ b/docs/yahtmlj.tex	Sun Apr 09 03:37:47 2000 +0000
     5.3 @@ -7,6 +7,7 @@
     5.4  @c @syncodeindex fn cp
     5.5  @c Infoって最近読む人が増えたらしい
     5.6  @c まだ書き終わっていません。
     5.7 +@c Last modified Mon Nov 29 15:43:04 1999 on buell
     5.8  @syncodeindex vr cp
     5.9  @end iftex
    5.10  
    5.11 @@ -16,7 +17,7 @@
    5.12  @subtitle Yet Another html-mode for emacs
    5.13  @title 『HTML屋』
    5.14  @subtitle // yahtml //
    5.15 -@author @copyright{} 1994-1997 by    HIROSE, Yuuji [yuuji@@gentei.org]
    5.16 +@author @copyright{} 1994-1997 by    HIROSE, Yuuji [yuuji@@yatex.org]
    5.17  @end titlepage
    5.18  
    5.19  @node Top, Intro, (dir), (dir)
    5.20 @@ -29,6 +30,7 @@
    5.21  * Completion::                  補完入力
    5.22  * Jump::                        カーソルジャンプ
    5.23  * Changing and Deleting::       変更と削除
    5.24 +* CSS Support::                 スタイルシート補完
    5.25  * Customizations::              カスタマイズ変数一覧
    5.26  * Copying::                     とりあつかい
    5.27  * Concept Index::               索引
    5.28 @@ -221,7 +223,7 @@
    5.29  @c @item @code{\include(\input)} → 対応するファイル
    5.30  @end itemize
    5.31  
    5.32 -@node Changing and Deleting, Customizations, Jump, Top
    5.33 +@node Changing and Deleting, CSS Support, Jump, Top
    5.34  @comment  node-name,  next,  previous,  up
    5.35  @chapter 変更/削除
    5.36  
    5.37 @@ -249,7 +251,7 @@
    5.38  @itemize @bullet
    5.39  @item @code{<TAG>}〜@code{</TAG>}
    5.40  @dots{} @code{TAG} の変更
    5.41 -@item @code{<img src="画像ファイル"> alt="photo"} などの属性値
    5.42 +@item @code{<img src="画像ファイル" alt="photo">} などの属性値
    5.43  @dots{} 属性値の変更
    5.44  @end itemize
    5.45  
    5.46 @@ -279,8 +281,65 @@
    5.47          エンコード表記に置換。
    5.48  @end table
    5.49  
    5.50 +@node CSS Support, Customizations, Changing and Deleting, Top
    5.51 +@comment  node-name,  next,  previous,  up
    5.52 +@chapter CSS(スタイルシート)サポート
    5.53  
    5.54 -@node Customizations, Copying, Changing and Deleting, Top
    5.55 +@menu
    5.56 +* CSS-class completion::        
    5.57 +* Reread CSS file::             
    5.58 +@end menu
    5.59 +
    5.60 +@node CSS-class completion, Reread CSS file, CSS Support, CSS Support
    5.61 +@comment  node-name,  next,  previous,  up
    5.62 +@section CSSクラス名補完
    5.63 +HTML屋はCSS(Cascading Style Sheets)のクラス名を補完入力することができます。
    5.64 +スタイル定義として
    5.65 +
    5.66 +@display
    5.67 + h1.foo, h2.foo @{ background-color: 0xffffff; @}
    5.68 + h1.bar, h2.bar @{ font-size: 120%; @}
    5.69 +@end display
    5.70 +
    5.71 +のようなものがあった場合に、h1またはh2タグを [prefix] b や [prefix] l で補
    5.72 +完入力した場合に、それらに有効な class 名である foo, bar を候補として補完
    5.73 +入力することが可能です。また
    5.74 +
    5.75 +@display
    5.76 + .caution @{ font-size: 120%; background-color: 0xc00000;@}
    5.77 +@end display
    5.78 +
    5.79 +のような全てのエレメントに働くclassが定義されていた場合は、全てのタグの補
    5.80 +完入力時にclass参照入力を求められます。これが煩わしい場合はエレメント名入
    5.81 +力確定のときにリターンキー(またはC-m)ではなく、C-jを押せばclass補完入力を
    5.82 +キャンセルできます。たとえば
    5.83 +
    5.84 +@display
    5.85 + @kbd{[prefix] l}                    行内タグ補完を起動
    5.86 +    (または@kbd{[prefix] l SPC})
    5.87 + tt                                  <tt></tt>をいれたいのでttと入力
    5.88 + @kbd{C-m}
    5.89 +@end display
    5.90 +
    5.91 +とした場合は続いて class= と補完プロンプトが出ますが、
    5.92 +
    5.93 +@display
    5.94 + @kbd{[prefix] l}                    行内タグ補完を起動
    5.95 +    (または@kbd{[prefix] l SPC})
    5.96 + tt                                  <tt></tt>をいれたいのでttと入力
    5.97 + @kbd{C-j}
    5.98 +@end display
    5.99 +
   5.100 +と最後を @kbd{C-j} で入力した場合は class 補完プロンプトは出ません。
   5.101 +
   5.102 +@node Reread CSS file,  , CSS-class completion, CSS Support
   5.103 +@comment  node-name,  next,  previous,  up
   5.104 +@section CSS定義ファイルの読み直し
   5.105 +htmlファイルを編集中にCSS定義ファイルを修正し、追加した
   5.106 +classを補完候補として直ちに読み込ませたい場合は、
   5.107 +@kbd{M-x yahtml-mode} として再起動を行ってください。
   5.108 +
   5.109 +@node Customizations, Copying, CSS Support, Top
   5.110  @comment  node-name,  next,  previous,  up
   5.111  @chapter カスタマイズ
   5.112  @cindex カスタマイズ[かすたまいす]
   5.113 @@ -414,7 +473,7 @@
   5.114  ただくと、作者は喜んでサポートに励むことでしょう。
   5.115  
   5.116    苦情、希望、バグ報告、感想等は歓迎いたします。
   5.117 -連絡は gentei.org まで(1999年7月現在)。
   5.118 +連絡は yuuji@@yatex.org まで(1999年7月現在)。
   5.119  継続的に使用してくださる方はメイリングリスト「fj野鳥の会」に
   5.120  是非加入してください。加入方法については本パッケージの @file{docs/yahtmlqa}
   5.121  ファイルの「その他」の章を御覧ください。
     6.1 --- a/docs/yatex.ref	Thu Jul 15 04:58:26 1999 +0000
     6.2 +++ b/docs/yatex.ref	Sun Apr 09 03:37:47 2000 +0000
     6.3 @@ -159,7 +159,7 @@
     6.4  	◆インクルード構造ブラウズ	[prefix] d
     6.5  
     6.6  							       広瀬雄二
     6.7 -						       yuuji@gentei.org
     6.8 +						       yuuji@yatex.org
     6.9  
    6.10  Local variables:
    6.11  mode: text
     7.1 --- a/docs/yatexadd.doc	Thu Jul 15 04:58:26 1999 +0000
     7.2 +++ b/docs/yatexadd.doc	Sun Apr 09 03:37:47 2000 +0000
     7.3 @@ -170,4 +170,4 @@
     7.4  
     7.5  
     7.6  								広瀬雄二
     7.7 -							yuuji@gentei.org
     7.8 +							yuuji@yatex.org
     8.1 --- a/docs/yatexe.tex	Thu Jul 15 04:58:26 1999 +0000
     8.2 +++ b/docs/yatexe.tex	Sun Apr 09 03:37:47 2000 +0000
     8.3 @@ -5,6 +5,7 @@
     8.4  
     8.5  @iftex
     8.6  @c @syncodeindex fn cp
     8.7 +@c Last modified Thu Mar 16 01:05:41 2000 on firestorm
     8.8  @syncodeindex vr cp
     8.9  @end iftex
    8.10  
    8.11 @@ -14,7 +15,7 @@
    8.12  @subtitle Yet Another tex-mode for emacs
    8.13  @title Wild Bird
    8.14  @subtitle // YaTeX //
    8.15 -@author @copyright{} 1991-1996 by    HIROSE, Yuuji [yuuji@@gentei.org]
    8.16 +@author @copyright{} 1991-1996 by    HIROSE, Yuuji [yuuji@@yatex.org]
    8.17  @end titlepage
    8.18  
    8.19  @node Top, What is YaTeX?, (dir), (dir)
    8.20 @@ -292,12 +293,13 @@
    8.21  
    8.22  @menu
    8.23  * Changing typesetter::         
    8.24 +* Splitting input files::       
    8.25  * Static region for typesetting::  
    8.26  * Lpr format::                  
    8.27  * Editing %# notation::         
    8.28  @end menu
    8.29  
    8.30 -@node Changing typesetter, Static region for typesetting, %#notation, %#notation
    8.31 +@node Changing typesetter, Splitting input files, %#notation, %#notation
    8.32  @comment  node-name,  next,  previous,  up
    8.33  @section To change the `latex' command or to split a source text.
    8.34  @cindex typesetter
    8.35 @@ -314,6 +316,7 @@
    8.36  
    8.37  @node Splitting input files, Static region for typesetting, Changing typesetter, %#notation
    8.38  @comment  node-name,  next,  previous,  up
    8.39 +@section Splitting input files
    8.40  
    8.41    And if you split the source text and
    8.42  edit subfile that should be included from main text.
    8.43 @@ -343,13 +346,13 @@
    8.44  @item You can put split texts in sub directory, but not in
    8.45   sub directory of sub directory.
    8.46  @item In the main text, specify the child file name with relative path name
    8.47 - such as \include{chap1/sub}, when you include the file in
    8.48 + such as \include@{chap1/sub@}, when you include the file in
    8.49   a sub-directory.
    8.50  @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex}
    8.51   is in the parent directory(not %#!latex ../main.tex).
    8.52  @end itemize
    8.53  
    8.54 -@node Static region for typesetting, Lpr format, Changing typesetter, %#notation
    8.55 +@node Static region for typesetting, Lpr format, Splitting input files, %#notation
    8.56  @comment  node-name,  next,  previous,  up
    8.57  @section Static region
    8.58  @cindex static region
    8.59 @@ -625,7 +628,7 @@
    8.60  
    8.61  @example
    8.62          \???@{@} (default documentstyle): section
    8.63 -        \section{???}: Hello world.
    8.64 +        \section@{???@}: Hello world.
    8.65  @end example
    8.66  
    8.67  @noindent
    8.68 @@ -652,7 +655,7 @@
    8.69  and move the cursor in the braces.
    8.70  
    8.71    In La@TeX{} command, there are commands which take more than one
    8.72 -arguments such as @code{\addtolength{\topmargin}{8mm}}.  To complete these
    8.73 +arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}.  To complete these
    8.74  commands, invoke section-type completion with universal argument as,
    8.75  @cindex number of argument
    8.76  
    8.77 @@ -844,7 +847,7 @@
    8.78  and you will see
    8.79  
    8.80  @example
    8.81 -        \`{}
    8.82 +        \`@{@}
    8.83  @end example
    8.84  
    8.85  @noindent
    8.86 @@ -852,7 +855,7 @@
    8.87  one more character `o' for example, then
    8.88  
    8.89  @example
    8.90 -        \`{o}
    8.91 +        \`@{o@}
    8.92  @end example
    8.93  
    8.94  @noindent
    8.95 @@ -1817,6 +1820,10 @@
    8.96  If you use AMS-LaTeX, set to @code{t} (@code{nil})
    8.97  @end defvar
    8.98  
    8.99 +@defvar YaTeX-use-LaTeX2e
   8.100 +If you use LaTeX2e, set to @code{t} (@code{nil})
   8.101 +@end defvar
   8.102 +
   8.103  @defvar YaTeX-template-file
   8.104  File name which is automatically inserted at creation
   8.105  (@code{~/work/template.tex})
   8.106 @@ -1917,11 +1924,11 @@
   8.107  functions, where underlined strings are generated by add-in functions.
   8.108  
   8.109  @display
   8.110 -\begin{table}[ht]		(Function name: YaTeX:table)
   8.111 +\begin@{table@}[ht]		(Function name: YaTeX:table)
   8.112               ~~~~
   8.113 -\put(100,200){}		(Function name: YaTeX:put)
   8.114 +\put(100,200)@{@}		(Function name: YaTeX:put)
   8.115      ~~~~~~~~~
   8.116 -\sum_{i=0}^{n}		(Function name: YaTeX:sum)
   8.117 +\sum_@{i=0@}^@{n@}		(Function name: YaTeX:sum)
   8.118      ~~~~~~~~~~
   8.119  @end display
   8.120  
   8.121 @@ -1932,7 +1939,7 @@
   8.122  for section-type commands.
   8.123  
   8.124  @display
   8.125 -\newcommand{\foo}{bar}	(Function name: YaTeX::newcommand)
   8.126 +\newcommand@{\foo@}@{bar@}	(Function name: YaTeX::newcommand)
   8.127              ~~~~  ~~~
   8.128  @end display
   8.129  
   8.130 @@ -1955,7 +1962,7 @@
   8.131  
   8.132  @lisp
   8.133          (defun YaTeX:tabular ()
   8.134 -          "{|c|c|c|}")
   8.135 +          "@{|c|c|c|@}")
   8.136  @end lisp
   8.137  
   8.138  @noindent
   8.139 @@ -1971,7 +1978,7 @@
   8.140  Emacs-Lisp.  The next example reads the tabular format from keyboard.
   8.141  @lisp
   8.142          (defun YaTeX:tabular ()
   8.143 -          (concat "{" (read-string "Rule: ") "}"))
   8.144 +          (concat "@{" (read-string "Rule: ") "@}"))
   8.145  @end lisp
   8.146  
   8.147  @node Defining argument-add-in,  , Defining option-add-in, How the add-in function works
   8.148 @@ -2091,7 +2098,7 @@
   8.149    For example, assume you have the LaTeX command as follows.
   8.150  
   8.151  @example
   8.152 -	\epsinput[t](250,50){hoge.eps}{plain}{Picture of foo}
   8.153 +	\epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@}
   8.154  	         (A)  (B)     (1)      (2)      (3)
   8.155  	(A)Optional parameter to specify the position
   8.156  	   One of t(top), b(bottom), l(left), r(right)
   8.157 @@ -2271,7 +2278,7 @@
   8.158  redistribute this software freely but with NO warranty to anything
   8.159  as a result  of using this  software.   However, any  reports  and
   8.160  suggestions are  welcome as  long as I   feel  interests in   this
   8.161 -software.   My possible  e-mail address is  `yuuji@@gentei.org'.
   8.162 +software.   My possible  e-mail address is  `yuuji@@yatex.org'.
   8.163  (up to May.1999 at least)  And there is mailing list for YaTeX.
   8.164  Although the common language is Japanese, questions in English will be
   8.165  welcome.  To join the ML, send the mail whose subject is `append' to
     9.1 --- a/docs/yatexgen.doc	Thu Jul 15 04:58:26 1999 +0000
     9.2 +++ b/docs/yatexgen.doc	Sun Apr 09 03:37:47 2000 +0000
     9.3 @@ -176,4 +176,4 @@
     9.4  	yatexgen が作るんだから、ろくな関数じゃないことは分かってます:-p。
     9.5  
     9.6  								広瀬雄二
     9.7 -							yuuji@gentei.org
     9.8 +							yuuji@yatex.org
    10.1 --- a/docs/yatexj.tex	Thu Jul 15 04:58:26 1999 +0000
    10.2 +++ b/docs/yatexj.tex	Sun Apr 09 03:37:47 2000 +0000
    10.3 @@ -10,6 +10,7 @@
    10.4  @c ノードいじったら C-l C-u C-n 全部のノード更新 C-l C-u C-e
    10.5  @c メニュー増やしたら C-l C-u C-m 全部のメニュー更新 C-l C-u C-a
    10.6  @c フォーマットするときは C-l C-e C-b
    10.7 +@c Last modified Thu Mar 16 01:04:48 2000 on firestorm
    10.8  @syncodeindex vr cp
    10.9  @end iftex
   10.10  
   10.11 @@ -19,7 +20,7 @@
   10.12  @subtitle Yet Another tex-mode for emacs
   10.13  @title 『野鳥』
   10.14  @subtitle // YaTeX //
   10.15 -@author @copyright{} 1991-1999 by    HIROSE, Yuuji [yuuji@@gentei.org]
   10.16 +@author @copyright{} 1991-1999 by    HIROSE, Yuuji [yuuji@@yatex.org]
   10.17  @end titlepage
   10.18  
   10.19  @node Top, Intro, (dir), (dir)
   10.20 @@ -125,7 +126,7 @@
   10.21  ストの編集を支援します。さらに La@TeX{} コマンドのオンラインヘルプに
   10.22  よりマニュアルを調べる手間を軽減します。
   10.23  
   10.24 -  English manual @xref{Top, , , yatexe,YaTeX English info}
   10.25 +  English manual @xref{Top, , , yatexe,YaTeX English info}.
   10.26  
   10.27  @node Terminology, Main features, Intro, Top
   10.28  @comment  node-name,  next,  previous,  up
   10.29 @@ -434,7 +435,7 @@
   10.30  @item
   10.31  メインファイルからサブディレクトリ内のファイルを include
   10.32  する時には、相対パス指定を用いて、
   10.33 -@code{\include{chap1/sub}}のように記述。
   10.34 +@code{\include@{chap1/sub@}}のように記述。
   10.35  @item
   10.36  メインファイルが一つ上のディレクトリにある場合も、サブファイルには
   10.37  %#!jlatex main.tex のように記述する(../mainではない)。
   10.38 @@ -493,7 +494,7 @@
   10.39  の消し忘れには十分ご注意下さい。
   10.40  @cindex 長いファイルの編集[なかいふあいるのへんしゆう]
   10.41  
   10.42 -@node  Require, lpr format, Fix region for typesetting, %#notation
   10.43 +@c @node  Require, lpr format, Fix region for typesetting, %#notation
   10.44  @comment  node-name,  next,  previous,  up
   10.45  
   10.46  @node lpr format, Editing %# notation, Fix region for typesetting, %#notation
   10.47 @@ -773,7 +774,7 @@
   10.48  @subsection 2個以上の引数をとる section型コマンド
   10.49  @cindex 引数[ひきすう]
   10.50  
   10.51 -  ところで、@samp{\addtolength{\topmargin}{8mm}} などのように、引数を二つ
   10.52 +  ところで、@samp{\addtolength@{\topmargin@}@{8mm@}} などのように、引数を二つ
   10.53  以上取る La@TeX{} コマンドがあります。このようなコマンドの補完入力には、
   10.54  section 型補完呼び出しに引数を付けてください。例えば上の@samp{addtolength} 
   10.55  の例であれば、引数2を指定します。つまり、
   10.56 @@ -959,7 +960,7 @@
   10.57  @end table
   10.58  
   10.59  @noindent 
   10.60 -とすることで、現在開いている環境名で \end{} が補われます。
   10.61 +とすることで、現在開いている環境名で \end@{@} が補われます。
   10.62  
   10.63  @node Accent mark completion, Image completion, end補完, Completion
   10.64  @comment  node-name,  next,  previous,  up
   10.65 @@ -1235,8 +1236,8 @@
   10.66  ない場合はエラーになります。またこれは、領域固定のための @code{%#BEGIN} と 
   10.67  @code{%#END} のペアに対しても同様に動作します。なお、@code{label/ref}や
   10.68  @code{cite/bibitem}対応するものが別ファイルにある時は、ジャンプ先となるファ
   10.69 -イルがオープンされていなければなりません。@xref{%#notation}
   10.70 -メインの .tex ファイルの @code{\include{chap1}} などにカーソルを合わせ、
   10.71 +イルがオープンされていなければなりません。@xref{%#notation}.
   10.72 +メインの .tex ファイルの @code{\include@{chap1@}} などにカーソルを合わせ、
   10.73  @kbd{[prefix] g} を押すと、@file{chap1.tex} にジャンプします。
   10.74  
   10.75  また、
   10.76 @@ -1538,7 +1539,7 @@
   10.77  下のような tabular において、
   10.78  
   10.79  @example
   10.80 -        \begin@{tabular@}{|c|c|c|c|c|c|c|c|}\hline
   10.81 +        \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline
   10.82           氏名&所属&〒&住所&電話&FAX&帰省先&帰省先電話\\ \hline
   10.83           矢上二郎 & 6 & 223 & 横浜市港北区日吉 & xxx-yyy &
   10.84                  zzz-www & トンガ & 9876-54321 \\
   10.85 @@ -2018,6 +2019,10 @@
   10.86  AMS-LaTeX を使用する場合は @code{t} に設定する (@code{nil})
   10.87  @end defvar
   10.88  
   10.89 +@defvar YaTeX-use-LaTeX2e
   10.90 +LaTeX2e を使用する場合は @code{t} に設定する (@code{nil})
   10.91 +@end defvar
   10.92 +
   10.93  @defvar YaTeX-template-file
   10.94  新規ファイル作成時に自動挿入するファイル名 (@code{~/work/template.tex})
   10.95  @end defvar
   10.96 @@ -2113,7 +2118,7 @@
   10.97  ただくと、作者は喜んでサポートに励むことでしょう。
   10.98  
   10.99    苦情、希望、バグ報告、感想等は歓迎いたします。
  10.100 -連絡は yuuji@@gentei.org まで(1999年5月現在)。
  10.101 +連絡は yuuji@@yatex.org まで(1999年8月現在)。
  10.102  継続的に使用してくださる方はメイリングリスト「fj野鳥の会」に
  10.103  是非加入してください。加入方法については本パッケージの @file{docs/qanda}
  10.104  ファイルの「その他」の章を御覧ください。
    11.1 --- a/docs/yatexref.eng	Thu Jul 15 04:58:26 1999 +0000
    11.2 +++ b/docs/yatexref.eng	Sun Apr 09 03:37:47 2000 +0000
    11.3 @@ -155,7 +155,7 @@
    11.4  	*Browse included structure		[prefix] d
    11.5  
    11.6  							    HIROSE Yuuji
    11.7 -							yuuji@gentei.org
    11.8 +							yuuji@yatex.org
    11.9  
   11.10  Local variables:
   11.11  mode: text
    12.1 --- a/help/YATEXHLP.eng	Thu Jul 15 04:58:26 1999 +0000
    12.2 +++ b/help/YATEXHLP.eng	Sun Apr 09 03:37:47 2000 +0000
    12.3 @@ -1,3 +1,10 @@
    12.4 +%%%
    12.5 +%%% YaTeX-LaTeX Help File(c)HIROSE Yuuji [yuuji@yatex.org]
    12.6 +%%% You can translate this file for any device other than YaTeX via
    12.7 +%%% any filter program.  But it is not allowed to remove copyright
    12.8 +%%% notice and any existing dictionary entiries.
    12.9 +%%%
   12.10 +
   12.11  textfloatsep
   12.12  \addtolength{\textfloatsep}{LENGTH}
   12.13  Length between the text and a float at the top or bottom of page
    13.1 --- a/help/YATEXHLP.jp	Thu Jul 15 04:58:26 1999 +0000
    13.2 +++ b/help/YATEXHLP.jp	Sun Apr 09 03:37:47 2000 +0000
    13.3 @@ -1,3 +1,9 @@
    13.4 +%%%
    13.5 +%%% 野鳥-LaTeXヘルプファイル(c)HIROSE Yuuji [yuuji@yatex.org]
    13.6 +%%% 機械的に変換して野鳥以外のデバイスで利用することを許可します。
    13.7 +%%% その際にコピーライト表示と含まれている項目を削除しないでください。
    13.8 +%%%
    13.9 +
   13.10  textfloatsep
   13.11  \addtolength{\textfloatsep}{長さ}
   13.12  ページ先頭のfloatまたは、ページ最下部のfloatとテキストとの間隔。
   13.13 @@ -1344,8 +1350,8 @@
   13.14  Nop.Mさん(asciinet)
   13.15  	異なる環境での設定の不具合等のレポートを数多く頂きました。
   13.16  
   13.17 -jaybirdさん(asciinet)
   13.18 -	英語版のヘルプファイルを作成して頂きました。
   13.19 +jaybirdさん(asciinet, bekkoame)
   13.20 +	ドキュメントの多くを英訳して下さいました。
   13.21  
   13.22  内山滋さん(成蹊大学)
   13.23  	日本語入力モード判定関数のバグを直すパッチ、section-view のバグ
    14.1 --- a/yahtml.el	Thu Jul 15 04:58:26 1999 +0000
    14.2 +++ b/yahtml.el	Sun Apr 09 03:37:47 2000 +0000
    14.3 @@ -1,6 +1,6 @@
    14.4  ;;; -*- Emacs-Lisp -*-
    14.5 -;;; (c ) 1994-1999 by HIROSE Yuuji [yuuji@gentei.org]
    14.6 -;;; Last modified Wed Jul 14 18:01:18 1999 on firestorm
    14.7 +;;; (c ) 1994-2000 by HIROSE Yuuji [yuuji@yatex.org]
    14.8 +;;; Last modified Wed Mar  1 23:28:22 2000 on firestorm
    14.9  ;;; $Id$
   14.10  
   14.11  ;;;[Installation]
   14.12 @@ -175,7 +175,7 @@
   14.13    "*Alist of unix path name vs. URL name of WWW server.
   14.14  Ex.
   14.15  '((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\")
   14.16 -  (\"/usr/home/yuuji/darts/http\" . \"http://darts.comp.ae.keio.ac.jp/~darts\"))")
   14.17 +  (\"/home/yuuji/http\" . \"http://www.gentei.org/~yuuji\"))")
   14.18  (defvar yahtml-directory-index "index.html"
   14.19    "*Directory index file name;
   14.20  Consult your site's WWW administrator.")
   14.21 @@ -194,7 +194,7 @@
   14.22  (defvar yahtml-always-/p nil
   14.23    "*Those who always use <p> with </p> set this to t.")
   14.24  
   14.25 -(defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\)"
   14.26 +(defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\|blockquote\\)"
   14.27    "*Regexp of envs where paragraphed sentences are prefered.")
   14.28  
   14.29  (defvar yahtml-template-file "~/http/template.html"
   14.30 @@ -214,6 +214,16 @@
   14.31  
   14.32  (defvar yahtml-use-css t "*Use stylesheet or not")
   14.33  
   14.34 +(defvar yahtml-image-inspection-bytes 10000 ;256
   14.35 +  "*Number of bytes to inspect the image for geometry information")
   14.36 +(defvar yahtml:img-default-alt-format "%xx%y(%sbytes)"
   14.37 +  "*Default format of img entity's ALT attributes.
   14.38 +%x: width, %y: height, %s: size in bytes, %c: first comment string,
   14.39 +%f: filename")
   14.40 +
   14.41 +(defvar yahtml-use-hilit19 (featurep 'hilit19)
   14.42 +  "*Use hilit19 to fontify buffer or not")
   14.43 +
   14.44  ;;; --- customizable variable ends here ---
   14.45  (defvar yahtml-prefix-map nil)
   14.46  (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
   14.47 @@ -255,6 +265,7 @@
   14.48    (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment)
   14.49    (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline)
   14.50    (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line)
   14.51 +  (define-key yahtml-mode-map "&" 'yahtml-insert-amps)
   14.52    (let ((map yahtml-prefix-map))
   14.53      (YaTeX-define-key "^" 'yahtml-visit-main map)
   14.54      (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map)
   14.55 @@ -310,7 +321,11 @@
   14.56      (YaTeX-define-key ":" 'yahtml-translate-reverse-region map)
   14.57      (YaTeX-define-key "#" 'yahtml-escape-chars-region map)
   14.58      ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map)
   14.59 -    ))
   14.60 +    )
   14.61 +  (let ((keys (where-is-internal 'fill-paragraph global-map)))
   14.62 +    (while keys
   14.63 +      (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph)
   14.64 +      (setq keys (cdr keys)))))
   14.65  
   14.66  (if yahtml-lint-buffer-map nil
   14.67    (setq yahtml-lint-buffer-map (make-keymap))
   14.68 @@ -356,7 +371,7 @@
   14.69      ("address") 
   14.70      ("h1") ("h2") ("h3") ("h4") ("h5") ("h6")
   14.71      ;; ("p") ;This makes indentation screwed up!
   14.72 -    ("style") ("div")
   14.73 +    ("style") ("div") ("object")
   14.74      ))
   14.75  
   14.76  ;(defvar yahtml-itemizing-regexp
   14.77 @@ -373,7 +388,7 @@
   14.78  
   14.79  (defvar yahtml-typeface-table
   14.80    (append
   14.81 -   '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("strike")
   14.82 +   '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("strike") ("s")
   14.83       ("strong") ("var") ("b") ("i") ("tt") ("u") ("big") ("small") ("font")
   14.84       ("sup") ("sub") ("span"))
   14.85     yahtml-env-table)
   14.86 @@ -397,27 +412,41 @@
   14.87  (defvar yahtml-tmp-single-cmd-table nil)
   14.88  (defvar yahtml-last-single-cmd nil)
   14.89  
   14.90 +(defvar yahtml-current-completion-type nil
   14.91 +  "Has current completion type.  This may be used in yahtml addin functions.")
   14.92 +
   14.93  ;(defvar yahtml-struct-name-regexp
   14.94  ;  "\\<\\(h[1-6]\\|[uod]l\\|html\\|body\\|title\\|head\\|table\\|t[rhd]\\|pre\\|a\\|form\\|select\\|center\\|blockquote\\)\\b")
   14.95  (defvar yahtml-struct-name-regexp
   14.96    (concat
   14.97     "\\<\\("
   14.98 -   (mapconcat (function (lambda (x) (car x))) yahtml-typeface-table "\\|")
   14.99 +   ;(mapconcat 'car yahtml-typeface-table "\\|")
  14.100 +   (mapconcat 'car yahtml-env-table "\\|")
  14.101     "\\)\\b")
  14.102    "Regexp of structure beginning.")
  14.103 +
  14.104 +(defvar yahtml-closable-regexp
  14.105 +  (concat
  14.106 +   "\\<\\("
  14.107 +   (mapconcat 'car yahtml-typeface-table "\\|")
  14.108 +   (mapconcat 'car yahtml-env-table "\\|")
  14.109 +   "\\)\\b")
  14.110 +  "Regexp of any closable elemnts.")
  14.111 +  
  14.112 +
  14.113  (or (assoc "p" yahtml-env-table)
  14.114      (setq yahtml-env-table (cons '("p") yahtml-env-table)))
  14.115  
  14.116 -(defun yahtml-dir-default-charset ()
  14.117 +
  14.118 +(defun yahtml-get-user-httpconf-entry (regexp)
  14.119    (cond
  14.120     ((and (eq yahtml-server-type 'apache) ;;check .htaccess
  14.121  	 buffer-file-name)
  14.122      (let ((dir default-directory)
  14.123  	  charset af ext (ldir "")
  14.124 +	  line
  14.125  	  (case-fold-search t)
  14.126  	  (uid (car (cdr (cdr (file-attributes "."))))))
  14.127 -      (setq ext (file-name-nondirectory buffer-file-name)
  14.128 -	    ext (substring ext (string-match "\\.[a-z0-9]+$" ext)))
  14.129        (if (string-match "^[A-Z]:" dir)
  14.130  	  (setq dir (substring dir 2)))	;remove drive letter
  14.131        (while (and dir
  14.132 @@ -429,33 +458,65 @@
  14.133  	      (set-buffer (find-file-noselect af))
  14.134  	      (save-excursion
  14.135  		(goto-char (point-min))
  14.136 -		(if (re-search-forward  ;search the charset for same extension
  14.137 -		     (format "^\\s *AddType.*charset=\\(.*\\)\\%s$" ext)
  14.138 -		     nil t)
  14.139 -		    (progn
  14.140 -		      (setq charset
  14.141 -			    (buffer-substring
  14.142 -			     (match-beginning 1) (match-end 1)))
  14.143 -		      (cond
  14.144 -		       ((string-match "iso-2022-jp" charset)
  14.145 -			(setq charset 2))
  14.146 -		       ((string-match "euc-jp" charset)
  14.147 -			(setq charset 3))
  14.148 -		       ((string-match "shift_jis" charset)
  14.149 -			(setq charset 1))
  14.150 -		       (t (setq charset nil)))
  14.151 -		      (setq dir ""))))
  14.152 +		(if (re-search-forward regexp nil t)
  14.153 +		    (setq line (buffer-substring
  14.154 +				(point-beginning-of-line)
  14.155 +				(point-end-of-line))
  14.156 +			  dir nil)))
  14.157  	      (kill-buffer (current-buffer))))
  14.158 -	(setq ldir dir
  14.159 -	      dir (substring dir 0 (string-match "/$" dir))
  14.160 -	      dir (file-name-directory dir)))
  14.161 -      (if (featurep 'mule)
  14.162 -	  (setq charset (cdr (assq charset YaTeX-kanji-code-alist))))
  14.163 -      charset
  14.164 +	(if dir
  14.165 +	    (setq ldir dir
  14.166 +		  dir (substring dir 0 (string-match "/$" dir))
  14.167 +		  dir (file-name-directory dir))))
  14.168 +      line
  14.169        ))
  14.170     (t nil))
  14.171    )
  14.172  
  14.173 +(defun yahtml-dir-default-charset ()
  14.174 +  (let*((fn (file-name-nondirectory (or buffer-file-name "")))
  14.175 +	(ext (substring fn (or (string-match "\\.[a-z0-9]+$" fn) 0)))
  14.176 +	(ptn (format "^\\s *AddType.*charset=\\(.*\\)\\%s$" ext))
  14.177 +	line
  14.178 +	charset)
  14.179 +    (if (setq line (yahtml-get-user-httpconf-entry ptn))
  14.180 +	(progn
  14.181 +	  (string-match ptn line)
  14.182 +	  (setq charset
  14.183 +		(substring line (match-beginning 1) (match-end 1)))
  14.184 +	  (cond
  14.185 +	   ((string-match "iso-2022-jp" charset)
  14.186 +	    (setq charset 2))
  14.187 +	   ((string-match "euc-jp" charset)
  14.188 +	    (setq charset 3))
  14.189 +	   ((string-match "shift_jis" charset)
  14.190 +	    (setq charset 1))
  14.191 +	   (t (setq charset nil)))
  14.192 +	  (setq dir "")))
  14.193 +    (if (featurep 'mule)
  14.194 +	(setq charset (cdr (assq charset YaTeX-kanji-code-alist))))
  14.195 +    charset))
  14.196 +
  14.197 +(defun yahtml-get-directory-index ()
  14.198 +  (let ((line (yahtml-get-user-httpconf-entry "^\\s *DirectoryIndex"))
  14.199 +	x index-list)
  14.200 +    ;;s/\\s *$//;
  14.201 +    (if line
  14.202 +	(progn
  14.203 +	  (if (string-match "DirectoryIndex\\s +\\(.*\\)\\s *$" line)
  14.204 +	      (setq line (substring line (match-beginning 1) (match-end 1))))
  14.205 +	  (while (string< "" line)
  14.206 +	    (if (setq x (string-match "\\(\\s +\\)" line))
  14.207 +		(setq index-list (cons (substring line 0 x) index-list)
  14.208 +		      line (substring line (match-end 1)))
  14.209 +	      (setq index-list (cons line index-list)
  14.210 +		    line ""))
  14.211 +	    )
  14.212 +	  (or (nreverse index-list)
  14.213 +	      (if (listp yahtml-directory-index)
  14.214 +		  yahtml-directory-index
  14.215 +		(list yahtml-directory-index)))))))
  14.216 +
  14.217  (defun yahtml-mode ()
  14.218    (interactive)
  14.219    (let ((coding (or (yahtml-dir-default-charset) yahtml-kanji-code)))
  14.220 @@ -479,7 +540,7 @@
  14.221     '((YaTeX-ec . "")
  14.222       (YaTeX-struct-begin . "<%1%2")
  14.223       (YaTeX-struct-end . "</%1>")
  14.224 -     (YaTeX-struct-name-regexp . yahtml-struct-name-regexp)
  14.225 +     (YaTeX-struct-name-regexp . yahtml-closable-regexp)
  14.226       (YaTeX-comment-prefix . "<!--")
  14.227       (YaTeX-coding-system . yahtml-kanji-code) ;necessary?
  14.228       (YaTeX-typesetting-mode-map . yahtml-lint-buffer-map)
  14.229 @@ -607,10 +668,6 @@
  14.230        )))
  14.231    (define-key yahtml-mode-map [menu-bar yahtml]
  14.232      (cons "yahtml" yahtml-menu-map))
  14.233 -  (let ((keys (where-is-internal 'fill-paragraph global-map)))
  14.234 -    (while keys
  14.235 -      (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph)
  14.236 -      (setq keys (cdr keys))))
  14.237    (YaTeX-define-menu
  14.238     'yahtml-menu-map
  14.239     (nreverse
  14.240 @@ -640,6 +697,7 @@
  14.241  (defun yahtml-insert-begend (&optional region env)
  14.242    "Insert <cmd> ... </cmd>."
  14.243    (interactive "P")
  14.244 +  (setq yahtml-current-completion-type 'multiline)
  14.245    (let*((completion-ignore-case t)
  14.246  	(cmd
  14.247  	 (or env
  14.248 @@ -685,6 +743,7 @@
  14.249  (defun yahtml-insert-form (&optional form)
  14.250    "Insert <FORM option=\"argument\">."
  14.251     (interactive)
  14.252 +   (setq yahtml-current-completion-type 'single)
  14.253     (or form
  14.254         (let ((completion-ignore-case t))
  14.255  	 (setq form
  14.256 @@ -707,9 +766,11 @@
  14.257    "Check add-in function's existence and call it if exists."
  14.258     (let ((addin (concat "yahtml:" (downcase form))) s a)
  14.259       (concat
  14.260 -      (if (setq a (assoc form yahtml-css-class-alist))
  14.261 -	  (yahtml-make-optional-argument ;should be made generic?
  14.262 -	   "class" (completing-read "class: " (cdr a))))
  14.263 +      (and (setq a (yahtml-css-get-element-completion-alist form))
  14.264 +	   (not (equal last-command-char ?\C-j))
  14.265 +	   (memq yahtml-current-completion-type '(multiline inline))
  14.266 +	   (yahtml-make-optional-argument ;should be made generic?
  14.267 +	    "class" (completing-read "class: " a)))
  14.268        (if (and (intern-soft addin) (fboundp (intern-soft addin))
  14.269  	       (stringp (setq s (funcall (intern addin))))
  14.270  	       (string< "" s))
  14.271 @@ -907,11 +968,15 @@
  14.272  
  14.273  (defvar yahtml-parameters-completion-alist
  14.274    '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center"))
  14.275 +    ("clear" ("left") ("right") ("center") ("all") ("none"))
  14.276      ("src" . file)
  14.277 +    ("background" . file)
  14.278 +    ("class file name" . file) ("data" . file)
  14.279      ("method" ("POST") ("GET"))
  14.280      ("rev" . yahtml-link-types-alist)
  14.281      ("rel" . yahtml-link-types-alist)
  14.282 -    ("type" . yahtml-content-types-alist)))
  14.283 +    ("type" . yahtml-content-types-alist)
  14.284 +    ("codetype" . yahtml-content-types-alist)))
  14.285  
  14.286  (defvar yahtml-link-types-alist 
  14.287    '(("alternate") ("stylesheet") ("start") ("next") ("prev")
  14.288 @@ -922,7 +987,8 @@
  14.289    '(("text/css") ("text/html") ("text/plain") ("text/richtext")
  14.290      ("text/sgml") ("text/xml")
  14.291      ("application/octet-stream") ("application/postscript") ("application/pdf")
  14.292 -    ("image/jpeg") ("image/gif") ("image/tiff") ("video/mpeg"))
  14.293 +    ("application/java")
  14.294 +    ("image/jpeg") ("image/gif") ("image/tiff") ("image/png") ("video/mpeg"))
  14.295    "Alist of content-types")
  14.296  
  14.297  (defun yahtml-read-parameter (par &optional default alist)
  14.298 @@ -934,7 +1000,7 @@
  14.299      (cond
  14.300       ((eq alist 'file)
  14.301        (read-file-name prompt "" default nil ""))
  14.302 -     ((symbolp alist)
  14.303 +     ((and alist (symbolp alist))
  14.304        (completing-read prompt (symbol-value alist) nil nil default))
  14.305       (alist
  14.306        (completing-read prompt alist nil nil default))
  14.307 @@ -952,28 +1018,161 @@
  14.308  (defun yahtml:body ()
  14.309    "Add-in function for <body>"
  14.310    (let ((b (read-string "bgcolor="))
  14.311 +	(bg (yahtml-read-parameter "background" ""))
  14.312  	(x (read-string "text color="))
  14.313  	(l (read-string "link color="))
  14.314  	(v (read-string "vlink color=")))
  14.315      (concat
  14.316       (yahtml-make-optional-argument "bgcolor" b)
  14.317 +     (yahtml-make-optional-argument "background" bg)
  14.318       (yahtml-make-optional-argument "text" x)
  14.319       (yahtml-make-optional-argument "link" l)
  14.320       (yahtml-make-optional-argument "vlink" v))))
  14.321  
  14.322 -
  14.323  (defun yahtml:img ()
  14.324    "Add-in function for <img>"
  14.325    (let ((src (yahtml-read-parameter "src"))
  14.326  	(alg (yahtml-read-parameter "align"))
  14.327 -	(alt (yahtml-read-parameter "alt"))
  14.328 +	alt
  14.329  	(brd (read-string "border="))
  14.330 -	(l yahtml-prefer-upcase-attributes))
  14.331 +	(l yahtml-prefer-upcase-attributes)
  14.332 +	info width height bytes comments)
  14.333 +    (and (stringp src) (string< "" src) (file-exists-p src)
  14.334 +	 (setq info (yahtml-get-image-info src))
  14.335 +	 (car info)
  14.336 +	 (setq width (int-to-string (car info))
  14.337 +	       height (int-to-string (car (cdr info)))
  14.338 +	       bytes (car (cdr (cdr info)))
  14.339 +	       comments (nth 4 info)))
  14.340 +    (if info
  14.341 +	(setq alt
  14.342 +	      (YaTeX-replace-formats
  14.343 +	       yahtml:img-default-alt-format
  14.344 +	       (list (cons "x" width)
  14.345 +		     (cons "y" height)
  14.346 +		     (cons "s" (int-to-string bytes))
  14.347 +		     (cons "f" (file-name-nondirectory src))
  14.348 +		     (cons "c" (car comments))))))
  14.349 +	 
  14.350 +    (setq alt (yahtml-read-parameter "alt" alt))
  14.351 +    (setq width (yahtml-read-parameter "width" width)
  14.352 +	  height (yahtml-read-parameter "height" height))
  14.353      (concat (if l "SRC" "src") "=\"" src "\""
  14.354  	    (yahtml-make-optional-argument "align" alg)
  14.355  	    (yahtml-make-optional-argument "alt" alt)
  14.356 +	    (yahtml-make-optional-argument "width" width)
  14.357 +	    (yahtml-make-optional-argument "height" height)
  14.358  	    (yahtml-make-optional-argument "border" brd))))
  14.359  
  14.360 +(defun yahtml-file-truename (file)
  14.361 +  (cond
  14.362 +   ((fboundp 'file-truename) (file-truename (expand-file-name file)))
  14.363 +   (t (let ((new file))
  14.364 +	(while (and (stringp (setq new (nth 0 (file-attributes file))))
  14.365 +		    (not (equal new file)))
  14.366 +	  (setq file new))
  14.367 +	file))))
  14.368 +
  14.369 +(defun yahtml-hex-value (point length &optional little-endian)
  14.370 +  "Return the hex value the POINT positions LENGTH byte stream represents.
  14.371 +Optional third argument LITTLE-ENDIAN is self extplanatory."
  14.372 +  (setq point (1+ point)) ;translate file offset to Emacs's point value
  14.373 +  (let ((mlt 1)
  14.374 +	(pos (if little-endian point (+ point length -1)))
  14.375 +	(direc (if little-endian 1 -1))
  14.376 +	(value 0))
  14.377 +    (while (> length 0)
  14.378 +      (setq value (+ value (* mlt (char-after pos)))
  14.379 +	    pos (+ pos direc)
  14.380 +	    mlt (* mlt 256)
  14.381 +	    length (1- length)))
  14.382 +    value))
  14.383 +
  14.384 +(defun yahtml-get-image-info (file)
  14.385 +  "Return the information on the image file FILE.
  14.386 +Returns list of '(WIDTH HEIGHT BYTES DEPTH COMMENTLIST)."
  14.387 +  (save-excursion
  14.388 +    (let*((tmpbuf (get-buffer-create " *imgheader*"))
  14.389 +	  width height bytes depth comment
  14.390 +	  (file-coding-system-alist (list (cons "." 'no-conversion))) ;20
  14.391 +	  (file-coding-system-for-read (and (boundp '*noconv*) *noconv*)) ;19
  14.392 +	  (seekpoint 1)
  14.393 +	  c1 c2 c3 c4 beg end
  14.394 +	  (case-fold-search nil))
  14.395 +      (setq bytes (nth 7 (file-attributes (yahtml-file-truename file))))
  14.396 +      (set-buffer tmpbuf)
  14.397 +      (if (boundp 'mc-flag) (set (make-local-variable 'mc-flag) nil))
  14.398 +      (erase-buffer)
  14.399 +      (if (fboundp 'set-buffer-multibyte) (set-buffer-multibyte nil))
  14.400 +      (unwind-protect
  14.401 +	  (progn
  14.402 +	    (message "Inspecting image information of %s..." file)
  14.403 +	    ;; Read 4bytes-more than inspection-bytes in case that
  14.404 +	    ;; JPEG marker delimiter (4bytes) is on the alignment.
  14.405 +	    (YaTeX-insert-file-contents
  14.406 +	     file nil 0 (+ yahtml-image-inspection-bytes 4))
  14.407 +	    (goto-char (point-min))	;assertion
  14.408 +	    (setq c1 (char-after 1)	;cache first 4 bytes
  14.409 +		  c2 (char-after 2)
  14.410 +		  c3 (char-after 3)
  14.411 +		  c4 (char-after 4))
  14.412 +	    (cond
  14.413 +	     ((and (eq c1 255) (eq c2 216)) ; 0xff 0xd8
  14.414 +	      ;;JPEG images need JPEG markers inspection
  14.415 +	      ;;JPEG markers consist of [ 0xff ID(B) LEN(S) CONTENTS... ]
  14.416 +	      ;; Warning: here seekpoint is measured by Emacs's point value
  14.417 +	      ;; while yahtml-hex-vale requires file offset
  14.418 +	      (setq seekpoint 3) ;where the first JPEG marker exists
  14.419 +	      (catch 'exit
  14.420 +		(while (< seekpoint (- (buffer-size) 4))
  14.421 +		  (cond
  14.422 +		   ((not (eq (char-after seekpoint) 255))
  14.423 +		    ;maybe corrupted, exit from loop
  14.424 +		    (throw 'exit t))
  14.425 +		   ((memq (char-after (1+ seekpoint))
  14.426 +			  '(192 193 194 195 197 198 199 201 202 203 205 206 207))
  14.427 +		    ;;found!
  14.428 +		    (setq height (yahtml-hex-value (+ seekpoint 4) 2)
  14.429 +			  width  (yahtml-hex-value (+ seekpoint 6) 2)
  14.430 +			  depth  (yahtml-hex-value (+ seekpoint 3) 1)))
  14.431 +		   ((eq (char-after (1+ seekpoint)) 254) ;0xFE = comment
  14.432 +		    ;; JPEG comment area
  14.433 +		    (setq beg (+ seekpoint 2 2)
  14.434 +			  end (+ seekpoint
  14.435 +				 (yahtml-hex-value (1+ seekpoint) 2) 2))
  14.436 +		    (setq comment (cons (buffer-substring beg end) comment)))
  14.437 +		   (t ;other markers
  14.438 +		    nil))			;just skip it
  14.439 +		  (setq seekpoint (+ seekpoint 2)
  14.440 +			seekpoint (+ seekpoint
  14.441 +				     (yahtml-hex-value (1- seekpoint) 2))))))
  14.442 +	     ((and (eq c1 137) ;0x89
  14.443 +		   (eq c2 ?P) (eq c3 ?N) (eq c4 ?G))
  14.444 +	      ;;PNG Image data X=@0x10(L), Y=@0x14(L), D=@0x18(B)
  14.445 +	      (setq width  (yahtml-hex-value 16 4)
  14.446 +		    height (yahtml-hex-value 20 4)
  14.447 +		    depth  (yahtml-hex-value 24 1)))
  14.448 +	     ((looking-at "GIF8")
  14.449 +	      ;;GIF Image data X=@0x6(leshort), Y=@0x8(leshort)
  14.450 +	      (setq width (yahtml-hex-value 6 2 t)
  14.451 +		    height (yahtml-hex-value 8 2 t)))
  14.452 +	     ((looking-at "BM")
  14.453 +	      ;;# OS/2, Windoze BMP files
  14.454 +	      ;;@0x0e = 12 -> OS/2 1.x - X=@0x12(leshort), Y=@0x14(leshort)
  14.455 +	      ;;@0x0e = 64 -> OS/2 2.x - X=@0x12(leshort), Y=@0x14(leshort)
  14.456 +	      ;;@0x0e = 40 -> Windows 3.x - X=@0x12(lelong), Y=@0x16(lelong)
  14.457 +	      (cond
  14.458 +	       ((eq (yahtml-hex-value 14 2 t) 40)
  14.459 +		(setq width (yahtml-hex-value 18 4 t)
  14.460 +		      height (yahtml-hex-value 22 4 t)))
  14.461 +	       (t
  14.462 +		(setq width (yahtml-hex-value 18 2 t)
  14.463 +		      height (yahtml-hex-value 20 2 t)))))
  14.464 +	     ))
  14.465 +	(message "")
  14.466 +	(kill-buffer tmpbuf))
  14.467 +      (list width height bytes depth (nreverse comment)))))
  14.468 +
  14.469  (defun yahtml:form ()
  14.470    "Add-in function `form' input format"
  14.471    (concat
  14.472 @@ -1101,10 +1300,38 @@
  14.473       (t ;;??
  14.474        ))))
  14.475  
  14.476 +(defun yahtml:br ()
  14.477 +  (yahtml-make-optional-argument "clear" (yahtml-read-parameter "clear")))
  14.478 +
  14.479 +(defun yahtml:object ()
  14.480 +  (let ((codetype (yahtml-read-parameter "codetype" "application/java"))
  14.481 +	data classid)
  14.482 +    (cond
  14.483 +     ((string-match "java" codetype)
  14.484 +      (let ((completion-ignored-extensions
  14.485 +	     ;;any extensions except ".class"
  14.486 +	     '(".java" ".html" ".htm" ".gif" ".jpg" ".jpeg" ".png")))
  14.487 +	(setq classid (concat "java:"
  14.488 +			      (yahtml-read-parameter "class file name"))))
  14.489 +      (concat
  14.490 +       (yahtml-make-optional-argument "codetype" codetype)
  14.491 +       (yahtml-make-optional-argument "classid" classid)
  14.492 +       (yahtml-make-optional-argument
  14.493 +	"width" (yahtml-read-parameter "width"))
  14.494 +       (yahtml-make-optional-argument
  14.495 +	"height" (yahtml-read-parameter "height"))
  14.496 +       (yahtml-make-optional-argument
  14.497 +	"align" (yahtml-read-parameter "align"))
  14.498 +       ))
  14.499 +     (t
  14.500 +      ""
  14.501 +      ))))
  14.502 +
  14.503  ;;; ---------- Simple tag ----------
  14.504  (defun yahtml-insert-tag (region-mode &optional tag)
  14.505    "Insert <TAG> </TAG> and put cursor inside of them."
  14.506    (interactive "P")
  14.507 +  (setq yahtml-current-completion-type 'inline)
  14.508    (or tag
  14.509        (let ((completion-ignore-case t))
  14.510  	(setq tag
  14.511 @@ -1160,6 +1387,29 @@
  14.512        (yahtml-insert-single "/p"))	;in the last-completion variable
  14.513      (yahtml-insert-single "p")))
  14.514  
  14.515 +(defun yahtml-insert-amps (arg)
  14.516 +  "Insert char-entity references via ampersand"
  14.517 +  ;; Thanks; http://www.tsc.co.jp/~asada/html/wdg40_f/entities/
  14.518 +  (interactive "P")
  14.519 +  (let*((mess "") c
  14.520 +	(list (append yahtml-entity-reference-chars-alist-default
  14.521 +		      yahtml-entity-reference-chars-alist))
  14.522 +	(l list))
  14.523 +    (while l
  14.524 +      (setq mess (format "%s %c" mess (car (car l)) (cdr (car l)))
  14.525 +	    l (cdr l)))
  14.526 +    (message "Char-entity reference:  %s  SPC=& RET=&; Other=&#..;" mess)
  14.527 +    (setq c (read-char))
  14.528 +    (cond
  14.529 +     ((equal c (car-safe (assoc c list)))
  14.530 +	(insert (format "&%s;" (cdr (assoc c list)))))
  14.531 +     ((or (equal c ?\n) (equal c ?\r))
  14.532 +      (insert "&;")
  14.533 +      (forward-char -1))
  14.534 +     ((equal c ? )
  14.535 +      (insert ?&))
  14.536 +     (t (insert (format "&#%d;" c))))))
  14.537 +
  14.538  ;;; ---------- Jump ----------
  14.539  (defun yahtml-on-href-p ()
  14.540    "Check if point is on href clause."
  14.541 @@ -1254,7 +1504,14 @@
  14.542  	    (if (string< "" file)
  14.543  		(progn
  14.544  		  (if (string-match "/$" file)
  14.545 -		      (setq file (concat file yahtml-directory-index)))
  14.546 +		      (or (catch 'dirindex
  14.547 +			    (mapcar
  14.548 +			     (lambda (f)
  14.549 +			       (if (file-exists-p (concat file f))
  14.550 +				   (throw 'dirindex
  14.551 +					  (setq file (concat file f)))))
  14.552 +			     (yahtml-get-directory-index)))
  14.553 +			  (setq file (concat file yahtml-directory-index))))
  14.554  		  (if (string-match "^/" file)
  14.555  		      (setq file (yahtml-url-to-path file)))
  14.556  		  (if other (YaTeX-switch-to-buffer-other-window file)
  14.557 @@ -1279,7 +1536,9 @@
  14.558        (if (equal (char-after (point)) ?<) (forward-char 1))
  14.559        (if (and (re-search-backward "<" nil t)
  14.560  	       (looking-at
  14.561 -		(concat "<\\(/?" yahtml-struct-name-regexp "\\)\\b"))
  14.562 +		;(concat "<\\(/?" yahtml-struct-name-regexp "\\)\\b")
  14.563 +		"<\\(/?[A-Z][A-Z0-9]*\\)\\b"
  14.564 +		)
  14.565  	       (condition-case nil
  14.566  		   (forward-list 1)
  14.567  		 (error nil))
  14.568 @@ -1396,7 +1655,7 @@
  14.569  	(unwind-protect
  14.570  	    (progn
  14.571  	      (set-buffer (get-buffer-create b))
  14.572 -	      (insert-file-contents s nil 0 100)
  14.573 +	      (YaTeX-insert-file-contents s nil 0 100)
  14.574  	      (if (looking-at "#!")
  14.575  		  (if other (YaTeX-switch-to-buffer-other-window s)
  14.576  		    (YaTeX-switch-to-buffer s))))
  14.577 @@ -1488,7 +1747,7 @@
  14.578    (let ((p (point)))
  14.579      (save-excursion
  14.580        (put 'yahtml-on-assignment-p 'region nil)
  14.581 -      (skip-chars-backward "^ \t")
  14.582 +      (skip-chars-backward "^ \t\n")
  14.583        (and (looking-at "\\([A-Za-z0-9]+\\)\\s *=\\s *\"?\\([^ \t\"]+\\)\"?")
  14.584  	   (< p (match-end 0))
  14.585  	   (>= p (1- (match-beginning 2)))
  14.586 @@ -1542,9 +1801,9 @@
  14.587  	      (insert href))))
  14.588         ((setq attr (yahtml-on-assignment-p)) ;if on the assignment to attr
  14.589  	(if (and (equal attr "class")	     ;treat "class" attribute specially
  14.590 -		 (setq css (assoc tag yahtml-css-class-alist)))
  14.591 +		 (setq css (yahtml-css-get-element-completion-alist tag)))
  14.592  	    (setq new (yahtml-read-parameter ;should be made generic?
  14.593 -		       attr nil (list (cons "class" (cdr css)))))
  14.594 +		       attr nil (list (cons "class" css))))
  14.595  	  ;;other than "class", read parameter normally
  14.596  	  (setq new (yahtml-read-parameter attr)))
  14.597  	(goto-char (car (get 'yahtml-on-assignment-p 'region)))
  14.598 @@ -1853,17 +2112,19 @@
  14.599    (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|font")
  14.600  	(itemizing-envs "^\\([uod]l\\|menu\\|dir\\)$")
  14.601  	(itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b")
  14.602 +	(excludes
  14.603 +	 "\\(a\\|p\\|span\\|tt\\|em\\|u\\|i\\|big\\|small\\|font\\)\\b")
  14.604  	inenv p col peol (case-fold-search t))
  14.605      (save-excursion
  14.606        (beginning-of-line)
  14.607 -      (setq inenv (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t)
  14.608 +      (setq inenv (or (yahtml-inner-environment-but excludes  t)
  14.609  		      "html")
  14.610  	    col (get 'YaTeX-inner-environment 'indent)
  14.611  	    p (get 'YaTeX-inner-environment 'point)
  14.612  	    op nil))
  14.613      (save-excursion
  14.614        (cond
  14.615 -       ((string-match envs inenv)
  14.616 +       ((string-match (concat "^\\(" envs "\\)") inenv)
  14.617  	(save-excursion
  14.618  	  (beginning-of-line)
  14.619  	  (skip-chars-forward " \t")
  14.620 @@ -1899,7 +2160,7 @@
  14.621    (interactive)
  14.622    (YaTeX-reindent (yahtml-this-indent))
  14.623    (if (bolp) (skip-chars-forward " \t"))
  14.624 -  (let (peol col)
  14.625 +  (let (peol col inenv)
  14.626      (if (and (setq inenv (yahtml-on-begend-p))
  14.627  	     (string-match
  14.628  	      (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv))
  14.629 @@ -2102,6 +2363,22 @@
  14.630    (insert "<" (if yahtml-prefer-upcases "OPTION" "option") "> ")
  14.631    (yahtml-indent-line))
  14.632  
  14.633 +(defun yahtml-intelligent-newline-style ()
  14.634 +  (interactive)
  14.635 +  (if (save-excursion
  14.636 +	(and
  14.637 +	 (re-search-backward "<style\\|<!-- " nil t)
  14.638 +	 (looking-at "<style")))
  14.639 +      (let (c)
  14.640 +	(yahtml-indent-line)
  14.641 +	(setq c (current-column))
  14.642 +	(insert "<!--\n")
  14.643 +	(YaTeX-reindent c)
  14.644 +	(insert "-->")
  14.645 +	(beginning-of-line)
  14.646 +	(open-line 1)
  14.647 +	(YaTeX-reindent c))))
  14.648 +
  14.649  ;;; ---------- Marking ----------
  14.650  (defun yahtml-mark-begend ()
  14.651    "Mark current tag"
  14.652 @@ -2161,45 +2438,43 @@
  14.653    "Alist of elements vs. their classes")
  14.654  
  14.655  (defun yahtml-css-collect-classes-region (beg end &optional initial)
  14.656 -  (save-restriction
  14.657 -    (save-excursion
  14.658 +  (save-excursion
  14.659 +    (save-restriction
  14.660        (narrow-to-region beg end)
  14.661        (goto-char (point-min))
  14.662 -      (let ((alist initial) b e element class a
  14.663 -	    (s1 (aref (syntax-table) ?\{ ))
  14.664 -	    (s2 (aref (syntax-table) ?\} )))
  14.665 -	;(modify-syntax-entry ?{ "(}")
  14.666 -        ;(modify-syntax-entry ?} "){")
  14.667 +      (let ((alist initial) b e element class a)
  14.668  	(setq b (point))
  14.669 -	(unwind-protect
  14.670 -	    (while (search-forward "{" nil t)
  14.671 -	      (setq e (point))
  14.672 -	      (goto-char b)
  14.673 -	      (while (re-search-forward		;ちょといい加減なREGEXP
  14.674 -		      "\\([a-z][a-z0-9]*\\)\\.\\([a-z][a-z0-9]*\\)\\>" e t)
  14.675 -		(setq element (YaTeX-match-string 1)
  14.676 -		      class (YaTeX-match-string 2))
  14.677 -		(if (setq a (assoc element alist))
  14.678 -		    (or (assoc class (cdr a))
  14.679 -			(setcdr a (cons (list class) (cdr a))))
  14.680 -		  (setq alist (cons (list element (list class)) alist))))
  14.681 -	      (goto-char (1- e))
  14.682 -	      ;(forward-list 1)
  14.683 -	      (search-forward "}" nil t)
  14.684 -	      (setq b (point)))
  14.685 -	  (aset (syntax-table) ?\{ s1)
  14.686 -	  (aset (syntax-table) ?} s2))
  14.687 -      alist))))
  14.688 +	(while (search-forward "{" nil t)
  14.689 +	  (setq e (point))
  14.690 +	  (goto-char b)
  14.691 +	  (while (re-search-forward	;ちょといい加減なREGEXP
  14.692 +		  "\\([a-z][a-z0-9]*\\)?\\.\\([a-z][a-z0-9]*\\)\\>" e t)
  14.693 +	    (setq element (YaTeX-match-string 1)
  14.694 +		  class (YaTeX-match-string 2))
  14.695 +	    ;;if starts with period (match-string 1 is nil),
  14.696 +	    ;;this is global class
  14.697 +	    (setq element (or element "global"))
  14.698 +	    (if (setq a (assoc element alist))
  14.699 +		(or (assoc class (cdr a))
  14.700 +		    (setcdr a (cons (list class) (cdr a))))
  14.701 +	      (setq alist (cons (list element (list class)) alist))))
  14.702 +	  (goto-char (1- e))
  14.703 +	  (search-forward "}" nil t)
  14.704 +	  (setq b (point)))
  14.705 +	alist))))
  14.706  	    
  14.707  (defun yahtml-css-collect-classes-buffer (&optional initial)
  14.708    (interactive)
  14.709    (yahtml-css-collect-classes-region (point-min) (point-max) initial))
  14.710  
  14.711  (defun yahtml-css-collect-classes-file (file &optional initial)
  14.712 -  (let ((hilit-auto-highlight nil) (cb (current-buffer)))
  14.713 -    (set-buffer (find-file-noselect file))
  14.714 +  (let*((hilit-auto-highlight nil)
  14.715 +	(openedp (get-file-buffer file))
  14.716 +	(cb (current-buffer))
  14.717 +	(buf (set-buffer (find-file-noselect file))))
  14.718      (prog1
  14.719  	(yahtml-css-collect-classes-buffer initial)
  14.720 +      (or openedp (kill-buffer buf))
  14.721        (set-buffer cb))))
  14.722  
  14.723  (defun yahtml-css-scan-styles ()
  14.724 @@ -2226,6 +2501,12 @@
  14.725  		   (yahtml-url-to-path href) alist))))
  14.726  	(setq yahtml-css-class-alist alist)))))
  14.727  
  14.728 +(defun yahtml-css-get-element-completion-alist (element)
  14.729 +  (let ((alist (cdr-safe (assoc element yahtml-css-class-alist)))
  14.730 +	(global (cdr-safe (assoc "global" yahtml-css-class-alist))))
  14.731 +    (and (or alist global)
  14.732 +	 (append alist global))))
  14.733 +
  14.734  ;;; ---------- ----------
  14.735  
  14.736  ;;;
  14.737 @@ -2237,6 +2518,7 @@
  14.738      ))
  14.739  (defvar yahtml-hilit-patterns-alist
  14.740    '(
  14.741 +    'case-fold
  14.742      ;; comments
  14.743      ("<!--\\s " "-->" comment)
  14.744      ;; include&exec
  14.745 @@ -2267,7 +2549,7 @@
  14.746  	(cons m0 (1+ (point) )))))
  14.747  
  14.748  ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist))
  14.749 -(and (featurep 'hilit19)
  14.750 +(and yahtml-use-hilit19
  14.751       (or (assq 'yahtml-mode hilit-patterns-alist)
  14.752  	 (setq hilit-patterns-alist
  14.753  	       (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist)
    15.1 --- a/yatex.el	Thu Jul 15 04:58:26 1999 +0000
    15.2 +++ b/yatex.el	Sun Apr 09 03:37:47 2000 +0000
    15.3 @@ -1,8 +1,8 @@
    15.4  ;;; -*- Emacs-Lisp -*-
    15.5  ;;; Yet Another tex-mode for emacs - //野鳥//
    15.6 -;;; yatex.el rev. 1.67
    15.7 -;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    15.8 -;;; Last modified Tue Jul 13 14:20:45 1999 on firestorm
    15.9 +;;; yatex.el rev. 1.68
   15.10 +;;; (c )1991-2000 by HIROSE Yuuji.[yuuji@yatex.org]
   15.11 +;;; Last modified Sun Apr  9 12:35:15 2000 on firestorm
   15.12  ;;; $Id$
   15.13  ;;; The latest version of this software is always available at;
   15.14  ;;; http://www.yatex.org/
   15.15 @@ -24,7 +24,7 @@
   15.16  
   15.17  (require 'comment)
   15.18  (require 'yatexlib)
   15.19 -(defconst YaTeX-revision-number "1.67"
   15.20 +(defconst YaTeX-revision-number "1.6*"
   15.21    "Revision number of running yatex.el")
   15.22  
   15.23  ;---------- Local variables ----------
   15.24 @@ -130,6 +130,9 @@
   15.25  tにする(古いNTT-jTeXで顕著に現れる)。具体的には、fillするときに各行の終わりに
   15.26  %を付加する。")
   15.27  
   15.28 +(defvar YaTeX-use-LaTeX2e t "*Use LaTeX2e or not.  Nil meas latex 2.09")
   15.29 +
   15.30 +
   15.31  (defvar YaTeX-item-regexp
   15.32    (concat (regexp-quote "\\") "\\(sub\\|bib\\)*item")
   15.33    "*Regular expression of item command.")
   15.34 @@ -142,6 +145,7 @@
   15.35    (concat "^[ \t]*%\\|^[ \t]*$\\|\\'\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\("
   15.36  	  YaTeX-sectioning-regexp		;sectioning commands
   15.37  	  "\\|[A-z]*item\\|begin{\\|end{"	;special declaration
   15.38 +	  "\\|\\[\\|\\]"
   15.39  	  "\\|newpage\\b\\|vspace\\b"
   15.40  	  "\\)")
   15.41    "*Paragraph starting regexp of common LaTeX source.  Use this value
   15.42 @@ -201,6 +205,10 @@
   15.43  (defvar yatex-mode-hook nil
   15.44    "*List of functions to be called at the end of yatex-mode initializations.")
   15.45  
   15.46 +(defvar YaTeX-search-file-from-top-directory t
   15.47 +  "*Non-nil means to search input-files from the directory where main file
   15.48 +exists.")
   15.49 +
   15.50  ;;-- Math mode values --
   15.51  
   15.52  (defvar YaTeX-math-key-list-default
   15.53 @@ -228,26 +236,39 @@
   15.54  ;------------ Completion table ------------
   15.55  ; Set tex-section-like command possible completion
   15.56  (defvar section-table
   15.57 -  '(("part") ("chapter") ("section") ("subsection")
   15.58 -    ("subsubsection") ("paragraph") ("subparagraph")
   15.59 -    ("author") ("thanks") ("documentstyle") ("documentclass") ("pagestyle")
   15.60 -    ("title") ("underline") ("label") ("makebox")
   15.61 -    ("footnote") ("footnotetext")
   15.62 -    ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite")
   15.63 -    ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption")
   15.64 -    ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2)
   15.65 -    ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2)
   15.66 -    ("newcommand" 2) ("renewcommand" 2)
   15.67 -    ("setcounter" 2) ("newenvironment" 3) ("newtheorem" 2)
   15.68 -    ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox")
   15.69 -    ("date") ("put") ("ref") ("pageref")
   15.70 -    ("multicolumn" 3) ("shortstack")
   15.71 -    ;; for mathmode accent
   15.72 -    ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec")
   15.73 -    ("widetilde") ("widehat") ("overline") ("overrightarrow")
   15.74 -    ;; section types in mathmode
   15.75 -    ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit")
   15.76 -    )
   15.77 +  (append
   15.78 +   '(("part") ("chapter") ("chapter*") ("section") ("section*")
   15.79 +     ("subsection") ("subsection*")
   15.80 +     ("subsubsection") ("paragraph") ("subparagraph")
   15.81 +     ("author") ("thanks") ("documentstyle") ("pagestyle")
   15.82 +     ("title") ("underline") ("label") ("makebox")
   15.83 +     ("footnote") ("footnotetext") ("index")
   15.84 +     ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite")
   15.85 +     ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption")
   15.86 +     ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2)
   15.87 +     ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2)
   15.88 +     ("newcommand" 2) ("renewcommand" 2)
   15.89 +     ("setcounter" 2) ("newenvironment" 3) ("newtheorem" 2)
   15.90 +     ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox")
   15.91 +     ("date") ("put") ("ref") ("pageref")
   15.92 +     ("multicolumn" 3) ("shortstack")
   15.93 +     ;; for mathmode accent
   15.94 +     ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec")
   15.95 +     ("widetilde") ("widehat") ("overline") ("overrightarrow")
   15.96 +     ;; section types in mathmode
   15.97 +     ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit")
   15.98 +     )
   15.99 +   (if YaTeX-use-LaTeX2e
  15.100 +       '(("documentclass") ("usepackage")
  15.101 +	 ("textbf") ("textgt") ("textit") ("textmc") ("textmd") ("textnormal")
  15.102 +	 ("textrm") ("textsc") ("textsf") ("textsl") ("texttt") ("textup")
  15.103 +	 ("mathbf") ("mathcal") ("mathit") ("mathnormal") ("mathrm")
  15.104 +	 ("mathsf") ("mathtt")
  15.105 +	 ("scalebox" 1) ;is faking of argument position
  15.106 +	 ("rotatebox" 2) ("resizebox" 2) ("reflectbox")
  15.107 +	 ("colorbox" 2) ("fcolorbox" 3) ("textcolor" 2) ("color")
  15.108 +	 ("includegraphics") ("includegraphics*")
  15.109 +	 )))
  15.110    "Default completion table for section-type completion.")
  15.111  
  15.112  (defvar user-section-table nil)
  15.113 @@ -258,7 +279,7 @@
  15.114    '(("quote") ("quotation") ("center") ("verse") ("document")
  15.115      ("verbatim") ("itemize") ("enumerate") ("description")
  15.116      ("list") ("tabular") ("tabular*") ("table") ("tabbing") ("titlepage")
  15.117 -    ("sloppypar") ("quotation") ("picture") ("displaymath")
  15.118 +    ("sloppypar") ("picture") ("displaymath")
  15.119      ("eqnarray") ("figure") ("equation") ("abstract") ("array")
  15.120      ("thebibliography") ("theindex") ("flushleft") ("flushright")
  15.121      ("minipage")
  15.122 @@ -274,22 +295,36 @@
  15.123      ("dg") ("dm")
  15.124      ("tiny") ("scriptsize") ("footnotesize") ("small")("normalsize")
  15.125      ("large") ("Large") ("LARGE") ("huge") ("Huge")
  15.126 +    ("rmfamily") ("sffamily") ("ttfamily")
  15.127 +    ("mdseries") ("bfseries") ("upshape")
  15.128 +    ("itshape") ("slshape") ("scshape")
  15.129      )
  15.130    "Default completion table for large-type completion.")
  15.131  
  15.132 +(defvar LaTeX2e-fontstyle-alist
  15.133 +  '(("rm" . "rmfamily")
  15.134 +    ("sf" . "sffamily")
  15.135 +    ("tt" . "ttfamily")
  15.136 +    ("md" . "mdseries")
  15.137 +    ("bf" . "bfseries")
  15.138 +    ("up" . "upshape")
  15.139 +    ("it" . "itshape")
  15.140 +    ("sl" . "slshape")
  15.141 +    ("sc" . "scshape")))
  15.142 +
  15.143  (defvar user-fontsize-table nil)
  15.144  (defvar tmp-fontsize-table nil)
  15.145  
  15.146  (defvar singlecmd-table
  15.147    (append
  15.148     '(("maketitle") ("makeindex") ("sloppy") ("protect")
  15.149 -     ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline")
  15.150 +     ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") ("kill")
  15.151       ;;("rightarrow") ("Rightarrow") ("leftarrow") ("Leftarrow")
  15.152 -     ("pagebreak") ("nopagebreak")
  15.153 +     ("pagebreak") ("nopagebreak") ("tableofcontents")
  15.154       ("newpage") ("clearpage") ("cleardoublepage")
  15.155       ("footnotemark") ("verb") ("verb*")
  15.156       ("linebreak") ("pagebreak") ("noindent") ("indent")
  15.157 -     ("left") ("right") ("dots")
  15.158 +     ("left") ("right") ("dots") ("smallskip") ("medskip") ("bigskip")
  15.159       )
  15.160     (if YaTeX-greek-by-maketitle-completion
  15.161         '(("alpha") ("beta") ("gamma") ("delta") ("epsilon")
  15.162 @@ -464,14 +499,20 @@
  15.163    (setq YaTeX-latex-message-code latex-message-kanji-code)))
  15.164  
  15.165  (defvar YaTeX-mode-syntax-table nil
  15.166 -
  15.167    "*Syntax table for yatex-mode")
  15.168  
  15.169  (if YaTeX-mode-syntax-table nil
  15.170    (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table)))
  15.171    (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table)
  15.172    (modify-syntax-entry ?\{ "(}" YaTeX-mode-syntax-table)
  15.173 -  (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table))
  15.174 +  (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table)
  15.175 +  (modify-syntax-entry ?\t " " YaTeX-mode-syntax-table)
  15.176 +  (modify-syntax-entry ?\f ">" YaTeX-mode-syntax-table)
  15.177 +  (modify-syntax-entry ?\n ">" YaTeX-mode-syntax-table)
  15.178 +  (modify-syntax-entry ?$ "$$" YaTeX-mode-syntax-table)
  15.179 +  (modify-syntax-entry ?% "<" YaTeX-mode-syntax-table)
  15.180 +  (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table)
  15.181 +  (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table))
  15.182  
  15.183  ;---------- Provide YaTeX-mode ----------
  15.184  ;;;
  15.185 @@ -564,13 +605,14 @@
  15.186  	indent-line-function 'YaTeX-indent-line
  15.187  	comment-start YaTeX-comment-prefix
  15.188  	comment-end ""
  15.189 -	;;comment-start-skip "[^\\\\]%+[ \t]*"
  15.190 +	comment-start-skip "[^\\\\]%+[ \t]*"
  15.191  	)
  15.192    (use-local-map YaTeX-mode-map)
  15.193    (set-syntax-table YaTeX-mode-syntax-table)
  15.194    (if YaTeX-dos (setq YaTeX-saved-screen-height (screen-height)))
  15.195    (YaTeX-read-user-completion-table)
  15.196    (and (fboundp 'YaTeX-19-collect-macros) (YaTeX-19-collect-macros))
  15.197 +  (makunbound 'inenv)
  15.198    (turn-on-auto-fill)			;1.63
  15.199    (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file)
  15.200         (y-or-n-p (format "Insert %s?" YaTeX-template-file))
  15.201 @@ -649,8 +691,6 @@
  15.202  (autoload 'YaTeX-display-hierarchy-directly "yatexhie"
  15.203    "Same as YaTeX-display-hierarchy.  Call from mouse." t)
  15.204  
  15.205 -;; autoload from yahtml.el
  15.206 -(autoload 'yahtml-inner-environment-but "yahtml" "yahtml internal func." t)
  15.207  
  15.208  ;;;
  15.209  ;; YaTeX-mode functions
  15.210 @@ -840,6 +880,10 @@
  15.211      (YaTeX-update-table
  15.212       (list fontsize-name)
  15.213       'fontsize-table 'user-fontsize-table 'tmp-fontsize-table)
  15.214 +    (and YaTeX-use-LaTeX2e
  15.215 +	 (YaTeX-latex2e-p)
  15.216 +	 (setq fontsize (cdr (assoc fontsize-name LaTeX2e-fontstyle-alist)))
  15.217 +	 (setq fontsize-name fontsize))
  15.218      (if arg
  15.219  	(save-excursion
  15.220  	  (if (> (point) (mark)) (exchange-point-and-mark))
  15.221 @@ -1429,7 +1473,8 @@
  15.222      (let ((p  (match-end 0)) b0 b1 env (nest 0) regexp re-s (op (point))
  15.223  	  (m0 (match-beginning 0))	;whole matching
  15.224  	  (m1 (match-beginning 1))	;environment in \begin{}
  15.225 -	  (m2 (match-beginning 2)))	;environment in \end{}
  15.226 +	  (m2 (match-beginning 2))	;environment in \end{}
  15.227 +	  (m3 (match-beginning 3)))	;environment in \[ \] \( \)
  15.228        ;(setq env (regexp-quote (buffer-substring p (match-beginning 0))))
  15.229        (if (cond
  15.230  	   (m1				;if begin{xxx}
  15.231 @@ -1464,6 +1509,18 @@
  15.232  		    (regexp-quote YaTeX-struct-end) env "" "")
  15.233  		   "\\)"))
  15.234  	    (setq re-s 're-search-backward))
  15.235 +	   (m3				;math environment
  15.236 +	    (setq env (char-after (1+ m3))
  15.237 +		  regexp (format "\\(%s%s\\)\\|\\(%s%s\\)"
  15.238 +				 YaTeX-ec-regexp
  15.239 +				 (regexp-quote
  15.240 +				  (cdr (assq env '((?( . ")") (?) . "(")
  15.241 +						   (?[ . "]") (?] . "[")))))
  15.242 +				 YaTeX-ec-regexp
  15.243 +				 (regexp-quote (char-to-string env)))
  15.244 +		  re-s (if (memq env '(?\( ?\[))
  15.245 +			   're-search-forward
  15.246 +			 're-search-backward)))
  15.247  	   (t (if noerr nil (error "Corresponding environment not found."))))
  15.248  	  (progn
  15.249  	    (while (and (>= nest 0) (funcall re-s regexp nil t))
  15.250 @@ -1486,7 +1543,7 @@
  15.251    "Visit or switch buffer of corresponding file,
  15.252  looking at \\input or \\include or \includeonly on current line."
  15.253    (if (not (YaTeX-on-includes-p)) nil
  15.254 -    (let ((parent buffer-file-name) input-file)
  15.255 +    (let ((parent buffer-file-name) input-file b)
  15.256        (save-excursion
  15.257  	(if (search-forward "{" (point-end-of-line) t)
  15.258  	    nil
  15.259 @@ -1498,7 +1555,8 @@
  15.260  	    (setq input-file (concat input-file ".tex"))))
  15.261        (cond
  15.262         (other (YaTeX-switch-to-buffer-other-window input-file))
  15.263 -       ((get-file-buffer input-file) (goto-buffer-window input-file))
  15.264 +       ((setq b (YaTeX-get-file-buffer input-file))
  15.265 +	(goto-buffer-window b))
  15.266         (t (YaTeX-switch-to-buffer input-file)))
  15.267        (or (YaTeX-get-builtin "!")
  15.268  	  YaTeX-parent-file
  15.269 @@ -1573,16 +1631,20 @@
  15.270      (let ((list (append YaTeX-processed-file-regexp-alist
  15.271  			YaTeX-processed-file-regexp-alist-default))
  15.272  	  (p (point)) flist file
  15.273 -	  (peol (point-end-of-line)))
  15.274 +	  (peol (point-end-of-line))
  15.275 +	  (basedir
  15.276 +	   (if YaTeX-search-file-from-top-directory
  15.277 +	       (save-excursion (YaTeX-visit-main t) default-directory)
  15.278 +	     ".")))
  15.279        (setq flist (catch 'found
  15.280 -		   (while list
  15.281 -		     (goto-char p)
  15.282 -		     (if (re-search-forward (car (car list)) peol t)
  15.283 -			 (progn
  15.284 -			   (setq file (YaTeX-match-string
  15.285 -				       (car (cdr (car list)))))
  15.286 -			   (throw 'found (cdr (car list)))))
  15.287 -		     (setq list (cdr list)))))
  15.288 +		    (while list
  15.289 +		      (goto-char p)
  15.290 +		      (if (re-search-forward (car (car list)) peol t)
  15.291 +			  (progn
  15.292 +			    (setq file (YaTeX-match-string
  15.293 +					(car (cdr (car list)))))
  15.294 +			    (throw 'found (cdr (car list)))))
  15.295 +		      (setq list (cdr list)))))
  15.296        (if flist				;if pattern and file name found
  15.297  	  (let*((plist (append YaTeX-file-processor-alist
  15.298  			       YaTeX-file-processor-alist-default))
  15.299 @@ -1598,36 +1660,38 @@
  15.300  	      (while plist		;if processor is not specified
  15.301  		(setq ext (cdr (car plist)))
  15.302  		(if (and (string< "" (concat file ext))
  15.303 -			 (file-exists-p (concat file ext)))
  15.304 -		      (setq cmd (car (car plist))
  15.305 -			    src (concat file ext) plist nil))
  15.306 +			 (file-exists-p
  15.307 +			  (expand-file-name (concat file ext) basedir)))
  15.308 +		    (setq cmd (car (car plist))
  15.309 +			  src (concat file ext) plist nil))
  15.310  		(setq plist (cdr plist)))
  15.311  	      (if (and (null src) alt YaTeX-create-file-prefix-g)
  15.312  		  (setq cmd alt
  15.313  			src (concat file (cdr (assoc alt plist0))))))
  15.314 -	    (if src		;if processor and src file found
  15.315 -		(cond
  15.316 -		 ((stringp cmd)
  15.317 -		  (let ((buf (concat "* " cmd " " src " *")))
  15.318 -		    (YaTeX-system (concat cmd " " src) buf)
  15.319 -		    t))
  15.320 -		 ((eq t cmd)
  15.321 -		  (let ((parent buffer-file-name))
  15.322 -		    (funcall
  15.323 -		     (cond
  15.324 -		      (other 'YaTeX-switch-to-buffer-other-window)
  15.325 -		      ((get-file-buffer src) 'goto-buffer-window)
  15.326 -		      (t 'YaTeX-switch-to-buffer))
  15.327 -		     src)
  15.328 -		    (or (YaTeX-get-builtin "!")
  15.329 -			YaTeX-parent-file
  15.330 -			(setq YaTeX-parent-file parent))
  15.331 -		    t))
  15.332 -		 ((symbolp cmd)
  15.333 +	    (if src			;if processor and src file found
  15.334 +		(let ((default-directory basedir))
  15.335  		  (cond
  15.336 -		   ((symbol-function cmd)
  15.337 -		    (funcall cmd src other)))
  15.338 -		  t))))))))
  15.339 +		   ((stringp cmd)
  15.340 +		    (let ((buf (concat "* " cmd " " src " *")))
  15.341 +		      (YaTeX-system (concat cmd " " src) buf)
  15.342 +		      t))
  15.343 +		   ((eq t cmd)
  15.344 +		    (let ((parent buffer-file-name))
  15.345 +		      (funcall
  15.346 +		       (cond
  15.347 +			(other 'YaTeX-switch-to-buffer-other-window)
  15.348 +			((get-file-buffer src) 'goto-buffer-window)
  15.349 +			(t 'YaTeX-switch-to-buffer))
  15.350 +		       src)
  15.351 +		      (or (YaTeX-get-builtin "!")
  15.352 +			  YaTeX-parent-file
  15.353 +			  (setq YaTeX-parent-file parent))
  15.354 +		      t))
  15.355 +		   ((symbolp cmd)
  15.356 +		    (cond
  15.357 +		     ((symbol-function cmd)
  15.358 +		      (funcall cmd src other)))
  15.359 +		    t)))))))))
  15.360  
  15.361  (defun YaTeX-on-section-command-p (command)
  15.362    "Check if point is on the LaTeX command: COMMAND(regexp).
  15.363 @@ -1702,7 +1766,11 @@
  15.364        "\\|"
  15.365        (YaTeX-replace-format-args
  15.366         (regexp-quote YaTeX-struct-end)
  15.367 -       (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" ""))
  15.368 +       (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "")
  15.369 +      "\\|\\("
  15.370 +      YaTeX-ec-regexp  ;;"[][()]\\)"
  15.371 +      "[][]\\)"
  15.372 +      )
  15.373       (point-end-of-line) t)))
  15.374  
  15.375  (defun YaTeX-on-includes-p ()
  15.376 @@ -1787,51 +1855,6 @@
  15.377    (message "%sommented out current environment."
  15.378  	   (if (eq func 'comment-out-region) "C" "Un-c")))
  15.379  
  15.380 -(defun YaTeX-beginning-of-environment (&optional limit-search-bound end)
  15.381 -  "Goto the beginning of the current environment.
  15.382 -Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound to
  15.383 -most recent sectioning command.  Non-nil for optional third argument END
  15.384 -goes to end of environment."
  15.385 -  (interactive)
  15.386 -  (let ((op (point)))
  15.387 -    (if (YaTeX-inner-environment limit-search-bound)
  15.388 -	(progn
  15.389 -	  (goto-char (get 'YaTeX-inner-environment 'point))
  15.390 -	  (and end (YaTeX-goto-corresponding-environment))
  15.391 -	  (if (interactive-p) (push-mark op))
  15.392 -	  t))))
  15.393 -
  15.394 -(defun YaTeX-end-of-environment (&optional limit-search-bound)
  15.395 -  "Goto the end of the current environment.
  15.396 -Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound
  15.397 -to most recent sectioning command."
  15.398 -  (interactive)
  15.399 -  (YaTeX-beginning-of-environment limit-search-bound t))
  15.400 -
  15.401 -(defun YaTeX-mark-environment ()
  15.402 -  "Mark current position and move point to end of environment."
  15.403 -  (interactive)
  15.404 -  (let ((curp (point)))
  15.405 -    (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin
  15.406 -	(forward-line 1)
  15.407 -      (beginning-of-line))
  15.408 -    (if (not (YaTeX-end-of-environment))   ;arg1 turns to match-beginning 1
  15.409 -	(progn
  15.410 -	  (goto-char curp)
  15.411 -	  (error "Cannot found the end of current environment."))
  15.412 -      (YaTeX-goto-corresponding-environment)
  15.413 -      (beginning-of-line)		;for confirmation
  15.414 -      (if (< curp (point))
  15.415 -	  (progn
  15.416 -	    (message "Mark this environment?(y or n): ")
  15.417 -	    (if (= (read-char) ?y) nil
  15.418 -	      (goto-char curp)
  15.419 -	      (error "Abort.  Please call again at more proper position."))))
  15.420 -      (set-mark-command nil)
  15.421 -      (YaTeX-goto-corresponding-environment)
  15.422 -      (end-of-line)
  15.423 -      (if (eobp) nil (forward-char 1)))))
  15.424 -
  15.425  (defun YaTeX-comment-paragraph ()
  15.426    "Comment out current paragraph."
  15.427    (interactive)
  15.428 @@ -2061,49 +2084,55 @@
  15.429    "Change section-type command."
  15.430    (interactive)
  15.431    (let*((where (YaTeX-on-section-command-p YaTeX-command-token-regexp))
  15.432 -	(p (point)) (cmd (YaTeX-match-string 1)) beg end old new)
  15.433 +	(p (point)) (cmd (YaTeX-match-string 1))
  15.434 +	(beg (make-marker)) (end (make-marker)) old new)
  15.435      (if (null where) nil
  15.436 -      (cond
  15.437 +      (unwind-protect
  15.438 +	  (progn
  15.439 +	    (cond
  15.440 +	     ((equal where 0);;if point is on section command
  15.441 +	      (set-marker beg (match-beginning 1))
  15.442 +	      (set-marker end (match-end 1))
  15.443 +	      (goto-char beg)		;beginning of the command
  15.444 +	      (setq new (YaTeX-read-section
  15.445 +			 (format "Change `%s' to: " cmd) nil)))
  15.446  
  15.447 -       ((equal where 0);;if point is on section command
  15.448 -	(setq beg (match-beginning 1)
  15.449 -	      end (match-end 1))
  15.450 -	(goto-char beg)			;beginning of the command
  15.451 -	(setq new (YaTeX-read-section (format "Change `%s' to: " cmd) nil)))
  15.452 +	     ((= where -1);;if point is on a optional parameter
  15.453 +	      (set-marker beg (match-beginning 2))
  15.454 +	      (skip-chars-forward "^{")
  15.455 +	      (set-marker end (point))
  15.456 +	      (goto-char p)
  15.457 +	      (setq new
  15.458 +		    (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd)))
  15.459 +			(YaTeX-addin cmd)
  15.460 +		      (concat "["
  15.461 +			      (read-string (format "Change `%s' to: "
  15.462 +						   (buffer-substring
  15.463 +						    (1+ beg) (1- end))))
  15.464 +			      "]"))))
  15.465  
  15.466 -       ((= where -1);;if point is on a optional parameter
  15.467 -	(setq beg (match-beginning 2))
  15.468 -	(skip-chars-forward "^{")
  15.469 -	(setq end (point))
  15.470 -	(goto-char p)
  15.471 -	(setq new
  15.472 -	      (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd)))
  15.473 -		  (YaTeX-addin cmd)
  15.474 -		(concat "["
  15.475 -			(read-string (format "Change `%s' to: "
  15.476 -					     (buffer-substring
  15.477 -					      (1+ beg) (1- end))))
  15.478 -			"]"))))
  15.479 -
  15.480 -       ((> where 0);;if point is in arguments' braces
  15.481 -	(or (looking-at "{")
  15.482 -	    (progn (skip-chars-backward "^{") (forward-char -1)))
  15.483 -	(setq beg (1+ (point)))
  15.484 -	(forward-list 1)
  15.485 -	(forward-char -1)
  15.486 -	(setq end (point)
  15.487 -	      old (buffer-substring beg end))
  15.488 -	(goto-char p)
  15.489 -	(if (> (length old) 40)
  15.490 -	    (setq old (concat (substring old 0 12) "..." (substring old -12))))
  15.491 -	(setq new
  15.492 -	      (if (intern-soft (concat "YaTeX::" cmd))
  15.493 -		  (funcall (intern-soft (concat "YaTeX::" cmd)) where)
  15.494 -		(read-string (format "Change `%s' to: " old)))))
  15.495 -       );cond
  15.496 -      (delete-region beg end)
  15.497 -      (goto-char beg)
  15.498 -      (insert-before-markers new)
  15.499 +	     ((> where 0);;if point is in arguments' braces
  15.500 +	      (or (looking-at "{")
  15.501 +		  (progn (skip-chars-backward "^{") (forward-char -1)))
  15.502 +	      (set-marker beg (1+ (point)))
  15.503 +	      (forward-list 1)
  15.504 +	      (forward-char -1)
  15.505 +	      (set-marker end (point))
  15.506 +	      (setq old (buffer-substring beg end))
  15.507 +	      (goto-char p)
  15.508 +	      (if (> (length old) 40)
  15.509 +		  (setq old (concat (substring old 0 12) "..."
  15.510 +				    (substring old -12))))
  15.511 +	      (setq new
  15.512 +		    (if (intern-soft (concat "YaTeX::" cmd))
  15.513 +			(funcall (intern-soft (concat "YaTeX::" cmd)) where)
  15.514 +		      (read-string (format "Change `%s' to: " old)))))
  15.515 +	     )				;cond
  15.516 +	    (delete-region beg end)
  15.517 +	    (goto-char beg)
  15.518 +	    (insert-before-markers new))
  15.519 +	(set-marker beg nil)
  15.520 +	(set-marker end nil))
  15.521        ;;(goto-char (marker-position p))
  15.522        new)))
  15.523  
  15.524 @@ -2205,28 +2234,35 @@
  15.525    "Check if POINT is in verb or verb*.  Default of POINT is (point)."
  15.526    (setq point (or point (point)))
  15.527    (save-excursion
  15.528 -    (goto-char point)
  15.529 -    (if (not (re-search-backward
  15.530 -	      (concat YaTeX-ec-regexp
  15.531 -		      "\\(" YaTeX-verb-regexp "\\)"
  15.532 -		      "\\([^-A-Za-z_*]\\)")
  15.533 -	      (point-beginning-of-line) t))
  15.534 -	nil
  15.535 -      (goto-char (match-end 2))
  15.536 -      (skip-chars-forward
  15.537 -       (concat "^" (buffer-substring (match-beginning 2) (match-end 2))))
  15.538 -      (and (< (match-beginning 2) point) (< (1- point) (point))))))
  15.539 +    (let ((md (match-data)))
  15.540 +      (goto-char point)
  15.541 +      (unwind-protect
  15.542 +	  (if (not (re-search-backward
  15.543 +		    (concat YaTeX-ec-regexp
  15.544 +			    "\\(" YaTeX-verb-regexp "\\)"
  15.545 +			    "\\([^-A-Za-z_*]\\)")
  15.546 +		    (point-beginning-of-line) t))
  15.547 +	      nil
  15.548 +	    (goto-char (match-end 2))
  15.549 +	    (skip-chars-forward
  15.550 +	     (concat "^" (buffer-substring (match-beginning 2) (match-end 2))))
  15.551 +	    (and (< (match-beginning 2) point) (< (1- point) (point))))
  15.552 +	(store-match-data md)))))
  15.553  
  15.554  (defun YaTeX-literal-p (&optional point)
  15.555    "Check if POINT is in verb or verb* or verbatime environment family.
  15.556  Default of POINT is (point)."
  15.557 -  (cond
  15.558 -   ((equal YaTeX-ec "\\")		;maybe LaTeX
  15.559 -    (save-excursion
  15.560 -      (and point (goto-char point))
  15.561 -      (or (YaTeX-in-verb-p (point))
  15.562 -	  (and (not (looking-at "\\\\end{verb"))
  15.563 -	       (YaTeX-quick-in-environment-p YaTeX-verbatim-environments)))))))
  15.564 +  (let ((md (match-data)))
  15.565 +    (unwind-protect
  15.566 +	(cond
  15.567 +	 ((equal YaTeX-ec "\\")		;maybe LaTeX
  15.568 +	  (save-excursion
  15.569 +	    (and point (goto-char point))
  15.570 +	    (or (YaTeX-in-verb-p (point))
  15.571 +		(and (not (looking-at "\\\\end{verb"))
  15.572 +		     (YaTeX-quick-in-environment-p
  15.573 +		      YaTeX-verbatim-environments))))))
  15.574 +      (store-match-data md))))
  15.575  
  15.576  (defun YaTeX-in-environment-p (env)
  15.577    "Return if current LaTeX environment is ENV.
  15.578 @@ -2548,8 +2584,15 @@
  15.579      ;;	  (kill-line))))))
  15.580      (or inenv (setq inenv "document"))	;is the default environment
  15.581      (cond
  15.582 -     ((and (YaTeX-on-begin-end-p) (match-beginning 2)) ;if \end
  15.583 -      (YaTeX-reindent (YaTeX-current-indentation)))
  15.584 +     ((and (YaTeX-on-begin-end-p)
  15.585 +	   (or
  15.586 +	    (match-beginning 2)		;if \end
  15.587 +	    (and (match-beginning 3)	;if \) \]
  15.588 +		 (= (char-syntax (char-after (1+ (match-beginning 3)))) ?\)))))
  15.589 +      (YaTeX-reindent
  15.590 +       (save-excursion
  15.591 +	 (YaTeX-goto-corresponding-environment)
  15.592 +	 (current-column))))
  15.593       ((string-match YaTeX-equation-env-regexp inenv)
  15.594        (YaTeX-indent-line-equation))	;autoload-ed from yatexenv
  15.595       (;(YaTeX-in-environment-p '("itemize" "enumerate" "description" "list"))
  15.596 @@ -2642,6 +2685,16 @@
  15.597  		  (looking-at "\\sw+")) ;is not japanese string
  15.598  		(insert YaTeX-comment-prefix)))))))
  15.599  
  15.600 +(defun YaTeX-latex2e-p ()
  15.601 +  (let ((b (current-buffer))
  15.602 +	(ptn (concat YaTeX-ec "documentclass")))
  15.603 +    (unwind-protect
  15.604 +	(or (save-excursion (search-backward ptn nil t))
  15.605 +	    (progn
  15.606 +	      (YaTeX-visit-main t)
  15.607 +	      (save-excursion (search-backward ptn nil t))))
  15.608 +      (set-buffer b))))
  15.609 +
  15.610  (provide 'yatex)
  15.611  (defvar yatex-mode-load-hook nil
  15.612    "*List of functions to be called when yatex.el is loaded.")
    16.1 --- a/yatex.new	Thu Jul 15 04:58:26 1999 +0000
    16.2 +++ b/yatex.new	Sun Apr 09 03:37:47 2000 +0000
    16.3 @@ -1,6 +1,26 @@
    16.4  	What's new in YaTeX/yahtml
    16.5  	野鳥/yahtml - 各バージョンの変更点について
    16.6  
    16.7 +1.68	=== yatex ===
    16.8 +	XEmacsでyatexgenが動かなくなったのに対処。
    16.9 +	Windowsでのインストールが少し楽になるように makefile を修正。
   16.10 +	ref/cite ラベル補完で全てのカウンタを補完候補にあげてなおかつ
   16.11 +	labelが設定していないところには自動的にラベルを付加するようにした。
   16.12 +	\cite の補完を BibTeX データベースファイルからも探すようにした。
   16.13 +	LaTeX2eの多くのコマンドに、本体/アドイン共に対応。
   16.14 +	=== yahtml ===
   16.15 +	英語版info、Q&Aの添付(by Jun Ohyaさん)
   16.16 +	<img src="..">補完でsrcとなる画像ファイルのピクセルサイズを自前
   16.17 +	で調べて width, height 属性の補完のデフォルトとなるようにした。
   16.18 +	M-C-a(beginning-of-environment), M-C-e(end-of-environment),
   16.19 +	M-C-@(mark-environment) が yatex.el 内に定義されていてyahtmlだけ
   16.20 +	をロードしているときにエラーになったので、これら関数定義を
   16.21 +	yatexlibに移動。
   16.22 +	css定義ファイル中ピリオドで始まるエントリを全てのエレメントに共
   16.23 +	通なclass補完候補として出すようにした。
   16.24 +	yahtmlを使用するとYaTeXでのインデントがおかしくなるのを直した。
   16.25 +	& でchar-entity reference補完。
   16.26 +
   16.27  1.67	[[[ http://www.yatex.org/ が誕生しました ]]]
   16.28  	=== yahtml ===
   16.29  	href入力でSPCなどのunsafe-charを%エンコードに置換するかを
    17.1 --- a/yatex19.el	Thu Jul 15 04:58:26 1999 +0000
    17.2 +++ b/yatex19.el	Sun Apr 09 03:37:47 2000 +0000
    17.3 @@ -1,7 +1,7 @@
    17.4  ;;; -*- Emacs-Lisp -*-
    17.5  ;;; YaTeX facilities for Emacs 19
    17.6 -;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    17.7 -;;; Last modified Thu Apr 29 18:40:26 1999 on firestorm
    17.8 +;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@yatex.org]
    17.9 +;;; Last modified Fri Nov 26 09:56:09 1999 on firestorm
   17.10  ;;; $Id$
   17.11  
   17.12  ;;; とりあえず hilit19 を使っている時に色が付くようにして
   17.13 @@ -13,6 +13,10 @@
   17.14  
   17.15  ;(require 'yatex)
   17.16  
   17.17 +(defvar YaTeX-use-hilit19 (and (featurep 'hilit19) (fboundp 'x-color-values)
   17.18 +			       (fboundp 'hilit-translate))
   17.19 +  "*Use hilit19 to fontify buffer or not.")
   17.20 +
   17.21  (defvar YaTeX-mode-menu-map (make-sparse-keymap "YaTeX"))
   17.22  (defvar YaTeX-mode-menu-map-process (make-sparse-keymap "Process"))
   17.23  (define-key YaTeX-mode-map [menu-bar yatex]
   17.24 @@ -360,7 +364,7 @@
   17.25  ;    (fset 'x-color-values 'win32-color-values))
   17.26  
   17.27  (cond
   17.28 - ((and (featurep 'hilit19) (fboundp 'x-color-values))
   17.29 + (YaTeX-use-hilit19
   17.30    (let*((sectface
   17.31  	 (car (if (eq hilit-background-mode 'dark)
   17.32  		  (cdr YaTeX-hilit-sectioning-face)
   17.33 @@ -412,7 +416,7 @@
   17.34  ;; ローカルマクロを keyword として光らせる(keywordじゃまずいかな…)。
   17.35  (defun YaTeX-19-collect-macros ()
   17.36    (cond
   17.37 -   ((and (featurep 'hilit19) (fboundp 'hilit-translate))
   17.38 +   (YaTeX-use-hilit19
   17.39      (let ((get-face
   17.40  	   (function
   17.41  	    (lambda (table)
    18.1 --- a/yatexadd.el	Thu Jul 15 04:58:26 1999 +0000
    18.2 +++ b/yatexadd.el	Sun Apr 09 03:37:47 2000 +0000
    18.3 @@ -1,8 +1,8 @@
    18.4  ;;; -*- Emacs-Lisp -*-
    18.5  ;;; YaTeX add-in functions.
    18.6  ;;; yatexadd.el rev.14
    18.7 -;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    18.8 -;;; Last modified Tue Jul 13 13:57:45 1999 on firestorm
    18.9 +;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@yatex.org]
   18.10 +;;; Last modified Fri Mar 17 20:21:45 2000 on firestorm
   18.11  ;;; $Id$
   18.12  
   18.13  ;;;
   18.14 @@ -371,12 +371,212 @@
   18.15        (goto-char (match-beginning 0))))
   18.16      (message YaTeX-label-guide-msg)))
   18.17  
   18.18 +; (defun YaTeX::ref (argp &optional labelcmd refcmd)
   18.19 +;   (cond
   18.20 +;    ((= argp 1)
   18.21 +;     (let ((lnum 0) e0 label label-list (buf (current-buffer))
   18.22 +; 	  (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref"))
   18.23 +; 	  (p (point)) initl line cf)
   18.24 +;       (message "Collecting labels...")
   18.25 +;       (save-window-excursion
   18.26 +; 	(YaTeX-showup-buffer
   18.27 +; 	 YaTeX-label-buffer (function (lambda (x) (window-width x))))
   18.28 +; 	(if (fboundp 'select-frame) (setq cf (selected-frame)))
   18.29 +; 	(if (eq (window-buffer (minibuffer-window)) buf)
   18.30 +; 	    (progn
   18.31 +; 	      (other-window 1)
   18.32 +; 	      (setq buf (current-buffer))
   18.33 +; 	      (set-buffer buf)
   18.34 +; 	      ;(message "cb=%s" buf)(sit-for 3)
   18.35 +; 	      ))
   18.36 +; 	(save-excursion
   18.37 +; 	  (set-buffer (get-buffer-create YaTeX-label-buffer))
   18.38 +; 	  (setq buffer-read-only nil)
   18.39 +; 	  (erase-buffer))
   18.40 +; 	(save-excursion
   18.41 +; 	  (goto-char (point-min))
   18.42 +; 	  (let ((standard-output (get-buffer YaTeX-label-buffer)))
   18.43 +; 	    (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf)))
   18.44 +; 	    (while (YaTeX-re-search-active-forward
   18.45 +; 		    (concat "\\\\" labelcmd "\\b")
   18.46 +; 		    (regexp-quote YaTeX-comment-prefix) nil t)
   18.47 +; 	      (goto-char (match-beginning 0))
   18.48 +; 	      (skip-chars-forward "^{")
   18.49 +; 	      (setq label
   18.50 +; 		    (buffer-substring
   18.51 +; 		     (1+ (point))
   18.52 +; 		     (prog2 (forward-list 1) (setq e0 (1- (point)))))
   18.53 +; 		    label-list (cons label label-list))
   18.54 +; 	      (or initl
   18.55 +; 		  (if (< p (point)) (setq initl lnum)))
   18.56 +; 	      (beginning-of-line)
   18.57 +; 	      (skip-chars-forward " \t\n" nil)
   18.58 +; 	      (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
   18.59 +; 			     (buffer-substring (point) (point-end-of-line))))
   18.60 +; 	      (setq lnum (1+ lnum))
   18.61 +; 	      (message "Collecting \\%s{}... %d" labelcmd lnum)
   18.62 +; 	      (goto-char e0))
   18.63 +; 	    (princ YaTeX-label-menu-other)
   18.64 +; 	    (princ YaTeX-label-menu-repeat)
   18.65 +; 	    (princ YaTeX-label-menu-any)
   18.66 +; 	    );standard-output
   18.67 +; 	  (goto-char p)
   18.68 +; 	  (or initl (setq initl lnum))
   18.69 +; 	  (message "Collecting %s...Done" labelcmd)
   18.70 +; 	  (if (fboundp 'select-frame) (select-frame cf))
   18.71 +; 	  (YaTeX-showup-buffer YaTeX-label-buffer nil t)
   18.72 +; 	  (YaTeX::label-setup-key-map)
   18.73 +; 	  (setq truncate-lines t)
   18.74 +; 	  (setq buffer-read-only t)
   18.75 +; 	  (use-local-map YaTeX-label-select-map)
   18.76 +; 	  (message YaTeX-label-guide-msg)
   18.77 +; 	  (goto-line (1+ initl)) ;goto recently defined label line
   18.78 +; 	  (switch-to-buffer (current-buffer))
   18.79 +; 	  (unwind-protect
   18.80 +; 	      (progn
   18.81 +; 		(recursive-edit)
   18.82 +; 		(set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
   18.83 +; 		(beginning-of-line)
   18.84 +; 		(setq line (1- (count-lines (point-min)(point))))
   18.85 +; 		(cond
   18.86 +; 		 ((= line -1) (setq label ""))
   18.87 +; 		 ((= line lnum) (setq label (YaTeX-label-other)))
   18.88 +; 		 ((= line (1+ lnum))
   18.89 +; 		  (save-excursion
   18.90 +; 		    (switch-to-buffer buf)
   18.91 +; 		    (goto-char p)
   18.92 +; 		    (if (re-search-backward
   18.93 +; 			 (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t)
   18.94 +; 			(setq label (YaTeX-match-string 1))
   18.95 +; 		      (setq label ""))))
   18.96 +; 		 ((>= line (+ lnum 2))
   18.97 +; 		  (setq label (read-string (format "\\%s{???}: " refcmd))))
   18.98 +; 		 (t (setq label (nth (- lnum line 1) label-list)))))
   18.99 +; 	    (bury-buffer YaTeX-label-buffer)))
  18.100 +; 	label)))))
  18.101 +
  18.102 +(defun YaTeX::ref-generate-label ()
  18.103 +  "Generate a label string which is unique in current buffer."
  18.104 +  (let ((default (substring (current-time-string) 4)))
  18.105 +    (read-string "Give a label for this line: "
  18.106 +		 (if YaTeX-emacs-19 (cons default 1) default))))
  18.107 +
  18.108 +(defun YaTeX::ref-getset-label (buffer point)
  18.109 +  "Get label string in the BUFFER near the POINT.
  18.110 +Make \\label{xx} if no label."
  18.111 +  (let (boundary inspoint cc newlabel (labelholder "label") mathp env)
  18.112 +    ;(set-buffer buffer)
  18.113 +    (switch-to-buffer buffer)
  18.114 +    (save-excursion
  18.115 +      (goto-char point)
  18.116 +      (setq cc (current-column))
  18.117 +      (if (= (char-after (point)) ?\\) (forward-char 1))
  18.118 +      (cond
  18.119 +       ((looking-at YaTeX-sectioning-regexp)
  18.120 +	(skip-chars-forward "^{")
  18.121 +	(forward-list 1)
  18.122 +	(skip-chars-forward " \t\n")
  18.123 +	(setq boundary "\\S "))
  18.124 +       ((looking-at "item\\s ")
  18.125 +	(setq cc (+ cc 6))
  18.126 +	(setq boundary (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b")))
  18.127 +       ((looking-at "bibitem")
  18.128 +	(setq labelholder "bibitem"))	; label holder is bibitem itself
  18.129 +       ((string-match YaTeX::ref-mathenv-regexp
  18.130 +		      (setq env (or (YaTeX-inner-environment t) "document")))
  18.131 +	(setq mathp t)
  18.132 +	(setq boundary (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)")))
  18.133 +       ((looking-at "caption\\|\\(begin\\)")
  18.134 +	(skip-chars-forward "^{")
  18.135 +	(if (match-beginning 1) (forward-list 1))
  18.136 +	(setq boundary (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b")))
  18.137 +       (t ))
  18.138 +      (if (save-excursion (skip-chars-forward " \t") (looking-at "%"))
  18.139 +	  (forward-line 1))
  18.140 +      (if (and (save-excursion
  18.141 +		 (YaTeX-re-search-active-forward
  18.142 +		  (concat "\\(" labelholder "\\)\\|\\(" boundary "\\)")
  18.143 +		  (regexp-quote YaTeX-comment-prefix)
  18.144 +		  nil 1))
  18.145 +	       (match-beginning 1))
  18.146 +	  ;; if \label{hoge} found, return it
  18.147 +	  (buffer-substring
  18.148 +	   (progn
  18.149 +	     (goto-char (match-end 0))
  18.150 +	     (skip-chars-forward "^{") (1+ (point)))
  18.151 +	   (progn
  18.152 +	     (forward-sexp 1) (1- (point))))
  18.153 +	;;else make a label
  18.154 +	(goto-char (match-beginning 0))
  18.155 +	(skip-chars-backward " \t\n")
  18.156 +	(save-excursion (setq newlabel (YaTeX::ref-generate-label)))
  18.157 +	(delete-region (point) (progn (skip-chars-backward " \t") (point)))
  18.158 +	(if mathp nil 
  18.159 +	  (insert "\n")
  18.160 +	  (YaTeX-reindent cc))
  18.161 +	(insert (format "\\label{%s}" newlabel))
  18.162 +	newlabel))))
  18.163 +
  18.164 +(defvar YaTeX::ref-labeling-regexp-alist
  18.165 +  '(("\\\\begin{java}{\\([^}]+\\)}" . 1)
  18.166 +    ("\\\\elabel{\\([^}]+\\)}" . 1)))
  18.167 +(defvar YaTeX::ref-labeling-regexp
  18.168 +  (mapconcat 'car YaTeX::ref-labeling-regexp-alist "\\|"))
  18.169 +(defvar YaTeX::ref-mathenv-regexp
  18.170 +  "equation\\|eqnarray\\|align\\|gather\\|alignat\\|xalignat")
  18.171 +(defvar YaTeX::ref-enumerateenv-regexp
  18.172 +  "enumerate")
  18.173 +
  18.174 +(defvar YaTeX::ref-labeling-section-level 2
  18.175 +  "ref補完で収集するセクショニングコマンドの下限レベル
  18.176 +YaTeX-sectioning-levelの数値で指定.")
  18.177 +
  18.178  (defun YaTeX::ref (argp &optional labelcmd refcmd)
  18.179 +  (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache
  18.180 +  (require 'yatexsec)
  18.181    (cond
  18.182     ((= argp 1)
  18.183 -    (let ((lnum 0) e0 label label-list (buf (current-buffer))
  18.184 -	  (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref"))
  18.185 -	  (p (point)) initl line cf)
  18.186 +    (let*((lnum 0) e0 x cmd label match-point point-list boundary
  18.187 +	  (buf (current-buffer))
  18.188 +	  (llv YaTeX::ref-labeling-section-level)
  18.189 +	  (mathenvs YaTeX::ref-mathenv-regexp)
  18.190 +	  (enums YaTeX::ref-enumerateenv-regexp)
  18.191 +	  (counter
  18.192 +	   (or labelcmd
  18.193 +	       (concat
  18.194 +		YaTeX-ec-regexp "\\(\\("
  18.195 +		(mapconcat
  18.196 +		 'concat
  18.197 +		 (delq nil
  18.198 +		       (mapcar
  18.199 +			(lambda (s)
  18.200 +			  (if (>= llv (cdr s))
  18.201 +			      (car s)))
  18.202 +			YaTeX-sectioning-level))
  18.203 +		 "\\|")
  18.204 +		"\\|caption\\){"
  18.205 +		"\\|\\(begin{\\(" mathenvs "\\|" enums  "\\)\\)\\)")))
  18.206 +	  (regexp (concat "\\(" counter
  18.207 +			  "\\)\\|\\(" YaTeX::ref-labeling-regexp "\\)"))
  18.208 +	  (itemsep (concat YaTeX-ec-regexp
  18.209 +			   "\\(\\(bib\\)?item\\|begin\\|end\\)"))
  18.210 +	  (refcmd (or refcmd "ref"))
  18.211 +	  (p (point)) initl line cf
  18.212 +	  (percent (regexp-quote YaTeX-comment-prefix))
  18.213 +	  (output
  18.214 +	   (function
  18.215 +	    (lambda (label p)
  18.216 +	      (while (setq x (string-match "\n" label))
  18.217 +		(aset label x ? ))
  18.218 +	      (while (setq x (string-match "[ \t\n][ \t\n]+" label))
  18.219 +		(setq label (concat
  18.220 +			     (substring label 0 (1+ (match-beginning 0)))
  18.221 +			     (substring label (match-end 0)))))
  18.222 +	      (princ (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label))
  18.223 +	      (setq point-list (cons p point-list))
  18.224 +	      (message "Collecting labels... %d" lnum)
  18.225 +	      (setq lnum (1+ lnum)))))
  18.226 +	  )
  18.227        (message "Collecting labels...")
  18.228        (save-window-excursion
  18.229  	(YaTeX-showup-buffer
  18.230 @@ -386,35 +586,106 @@
  18.231  	    (progn
  18.232  	      (other-window 1)
  18.233  	      (setq buf (current-buffer))
  18.234 -	      (set-buffer buf)
  18.235 -	      ;(message "cb=%s" buf)(sit-for 3)
  18.236 -	      ))
  18.237 +	      (set-buffer buf)))
  18.238  	(save-excursion
  18.239  	  (set-buffer (get-buffer-create YaTeX-label-buffer))
  18.240  	  (setq buffer-read-only nil)
  18.241  	  (erase-buffer))
  18.242  	(save-excursion
  18.243 +	  (set-buffer buf)
  18.244  	  (goto-char (point-min))
  18.245  	  (let ((standard-output (get-buffer YaTeX-label-buffer)))
  18.246  	    (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf)))
  18.247  	    (while (YaTeX-re-search-active-forward
  18.248 -		    (concat "\\\\" labelcmd "\\b")
  18.249 -		    (regexp-quote YaTeX-comment-prefix) nil t)
  18.250 -	      (goto-char (match-beginning 0))
  18.251 -	      (skip-chars-forward "^{")
  18.252 -	      (setq label
  18.253 -		    (buffer-substring
  18.254 -		     (1+ (point))
  18.255 -		     (prog2 (forward-list 1) (setq e0 (1- (point)))))
  18.256 -		    label-list (cons label label-list))
  18.257 -	      (or initl
  18.258 -		  (if (< p (point)) (setq initl lnum)))
  18.259 -	      (beginning-of-line)
  18.260 -	      (skip-chars-forward " \t\n" nil)
  18.261 -	      (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
  18.262 -			     (buffer-substring (point) (point-end-of-line))))
  18.263 -	      (setq lnum (1+ lnum))
  18.264 -	      (message "Collecting \\%s{}... %d" labelcmd lnum)
  18.265 +		    regexp ;;counter
  18.266 +		    percent nil t)
  18.267 +	      ;(goto-char (match-beginning 0))
  18.268 +	      (setq e0 (match-end 0))
  18.269 +	      (cond
  18.270 +	       ((match-string 1)
  18.271 +		;;if standard counter commands found 
  18.272 +		(setq cmd (YaTeX-match-string 2))
  18.273 +		(setq match-point (match-beginning 0))
  18.274 +		(or initl
  18.275 +		    (if (< p (point)) (setq initl lnum)))
  18.276 +		(cond
  18.277 +		 ((string-match mathenvs cmd) ;;if matches mathematical env
  18.278 +		  ;(skip-chars-forward "} \t\n")
  18.279 +		  (forward-line 1)
  18.280 +		  (setq x (point))
  18.281 +		  (catch 'scan
  18.282 +		    (while (YaTeX-re-search-active-forward
  18.283 +			    (concat "\\\\\\\\$\\|\\\\end{\\(" mathenvs "\\)")
  18.284 +			    percent nil t)
  18.285 +		      (let ((quit (match-beginning 1)))
  18.286 +			(funcall output
  18.287 +				 (buffer-substring x (match-beginning 0))
  18.288 +				 x)
  18.289 +			(if quit (throw 'scan t)))
  18.290 +		      (setq x (point))))
  18.291 +		  (setq e0 (point)))
  18.292 +		 ((string-match enums cmd)
  18.293 +		  ;(skip-chars-forward "} \t\n")
  18.294 +		  (save-restriction
  18.295 +		    (narrow-to-region
  18.296 +		     (point)
  18.297 +		     (save-excursion
  18.298 +		       (YaTeX-goto-corresponding-environment) (point)))
  18.299 +		    (forward-line 1)
  18.300 +		    (while (YaTeX-re-search-active-forward
  18.301 +			    (concat YaTeX-ec-regexp "item\\s ")
  18.302 +			    percent nil t)
  18.303 +		      (setq x (match-beginning 0))
  18.304 +		      (funcall
  18.305 +		       output
  18.306 +		       (buffer-substring
  18.307 +			(match-beginning 0)
  18.308 +			(if (re-search-forward itemsep nil t)
  18.309 +			    (progn (goto-char (match-beginning 0))
  18.310 +				   (skip-chars-backward " \t")
  18.311 +				   (1- (point)))
  18.312 +			  (point-end-of-line)))
  18.313 +		       x))))
  18.314 +
  18.315 +		 ((= (char-after (1- (point))) ?{)
  18.316 +		  (setq label (buffer-substring
  18.317 +			       (match-beginning 0)
  18.318 +			       (progn (forward-char -1)
  18.319 +				      (forward-list 1)
  18.320 +				      (point))))
  18.321 +		  (funcall output label match-point))
  18.322 +		 (t
  18.323 +		  (skip-chars-forward " \t")
  18.324 +		  (setq label (buffer-substring
  18.325 +			       (match-beginning 0)
  18.326 +			       (if (re-search-forward
  18.327 +				    itemsep
  18.328 +				    nil t)
  18.329 +				   (progn
  18.330 +				     (goto-char (match-beginning 0))
  18.331 +				     (skip-chars-backward " \t")
  18.332 +				     (1- (point)))
  18.333 +				 (point-end-of-line))))
  18.334 +		  (funcall output label match-point)
  18.335 +		  ))
  18.336 +		) ;;put label buffer
  18.337 +	       ;;
  18.338 +	       ;; if user defined label found
  18.339 +	       (t
  18.340 +		;; memorize line number and label into property
  18.341 +		(goto-char (match-beginning 0))
  18.342 +		(let ((list YaTeX::ref-labeling-regexp-alist)
  18.343 +		      (cache (symbol-plist 'YaTeX::ref-labeling-regexp)))
  18.344 +		  (while list
  18.345 +		    (if (looking-at (car (car list)))
  18.346 +			(progn
  18.347 +			  (setq label (YaTeX-match-string 0))
  18.348 +			  (put 'YaTeX::ref-labeling-regexp lnum
  18.349 +			       (YaTeX-match-string (cdr (car list))))
  18.350 +			  (funcall output label 0) ;;0 is dummy, never used
  18.351 +			  (setq list nil)))
  18.352 +		    (setq list (cdr list))))
  18.353 +		))
  18.354  	      (goto-char e0))
  18.355  	    (princ YaTeX-label-menu-other)
  18.356  	    (princ YaTeX-label-menu-repeat)
  18.357 @@ -422,7 +693,7 @@
  18.358  	    );standard-output
  18.359  	  (goto-char p)
  18.360  	  (or initl (setq initl lnum))
  18.361 -	  (message "Collecting %s...Done" labelcmd)
  18.362 +	  (message "Collecting labels...Done")
  18.363  	  (if (fboundp 'select-frame) (select-frame cf))
  18.364  	  (YaTeX-showup-buffer YaTeX-label-buffer nil t)
  18.365  	  (YaTeX::label-setup-key-map)
  18.366 @@ -435,6 +706,7 @@
  18.367  	  (unwind-protect
  18.368  	      (progn
  18.369  		(recursive-edit)
  18.370 +
  18.371  		(set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
  18.372  		(beginning-of-line)
  18.373  		(setq line (1- (count-lines (point-min)(point))))
  18.374 @@ -451,17 +723,112 @@
  18.375  		      (setq label ""))))
  18.376  		 ((>= line (+ lnum 2))
  18.377  		  (setq label (read-string (format "\\%s{???}: " refcmd))))
  18.378 -		 (t (setq label (nth (- lnum line 1) label-list)))))
  18.379 +		 (t ;(setq label (nth (- lnum line 1) label-list))
  18.380 +		  (setq label
  18.381 +			(or (get 'YaTeX::ref-labeling-regexp line)
  18.382 +			    (YaTeX::ref-getset-label
  18.383 +			     buf (nth (- lnum line 1) point-list))))
  18.384 +		  )))
  18.385  	    (bury-buffer YaTeX-label-buffer)))
  18.386  	label)))))
  18.387  
  18.388  (fset 'YaTeX::pageref 'YaTeX::ref)
  18.389 +
  18.390 +(defun YaTeX::cite-collect-bibs-external (&rest files)
  18.391 +  "Collect bibentry from FILES(variable length argument);
  18.392 +and print them to standard output."
  18.393 +  ;;Thanks; http://icarus.ilcs.hokudai.ac.jp/comp/biblio.html
  18.394 +  (let ((tb (get-buffer-create " *bibtmp*")))
  18.395 +    (save-excursion
  18.396 +      (set-buffer tb)
  18.397 +      (while files
  18.398 +	(erase-buffer)
  18.399 +	(cond
  18.400 +	 ((file-exists-p (car files))
  18.401 +	  (insert-file-contents (car files)))
  18.402 +	 ((file-exists-p (concat (car files) ".bib"))
  18.403 +	  (insert-file-contents (concat (car files) ".bib"))))
  18.404 +	(save-excursion
  18.405 +	  (goto-char (point-min))
  18.406 +	  (while (re-search-forward "^\\s *@[A-Za-z]" nil t)
  18.407 +	    (skip-chars-forward "^{,")
  18.408 +	    (if (= (char-after (point)) ?{)
  18.409 +		(princ (format "%sbibitem{%s}%s\n"
  18.410 +			       YaTeX-ec
  18.411 +			       (buffer-substring
  18.412 +				(1+ (point))
  18.413 +				(progn (skip-chars-forward "^,\n")
  18.414 +				       (point)))
  18.415 +			       (if (re-search-forward "title\\s *=" nil t)
  18.416 +				   (buffer-substring
  18.417 +				    (progn
  18.418 +				      (goto-char (match-end 0))
  18.419 +				      (skip-chars-forward " \t\n")
  18.420 +				      (point))
  18.421 +				    (progn
  18.422 +				      (if (looking-at "[{\"]")
  18.423 +					  (forward-sexp 1)
  18.424 +					(forward-char 1)
  18.425 +					(skip-chars-forward "^,"))
  18.426 +				      (point)))))))))
  18.427 +	(setq files (cdr files))))))
  18.428 +
  18.429 +(defun YaTeX::cite-collect-bibs-internal ()
  18.430 +  "Collect bibentry in the current buffer and print them to standard output."
  18.431 +  (let ((ptn (concat YaTeX-ec-regexp "bibitem\\b"))
  18.432 +	(pcnt (regexp-quote YaTeX-comment-prefix)))
  18.433 +    (save-excursion
  18.434 +      (while (YaTeX-re-search-active-forward ptn pcnt nil t)
  18.435 +	(skip-chars-forward "^{\n")
  18.436 +	(or (eolp)
  18.437 +	    (princ (format "%sbibitem{%s}\n"
  18.438 +			   YaTeX-ec
  18.439 +			   (buffer-substring
  18.440 +			    (1+ (point))
  18.441 +			    (progn (forward-sexp 1) (point))))))))))
  18.442 +
  18.443  (defun YaTeX::cite (argp)
  18.444    (cond
  18.445     ((eq argp 1)
  18.446 -    (YaTeX::ref argp "bibitem\\(\\[.*\\]\\)?" "cite"))
  18.447 +    (let* ((cb (current-buffer))
  18.448 +	   (f (file-name-nondirectory buffer-file-name))
  18.449 +	   (d default-directory)
  18.450 +	   (hilit-auto-highlight nil)
  18.451 +	   (pcnt (regexp-quote YaTeX-comment-prefix))
  18.452 +	   (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}"))
  18.453 +	   (bbuf (get-buffer-create " *bibitems*"))
  18.454 +	   (standard-output bbuf)
  18.455 +	   bibs files)
  18.456 +      (set-buffer bbuf)(erase-buffer)(set-buffer cb)
  18.457 +      (save-excursion
  18.458 +	(goto-char (point-min))
  18.459 +	;;(1)search external bibdata
  18.460 +	(while (YaTeX-re-search-active-forward bibrx pcnt nil t)
  18.461 +	  (apply 'YaTeX::cite-collect-bibs-external
  18.462 +		 (YaTeX-split-string
  18.463 +		  (YaTeX-match-string 1) ",")))
  18.464 +	;;(2)search direct \bibitem usage
  18.465 +	(YaTeX::cite-collect-bibs-internal)
  18.466 +	(if (progn
  18.467 +	      (YaTeX-visit-main t)
  18.468 +	      (not (eq (current-buffer) cb)))
  18.469 +	    (save-excursion
  18.470 +	      (goto-char (point-min))
  18.471 +	      ;;(1)search external bibdata
  18.472 +	      (while (YaTeX-re-search-active-forward bibrx pcnt nil t)
  18.473 +		(apply 'YaTeX::cite-collect-bibs-external
  18.474 +		       (YaTeX-split-string
  18.475 +			(YaTeX-match-string 1) ",")))
  18.476 +	      ;;(2)search internal
  18.477 +	      (YaTeX::cite-collect-bibs-internal)))
  18.478 +	;;Now bbuf holds the list of bibitem
  18.479 +	(set-buffer bbuf)
  18.480 +	(YaTeX::ref argp "\\\\\\(bibitem\\)\\(\\[.*\\]\\)?" "cite"))))
  18.481 +  
  18.482     (t nil)))
  18.483  
  18.484 +(and YaTeX-use-AMS-LaTeX (fset 'YaTeX::eqref 'YaTeX::ref))
  18.485 +
  18.486  (defun YaTeX-yatex-buffer-list ()
  18.487    (save-excursion
  18.488      (delq nil (mapcar (function (lambda (buf)
  18.489 @@ -749,9 +1116,10 @@
  18.490  
  18.491  ;;; -------------------- LaTeX2e stuff --------------------
  18.492  (defvar YaTeX:documentclass-options-default
  18.493 -  '(("a4paper") ("a5paper") ("b5paper") ("10pt") ("11pt") ("12pt")
  18.494 +  '(("a4paper") ("a5paper") ("b4paper") ("b5paper") ("10pt") ("11pt") ("12pt")
  18.495      ("latterpaper") ("legalpaper") ("executivepaper") ("landscape")
  18.496      ("oneside") ("twoside") ("draft") ("final") ("leqno") ("fleqn") ("openbib")
  18.497 +    ("tombow") ("titlepage") ("notitlepage") ("dvips")
  18.498      ("clock")				;for slides class only
  18.499      )
  18.500      "Default options list for documentclass")
  18.501 @@ -773,6 +1141,7 @@
  18.502      (if (string< "" opt)
  18.503  	(progn
  18.504  	  (while substr
  18.505 +
  18.506  	    (setq o (substring substr 0 (string-match delim substr)))
  18.507  	    (or (assoc o dt)
  18.508  		(YaTeX-update-table
  18.509 @@ -811,6 +1180,77 @@
  18.510        (if (string= "" sname) (setq sname YaTeX-default-documentclass))
  18.511        (setq YaTeX-default-documentclass sname)))))
  18.512  
  18.513 +(defvar YaTeX:latex2e-named-color-alist
  18.514 +  '(("GreenYellow") ("Yellow") ("Goldenrod") ("Dandelion") ("Apricot")
  18.515 +    ("Peach") ("Melon") ("YellowOrange") ("Orange") ("BurntOrange")
  18.516 +    ("Bittersweet") ("RedOrange") ("Mahogany") ("Maroon") ("BrickRed")
  18.517 +    ("Red") ("OrangeRed") ("RubineRed") ("WildStrawberry") ("Salmon")
  18.518 +    ("CarnationPink") ("Magenta") ("VioletRed") ("Rhodamine") ("Mulberry")
  18.519 +    ("RedViolet") ("Fuchsia") ("Lavender") ("Thistle") ("Orchid")("DarkOrchid")
  18.520 +    ("Purple") ("Plum") ("Violet") ("RoyalPurple") ("BlueViolet")
  18.521 +    ("Periwinkle") ("CadetBlue") ("CornflowerBlue") ("MidnightBlue")
  18.522 +    ("NavyBlue") ("RoyalBlue") ("Blue") ("Cerulean") ("Cyan") ("ProcessBlue")
  18.523 +    ("SkyBlue") ("Turquoise") ("TealBlue") ("Aquamarine") ("BlueGreen")
  18.524 +    ("Emerald") ("JungleGreen") ("SeaGreen") ("Green") ("ForestGreen")
  18.525 +    ("PineGreen") ("LimeGreen") ("YellowGreen") ("SpringGreen") ("OliveGreen")
  18.526 +    ("RawSienna") ("Sepia") ("Brown") ("Tan") ("Gray") ("Black") ("White"))
  18.527 +  "Colors defined in $TEXMF/tex/plain/colordvi.tex")
  18.528 +
  18.529 +(defvar YaTeX:latex2e-basic-color-alist
  18.530 +  '(("black") ("white") ("red") ("blue") ("yellow") ("green") ("cyan")
  18.531 +    ("magenta"))
  18.532 +  "Basic colors")
  18.533 +
  18.534 +(defun YaTeX:textcolor ()
  18.535 +  "Add-in for \\color's option"
  18.536 +  (if (y-or-n-p "Use `named' color? ")
  18.537 +      "[named]"))
  18.538 +
  18.539 +(defun YaTeX::color-completing-read (prompt)
  18.540 +  (let ((completion-ignore-case t)
  18.541 +	(namedp (save-excursion
  18.542 +		  (skip-chars-backward "^\n\\[\\\\")
  18.543 +		  (looking-at "named"))))
  18.544 +    (completing-read
  18.545 +     prompt
  18.546 +     (if namedp
  18.547 +	 YaTeX:latex2e-named-color-alist
  18.548 +       YaTeX:latex2e-basic-color-alist)
  18.549 +     nil t)))
  18.550 +
  18.551 +(defun YaTeX::textcolor (argp)
  18.552 +  "Add-in for \\color's argument"
  18.553 +  (cond
  18.554 +   ((= argp 1) (YaTeX::color-completing-read "Color: "))
  18.555 +   ((= argp 2) (read-string "Colored string: "))))
  18.556 +
  18.557 +(fset 'YaTeX:color 'YaTeX:textcolor)
  18.558 +(fset 'YaTeX::color 'YaTeX::textcolor)
  18.559 +(fset 'YaTeX:colorbox 'YaTeX:textcolor)
  18.560 +(fset 'YaTeX::colorbox 'YaTeX::textcolor)
  18.561 +(fset 'YaTeX:fcolorbox 'YaTeX:textcolor)
  18.562 +
  18.563 +(defun YaTeX::fcolorbox (argp)
  18.564 +  (cond
  18.565 +   ((= argp 1) (YaTeX::color-completing-read "Frame color: "))
  18.566 +   ((= argp 2) (YaTeX::color-completing-read "Inner color: "))
  18.567 +   ((= argp 3) (read-string "Colored string: "))))
  18.568 +
  18.569 +(defun YaTeX:scalebox ()
  18.570 +  "Add-in for \\rotatebox"
  18.571 +  (let ((vmag (read-string (if YaTeX-japan "倍率: " "Magnification: ")))
  18.572 +	(hmag (read-string (if YaTeX-japan "横倍率(省略可): "
  18.573 +			     "Horizontal magnification(Optional): "))))
  18.574 +    (if (and hmag (string< "" hmag))
  18.575 +	(format "{%s}[%s]" vmag hmag)
  18.576 +      (format "{%s}" vmag))))
  18.577 +
  18.578 +(defun YaTeX::includegraphics (argp)
  18.579 +  "Add-in for \\includegraphics"
  18.580 +  (cond
  18.581 +   ((= argp 1)
  18.582 +    (read-file-name "EPS File: " ""))))
  18.583 + 
  18.584  (defun YaTeX:caption ()
  18.585    (setq section-name "label")
  18.586    nil)
    19.1 --- a/yatexenv.el	Thu Jul 15 04:58:26 1999 +0000
    19.2 +++ b/yatexenv.el	Sun Apr 09 03:37:47 2000 +0000
    19.3 @@ -1,8 +1,8 @@
    19.4  ;;; -*- Emacs-Lisp -*-
    19.5  ;;; YaTeX environment-specific functions.
    19.6  ;;; yatexenv.el
    19.7 -;;; (c ) 1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
    19.8 -;;; Last modified Wed Jan 14 16:44:36 1998 on firestorm
    19.9 +;;; (c ) 1994-1997 by HIROSE Yuuji.[yuuji@yatex.org]
   19.10 +;;; Last modified Thu Aug 26 18:14:51 1999 on firestorm
   19.11  ;;; $Id$
   19.12  
   19.13  ;;;
    20.1 --- a/yatexgen.el	Thu Jul 15 04:58:26 1999 +0000
    20.2 +++ b/yatexgen.el	Sun Apr 09 03:37:47 2000 +0000
    20.3 @@ -1,12 +1,11 @@
    20.4  ;;; -*- Emacs-Lisp -*-
    20.5  ;;; YaTeX add-in function generator.
    20.6  ;;; yatexgen.el rev.5
    20.7 -;;; (c )1991-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
    20.8 -;;; Last modified Thu Feb 15 01:44:24 1996 on nsr
    20.9 +;;; (c )1991-1995,1999 by HIROSE Yuuji.[yuuji@yatex.org]
   20.10 +;;; Last modified Thu Aug 26 18:15:14 1999 on firestorm
   20.11  ;;; $Id$
   20.12  
   20.13  (require 'yatex)
   20.14 -(provide 'yatexgen)
   20.15  
   20.16  (defmacro YaTeX-setq (var japanese english)
   20.17    (list 'setq var
   20.18 @@ -143,7 +142,7 @@
   20.19    10 "Window height of YaTeX-generate-message-buffer")
   20.20  
   20.21  ;; Do you need learning for generated function?
   20.22 -;; If you need, please tell me (yuuji@ae.keio.ac.jp)
   20.23 +;; If you need, please tell me (yuuji@yatex.org)
   20.24  ;;(defvar YaTeX-generate-variables-for-learning nil)
   20.25  ;;(defvar YaTeX-generate-current-completion-table nil)
   20.26  
   20.27 @@ -153,7 +152,7 @@
   20.28  (defun YaTeX-generate ()
   20.29    "Genarate YaTeX add-in function with enquiry."
   20.30    (interactive)
   20.31 -  (if (< (screen-height) (+ YaTeX-generate-message-height 10))
   20.32 +  (if (< (YaTeX-screen-height) (+ YaTeX-generate-message-height 10))
   20.33        (error YaTeX-generate-narrow-message))
   20.34    (put 'YaTeX-generate 'disabled t)
   20.35    (save-window-excursion
   20.36 @@ -609,3 +608,4 @@
   20.37        command
   20.38        (string-to-int (read-string "How many arguments?: ")))) nil)
   20.39  )
   20.40 +(provide 'yatexgen)
    21.1 --- a/yatexhie.el	Thu Jul 15 04:58:26 1999 +0000
    21.2 +++ b/yatexhie.el	Sun Apr 09 03:37:47 2000 +0000
    21.3 @@ -1,8 +1,8 @@
    21.4  ;;; -*- Emacs-Lisp -*-
    21.5  ;;; YaTeX hierarchy browser.
    21.6  ;;; yatexhie.el
    21.7 -;;; (c )1995 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
    21.8 -;;; Last modified Thu Sep 17 21:46:29 1998 on firestorm
    21.9 +;;; (c )1995 by HIROSE Yuuji [yuuji@yatex.org]
   21.10 +;;; Last modified Wed Dec  1 23:41:01 1999 on firestorm
   21.11  ;;; $Id$
   21.12  
   21.13  ;; ----- Customizable variables -----
   21.14 @@ -55,10 +55,14 @@
   21.15        (set-buffer cb)
   21.16        (nreverse list))))
   21.17  
   21.18 -(defun YaTeX-document-hierarchy (&optional file)
   21.19 +(defun YaTeX-document-hierarchy (&optional file basedir)
   21.20    "Return the document hierarchy beginning from FILE as a list.
   21.21  If FILE is nil, beginning with current buffer's file."
   21.22    (setq file (or file buffer-file-name))
   21.23 +  (and YaTeX-search-file-from-top-directory
   21.24 +       (not (file-exists-p file))
   21.25 +       (string-match "^[^/].*/" file)
   21.26 +       (setq file (expand-file-name file basedir)))
   21.27    (message "Parsing [%s]..." (file-name-nondirectory file))
   21.28    (prog1
   21.29        (save-excursion
   21.30 @@ -71,7 +75,8 @@
   21.31  			(YaTeX-get-builtin "!")
   21.32  			(setq YaTeX-parent-file parent))))
   21.33  	      (cons (buffer-file-name (current-buffer))
   21.34 -		    (mapcar 'YaTeX-document-hierarchy	;return value
   21.35 +		    (mapcar '(lambda (f) 	;return value
   21.36 +			       (YaTeX-document-hierarchy f basedir))
   21.37  			    (YaTeX-all-included-files))))))
   21.38      (message "Parsing [%s]...done" (file-name-nondirectory file))))
   21.39  
   21.40 @@ -145,12 +150,11 @@
   21.41  		   (boundp 'win:current-config)
   21.42  		   win:current-config)))
   21.43    (let*((b-in (YaTeX-get-builtin "!"))
   21.44 -	(default (or YaTeX-parent-file
   21.45 -		     (and b-in (YaTeX-guess-parent b-in))
   21.46 -		     buffer-file-name)))
   21.47 +	default)
   21.48      ;;$B$`!<$s"-$3$N$X$s$N;EMM$I$&$7$?$i$$$$$+NI$/J,$+$i$s(B...
   21.49      (if default (setq default (expand-file-name default)))
   21.50      (YaTeX-visit-main t)		;move to parent file
   21.51 +    (setq default buffer-file-name)
   21.52      (setq file
   21.53  	  (or (if use-default default file)
   21.54  	      (read-file-name
   21.55 @@ -162,13 +166,14 @@
   21.56  	       "" default 1))))
   21.57    (setq file (expand-file-name file))
   21.58    (setq YaTeX-hierarchy-current-main file)
   21.59 -  (let ((dbuf "*document hierarchy*"))
   21.60 +  (let ((dbuf "*document hierarchy*")
   21.61 +	(topdir default-directory))
   21.62      (YaTeX-showup-buffer dbuf nil t)
   21.63      (set-buffer (get-buffer dbuf))
   21.64      (setq truncate-lines t)
   21.65      (let ((buffer-read-only nil))
   21.66        (erase-buffer)
   21.67 -      (YaTeX-display-a-hierachy (YaTeX-document-hierarchy file) 0))
   21.68 +      (YaTeX-display-a-hierachy (YaTeX-document-hierarchy file topdir) 0))
   21.69      (goto-char (point-min))
   21.70      (YaTeX-hierarchy-next 0)
   21.71      (set-buffer-modified-p nil)
    22.1 --- a/yatexhlp.el	Thu Jul 15 04:58:26 1999 +0000
    22.2 +++ b/yatexhlp.el	Sun Apr 09 03:37:47 2000 +0000
    22.3 @@ -1,8 +1,8 @@
    22.4  ;;; -*- Emacs-Lisp -*-
    22.5  ;;; YaTeX helper with LaTeX commands and macros.
    22.6  ;;; yatexhlp.el
    22.7 -;;; (c )1994,1998 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
    22.8 -;;; Last modified Thu Mar 12 11:10:07 1998 on crx
    22.9 +;;; (c )1994,1998 by HIROSE Yuuji.[yuuji@yatex.org]
   22.10 +;;; Last modified Thu Aug 26 18:15:39 1999 on firestorm
   22.11  ;;; $Id$
   22.12  
   22.13  (let ((help-file (concat "YATEXHLP."
    23.1 --- a/yatexlib.el	Thu Jul 15 04:58:26 1999 +0000
    23.2 +++ b/yatexlib.el	Sun Apr 09 03:37:47 2000 +0000
    23.3 @@ -1,8 +1,8 @@
    23.4  ;;; -*- Emacs-Lisp -*-
    23.5  ;;; YaTeX and yahtml common libraries, general functions and definitions
    23.6  ;;; yatexlib.el
    23.7 -;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    23.8 -;;; Last modified Tue May  4 10:25:55 1999 on firestorm
    23.9 +;;; (c )1994-2000 by HIROSE Yuuji.[yuuji@yatex.org]
   23.10 +;;; Last modified Sun Apr  9 12:36:25 2000 on firestorm
   23.11  ;;; $Id$
   23.12  
   23.13  ;; General variables
   23.14 @@ -16,6 +16,9 @@
   23.15  (defvar YaTeX-japan (or (boundp 'NEMACS) (boundp 'MULE) YaTeX-emacs-20)
   23.16    "Whether yatex mode is running on Japanese environment or not.")
   23.17  
   23.18 +;; autoload from yahtml.el
   23.19 +(autoload 'yahtml-inner-environment-but "yahtml" "yahtml internal func." t)
   23.20 +
   23.21  (defvar YaTeX-kanji-code-alist
   23.22    (cond
   23.23     ((boundp '*junet*)
   23.24 @@ -318,7 +321,14 @@
   23.25    "Switch to buffer if buffer exists, find file if not.
   23.26  Optional second arg SETBUF t make use set-buffer instead of switch-to-buffer."
   23.27    (interactive "Fswitch to file: ")
   23.28 -  (if (bufferp file) (setq file (buffer-file-name file)))
   23.29 +  (if (bufferp file)
   23.30 +      (setq file (buffer-file-name file))
   23.31 +    (and (string-match "^[^/].*/" file)
   23.32 +	 (eq major-mode 'yatex-mode)
   23.33 +	 YaTeX-search-file-from-top-directory
   23.34 +	 (save-excursion
   23.35 +	   (YaTeX-visit-main t)
   23.36 +	   (setq file (expand-file-name file)))))
   23.37    (let (buf (hilit-auto-highlight (not setbuf)))
   23.38      (cond
   23.39       ((setq buf (get-file-buffer file))
   23.40 @@ -337,6 +347,13 @@
   23.41  (defun YaTeX-switch-to-buffer-other-window (file)
   23.42    "Switch to buffer if buffer exists, find file if not."
   23.43    (interactive "Fswitch to file: ")
   23.44 +  (and (eq major-mode 'yatex-mode)
   23.45 +       (stringp file)
   23.46 +       (string-match "^[^/].*/" file)
   23.47 +       YaTeX-search-file-from-top-directory
   23.48 +       (save-excursion
   23.49 +	 (YaTeX-visit-main t)
   23.50 +	 (setq file (expand-file-name file))))
   23.51    (if (bufferp file) (setq file (buffer-file-name file)))
   23.52    (cond
   23.53     ((get-file-buffer file)
   23.54 @@ -347,13 +364,24 @@
   23.55     (t (message "%s was not found in this directory." file)
   23.56        nil)))
   23.57  
   23.58 +(defun YaTeX-get-file-buffer (file)
   23.59 +  "Return the FILE's buffer.
   23.60 +Base directory is that of main file or current directory."
   23.61 +  (let (dir main (cdir default-directory))
   23.62 +    (or (and (eq major-mode 'yatex-mode)
   23.63 +	     YaTeX-search-file-from-top-directory
   23.64 +	     (save-excursion
   23.65 +	       (YaTeX-visit-main t)
   23.66 +	       (get-file-buffer file)))
   23.67 +	(get-file-buffer file))))
   23.68 +
   23.69  (defun YaTeX-replace-format-sub (string format repl)
   23.70    (let ((beg (or (string-match (concat "^\\(%" format "\\)") string)
   23.71  		 (string-match (concat "[^%]\\(%" format "\\)") string)))
   23.72  	(len (length format)))
   23.73      (if (null beg) string ;no conversion
   23.74        (concat
   23.75 -       (substring string 0 (match-beginning 1)) repl
   23.76 +       (substring string 0 (match-beginning 1)) (or repl "")
   23.77         (substring string (match-end 1))))))
   23.78  
   23.79  ;;;###autoload
   23.80 @@ -367,6 +395,15 @@
   23.81      string))
   23.82  
   23.83  ;;;###autoload
   23.84 +(defun YaTeX-replace-formats (string replace-list)
   23.85 +  (let ((list replace-list))
   23.86 +    (while list
   23.87 +      (setq string (YaTeX-replace-format
   23.88 +		    string (car (car list)) (cdr (car list)))
   23.89 +	    list (cdr list)))
   23.90 +    string))
   23.91 +
   23.92 +;;;###autoload
   23.93  (defun YaTeX-replace-format-args (string &rest args)
   23.94    "Translate the argument mark #1, #2, ... #n in the STRING into the
   23.95  corresponding real arguments ARGS."
   23.96 @@ -643,13 +680,49 @@
   23.97  (fset 'YaTeX-rassoc
   23.98        (if (and nil (fboundp 'rassoc) (subrp (symbol-function 'rassoc)))
   23.99  	  (symbol-function 'rassoc)
  23.100 -	(lambda (key list)
  23.101 -	  (let ((l list))
  23.102 -	    (catch 'found
  23.103 -	      (while l
  23.104 -		(if (equal key (cdr (car l)))
  23.105 -		    (throw 'found (car l)))
  23.106 -		(setq l (cdr l))))))))
  23.107 +	(function
  23.108 +	 (lambda (key list)
  23.109 +	   (let ((l list))
  23.110 +	     (catch 'found
  23.111 +	       (while l
  23.112 +		 (if (equal key (cdr (car l)))
  23.113 +		     (throw 'found (car l)))
  23.114 +		 (setq l (cdr l)))))))))
  23.115 +
  23.116 +(defun YaTeX-insert-file-contents (file visit &optional beg end)
  23.117 +  (cond
  23.118 +   ((string< "19" emacs-version)
  23.119 +    (insert-file-contents file visit beg end))
  23.120 +   ((string-match "unix" (symbol-name system-type))
  23.121 +    (let ((default-process-coding-system
  23.122 +	    (and (boundp '*noconv*) (list *noconv*)))
  23.123 +	  file-coding-system (and (boundp '*noconv*) *noconv*)
  23.124 +	  kanji-fileio-code
  23.125 +	  (default-process-kanji-code 0))
  23.126 +      (call-process shell-file-name file (current-buffer) nil
  23.127 +		    (or (and (boundp 'shell-command-option)
  23.128 +			     shell-command-option)
  23.129 +			"-c")
  23.130 +		    (format "head -c %d | tail -c +%d" end beg))))
  23.131 +    (t (insert-file-contents file))))
  23.132 +
  23.133 +(defun YaTeX-split-string (str &optional sep null)
  23.134 +  "Split string STR by every occurrence of SEP(regexp).
  23.135 +If the optional second argument SEP is nil, it defaults to \"[ \f\t\n\r\v]+\".
  23.136 +Do not include null string by default.  Non-nil for optional third argument
  23.137 +NULL includes null string in a list."
  23.138 +  (let ((sep (or sep "[ \f\t\n\r\v]+"))
  23.139 +	list m)
  23.140 +    (while str
  23.141 +      (if (setq m (string-match sep str))
  23.142 +	  (progn
  23.143 +	    (if (or (> m 0) null)
  23.144 +		(setq list (cons (substring str 0 m) list)))
  23.145 +	    (setq str (substring str (match-end 0))))
  23.146 +	(if (or null (string< "" str))
  23.147 +	    (setq list (cons str list)))
  23.148 +	(setq str nil)))
  23.149 +    (nreverse list)))
  23.150  
  23.151  ;;;
  23.152  ;; Interface function for windows.el
  23.153 @@ -752,6 +825,52 @@
  23.154  		   (YaTeX-replace-format-args YaTeX-struct-begin env "" "")
  23.155  		   (count-lines (point-min) (point))))))))
  23.156  
  23.157 +(defun YaTeX-beginning-of-environment (&optional limit-search-bound end)
  23.158 +  "Goto the beginning of the current environment.
  23.159 +Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound to
  23.160 +most recent sectioning command.  Non-nil for optional third argument END
  23.161 +goes to end of environment."
  23.162 +  (interactive)
  23.163 +  (let ((op (point)))
  23.164 +    (if (YaTeX-inner-environment limit-search-bound)
  23.165 +	(progn
  23.166 +	  (goto-char (get 'YaTeX-inner-environment 'point))
  23.167 +	  (and end (YaTeX-goto-corresponding-environment))
  23.168 +	  (if (interactive-p) (push-mark op))
  23.169 +	  t))))
  23.170 +
  23.171 +(defun YaTeX-end-of-environment (&optional limit-search-bound)
  23.172 +  "Goto the end of the current environment.
  23.173 +Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound
  23.174 +to most recent sectioning command."
  23.175 +  (interactive)
  23.176 +  (YaTeX-beginning-of-environment limit-search-bound t))
  23.177 +
  23.178 +(defun YaTeX-mark-environment ()
  23.179 +  "Mark current position and move point to end of environment."
  23.180 +  (interactive)
  23.181 +  (let ((curp (point)))
  23.182 +    (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin
  23.183 +	(forward-line 1)
  23.184 +      (beginning-of-line))
  23.185 +    (if (not (YaTeX-end-of-environment))   ;arg1 turns to match-beginning 1
  23.186 +	(progn
  23.187 +	  (goto-char curp)
  23.188 +	  (error "Cannot found the end of current environment."))
  23.189 +      (YaTeX-goto-corresponding-environment)
  23.190 +      (beginning-of-line)		;for confirmation
  23.191 +      (if (< curp (point))
  23.192 +	  (progn
  23.193 +	    (message "Mark this environment?(y or n): ")
  23.194 +	    (if (= (read-char) ?y) nil
  23.195 +	      (goto-char curp)
  23.196 +	      (error "Abort.  Please call again at more proper position."))))
  23.197 +      (set-mark-command nil)
  23.198 +      (YaTeX-goto-corresponding-environment)
  23.199 +      (end-of-line)
  23.200 +      (if (eobp) nil (forward-char 1)))))
  23.201 +
  23.202 +
  23.203  ;;;VER2
  23.204  (defun YaTeX-insert-struc (what env)
  23.205    (cond
  23.206 @@ -817,5 +936,4 @@
  23.207  	(mapcar 'byte-compile-file command-line-args-left)
  23.208  	(kill-emacs))))
  23.209  
  23.210 -	
  23.211  (provide 'yatexlib)
    24.1 --- a/yatexm-o.el	Thu Jul 15 04:58:26 1999 +0000
    24.2 +++ b/yatexm-o.el	Sun Apr 09 03:37:47 2000 +0000
    24.3 @@ -1,7 +1,7 @@
    24.4  ;;; -*- Emacs-Lisp -*-
    24.5  ;;; Sample startup file to invoke yatex-mode with outline-minor mode.
    24.6 -;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
    24.7 -;;; Last modified Mon Jan 29 21:38:26 1996 on pajero
    24.8 +;;; (c )1993 by HIROSE Yuuji [yuuji@yatex.org]
    24.9 +;;; Last modified Thu Aug 26 18:16:00 1999 on firestorm
   24.10  
   24.11  ;;;
   24.12  ;; outline-minor-mode(使用しない場合は不要です)
    25.1 --- a/yatexmth.el	Thu Jul 15 04:58:26 1999 +0000
    25.2 +++ b/yatexmth.el	Sun Apr 09 03:37:47 2000 +0000
    25.3 @@ -1,8 +1,8 @@
    25.4  ;;; -*- Emacs-Lisp -*-
    25.5  ;;; YaTeX math-mode-specific functions.
    25.6  ;;; yatexmth.el
    25.7 -;;; (c )1993-1999 by HIROSE Yuuji [yuuji@gentei.org]
    25.8 -;;; Last modified Thu Apr 29 17:39:10 1999 on firestorm
    25.9 +;;; (c )1993-1999 by HIROSE Yuuji [yuuji@yatex.org]
   25.10 +;;; Last modified Thu Sep 23 16:39:40 1999 on firestorm
   25.11  ;;; $Id$
   25.12  
   25.13  ;;; [Customization guide]
   25.14 @@ -551,7 +551,7 @@
   25.15  (defun YaTeX-math-show-menu (match-str)
   25.16    (save-window-excursion
   25.17      (YaTeX-showup-buffer YaTeX-math-menu-buffer nil t)
   25.18 -    (let ((maxcols (max 1 (/ (screen-width) YaTeX-math-sign-width)))
   25.19 +    (let ((maxcols (max 1 (/ (YaTeX-screen-width) YaTeX-math-sign-width)))
   25.20  	  (case-fold-search nil)
   25.21  	  (cols 0) (list alist) command)
   25.22        (erase-buffer)
   25.23 @@ -560,7 +560,7 @@
   25.24        (insert YaTeX-math-indicator "\t")
   25.25        (insert YaTeX-math-indicator)
   25.26        (newline 1)
   25.27 -      (insert-char ?- (1- (screen-width)))
   25.28 +      (insert-char ?- (1- (YaTeX-screen-width)))
   25.29        (newline 1)
   25.30        (while list
   25.31  	(if (string-match match-str (car (car list)))
    26.1 --- a/yatexprc.el	Thu Jul 15 04:58:26 1999 +0000
    26.2 +++ b/yatexprc.el	Sun Apr 09 03:37:47 2000 +0000
    26.3 @@ -1,8 +1,8 @@
    26.4  ;;; -*- Emacs-Lisp -*-
    26.5  ;;; YaTeX process handler.
    26.6  ;;; yatexprc.el
    26.7 -;;; (c )1993-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    26.8 -;;; Last modified Tue Jul 13 13:47:46 1999 on firestorm
    26.9 +;;; (c )1993-1999 by HIROSE Yuuji.[yuuji@yatex.org]
   26.10 +;;; Last modified Sat Dec 18 22:16:11 1999 on firestorm
   26.11  ;;; $Id$
   26.12  
   26.13  ;(require 'yatex)
   26.14 @@ -479,7 +479,7 @@
   26.15  	   (buffer-substring
   26.16  	    (point)
   26.17  	    (progn (skip-chars-forward "0-9" (match-end 0)) (point))))
   26.18 -	  error-buffer (YaTeX-get-error-file cur-buf))
   26.19 +	  error-buffer (expand-file-name (YaTeX-get-error-file cur-buf)))
   26.20      (if (or (null error-line) (equal 0 error-line))
   26.21  	(error "Can't detect error position."))
   26.22      (YaTeX-set-virtual-error-position 'error-buffer 'error-line)
   26.23 @@ -517,7 +517,8 @@
   26.24        (goto-char (match-beginning 0))
   26.25        (setq error-line (string-to-int
   26.26  			(buffer-substring (match-beginning 1) (match-end 1)))
   26.27 -	    error-file (YaTeX-get-error-file YaTeX-current-TeX-buffer))
   26.28 +	    error-file (expand-file-name
   26.29 +			(YaTeX-get-error-file YaTeX-current-TeX-buffer)))
   26.30        (YaTeX-set-virtual-error-position 'error-file 'error-line)
   26.31        (setq error-buf (YaTeX-switch-to-buffer error-file t)))
   26.32        (if (null error-buf)
   26.33 @@ -710,7 +711,9 @@
   26.34     (YaTeX-parent-file
   26.35      (eq (get-file-buffer YaTeX-parent-file) (current-buffer)))
   26.36     ((YaTeX-get-builtin "!")
   26.37 -    (string-match (YaTeX-guess-parent (YaTeX-get-builtin "!")) (buffer-name)))
   26.38 +    (string-match
   26.39 +     (concat "^" (YaTeX-guess-parent (YaTeX-get-builtin "!")))
   26.40 +     (buffer-name)))
   26.41     (t
   26.42      (save-excursion
   26.43        (let ((latex-main-id
   26.44 @@ -724,7 +727,11 @@
   26.45  SETBUF is t(Use it only from Emacs-Lisp program)."
   26.46    (interactive "P")
   26.47    (if (and (interactive-p) setbuf) (setq YaTeX-parent-file nil))
   26.48 -  (let (b-in main-file)
   26.49 +  (let ((ff (function (lambda (f)
   26.50 +			(if setbuf (set-buffer (find-file-noselect f))
   26.51 +			  (find-file f)))))
   26.52 +	b-in main-file YaTeX-create-file-prefix-g
   26.53 +	(hilit-auto-highlight (not setbuf)))
   26.54      (if (setq b-in (YaTeX-get-builtin "!"))
   26.55  	(setq main-file (YaTeX-guess-parent b-in)))
   26.56      (if YaTeX-parent-file
   26.57 @@ -733,18 +740,30 @@
   26.58      (if (YaTeX-main-file-p)
   26.59  	(if (interactive-p) (message "I think this is main LaTeX source.") nil)
   26.60        (cond
   26.61 -       ((and (interactive-p) main-file (get-file-buffer main-file))
   26.62 -	(goto-buffer-window main-file))
   26.63 -       ((and main-file (YaTeX-switch-to-buffer main-file setbuf)))
   26.64 +       ((and ;;(interactive-p) 
   26.65 +	     main-file
   26.66 +	     (cond ((get-file-buffer main-file)
   26.67 +		    (cond
   26.68 +		     (setbuf (set-buffer (get-file-buffer main-file)))
   26.69 +		     ((get-buffer-window (get-file-buffer main-file))
   26.70 +		      (select-window
   26.71 +		       (get-buffer-window (get-file-buffer main-file))))
   26.72 +		     (t (switch-to-buffer (get-file-buffer main-file)))))
   26.73 +		   ((file-exists-p main-file)
   26.74 +		    (funcall ff main-file)))))
   26.75 +       ;;((and main-file (YaTeX-switch-to-buffer main-file setbuf)))
   26.76         ((and main-file
   26.77  	     (file-exists-p (setq main-file (concat "../" main-file)))
   26.78  	     (y-or-n-p (concat (expand-file-name main-file)
   26.79  			       " is main file?:")))
   26.80  	(setq YaTeX-parent-file main-file)
   26.81 -	(YaTeX-switch-to-buffer main-file setbuf))
   26.82 +	;(YaTeX-switch-to-buffer main-file setbuf)
   26.83 +	(funcall ff main-file)
   26.84 +	)
   26.85         (t (setq main-file (read-file-name "Enter your main text: " nil nil 1))
   26.86  	  (setq YaTeX-parent-file main-file)
   26.87 -	  (YaTeX-switch-to-buffer main-file setbuf))
   26.88 +	 ; (YaTeX-switch-to-buffer main-file setbuf))
   26.89 +	  (funcall ff main-file))
   26.90         )))
   26.91    nil)
   26.92  
    27.1 --- a/yatexsec.el	Thu Jul 15 04:58:26 1999 +0000
    27.2 +++ b/yatexsec.el	Sun Apr 09 03:37:47 2000 +0000
    27.3 @@ -1,8 +1,8 @@
    27.4  ;;; -*- Emacs-Lisp -*-
    27.5  ;;; YaTeX sectioning browser.
    27.6  ;;; yatexsec.el
    27.7 -;;; (c ) 1994, 1998 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
    27.8 -;;; Last modified Wed Sep 30 20:09:35 1998 on firestorm
    27.9 +;;; (c ) 1994, 1998 by HIROSE Yuuji [yuuji@yatex.org]
   27.10 +;;; Last modified Sun Dec 19 13:13:17 1999 on firestorm
   27.11  ;;; $Id$
   27.12  
   27.13  (defvar YaTeX-sectioning-level
   27.14 @@ -287,6 +287,7 @@
   27.15      (save-excursion
   27.16        (set-buffer (get-buffer-create YaTeX-sectioning-buffer))
   27.17        (setq buffer-read-only nil)
   27.18 +      (erase-buffer)
   27.19        (set-buffer cb)
   27.20        (YaTeX-showup-buffer YaTeX-sectioning-buffer) ;show buffer
   27.21        (goto-char (point-min))