diff --git a/docs/htmlqa b/docs/htmlqa index 96ab118..f6d5524 100644 --- a/docs/htmlqa +++ b/docs/htmlqa @@ -39,6 +39,16 @@ �������AEmacs-20 �� XEmacs �̏ꍇ�A�����R�[�h�̃V���{���̗��[��* �͕t���܂���B +�E
  • �̒���ɋ󔒓����htmllint�ɓ{���邩��󔒂Ȃ��ɂ������񂾂��ǁc + + ����Ahtmllint����肷���Ȃ�ł��B�^�O����̋󔒂ɑ΂��ĕ��傢�� + �̂� + http://www.cre.canon.co.uk/%7Eneilb/weblint/www5-paper.html + �ɂ��ƁA�󔒂����邱�Ƃŕςȃ��C�A�E�g�ɂȂ��Ă��܂��ւڃu���E + �U�ւ̔z���ɂ����̂Ȃ̂�HTML�I�ɂ͂܂�Ŗ��Ȃ���ł��B�Ƃ��� + htmllint���g����htmllint�ɓ{���Ȃ����Ǝ��̂��ړI�ƂȂ肪���ł� + ���A�킽���͂���͖{���]�|�ł���Ǝv���܂��B + ���ǂ��ɂ��Ȃ�񂩂Ȃ��֘A �E���������̉��̕����ƃC���f���g���߂���x���񂾂��ǁB @@ -100,7 +110,7 @@ �E�߂��ɂ���ڂ����l�ɕ��� �E���C�����O���X�g�Ɏ�����o�� - �Eyuuji@gentei.org �Ɏ�����o�� + �Eyuuji@yatex.org �Ɏ�����o�� �ł��傤���B���D���ȕ��@�łǂ����B diff --git a/docs/htmlqa.eng b/docs/htmlqa.eng new file mode 100644 index 0000000..b2fe2d3 --- /dev/null +++ b/docs/htmlqa.eng @@ -0,0 +1,123 @@ +%% +%% Q and A on yahtml +%% +%% C-u C-x $ shows only questions. C-x $ shows all. +%% + +[Installation] +============== +*Must I install YaTeX even if I don't use LaTeX? + + No. Get the files starting with "yahtml" from + ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/text/yatex/ + and that's all you will need. + +[Customization] +============== +*I usually use EUC, but need JIS coding on some files. + + Write + (setq yahtml-kanji-code 3) ;3 for EUC + and your default kanji code for HTML files will be EUC. + Now to change codings foe selected files. If your server is + Apache, then prepare a file named ".htaccess" in the directory + and write + + AddType "text/html; charset=iso-2020-jp" .html + + Apache will now inform all your visitors that the html files + in this directory are in iso-2022-jp, aka JIS. yahtml will + also follow this and encode all files in this directory with JIS. + + Not using Apache? Then adding the following to the end of your + html source will make this files coding system JIS. + + + + + + Note that Emacs-20 and XEmacs do not need the "*" in the kanji + code symbol. + +[What about...] +============== +*Indentation for a large file is slow + + Should be fixed. + +*Inserting template.html + + Use autoinsert.el that comes with Emacs19/Mule2. Another + option is to use auto-insert-tkld. The latter can be found at + ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/auto-inset-tkld.tar.Z + Examples in Japanese are at + http://www-nagao.kuee.kyoto-u.ac.jp/member/tsuchiya/elisp/yahtml-mode.html + +[ETC] +============ +*How do I pronounce yahtml + + A real FAQ. The author doesn't know either. Any ideas? + ... It hits on me! We define the official name of yahtml as; + + HTML-Ya + + "Ya" is the Japanese word whose meaning is `shop', and sometimes + `enthusiast' of something. With HTML-Ya, do the publishment of + your thought efficiently and beautifully! + +*Mailing lists? + + A question, so an answer. The mailing list for YaTeX (Wild + Bird) and it's implementation to Vz; Raicho (by KATSURAGAWA, + Naoki), implementation to Wz Editor; HackTeX (by TAKKENAKA, + Hiroshi), implementation to Hidemaru; HiTeX (by YASUDA, + Haruyuki) is "fj Wild Bird Society". Send a mail like + + To: yatex@yatex.org + Subject: append + ----- + Hi! + My name is yuuji. + See any birds fly by? + + and you're in. Once you're in, you'll get a reply with lists of + commands used in the mailing list. Join along and help adding + new feathers to Wild Bird. BTW, if you haven't guessed it yet, + yes, this mailing list is in Japanese. But give us a try + anyway. You're always welcome. + +*How to get the up-to-date information on yahtml? + + If you can access WWW, try to see; + http://www.yatex.org/ + And if you trace the link of `yatex-current', you can get the + really latest version of yahtml. Since it collects the elisps in + the author's source directory, what you'll get may contain some + errors. The author cannot respond to your query about + yatex-current. + +*Help, help HELP!! + + Ways of getting answers in fastest order. + + *Look for someone near you who knows what's he/she's doing. + *Post a question to the mailing list. + *Send mail to yuuji@yatex.org + + take a pick. + +*Picking a question in this file with C-u C-x $ and hitting C-x $ takes + me to a weird world. + + You too? Try marking the question before C-x $ and to C-x C-x + to take you back to it. (Mule2 doesn't seem to have the same + problem) + + +Local Variables: +mode: indented-text +fill-column: 72 +fill-prefix: " " +End: + diff --git a/docs/qanda.eng b/docs/qanda.eng index 8f2b2f8..5c539a2 100644 --- a/docs/qanda.eng +++ b/docs/qanda.eng @@ -19,6 +19,17 @@ (After that, M-x info [RET] m yatex [RET] will give you Wild Bird's manual. Hitting ? will show how to use info) +*I'm a Meadow(Emacs on Win32) user. I don't have `make' utility + + Make program is needed only for byte-compiling. So if you do + not care the subtle speed difference, you don't have to + byte-compile. You don't have to look for `make' utility. The + simplest way to install yatex without `make'. + + 1 Extract this yatex*tar.gz to your Meadow's site-lisp dir. + 2 Add the yatex installed path to your load-path according to + `install' file in this package. + *I ain't got the privilege to write in the Info directory... Get yourself made root. If you can't, have them install Mule2 @@ -352,23 +363,22 @@ A question, so an answer. The mailing list for YaTeX (Wild Bird) and it's implementation to Vz; Raicho (by KATSURAGAWA, - Naoki; katsura@prc.tsukuba.ac.jp), implementation to Wz Editor; - HackTeX (by TAKKENAKA, Hiroshi), implementation to Hidemaru; - HiTeX (by YASUDA, Haruyuki) is "fj Wild Bird Society". Send a - mail like + Naoki), implementation to Wz Editor; HackTeX (by TAKKENAKA, + Hiroshi), implementation to Hidemaru; HiTeX (by YASUDA, + Haruyuki) is "fj Wild Bird Society". Send a mail like - To: yatex@jaist.ac.jp + To: yatex@yatex.org Subject: append ----- - Hi! My name is yuuji. + Hi! + My name is yuuji. See any birds fly by? - and you're in. The text will be used as your profile. (you can - change it later) Once you're in, you'll get a reply with lists - of commands used in the mailing list. Join along and help - adding new feathers to Wild Bird. BTW, if you haven't guessed - it yet, yes, this mailing list is in Japanese. But give us a - try anyway. You're always welcome. + and you're in. Once you're in, you'll get a reply with lists of + commands used in the mailing list. Join along and help adding + new feathers to Wild Bird. BTW, if you haven't guessed it yet, + yes, this mailing list is in Japanese. But give us a try + anyway. You're always welcome. *How to get the up-to-date information on YaTeX? @@ -386,7 +396,7 @@ *Look for someone near you who knows what's he/she's doing. *Post a question to the mailing list. - *Send mail to yuuji@gentei.org + *Send mail to yuuji@yatex.org take a pick. diff --git a/docs/yahtmle.tex b/docs/yahtmle.tex new file mode 100644 index 0000000..a1bc7ad --- /dev/null +++ b/docs/yahtmle.tex @@ -0,0 +1,485 @@ +\def\lang{eng} % -*- texinfo -*- for Texinfo V.3.1 +\input texinfo +@setfilename yahtmle +@settitle Yet Another html-mode for Emacs + +@iftex +@c @syncodeindex fn cp +@c Do people really read this INFO? +@c Still not finished +@c Last modified Mon Nov 29 16:01:00 1999 on buell +@syncodeindex vr cp +@end iftex + +@titlepage +@sp 10 +@center +@subtitle Yet Another html-mode for emacs +@title // yahtml // +%@subtitle // yahtml // +@author @copyright{} 1994-1997 by HIROSE, Yuuji [yuuji@@yatex.org] +@end titlepage + +@node Top, Intro, (dir), (dir) +@comment node-name, next, previous, up + +@menu +* Intro:: Introduction +* Installation:: Installing yahtml +* Command Invocation:: Using External Commands +* Completion:: Input with Completion +* Jump:: Moving the Cursor +* Changing and Deleting:: Changing and Deleting +* CSS Support:: Style Sheet Support +* Customizations:: List of Customize Variables +* Copying:: Copyright +* Concept Index:: Index +@end menu + +@node Intro, Installation, Top, Top +@comment node-name, next, previous, up +@chapter Introduction +@cindex Demacs +@cindex Mule +@cindex LaTeX +@cindex yahtml + +yahtml is a package to support creating HTML documents on Emacsens. Easy +input of elements (tags) by completion, syntax checking with programs like +weblint, and invoking the appropriate browser or image viewer depending on +the cursor position is its main features. + +(This Info is still incomplete) + +@node Installation, Command Invocation, Intro, Top +@comment node-name, next, previous, up +@chapter Installing yahtml +@menu +* Setting up yahtml:: +* Setting environments for weblint browsers and image viewers:: +* Setting environment variables for WWW pages:: +@end menu + +@node Setting up yahtml, Setting environments for weblint browsers and image viewers, Installation, Installation +@comment node-name, next, previous, up +@section Setting up yahtml + + +Add the following to @file{~/.emacs} + +@lisp +(setq auto-mode-alist + (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) +(autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) +@end lisp + +Next, add to load-path the directory with the yahtml files +(@file{yahtml.el}, @file{yatexlib.el}, @file{yatexprc.el}). For example, +if you put them in @file{~/src/emacs/yahtml}, + +@lisp +(setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path)) +@end lisp + +@noindent +is what you add. + +By this, yahtml will be automatically loaded when editing files with .html +extensions. "yahtml" will be displayed on the mode line if no errors +occurred. + +@node Setting environments for weblint browsers and image viewers, Setting environment variables for WWW pages, Setting up yahtml, Installation +@comment node-name, next, previous, up +@section Setting environments for weblint, browsers, and image viewers + +Check the variables for invoking external commands and modify as needed. +Defaults are in parenthesis. + +@table @code +@item yahtml-www-browser + @dots{} browser command name (netscape) +@item yahtml-image-viewer + @dots{} image viewer command name (xv) +@item yahtml-lint-program + @dots{} syntax check programs command name (jweblint) +@item yahtml-kanji-code + @dots{} kanji code for HTML files +@end table + +@node Setting environment variables for WWW pages, , Setting environments for weblint browsers and image viewers, Installation +@comment node-name, next, previous, up +@section Setting environment variables for WWW pages + +Variables regarding path names for files that will be your home page. +@table @code +@item yahtml-path-url-alist + @dots{} list of matching path name on file system and URLs +@item yahtml-directory-index + @dots{} index file displayed when none is given in URL. Usually + @file{index.html} on NCSA type httpd and @file{Welcome.html} on + CERN types. +@end table + +Examples for @code{yahtml-path-url-alist}. If @file{/home/yuuji/http/} +is @code{http://localhost/~yuuji} at home and @file{/usr/home/yuuji/www/} +is @code{http://www.keio.ac.jp/~yuuji/} at work, then + +@lisp +(setq yahtml-path-url-alist + '(("/home/yuuji/http" . "http://localhost/~yuuji") + ("/usr/home/yuuji/www" . "http://www.keio.ac.jp/~yuuji"))) +@end lisp + +Any number of additions can be made to this list. + +@node Command Invocation, Completion, Installation, Top +@comment node-name, next, previous, up +@chapter Invoking external commands + +For easy use of commands that are handy when editing HTML files. +@table @kbd +@item [prefix] t j + @dots{} Invoke HTML syntax checker (jweblint) +@item [prefix] t p + @dots{} Display current page in browser +@item [prefix] t r + @dots{} Reload current page if browser is already running +@end table + +@node Completion, Jump, Command Invocation, Top +@comment node-name, next, previous, up +@chapter Completion Input + +Completion input of HTML elements is done through the same key strokes as +YaTeX's begin-type completion, section-type completion, large-type +completion, maketitle-type completion, and accent completion. +Corresponding elements in this order is; elements that span multiple +lines, empty elements such as img, tags that start and end in a +single line, elements with no attributes or contents, and special or +symbol entities. + +@table @kbd +@item [prefix] b (YaTeX begin-type completion) +@dots{} +@example + +@end example + +@noindent +Completion for elements that the start tag and the end tag span multiple +lines. Mostly block-level elements. + +@item [prefix] s (YateX section-type completion) +@dots{} +@example +photo +@end example + +@noindent +Completion for elements that do not have end tags and require only +attributes. Possible completions are, , . + +@item [prefix] l (YaTeX large-type completion) +@dots{} + +@example + �` +@end example + +@noindent +Similar to begin-type completion but used for elements that start and end +on a single line. + + +@item [prefix] m (YaTeX maketitle-type completion) +@dots{} Completion for elements without attributes or contents. Possible +completion is
    + +@item [prefix] a (YaTeX accent completion) +@dots{} Used to enter special or symbol entities. By default completion +for < (<), > (>), & (&), " ("), ' ('), blank ( ) +is possible. +@end table + +@node Jump, Changing and Deleting, Completion, Top +@comment node-name, next, previous, up +@chapter Cursor Movement +By using + +@table @kbd +@item [prefix] g + @dots{} move to corresponding object +@end table + +@noindent +the cursor will go to the corresponding object according to the context. +Recognized contexts are + +@itemize @bullet +@item @code{} <--> @code{} +@item @code{} -> invoke viewer +@item @code{} -> move cursor to linked target +@item @code{} -> open Java source +@c @item @code{\include(\input)} �� �Ή�����t�@�C�� +@end itemize + +@node Changing and Deleting, CSS Support, Jump, Top +@comment node-name, next, previous, up +@chapter Changing and Deleting + +@menu +* Changing tags in pairs:: +* Changing entities:: +* URLencoding of strings within region:: +@end menu + +@node Changing tags in pairs, Changing entities, Changing and Deleting, Changing and Deleting +@comment node-name, next, previous, up +@section Changing tags in pairs +By using + +@table @kbd +@item [prefix] c + @dots{} change tags in matching pairs +@end table + +@noindent +the content can be changed according to the context of the HTML document +where the cursor is located. + +@itemize @bullet +@item @code{}�`@code{} +@dots{} change @code{TAG} element name +@item attributes such as @code{photo} +@dots{} change attributes +@end itemize + +@node Changing entities, URLencoding of strings within region, Changing tags in pairs, Changing and Deleting +@comment node-name, next, previous, up +@section Changing entities +Special characters such as < or > must be written as < and >. Easy +conversion of these characters can be done when importing text from non +HTML files. + + +@table @kbd +@item [prefix] ; + @dots{} convert char to special entity in marked region +@item [prefix] : + @dots{} convert special entity to original char in marked region + (reverse of [prefix] ;) +@end table + + +@node URLencoding of strings within region, , Changing entities, Changing and Deleting +@comment node-name, next, previous, up +@section URLencoding of strings within region + +@table @kbd +@item [prefix] # + @dots{} encode chars that needs to be URLencoded within region +@end table + +@node CSS Support, Customizations, Changing and Deleting, Top +@comment node-name, next, previous, up +@chapter CSS(Style Sheets) Support + +@menu +* CSS-class completion:: +* Reread CSS definition:: +@end menu + +@node CSS-class completion, Reread CSS definition, CSS Support, CSS Support +@comment node-name, next, previous, up +@section CSS class-name completion +You can input a class name in your CSS definition with completion. +If you have CSS defined as below; + +@display + h1.foo, h2.foo @{ background-color: 0xffffff; @} + h1.bar, h2.bar @{ font-size: 120%; @} +@end display + +when you input h1(or h2) tag with completing-read by [prefix] b or +[prefix] l, yahtml prompts you to input class name with completion from +the words which are effective to h1 or h2. And if you defined +global class like this; + +@display + .caution @{ font-size: 120%; background-color: 0xc00000;@} +@end display + +when you input any tags via completing-read, yahtml prompts you to input +class name. If this is bothering, typing @kbd{C-j} instead of +@kbd{RET} (or @kbd{C-m}) cancels the next prompt to class name completion. + +@node Reread CSS definition, , CSS-class completion, CSS Support +@comment node-name, next, previous, up +@section Re-reading CSS definition +If you add some class to your CSS file and you want yahtml to load +new definitions, type @kbd{M-x yahtml-mode RET} to make yahtml do. + +@node Customizations, Copying, CSS Support, Top +@comment node-name, next, previous, up +@chapter Customizations +@cindex Customize +@cindex Key Assign + +Variables that modify yahtml's behavior. + +@menu +* All customizable variables:: List of customizable variables +* Hook variables:: hook variables +@end menu + +@node All customizable variables, Hook variables, Customizations, Customizations +@comment node-name, next, previous, up +@section List of customizable variables. Defaults in parenthesis + +@defvar yahtml-prefix +Prefix key for yahtml-mode. (@kbd{\C-c}) +@end defvar + +@defvar yahtml-image-viewer +Command to view image files refered by img. (xv) +@end defvar + +@defvar yahtml-www-browser +Browser to view external pages with @kbd{[prefix]g}. (netscape) +@end defvar + +@defvar yahtml-kanji-code +Default kanji code. 1=sjis, 2=jis, 3=euc (2) +If +@quotation + AddType "text/html; charset=xxx" .html +@end quotation +is written in .htaccess, this will override yahtml-kanji-code. +@end defvar + +@defvar yahtml-fill-column +Columns to auto-fill (72) +@end defvar + +@defvar yahtml-fill-prefix +fill-prefix specific to yahtml-mode. (@code{nil}) +@end defvar + +@defvar yahtml-path-url-alist +Matching list of URL and full path name on OS's file system. +@end defvar + +@defvar yahtml-directory-index +Default index filed opened when accessing a server without a filename, +usually index.html. (@code{"index.html"}) +@end defvar + +@defvar yahtml-lint-program +HTML syntax check program. (@code{"jweblint"}) +@end defvar + +@defvar yahtml-hate-too-deep-indentation +setq to t when indentations for nested enumerate elements are too deep. +(@code{nil}) +@end defvar + +@defvar yahtml-always-/p +setq to t if you always want @code{

    } after @code{

    }. @code{nil} +@end defvar + +@defvar yahtml-p-prefered-env-regexp +Elements that @code{

    } will be automatically inserted. @code{^\(body\|dl\)} +@end defvar + +@defvar yahtml-template-file +File to automatically insert when editing a new HTML file. +@file{"~/http/template.html"} +@end defvar + +@defvar yahtml-prefer-upcases +Use uppercase for tags. @code{nil} +@end defvar + +@defvar yahtml-prefer-upcase-attributes +Use uppercase for attributes. @code{nil} +@end defvar + +@defvar yahtml-server-type +setq to 'apache if using a Apache server, and will refer ./.htaccess. +@code{'apache} +@end defvar + +@defvar yahtml-apache-access-file +When @code{yahtml-server-type} is @code{'apache}, define name of access +restriction file. @file{".htaccess"} +@end defvar + +@defvar yahtml-shell-command-option +Options needed to invoke shell commands. +@end defvar + +@defvar yahtml-translate-hyphens-when-comment-region +Whether to change hyphens to @code{-} when commenting out region. +(@code{t}) +@end defvar + +@defvar yahtml-entity-reference-chars-alist +alist of characters that needs to be written by Entity Reference. Enter +as @code{'(?char . "EntityReference")}. By default, @code{<}, @code{>}, +@code{&}, @code{'}, is set. Add as needed. Do not include @code{&} at +beginning and @code{;} at end of cdr portion of @code{"EntityReference"}. +@end defvar + +@defvar yahtml-faithful-to-htmllint +When using htmllint to check syntax, it will complain about excess spaces. +setq to @code{t} to avoid this. +@end defvar + + +@node Hook variables, , All customizable variables, Customizations +@comment node-name, next, previous, up +@section hook variables + + +@node Copying, Concept Index, Customizations, Top +@comment node-name, next, previous, up +@chapter Copying + +This program is distributed as freesoftware. The author will take no +responsibility to any damages due to the usage of this software +whatsoever. There are no restrictions to its redistribution, just use +common sense. Mail me your thoughts on this program and I will be more +than willing to help. + +Complaints, requests, bug reports and comments are welcome. Make contacts +to yuuji@@yatex.org�@(as of July 1999) + +If you like this program and use it on a regular basis, please join the +mailing list "fj Wild Bird Society". Procedures can be found in the "etc" +section of @file{docs/yahtmlqa} in this package. + + +@flushright +HIROSE, Yuuji +@end flushright + + +@node Concept Index, , Copying, Top +@comment node-name, next, previous, up +@unnumbered Index +@printindex cp + + +@contents + +@bye + +@c Local Variables: +@c fill-column: 74 +@c fill-prefix: nil +@c End: + +Tag table: + +End tag table diff --git a/docs/yahtmlj.tex b/docs/yahtmlj.tex index e9d53d6..287e1af 100644 --- a/docs/yahtmlj.tex +++ b/docs/yahtmlj.tex @@ -7,6 +7,7 @@ @c @syncodeindex fn cp @c Info���čŋߓǂސl���������炵�� @c �܂������I����Ă��܂���B +@c Last modified Mon Nov 29 15:43:04 1999 on buell @syncodeindex vr cp @end iftex @@ -16,7 +17,7 @@ @subtitle Yet Another html-mode for emacs @title �wHTML���x @subtitle // yahtml // -@author @copyright{} 1994-1997 by HIROSE, Yuuji [yuuji@@gentei.org] +@author @copyright{} 1994-1997 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, Intro, (dir), (dir) @@ -29,6 +30,7 @@ * Completion:: �⊮���� * Jump:: �J�[�\���W�����v * Changing and Deleting:: �ύX�ƍ폜 +* CSS Support:: �X�^�C���V�[�g�⊮ * Customizations:: �J�X�^�}�C�Y�ϐ��ꗗ * Copying:: �Ƃ肠�‚��� * Concept Index:: ���� @@ -221,7 +223,7 @@ @c @item @code{\include(\input)} �� �Ή�����t�@�C�� @end itemize -@node Changing and Deleting, Customizations, Jump, Top +@node Changing and Deleting, CSS Support, Jump, Top @comment node-name, next, previous, up @chapter �ύX/�폜 @@ -249,7 +251,7 @@ @itemize @bullet @item @code{}�`@code{} @dots{} @code{TAG} �̕ύX -@item @code{ alt="photo"} �Ȃǂ̑����l +@item @code{photo} �Ȃǂ̑����l @dots{} �����l�̕ύX @end itemize @@ -279,8 +281,65 @@ �G���R�[�h�\�L�ɒu���B @end table +@node CSS Support, Customizations, Changing and Deleting, Top +@comment node-name, next, previous, up +@chapter CSS(�X�^�C���V�[�g)�T�|�[�g -@node Customizations, Copying, Changing and Deleting, Top +@menu +* CSS-class completion:: +* Reread CSS file:: +@end menu + +@node CSS-class completion, Reread CSS file, CSS Support, CSS Support +@comment node-name, next, previous, up +@section CSS�N���X���⊮ +HTML����CSS(Cascading Style Sheets)�̃N���X����⊮���͂��邱�Ƃ��ł��܂��B +�X�^�C����`�Ƃ��� + +@display + h1.foo, h2.foo @{ background-color: 0xffffff; @} + h1.bar, h2.bar @{ font-size: 120%; @} +@end display + +�̂悤�Ȃ��̂��������ꍇ�ɁAh1�܂���h2�^�O�� [prefix] b �� [prefix] l �ŕ� +�����͂����ꍇ�ɁA�����ɗL���� class ���ł��� foo, bar �����Ƃ��ĕ⊮ +���͂��邱�Ƃ��”\�ł��B�܂� + +@display + .caution @{ font-size: 120%; background-color: 0xc00000;@} +@end display + +�̂悤�ȑS�ẴG�������g�ɓ���class����`����Ă����ꍇ�́A�S�Ẵ^�O�̕� +�����͎���class�Q�Ɠ��͂����߂��܂��B���ꂪ�ς킵���ꍇ�̓G�������g���� +�͊m��̂Ƃ��Ƀ��^�[���L�[(�܂���C-m)�ł͂Ȃ��AC-j��������class�⊮���͂� +�L�����Z���ł��܂��B���Ƃ��� + +@display + @kbd{[prefix] l} �s���^�O�⊮���N�� + (�܂���@kbd{[prefix] l SPC}) + tt �����ꂽ���̂�tt�Ɠ��� + @kbd{C-m} +@end display + +�Ƃ����ꍇ�͑����� class= �ƕ⊮�v�����v�g���o�܂����A + +@display + @kbd{[prefix] l} �s���^�O�⊮���N�� + (�܂���@kbd{[prefix] l SPC}) + tt �����ꂽ���̂�tt�Ɠ��� + @kbd{C-j} +@end display + +�ƍŌ�� @kbd{C-j} �œ��͂����ꍇ�� class �⊮�v�����v�g�͏o�܂���B + +@node Reread CSS file, , CSS-class completion, CSS Support +@comment node-name, next, previous, up +@section CSS��`�t�@�C���̓ǂݒ��� +html�t�@�C����ҏW����CSS��`�t�@�C�����C�����A�lj����� +class��⊮���Ƃ��Ē����ɓǂݍ��܂������ꍇ�́A +@kbd{M-x yahtml-mode} �Ƃ��čċN�����s���Ă��������B + +@node Customizations, Copying, CSS Support, Top @comment node-name, next, previous, up @chapter �J�X�^�}�C�Y @cindex �J�X�^�}�C�Y[�������܂���] @@ -414,7 +473,7 @@ �������ƁA��҂͊��ŃT�|�[�g�ɗ�ނ��Ƃł��傤�B ���A��]�A�o�O�񍐁A���z���͊��}�������܂��B -�A���� gentei.org �܂�(1999�N7������)�B +�A���� yuuji@@yatex.org �܂�(1999�N7������)�B �p���I�Ɏg�p���Ă���������̓��C�����O���X�g�ufj�쒹�̉�v�� ����������Ă��������B�������@�ɂ‚��Ă͖{�p�b�P�[�W�� @file{docs/yahtmlqa} �t�@�C���́u���̑��v�̏͂��䗗���������B diff --git a/docs/yatex.ref b/docs/yatex.ref index 17ced41..c6874a9 100644 --- a/docs/yatex.ref +++ b/docs/yatex.ref @@ -159,7 +159,7 @@ ���C���N���[�h�\���u���E�Y [prefix] d �L���Y�� - yuuji@gentei.org + yuuji@yatex.org Local variables: mode: text diff --git a/docs/yatexadd.doc b/docs/yatexadd.doc index 4bd51cf..d215f7b 100644 --- a/docs/yatexadd.doc +++ b/docs/yatexadd.doc @@ -170,4 +170,4 @@ �L���Y�� - yuuji@gentei.org + yuuji@yatex.org diff --git a/docs/yatexe.tex b/docs/yatexe.tex index cb51c73..9981ce2 100644 --- a/docs/yatexe.tex +++ b/docs/yatexe.tex @@ -5,6 +5,7 @@ @iftex @c @syncodeindex fn cp +@c Last modified Thu Mar 16 01:05:41 2000 on firestorm @syncodeindex vr cp @end iftex @@ -14,7 +15,7 @@ @subtitle Yet Another tex-mode for emacs @title Wild Bird @subtitle // YaTeX // -@author @copyright{} 1991-1996 by HIROSE, Yuuji [yuuji@@gentei.org] +@author @copyright{} 1991-1996 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, What is YaTeX?, (dir), (dir) @@ -292,12 +293,13 @@ @menu * Changing typesetter:: +* Splitting input files:: * Static region for typesetting:: * Lpr format:: * Editing %# notation:: @end menu -@node Changing typesetter, Static region for typesetting, %#notation, %#notation +@node Changing typesetter, Splitting input files, %#notation, %#notation @comment node-name, next, previous, up @section To change the `latex' command or to split a source text. @cindex typesetter @@ -314,6 +316,7 @@ @node Splitting input files, Static region for typesetting, Changing typesetter, %#notation @comment node-name, next, previous, up +@section Splitting input files And if you split the source text and edit subfile that should be included from main text. @@ -343,13 +346,13 @@ @item You can put split texts in sub directory, but not in sub directory of sub directory. @item In the main text, specify the child file name with relative path name - such as \include{chap1/sub}, when you include the file in + such as \include@{chap1/sub@}, when you include the file in a sub-directory. @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex} is in the parent directory(not %#!latex ../main.tex). @end itemize -@node Static region for typesetting, Lpr format, Changing typesetter, %#notation +@node Static region for typesetting, Lpr format, Splitting input files, %#notation @comment node-name, next, previous, up @section Static region @cindex static region @@ -625,7 +628,7 @@ @example \???@{@} (default documentstyle): section - \section{???}: Hello world. + \section@{???@}: Hello world. @end example @noindent @@ -652,7 +655,7 @@ and move the cursor in the braces. In La@TeX{} command, there are commands which take more than one -arguments such as @code{\addtolength{\topmargin}{8mm}}. To complete these +arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}. To complete these commands, invoke section-type completion with universal argument as, @cindex number of argument @@ -844,7 +847,7 @@ and you will see @example - \`{} + \`@{@} @end example @noindent @@ -852,7 +855,7 @@ one more character `o' for example, then @example - \`{o} + \`@{o@} @end example @noindent @@ -1817,6 +1820,10 @@ If you use AMS-LaTeX, set to @code{t} (@code{nil}) @end defvar +@defvar YaTeX-use-LaTeX2e +If you use LaTeX2e, set to @code{t} (@code{nil}) +@end defvar + @defvar YaTeX-template-file File name which is automatically inserted at creation (@code{~/work/template.tex}) @@ -1917,11 +1924,11 @@ functions, where underlined strings are generated by add-in functions. @display -\begin{table}[ht] (Function name: YaTeX:table) +\begin@{table@}[ht] (Function name: YaTeX:table) ~~~~ -\put(100,200){} (Function name: YaTeX:put) +\put(100,200)@{@} (Function name: YaTeX:put) ~~~~~~~~~ -\sum_{i=0}^{n} (Function name: YaTeX:sum) +\sum_@{i=0@}^@{n@} (Function name: YaTeX:sum) ~~~~~~~~~~ @end display @@ -1932,7 +1939,7 @@ for section-type commands. @display -\newcommand{\foo}{bar} (Function name: YaTeX::newcommand) +\newcommand@{\foo@}@{bar@} (Function name: YaTeX::newcommand) ~~~~ ~~~ @end display @@ -1955,7 +1962,7 @@ @lisp (defun YaTeX:tabular () - "{|c|c|c|}") + "@{|c|c|c|@}") @end lisp @noindent @@ -1971,7 +1978,7 @@ Emacs-Lisp. The next example reads the tabular format from keyboard. @lisp (defun YaTeX:tabular () - (concat "{" (read-string "Rule: ") "}")) + (concat "@{" (read-string "Rule: ") "@}")) @end lisp @node Defining argument-add-in, , Defining option-add-in, How the add-in function works @@ -2091,7 +2098,7 @@ For example, assume you have the LaTeX command as follows. @example - \epsinput[t](250,50){hoge.eps}{plain}{Picture of foo} + \epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@} (A) (B) (1) (2) (3) (A)Optional parameter to specify the position One of t(top), b(bottom), l(left), r(right) @@ -2271,7 +2278,7 @@ redistribute this software freely but with NO warranty to anything as a result of using this software. However, any reports and suggestions are welcome as long as I feel interests in this -software. My possible e-mail address is `yuuji@@gentei.org'. +software. My possible e-mail address is `yuuji@@yatex.org'. (up to May.1999 at least) And there is mailing list for YaTeX. Although the common language is Japanese, questions in English will be welcome. To join the ML, send the mail whose subject is `append' to diff --git a/docs/yatexgen.doc b/docs/yatexgen.doc index b94c936..a510047 100644 --- a/docs/yatexgen.doc +++ b/docs/yatexgen.doc @@ -176,4 +176,4 @@ yatexgen �����񂾂���A�낭�Ȋ֐�����Ȃ����Ƃ͕������Ă܂�:-p�B �L���Y�� - yuuji@gentei.org + yuuji@yatex.org diff --git a/docs/yatexj.tex b/docs/yatexj.tex index faf4486..c425baf 100644 --- a/docs/yatexj.tex +++ b/docs/yatexj.tex @@ -10,6 +10,7 @@ @c �m�[�h���������� C-l C-u C-n �S���̃m�[�h�X�V C-l C-u C-e @c ���j���[���₵���� C-l C-u C-m �S���̃��j���[�X�V C-l C-u C-a @c �t�H�[�}�b�g����Ƃ��� C-l C-e C-b +@c Last modified Thu Mar 16 01:04:48 2000 on firestorm @syncodeindex vr cp @end iftex @@ -19,7 +20,7 @@ @subtitle Yet Another tex-mode for emacs @title �w�쒹�x @subtitle // YaTeX // -@author @copyright{} 1991-1999 by HIROSE, Yuuji [yuuji@@gentei.org] +@author @copyright{} 1991-1999 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, Intro, (dir), (dir) @@ -125,7 +126,7 @@ �X�g�̕ҏW���x�����܂��B����� La@TeX{} �R�}���h�̃I�����C���w���v�� ���}�j���A���𒲂ׂ��Ԃ��y�����܂��B - English manual @xref{Top, , , yatexe,YaTeX English info} + English manual @xref{Top, , , yatexe,YaTeX English info}. @node Terminology, Main features, Intro, Top @comment node-name, next, previous, up @@ -434,7 +435,7 @@ @item ���C���t�@�C������T�u�f�B���N�g�����̃t�@�C���� include ���鎞�ɂ́A���΃p�X�w���p���āA -@code{\include{chap1/sub}}�̂悤�ɋL�q�B +@code{\include@{chap1/sub@}}�̂悤�ɋL�q�B @item ���C���t�@�C�������̃f�B���N�g���ɂ���ꍇ���A�T�u�t�@�C���ɂ� %#!jlatex main.tex �̂悤�ɋL�q����(../main�ł͂Ȃ�)�B @@ -493,7 +494,7 @@ �̏����Y��ɂ͏\�������Ӊ������B @cindex �����t�@�C���̕ҏW[�Ȃ����ӂ�����̂ւ񂵂䂤] -@node Require, lpr format, Fix region for typesetting, %#notation +@c @node Require, lpr format, Fix region for typesetting, %#notation @comment node-name, next, previous, up @node lpr format, Editing %# notation, Fix region for typesetting, %#notation @@ -773,7 +774,7 @@ @subsection 2�ˆȏ�̈������Ƃ� section�^�R�}���h @cindex ����[�Ђ�����] - �Ƃ���ŁA@samp{\addtolength{\topmargin}{8mm}} �Ȃǂ̂悤�ɁA�������� + �Ƃ���ŁA@samp{\addtolength@{\topmargin@}@{8mm@}} �Ȃǂ̂悤�ɁA�������� �ȏ��� La@TeX{} �R�}���h������܂��B���̂悤�ȃR�}���h�̕⊮���͂ɂ́A section �^�⊮�Ăяo���Ɉ�����t���Ă��������B�Ⴆ�Ώ��@samp{addtolength} �̗�ł���΁A����2���w�肵�܂��B�‚܂�A @@ -959,7 +960,7 @@ @end table @noindent -�Ƃ��邱�ƂŁA���݊J���Ă���‹����� \end{} ������܂��B +�Ƃ��邱�ƂŁA���݊J���Ă���‹����� \end@{@} ������܂��B @node Accent mark completion, Image completion, end�⊮, Completion @comment node-name, next, previous, up @@ -1235,8 +1236,8 @@ �Ȃ��ꍇ�̓G���[�ɂȂ�܂��B�܂�����́A�̈�Œ�̂��߂� @code{%#BEGIN} �� @code{%#END} �̃y�A�ɑ΂��Ă����l�ɓ��삵�܂��B�Ȃ��A@code{label/ref}�� @code{cite/bibitem}�Ή�������̂��ʃt�@�C���ɂ��鎞�́A�W�����v��ƂȂ�t�@ -�C�����I�[�v������Ă��Ȃ���΂Ȃ�܂���B@xref{%#notation} -���C���� .tex �t�@�C���� @code{\include{chap1}} �ȂǂɃJ�[�\�������킹�A +�C�����I�[�v������Ă��Ȃ���΂Ȃ�܂���B@xref{%#notation}. +���C���� .tex �t�@�C���� @code{\include@{chap1@}} �ȂǂɃJ�[�\�������킹�A @kbd{[prefix] g} �������ƁA@file{chap1.tex} �ɃW�����v���܂��B �܂��A @@ -1538,7 +1539,7 @@ ���̂悤�� tabular �ɂ����āA @example - \begin@{tabular@}{|c|c|c|c|c|c|c|c|}\hline + \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline ����&����&��&�Z��&�d�b&FAX&�A�Ȑ�&�A�Ȑ�d�b\\ \hline ����Y & 6 & 223 & ���l�s�`�k����g & xxx-yyy & zzz-www & �g���K & 9876-54321 \\ @@ -2018,6 +2019,10 @@ AMS-LaTeX ���g�p����ꍇ�� @code{t} �ɐݒ肷�� (@code{nil}) @end defvar +@defvar YaTeX-use-LaTeX2e +LaTeX2e ���g�p����ꍇ�� @code{t} �ɐݒ肷�� (@code{nil}) +@end defvar + @defvar YaTeX-template-file �V�K�t�@�C���쐬���Ɏ����}������t�@�C���� (@code{~/work/template.tex}) @end defvar @@ -2113,7 +2118,7 @@ �������ƁA��҂͊��ŃT�|�[�g�ɗ�ނ��Ƃł��傤�B ���A��]�A�o�O�񍐁A���z���͊��}�������܂��B -�A���� yuuji@@gentei.org �܂�(1999�N5������)�B +�A���� yuuji@@yatex.org �܂�(1999�N8������)�B �p���I�Ɏg�p���Ă���������̓��C�����O���X�g�ufj�쒹�̉�v�� ����������Ă��������B�������@�ɂ‚��Ă͖{�p�b�P�[�W�� @file{docs/qanda} �t�@�C���́u���̑��v�̏͂��䗗���������B diff --git a/docs/yatexref.eng b/docs/yatexref.eng index e0d91bf..a1b341a 100644 --- a/docs/yatexref.eng +++ b/docs/yatexref.eng @@ -155,7 +155,7 @@ *Browse included structure [prefix] d HIROSE Yuuji - yuuji@gentei.org + yuuji@yatex.org Local variables: mode: text diff --git a/help/YATEXHLP.eng b/help/YATEXHLP.eng index a2d6dcc..bf0d343 100644 --- a/help/YATEXHLP.eng +++ b/help/YATEXHLP.eng @@ -1,3 +1,10 @@ +%%% +%%% YaTeX-LaTeX Help File(c)HIROSE Yuuji [yuuji@yatex.org] +%%% You can translate this file for any device other than YaTeX via +%%% any filter program. But it is not allowed to remove copyright +%%% notice and any existing dictionary entiries. +%%% + textfloatsep \addtolength{\textfloatsep}{LENGTH} Length between the text and a float at the top or bottom of page diff --git a/help/YATEXHLP.jp b/help/YATEXHLP.jp index 58eddc0..13f63ff 100644 --- a/help/YATEXHLP.jp +++ b/help/YATEXHLP.jp @@ -1,3 +1,9 @@ +%%% +%%% �쒹-LaTeX�w���v�t�@�C��(c)HIROSE Yuuji [yuuji@yatex.org] +%%% �@�B�I�ɕϊ����Ė쒹�ȊO�̃f�o�C�X�ŗ��p���邱�Ƃ����‚��܂��B +%%% ���̍ۂɃR�s�[���C�g�\���Ɗ܂܂�Ă��鍀�ڂ��폜���Ȃ��ł��������B +%%% + textfloatsep \addtolength{\textfloatsep}{����} �y�[�W�擪��float�܂��́A�y�[�W�ʼn�����float�ƃe�L�X�g�Ƃ̊Ԋu�B @@ -1344,8 +1350,8 @@ Nop.M����(asciinet) �قȂ�‹��ł̐ݒ�̕s����̃��|�[�g�𐔑��������܂����B -jaybird����(asciinet) - �p��ł̃w���v�t�@�C�����쐬���Ē����܂����B +jaybird����(asciinet, bekkoame) + �h�L�������g�̑������p�󂵂ĉ������܂����B ���R������(������w) ���{����̓��[�h����֐��̃o�O�𒼂��p�b�`�Asection-view �̃o�O diff --git a/yahtml.el b/yahtml.el index c7087cf..54d9ab3 100644 --- a/yahtml.el +++ b/yahtml.el @@ -1,6 +1,6 @@ ;;; -*- Emacs-Lisp -*- -;;; (c ) 1994-1999 by HIROSE Yuuji [yuuji@gentei.org] -;;; Last modified Wed Jul 14 18:01:18 1999 on firestorm +;;; (c ) 1994-2000 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Wed Mar 1 23:28:22 2000 on firestorm ;;; $Id$ ;;;[Installation] @@ -175,7 +175,7 @@ "*Alist of unix path name vs. URL name of WWW server. Ex. '((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\") - (\"/usr/home/yuuji/darts/http\" . \"http://darts.comp.ae.keio.ac.jp/~darts\"))") + (\"/home/yuuji/http\" . \"http://www.gentei.org/~yuuji\"))") (defvar yahtml-directory-index "index.html" "*Directory index file name; Consult your site's WWW administrator.") @@ -194,7 +194,7 @@ (defvar yahtml-always-/p nil "*Those who always use

    with

    set this to t.") -(defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\)" +(defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\|blockquote\\)" "*Regexp of envs where paragraphed sentences are prefered.") (defvar yahtml-template-file "~/http/template.html" @@ -214,6 +214,16 @@ (defvar yahtml-use-css t "*Use stylesheet or not") +(defvar yahtml-image-inspection-bytes 10000 ;256 + "*Number of bytes to inspect the image for geometry information") +(defvar yahtml:img-default-alt-format "%xx%y(%sbytes)" + "*Default format of img entity's ALT attributes. +%x: width, %y: height, %s: size in bytes, %c: first comment string, +%f: filename") + +(defvar yahtml-use-hilit19 (featurep 'hilit19) + "*Use hilit19 to fontify buffer or not") + ;;; --- customizable variable ends here --- (defvar yahtml-prefix-map nil) (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") @@ -255,6 +265,7 @@ (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment) (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline) (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line) + (define-key yahtml-mode-map "&" 'yahtml-insert-amps) (let ((map yahtml-prefix-map)) (YaTeX-define-key "^" 'yahtml-visit-main map) (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map) @@ -310,7 +321,11 @@ (YaTeX-define-key ":" 'yahtml-translate-reverse-region map) (YaTeX-define-key "#" 'yahtml-escape-chars-region map) ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map) - )) + ) + (let ((keys (where-is-internal 'fill-paragraph global-map))) + (while keys + (define-key yahtml-mode-map (car keys) 'yahtml-fill-paragraph) + (setq keys (cdr keys))))) (if yahtml-lint-buffer-map nil (setq yahtml-lint-buffer-map (make-keymap)) @@ -356,7 +371,7 @@ ("address") ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ;; ("p") ;This makes indentation screwed up! - ("style") ("div") + ("style") ("div") ("object") )) ;(defvar yahtml-itemizing-regexp @@ -373,7 +388,7 @@ (defvar yahtml-typeface-table (append - '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("strike") + '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("strike") ("s") ("strong") ("var") ("b") ("i") ("tt") ("u") ("big") ("small") ("font") ("sup") ("sub") ("span")) yahtml-env-table) @@ -397,27 +412,41 @@ (defvar yahtml-tmp-single-cmd-table nil) (defvar yahtml-last-single-cmd nil) +(defvar yahtml-current-completion-type nil + "Has current completion type. This may be used in yahtml addin functions.") + ;(defvar yahtml-struct-name-regexp ; "\\<\\(h[1-6]\\|[uod]l\\|html\\|body\\|title\\|head\\|table\\|t[rhd]\\|pre\\|a\\|form\\|select\\|center\\|blockquote\\)\\b") (defvar yahtml-struct-name-regexp (concat "\\<\\(" - (mapconcat (function (lambda (x) (car x))) yahtml-typeface-table "\\|") + ;(mapconcat 'car yahtml-typeface-table "\\|") + (mapconcat 'car yahtml-env-table "\\|") "\\)\\b") "Regexp of structure beginning.") + +(defvar yahtml-closable-regexp + (concat + "\\<\\(" + (mapconcat 'car yahtml-typeface-table "\\|") + (mapconcat 'car yahtml-env-table "\\|") + "\\)\\b") + "Regexp of any closable elemnts.") + + (or (assoc "p" yahtml-env-table) (setq yahtml-env-table (cons '("p") yahtml-env-table))) -(defun yahtml-dir-default-charset () + +(defun yahtml-get-user-httpconf-entry (regexp) (cond ((and (eq yahtml-server-type 'apache) ;;check .htaccess buffer-file-name) (let ((dir default-directory) charset af ext (ldir "") + line (case-fold-search t) (uid (car (cdr (cdr (file-attributes ".")))))) - (setq ext (file-name-nondirectory buffer-file-name) - ext (substring ext (string-match "\\.[a-z0-9]+$" ext))) (if (string-match "^[A-Z]:" dir) (setq dir (substring dir 2))) ;remove drive letter (while (and dir @@ -429,33 +458,65 @@ (set-buffer (find-file-noselect af)) (save-excursion (goto-char (point-min)) - (if (re-search-forward ;search the charset for same extension - (format "^\\s *AddType.*charset=\\(.*\\)\\%s$" ext) - nil t) - (progn - (setq charset - (buffer-substring - (match-beginning 1) (match-end 1))) - (cond - ((string-match "iso-2022-jp" charset) - (setq charset 2)) - ((string-match "euc-jp" charset) - (setq charset 3)) - ((string-match "shift_jis" charset) - (setq charset 1)) - (t (setq charset nil))) - (setq dir "")))) + (if (re-search-forward regexp nil t) + (setq line (buffer-substring + (point-beginning-of-line) + (point-end-of-line)) + dir nil))) (kill-buffer (current-buffer)))) - (setq ldir dir - dir (substring dir 0 (string-match "/$" dir)) - dir (file-name-directory dir))) - (if (featurep 'mule) - (setq charset (cdr (assq charset YaTeX-kanji-code-alist)))) - charset + (if dir + (setq ldir dir + dir (substring dir 0 (string-match "/$" dir)) + dir (file-name-directory dir)))) + line )) (t nil)) ) +(defun yahtml-dir-default-charset () + (let*((fn (file-name-nondirectory (or buffer-file-name ""))) + (ext (substring fn (or (string-match "\\.[a-z0-9]+$" fn) 0))) + (ptn (format "^\\s *AddType.*charset=\\(.*\\)\\%s$" ext)) + line + charset) + (if (setq line (yahtml-get-user-httpconf-entry ptn)) + (progn + (string-match ptn line) + (setq charset + (substring line (match-beginning 1) (match-end 1))) + (cond + ((string-match "iso-2022-jp" charset) + (setq charset 2)) + ((string-match "euc-jp" charset) + (setq charset 3)) + ((string-match "shift_jis" charset) + (setq charset 1)) + (t (setq charset nil))) + (setq dir ""))) + (if (featurep 'mule) + (setq charset (cdr (assq charset YaTeX-kanji-code-alist)))) + charset)) + +(defun yahtml-get-directory-index () + (let ((line (yahtml-get-user-httpconf-entry "^\\s *DirectoryIndex")) + x index-list) + ;;s/\\s *$//; + (if line + (progn + (if (string-match "DirectoryIndex\\s +\\(.*\\)\\s *$" line) + (setq line (substring line (match-beginning 1) (match-end 1)))) + (while (string< "" line) + (if (setq x (string-match "\\(\\s +\\)" line)) + (setq index-list (cons (substring line 0 x) index-list) + line (substring line (match-end 1))) + (setq index-list (cons line index-list) + line "")) + ) + (or (nreverse index-list) + (if (listp yahtml-directory-index) + yahtml-directory-index + (list yahtml-directory-index))))))) + (defun yahtml-mode () (interactive) (let ((coding (or (yahtml-dir-default-charset) yahtml-kanji-code))) @@ -479,7 +540,7 @@ '((YaTeX-ec . "") (YaTeX-struct-begin . "<%1%2") (YaTeX-struct-end . "") - (YaTeX-struct-name-regexp . yahtml-struct-name-regexp) + (YaTeX-struct-name-regexp . yahtml-closable-regexp) (YaTeX-comment-prefix . "") + (beginning-of-line) + (open-line 1) + (YaTeX-reindent c)))) + ;;; ---------- Marking ---------- (defun yahtml-mark-begend () "Mark current tag" @@ -2161,45 +2438,43 @@ "Alist of elements vs. their classes") (defun yahtml-css-collect-classes-region (beg end &optional initial) - (save-restriction - (save-excursion + (save-excursion + (save-restriction (narrow-to-region beg end) (goto-char (point-min)) - (let ((alist initial) b e element class a - (s1 (aref (syntax-table) ?\{ )) - (s2 (aref (syntax-table) ?\} ))) - ;(modify-syntax-entry ?{ "(}") - ;(modify-syntax-entry ?} "){") + (let ((alist initial) b e element class a) (setq b (point)) - (unwind-protect - (while (search-forward "{" nil t) - (setq e (point)) - (goto-char b) - (while (re-search-forward ;����Ƃ���������REGEXP - "\\([a-z][a-z0-9]*\\)\\.\\([a-z][a-z0-9]*\\)\\>" e t) - (setq element (YaTeX-match-string 1) - class (YaTeX-match-string 2)) - (if (setq a (assoc element alist)) - (or (assoc class (cdr a)) - (setcdr a (cons (list class) (cdr a)))) - (setq alist (cons (list element (list class)) alist)))) - (goto-char (1- e)) - ;(forward-list 1) - (search-forward "}" nil t) - (setq b (point))) - (aset (syntax-table) ?\{ s1) - (aset (syntax-table) ?} s2)) - alist)))) + (while (search-forward "{" nil t) + (setq e (point)) + (goto-char b) + (while (re-search-forward ;����Ƃ���������REGEXP + "\\([a-z][a-z0-9]*\\)?\\.\\([a-z][a-z0-9]*\\)\\>" e t) + (setq element (YaTeX-match-string 1) + class (YaTeX-match-string 2)) + ;;if starts with period (match-string 1 is nil), + ;;this is global class + (setq element (or element "global")) + (if (setq a (assoc element alist)) + (or (assoc class (cdr a)) + (setcdr a (cons (list class) (cdr a)))) + (setq alist (cons (list element (list class)) alist)))) + (goto-char (1- e)) + (search-forward "}" nil t) + (setq b (point))) + alist)))) (defun yahtml-css-collect-classes-buffer (&optional initial) (interactive) (yahtml-css-collect-classes-region (point-min) (point-max) initial)) (defun yahtml-css-collect-classes-file (file &optional initial) - (let ((hilit-auto-highlight nil) (cb (current-buffer))) - (set-buffer (find-file-noselect file)) + (let*((hilit-auto-highlight nil) + (openedp (get-file-buffer file)) + (cb (current-buffer)) + (buf (set-buffer (find-file-noselect file)))) (prog1 (yahtml-css-collect-classes-buffer initial) + (or openedp (kill-buffer buf)) (set-buffer cb)))) (defun yahtml-css-scan-styles () @@ -2226,6 +2501,12 @@ (yahtml-url-to-path href) alist)))) (setq yahtml-css-class-alist alist))))) +(defun yahtml-css-get-element-completion-alist (element) + (let ((alist (cdr-safe (assoc element yahtml-css-class-alist))) + (global (cdr-safe (assoc "global" yahtml-css-class-alist)))) + (and (or alist global) + (append alist global)))) + ;;; ---------- ---------- ;;; @@ -2237,6 +2518,7 @@ )) (defvar yahtml-hilit-patterns-alist '( + 'case-fold ;; comments ("" comment) ;; include&exec @@ -2267,7 +2549,7 @@ (cons m0 (1+ (point) ))))) ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist)) -(and (featurep 'hilit19) +(and yahtml-use-hilit19 (or (assq 'yahtml-mode hilit-patterns-alist) (setq hilit-patterns-alist (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist) diff --git a/yatex.el b/yatex.el index b0e7311..6070e54 100644 --- a/yatex.el +++ b/yatex.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; Yet Another tex-mode for emacs - //�쒹// -;;; yatex.el rev. 1.67 -;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@gentei.org] -;;; Last modified Tue Jul 13 14:20:45 1999 on firestorm +;;; yatex.el rev. 1.68 +;;; (c )1991-2000 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sun Apr 9 12:35:15 2000 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -24,7 +24,7 @@ (require 'comment) (require 'yatexlib) -(defconst YaTeX-revision-number "1.67" +(defconst YaTeX-revision-number "1.6*" "Revision number of running yatex.el") ;---------- Local variables ---------- @@ -130,6 +130,9 @@ t�ɂ���(�Â�NTT-jTeX�Ō����Ɍ����)�B��̓I�ɂ́Afill����Ƃ��Ɋe�s�̏I���� %��t������B") +(defvar YaTeX-use-LaTeX2e t "*Use LaTeX2e or not. Nil meas latex 2.09") + + (defvar YaTeX-item-regexp (concat (regexp-quote "\\") "\\(sub\\|bib\\)*item") "*Regular expression of item command.") @@ -142,6 +145,7 @@ (concat "^[ \t]*%\\|^[ \t]*$\\|\\'\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\(" YaTeX-sectioning-regexp ;sectioning commands "\\|[A-z]*item\\|begin{\\|end{" ;special declaration + "\\|\\[\\|\\]" "\\|newpage\\b\\|vspace\\b" "\\)") "*Paragraph starting regexp of common LaTeX source. Use this value @@ -201,6 +205,10 @@ (defvar yatex-mode-hook nil "*List of functions to be called at the end of yatex-mode initializations.") +(defvar YaTeX-search-file-from-top-directory t + "*Non-nil means to search input-files from the directory where main file +exists.") + ;;-- Math mode values -- (defvar YaTeX-math-key-list-default @@ -228,26 +236,39 @@ ;------------ Completion table ------------ ; Set tex-section-like command possible completion (defvar section-table - '(("part") ("chapter") ("section") ("subsection") - ("subsubsection") ("paragraph") ("subparagraph") - ("author") ("thanks") ("documentstyle") ("documentclass") ("pagestyle") - ("title") ("underline") ("label") ("makebox") - ("footnote") ("footnotetext") - ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite") - ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption") - ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2) - ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2) - ("newcommand" 2) ("renewcommand" 2) - ("setcounter" 2) ("newenvironment" 3) ("newtheorem" 2) - ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox") - ("date") ("put") ("ref") ("pageref") - ("multicolumn" 3) ("shortstack") - ;; for mathmode accent - ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec") - ("widetilde") ("widehat") ("overline") ("overrightarrow") - ;; section types in mathmode - ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") - ) + (append + '(("part") ("chapter") ("chapter*") ("section") ("section*") + ("subsection") ("subsection*") + ("subsubsection") ("paragraph") ("subparagraph") + ("author") ("thanks") ("documentstyle") ("pagestyle") + ("title") ("underline") ("label") ("makebox") + ("footnote") ("footnotetext") ("index") + ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite") + ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption") + ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2) + ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2) + ("newcommand" 2) ("renewcommand" 2) + ("setcounter" 2) ("newenvironment" 3) ("newtheorem" 2) + ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox") + ("date") ("put") ("ref") ("pageref") + ("multicolumn" 3) ("shortstack") + ;; for mathmode accent + ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec") + ("widetilde") ("widehat") ("overline") ("overrightarrow") + ;; section types in mathmode + ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") + ) + (if YaTeX-use-LaTeX2e + '(("documentclass") ("usepackage") + ("textbf") ("textgt") ("textit") ("textmc") ("textmd") ("textnormal") + ("textrm") ("textsc") ("textsf") ("textsl") ("texttt") ("textup") + ("mathbf") ("mathcal") ("mathit") ("mathnormal") ("mathrm") + ("mathsf") ("mathtt") + ("scalebox" 1) ;is faking of argument position + ("rotatebox" 2) ("resizebox" 2) ("reflectbox") + ("colorbox" 2) ("fcolorbox" 3) ("textcolor" 2) ("color") + ("includegraphics") ("includegraphics*") + ))) "Default completion table for section-type completion.") (defvar user-section-table nil) @@ -258,7 +279,7 @@ '(("quote") ("quotation") ("center") ("verse") ("document") ("verbatim") ("itemize") ("enumerate") ("description") ("list") ("tabular") ("tabular*") ("table") ("tabbing") ("titlepage") - ("sloppypar") ("quotation") ("picture") ("displaymath") + ("sloppypar") ("picture") ("displaymath") ("eqnarray") ("figure") ("equation") ("abstract") ("array") ("thebibliography") ("theindex") ("flushleft") ("flushright") ("minipage") @@ -274,22 +295,36 @@ ("dg") ("dm") ("tiny") ("scriptsize") ("footnotesize") ("small")("normalsize") ("large") ("Large") ("LARGE") ("huge") ("Huge") + ("rmfamily") ("sffamily") ("ttfamily") + ("mdseries") ("bfseries") ("upshape") + ("itshape") ("slshape") ("scshape") ) "Default completion table for large-type completion.") +(defvar LaTeX2e-fontstyle-alist + '(("rm" . "rmfamily") + ("sf" . "sffamily") + ("tt" . "ttfamily") + ("md" . "mdseries") + ("bf" . "bfseries") + ("up" . "upshape") + ("it" . "itshape") + ("sl" . "slshape") + ("sc" . "scshape"))) + (defvar user-fontsize-table nil) (defvar tmp-fontsize-table nil) (defvar singlecmd-table (append '(("maketitle") ("makeindex") ("sloppy") ("protect") - ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") + ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") ("kill") ;;("rightarrow") ("Rightarrow") ("leftarrow") ("Leftarrow") - ("pagebreak") ("nopagebreak") + ("pagebreak") ("nopagebreak") ("tableofcontents") ("newpage") ("clearpage") ("cleardoublepage") ("footnotemark") ("verb") ("verb*") ("linebreak") ("pagebreak") ("noindent") ("indent") - ("left") ("right") ("dots") + ("left") ("right") ("dots") ("smallskip") ("medskip") ("bigskip") ) (if YaTeX-greek-by-maketitle-completion '(("alpha") ("beta") ("gamma") ("delta") ("epsilon") @@ -464,14 +499,20 @@ (setq YaTeX-latex-message-code latex-message-kanji-code))) (defvar YaTeX-mode-syntax-table nil - "*Syntax table for yatex-mode") (if YaTeX-mode-syntax-table nil (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table))) (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table) (modify-syntax-entry ?\{ "(}" YaTeX-mode-syntax-table) - (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table)) + (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table) + (modify-syntax-entry ?\t " " YaTeX-mode-syntax-table) + (modify-syntax-entry ?\f ">" YaTeX-mode-syntax-table) + (modify-syntax-entry ?\n ">" YaTeX-mode-syntax-table) + (modify-syntax-entry ?$ "$$" YaTeX-mode-syntax-table) + (modify-syntax-entry ?% "<" YaTeX-mode-syntax-table) + (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table) + (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table)) ;---------- Provide YaTeX-mode ---------- ;;; @@ -564,13 +605,14 @@ indent-line-function 'YaTeX-indent-line comment-start YaTeX-comment-prefix comment-end "" - ;;comment-start-skip "[^\\\\]%+[ \t]*" + comment-start-skip "[^\\\\]%+[ \t]*" ) (use-local-map YaTeX-mode-map) (set-syntax-table YaTeX-mode-syntax-table) (if YaTeX-dos (setq YaTeX-saved-screen-height (screen-height))) (YaTeX-read-user-completion-table) (and (fboundp 'YaTeX-19-collect-macros) (YaTeX-19-collect-macros)) + (makunbound 'inenv) (turn-on-auto-fill) ;1.63 (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file) (y-or-n-p (format "Insert %s?" YaTeX-template-file)) @@ -649,8 +691,6 @@ (autoload 'YaTeX-display-hierarchy-directly "yatexhie" "Same as YaTeX-display-hierarchy. Call from mouse." t) -;; autoload from yahtml.el -(autoload 'yahtml-inner-environment-but "yahtml" "yahtml internal func." t) ;;; ;; YaTeX-mode functions @@ -840,6 +880,10 @@ (YaTeX-update-table (list fontsize-name) 'fontsize-table 'user-fontsize-table 'tmp-fontsize-table) + (and YaTeX-use-LaTeX2e + (YaTeX-latex2e-p) + (setq fontsize (cdr (assoc fontsize-name LaTeX2e-fontstyle-alist))) + (setq fontsize-name fontsize)) (if arg (save-excursion (if (> (point) (mark)) (exchange-point-and-mark)) @@ -1429,7 +1473,8 @@ (let ((p (match-end 0)) b0 b1 env (nest 0) regexp re-s (op (point)) (m0 (match-beginning 0)) ;whole matching (m1 (match-beginning 1)) ;environment in \begin{} - (m2 (match-beginning 2))) ;environment in \end{} + (m2 (match-beginning 2)) ;environment in \end{} + (m3 (match-beginning 3))) ;environment in \[ \] \( \) ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) (if (cond (m1 ;if begin{xxx} @@ -1464,6 +1509,18 @@ (regexp-quote YaTeX-struct-end) env "" "") "\\)")) (setq re-s 're-search-backward)) + (m3 ;math environment + (setq env (char-after (1+ m3)) + regexp (format "\\(%s%s\\)\\|\\(%s%s\\)" + YaTeX-ec-regexp + (regexp-quote + (cdr (assq env '((?( . ")") (?) . "(") + (?[ . "]") (?] . "["))))) + YaTeX-ec-regexp + (regexp-quote (char-to-string env))) + re-s (if (memq env '(?\( ?\[)) + 're-search-forward + 're-search-backward))) (t (if noerr nil (error "Corresponding environment not found.")))) (progn (while (and (>= nest 0) (funcall re-s regexp nil t)) @@ -1486,7 +1543,7 @@ "Visit or switch buffer of corresponding file, looking at \\input or \\include or \includeonly on current line." (if (not (YaTeX-on-includes-p)) nil - (let ((parent buffer-file-name) input-file) + (let ((parent buffer-file-name) input-file b) (save-excursion (if (search-forward "{" (point-end-of-line) t) nil @@ -1498,7 +1555,8 @@ (setq input-file (concat input-file ".tex")))) (cond (other (YaTeX-switch-to-buffer-other-window input-file)) - ((get-file-buffer input-file) (goto-buffer-window input-file)) + ((setq b (YaTeX-get-file-buffer input-file)) + (goto-buffer-window b)) (t (YaTeX-switch-to-buffer input-file))) (or (YaTeX-get-builtin "!") YaTeX-parent-file @@ -1573,16 +1631,20 @@ (let ((list (append YaTeX-processed-file-regexp-alist YaTeX-processed-file-regexp-alist-default)) (p (point)) flist file - (peol (point-end-of-line))) + (peol (point-end-of-line)) + (basedir + (if YaTeX-search-file-from-top-directory + (save-excursion (YaTeX-visit-main t) default-directory) + "."))) (setq flist (catch 'found - (while list - (goto-char p) - (if (re-search-forward (car (car list)) peol t) - (progn - (setq file (YaTeX-match-string - (car (cdr (car list))))) - (throw 'found (cdr (car list))))) - (setq list (cdr list))))) + (while list + (goto-char p) + (if (re-search-forward (car (car list)) peol t) + (progn + (setq file (YaTeX-match-string + (car (cdr (car list))))) + (throw 'found (cdr (car list))))) + (setq list (cdr list))))) (if flist ;if pattern and file name found (let*((plist (append YaTeX-file-processor-alist YaTeX-file-processor-alist-default)) @@ -1598,36 +1660,38 @@ (while plist ;if processor is not specified (setq ext (cdr (car plist))) (if (and (string< "" (concat file ext)) - (file-exists-p (concat file ext))) - (setq cmd (car (car plist)) - src (concat file ext) plist nil)) + (file-exists-p + (expand-file-name (concat file ext) basedir))) + (setq cmd (car (car plist)) + src (concat file ext) plist nil)) (setq plist (cdr plist))) (if (and (null src) alt YaTeX-create-file-prefix-g) (setq cmd alt src (concat file (cdr (assoc alt plist0)))))) - (if src ;if processor and src file found - (cond - ((stringp cmd) - (let ((buf (concat "* " cmd " " src " *"))) - (YaTeX-system (concat cmd " " src) buf) - t)) - ((eq t cmd) - (let ((parent buffer-file-name)) - (funcall - (cond - (other 'YaTeX-switch-to-buffer-other-window) - ((get-file-buffer src) 'goto-buffer-window) - (t 'YaTeX-switch-to-buffer)) - src) - (or (YaTeX-get-builtin "!") - YaTeX-parent-file - (setq YaTeX-parent-file parent)) - t)) - ((symbolp cmd) + (if src ;if processor and src file found + (let ((default-directory basedir)) (cond - ((symbol-function cmd) - (funcall cmd src other))) - t)))))))) + ((stringp cmd) + (let ((buf (concat "* " cmd " " src " *"))) + (YaTeX-system (concat cmd " " src) buf) + t)) + ((eq t cmd) + (let ((parent buffer-file-name)) + (funcall + (cond + (other 'YaTeX-switch-to-buffer-other-window) + ((get-file-buffer src) 'goto-buffer-window) + (t 'YaTeX-switch-to-buffer)) + src) + (or (YaTeX-get-builtin "!") + YaTeX-parent-file + (setq YaTeX-parent-file parent)) + t)) + ((symbolp cmd) + (cond + ((symbol-function cmd) + (funcall cmd src other))) + t))))))))) (defun YaTeX-on-section-command-p (command) "Check if point is on the LaTeX command: COMMAND(regexp). @@ -1702,7 +1766,11 @@ "\\|" (YaTeX-replace-format-args (regexp-quote YaTeX-struct-end) - (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "")) + (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "") + "\\|\\(" + YaTeX-ec-regexp ;;"[][()]\\)" + "[][]\\)" + ) (point-end-of-line) t))) (defun YaTeX-on-includes-p () @@ -1787,51 +1855,6 @@ (message "%sommented out current environment." (if (eq func 'comment-out-region) "C" "Un-c"))) -(defun YaTeX-beginning-of-environment (&optional limit-search-bound end) - "Goto the beginning of the current environment. -Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound to -most recent sectioning command. Non-nil for optional third argument END -goes to end of environment." - (interactive) - (let ((op (point))) - (if (YaTeX-inner-environment limit-search-bound) - (progn - (goto-char (get 'YaTeX-inner-environment 'point)) - (and end (YaTeX-goto-corresponding-environment)) - (if (interactive-p) (push-mark op)) - t)))) - -(defun YaTeX-end-of-environment (&optional limit-search-bound) - "Goto the end of the current environment. -Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound -to most recent sectioning command." - (interactive) - (YaTeX-beginning-of-environment limit-search-bound t)) - -(defun YaTeX-mark-environment () - "Mark current position and move point to end of environment." - (interactive) - (let ((curp (point))) - (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin - (forward-line 1) - (beginning-of-line)) - (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1 - (progn - (goto-char curp) - (error "Cannot found the end of current environment.")) - (YaTeX-goto-corresponding-environment) - (beginning-of-line) ;for confirmation - (if (< curp (point)) - (progn - (message "Mark this environment?(y or n): ") - (if (= (read-char) ?y) nil - (goto-char curp) - (error "Abort. Please call again at more proper position.")))) - (set-mark-command nil) - (YaTeX-goto-corresponding-environment) - (end-of-line) - (if (eobp) nil (forward-char 1))))) - (defun YaTeX-comment-paragraph () "Comment out current paragraph." (interactive) @@ -2061,49 +2084,55 @@ "Change section-type command." (interactive) (let*((where (YaTeX-on-section-command-p YaTeX-command-token-regexp)) - (p (point)) (cmd (YaTeX-match-string 1)) beg end old new) + (p (point)) (cmd (YaTeX-match-string 1)) + (beg (make-marker)) (end (make-marker)) old new) (if (null where) nil - (cond + (unwind-protect + (progn + (cond + ((equal where 0);;if point is on section command + (set-marker beg (match-beginning 1)) + (set-marker end (match-end 1)) + (goto-char beg) ;beginning of the command + (setq new (YaTeX-read-section + (format "Change `%s' to: " cmd) nil))) - ((equal where 0);;if point is on section command - (setq beg (match-beginning 1) - end (match-end 1)) - (goto-char beg) ;beginning of the command - (setq new (YaTeX-read-section (format "Change `%s' to: " cmd) nil))) + ((= where -1);;if point is on a optional parameter + (set-marker beg (match-beginning 2)) + (skip-chars-forward "^{") + (set-marker end (point)) + (goto-char p) + (setq new + (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd))) + (YaTeX-addin cmd) + (concat "[" + (read-string (format "Change `%s' to: " + (buffer-substring + (1+ beg) (1- end)))) + "]")))) - ((= where -1);;if point is on a optional parameter - (setq beg (match-beginning 2)) - (skip-chars-forward "^{") - (setq end (point)) - (goto-char p) - (setq new - (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd))) - (YaTeX-addin cmd) - (concat "[" - (read-string (format "Change `%s' to: " - (buffer-substring - (1+ beg) (1- end)))) - "]")))) - - ((> where 0);;if point is in arguments' braces - (or (looking-at "{") - (progn (skip-chars-backward "^{") (forward-char -1))) - (setq beg (1+ (point))) - (forward-list 1) - (forward-char -1) - (setq end (point) - old (buffer-substring beg end)) - (goto-char p) - (if (> (length old) 40) - (setq old (concat (substring old 0 12) "..." (substring old -12)))) - (setq new - (if (intern-soft (concat "YaTeX::" cmd)) - (funcall (intern-soft (concat "YaTeX::" cmd)) where) - (read-string (format "Change `%s' to: " old))))) - );cond - (delete-region beg end) - (goto-char beg) - (insert-before-markers new) + ((> where 0);;if point is in arguments' braces + (or (looking-at "{") + (progn (skip-chars-backward "^{") (forward-char -1))) + (set-marker beg (1+ (point))) + (forward-list 1) + (forward-char -1) + (set-marker end (point)) + (setq old (buffer-substring beg end)) + (goto-char p) + (if (> (length old) 40) + (setq old (concat (substring old 0 12) "..." + (substring old -12)))) + (setq new + (if (intern-soft (concat "YaTeX::" cmd)) + (funcall (intern-soft (concat "YaTeX::" cmd)) where) + (read-string (format "Change `%s' to: " old))))) + ) ;cond + (delete-region beg end) + (goto-char beg) + (insert-before-markers new)) + (set-marker beg nil) + (set-marker end nil)) ;;(goto-char (marker-position p)) new))) @@ -2205,28 +2234,35 @@ "Check if POINT is in verb or verb*. Default of POINT is (point)." (setq point (or point (point))) (save-excursion - (goto-char point) - (if (not (re-search-backward - (concat YaTeX-ec-regexp - "\\(" YaTeX-verb-regexp "\\)" - "\\([^-A-Za-z_*]\\)") - (point-beginning-of-line) t)) - nil - (goto-char (match-end 2)) - (skip-chars-forward - (concat "^" (buffer-substring (match-beginning 2) (match-end 2)))) - (and (< (match-beginning 2) point) (< (1- point) (point)))))) + (let ((md (match-data))) + (goto-char point) + (unwind-protect + (if (not (re-search-backward + (concat YaTeX-ec-regexp + "\\(" YaTeX-verb-regexp "\\)" + "\\([^-A-Za-z_*]\\)") + (point-beginning-of-line) t)) + nil + (goto-char (match-end 2)) + (skip-chars-forward + (concat "^" (buffer-substring (match-beginning 2) (match-end 2)))) + (and (< (match-beginning 2) point) (< (1- point) (point)))) + (store-match-data md))))) (defun YaTeX-literal-p (&optional point) "Check if POINT is in verb or verb* or verbatime environment family. Default of POINT is (point)." - (cond - ((equal YaTeX-ec "\\") ;maybe LaTeX - (save-excursion - (and point (goto-char point)) - (or (YaTeX-in-verb-p (point)) - (and (not (looking-at "\\\\end{verb")) - (YaTeX-quick-in-environment-p YaTeX-verbatim-environments))))))) + (let ((md (match-data))) + (unwind-protect + (cond + ((equal YaTeX-ec "\\") ;maybe LaTeX + (save-excursion + (and point (goto-char point)) + (or (YaTeX-in-verb-p (point)) + (and (not (looking-at "\\\\end{verb")) + (YaTeX-quick-in-environment-p + YaTeX-verbatim-environments)))))) + (store-match-data md)))) (defun YaTeX-in-environment-p (env) "Return if current LaTeX environment is ENV. @@ -2548,8 +2584,15 @@ ;; (kill-line)))))) (or inenv (setq inenv "document")) ;is the default environment (cond - ((and (YaTeX-on-begin-end-p) (match-beginning 2)) ;if \end - (YaTeX-reindent (YaTeX-current-indentation))) + ((and (YaTeX-on-begin-end-p) + (or + (match-beginning 2) ;if \end + (and (match-beginning 3) ;if \) \] + (= (char-syntax (char-after (1+ (match-beginning 3)))) ?\))))) + (YaTeX-reindent + (save-excursion + (YaTeX-goto-corresponding-environment) + (current-column)))) ((string-match YaTeX-equation-env-regexp inenv) (YaTeX-indent-line-equation)) ;autoload-ed from yatexenv (;(YaTeX-in-environment-p '("itemize" "enumerate" "description" "list")) @@ -2642,6 +2685,16 @@ (looking-at "\\sw+")) ;is not japanese string (insert YaTeX-comment-prefix))))))) +(defun YaTeX-latex2e-p () + (let ((b (current-buffer)) + (ptn (concat YaTeX-ec "documentclass"))) + (unwind-protect + (or (save-excursion (search-backward ptn nil t)) + (progn + (YaTeX-visit-main t) + (save-excursion (search-backward ptn nil t)))) + (set-buffer b)))) + (provide 'yatex) (defvar yatex-mode-load-hook nil "*List of functions to be called when yatex.el is loaded.") diff --git a/yatex.new b/yatex.new index e98fe6f..82db3ec 100644 --- a/yatex.new +++ b/yatex.new @@ -1,6 +1,26 @@ What's new in YaTeX/yahtml �쒹/yahtml - �e�o�[�W�����̕ύX�_�ɂ‚��� +1.68 === yatex === + XEmacs��yatexgen�������Ȃ��Ȃ����̂ɑΏ��B + Windows�ł̃C���X�g�[���������y�ɂȂ�悤�� makefile ���C���B + ref/cite ���x���⊮�őS�ẴJ�E���^��⊮���ɂ����ĂȂ����� + label���ݒ肵�Ă��Ȃ��Ƃ���ɂ͎����I�Ƀ��x����t������悤�ɂ����B + \cite �̕⊮�� BibTeX �f�[�^�x�[�X�t�@�C��������T���悤�ɂ����B + LaTeX2e�̑����̃R�}���h�ɁA�{��/�A�h�C�����ɑΉ��B + === yahtml === + �p���info�AQ&A�̓Y�t(by Jun Ohya����) + �⊮��src�ƂȂ�摜�t�@�C���̃s�N�Z���T�C�Y�����O + �Œ��ׂ� width, height �����̕⊮�̃f�t�H���g�ƂȂ�悤�ɂ����B + M-C-a(beginning-of-environment), M-C-e(end-of-environment), + M-C-@(mark-environment) �� yatex.el ���ɒ�`����Ă���yahtml���� + �����[�h���Ă���Ƃ��ɃG���[�ɂȂ����̂ŁA�����֐���`�� + yatexlib�Ɉړ��B + css��`�t�@�C�����s���I�h�Ŏn�܂�G���g����S�ẴG�������g�ɋ� + �ʂ�class�⊮���Ƃ��ďo���悤�ɂ����B + yahtml���g�p�����YaTeX�ł̃C���f���g�����������Ȃ�̂𒼂����B + & ��char-entity reference�⊮�B + 1.67 [[[ http://www.yatex.org/ ���a�����܂��� ]]] === yahtml === href���͂�SPC�Ȃǂ�unsafe-char��%�G���R�[�h�ɒu�����邩�� diff --git a/yatex19.el b/yatex19.el index f7c5106..825669b 100644 --- a/yatex19.el +++ b/yatex19.el @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX facilities for Emacs 19 -;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org] -;;; Last modified Thu Apr 29 18:40:26 1999 on firestorm +;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Fri Nov 26 09:56:09 1999 on firestorm ;;; $Id$ ;;; �Ƃ肠���� hilit19 ���g���Ă��鎞�ɐF���t���悤�ɂ��� @@ -13,6 +13,10 @@ ;(require 'yatex) +(defvar YaTeX-use-hilit19 (and (featurep 'hilit19) (fboundp 'x-color-values) + (fboundp 'hilit-translate)) + "*Use hilit19 to fontify buffer or not.") + (defvar YaTeX-mode-menu-map (make-sparse-keymap "YaTeX")) (defvar YaTeX-mode-menu-map-process (make-sparse-keymap "Process")) (define-key YaTeX-mode-map [menu-bar yatex] @@ -360,7 +364,7 @@ ; (fset 'x-color-values 'win32-color-values)) (cond - ((and (featurep 'hilit19) (fboundp 'x-color-values)) + (YaTeX-use-hilit19 (let*((sectface (car (if (eq hilit-background-mode 'dark) (cdr YaTeX-hilit-sectioning-face) @@ -412,7 +416,7 @@ ;; ���[�J���}�N���� keyword �Ƃ��Č��点��(keyword����܂������ȁc)�B (defun YaTeX-19-collect-macros () (cond - ((and (featurep 'hilit19) (fboundp 'hilit-translate)) + (YaTeX-use-hilit19 (let ((get-face (function (lambda (table) diff --git a/yatexadd.el b/yatexadd.el index 698231a..71c84da 100644 --- a/yatexadd.el +++ b/yatexadd.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX add-in functions. ;;; yatexadd.el rev.14 -;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@gentei.org] -;;; Last modified Tue Jul 13 13:57:45 1999 on firestorm +;;; (c )1991-1999 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Fri Mar 17 20:21:45 2000 on firestorm ;;; $Id$ ;;; @@ -371,12 +371,212 @@ (goto-char (match-beginning 0)))) (message YaTeX-label-guide-msg))) +; (defun YaTeX::ref (argp &optional labelcmd refcmd) +; (cond +; ((= argp 1) +; (let ((lnum 0) e0 label label-list (buf (current-buffer)) +; (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref")) +; (p (point)) initl line cf) +; (message "Collecting labels...") +; (save-window-excursion +; (YaTeX-showup-buffer +; YaTeX-label-buffer (function (lambda (x) (window-width x)))) +; (if (fboundp 'select-frame) (setq cf (selected-frame))) +; (if (eq (window-buffer (minibuffer-window)) buf) +; (progn +; (other-window 1) +; (setq buf (current-buffer)) +; (set-buffer buf) +; ;(message "cb=%s" buf)(sit-for 3) +; )) +; (save-excursion +; (set-buffer (get-buffer-create YaTeX-label-buffer)) +; (setq buffer-read-only nil) +; (erase-buffer)) +; (save-excursion +; (goto-char (point-min)) +; (let ((standard-output (get-buffer YaTeX-label-buffer))) +; (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) +; (while (YaTeX-re-search-active-forward +; (concat "\\\\" labelcmd "\\b") +; (regexp-quote YaTeX-comment-prefix) nil t) +; (goto-char (match-beginning 0)) +; (skip-chars-forward "^{") +; (setq label +; (buffer-substring +; (1+ (point)) +; (prog2 (forward-list 1) (setq e0 (1- (point))))) +; label-list (cons label label-list)) +; (or initl +; (if (< p (point)) (setq initl lnum))) +; (beginning-of-line) +; (skip-chars-forward " \t\n" nil) +; (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label +; (buffer-substring (point) (point-end-of-line)))) +; (setq lnum (1+ lnum)) +; (message "Collecting \\%s{}... %d" labelcmd lnum) +; (goto-char e0)) +; (princ YaTeX-label-menu-other) +; (princ YaTeX-label-menu-repeat) +; (princ YaTeX-label-menu-any) +; );standard-output +; (goto-char p) +; (or initl (setq initl lnum)) +; (message "Collecting %s...Done" labelcmd) +; (if (fboundp 'select-frame) (select-frame cf)) +; (YaTeX-showup-buffer YaTeX-label-buffer nil t) +; (YaTeX::label-setup-key-map) +; (setq truncate-lines t) +; (setq buffer-read-only t) +; (use-local-map YaTeX-label-select-map) +; (message YaTeX-label-guide-msg) +; (goto-line (1+ initl)) ;goto recently defined label line +; (switch-to-buffer (current-buffer)) +; (unwind-protect +; (progn +; (recursive-edit) +; (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion +; (beginning-of-line) +; (setq line (1- (count-lines (point-min)(point)))) +; (cond +; ((= line -1) (setq label "")) +; ((= line lnum) (setq label (YaTeX-label-other))) +; ((= line (1+ lnum)) +; (save-excursion +; (switch-to-buffer buf) +; (goto-char p) +; (if (re-search-backward +; (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t) +; (setq label (YaTeX-match-string 1)) +; (setq label "")))) +; ((>= line (+ lnum 2)) +; (setq label (read-string (format "\\%s{???}: " refcmd)))) +; (t (setq label (nth (- lnum line 1) label-list))))) +; (bury-buffer YaTeX-label-buffer))) +; label))))) + +(defun YaTeX::ref-generate-label () + "Generate a label string which is unique in current buffer." + (let ((default (substring (current-time-string) 4))) + (read-string "Give a label for this line: " + (if YaTeX-emacs-19 (cons default 1) default)))) + +(defun YaTeX::ref-getset-label (buffer point) + "Get label string in the BUFFER near the POINT. +Make \\label{xx} if no label." + (let (boundary inspoint cc newlabel (labelholder "label") mathp env) + ;(set-buffer buffer) + (switch-to-buffer buffer) + (save-excursion + (goto-char point) + (setq cc (current-column)) + (if (= (char-after (point)) ?\\) (forward-char 1)) + (cond + ((looking-at YaTeX-sectioning-regexp) + (skip-chars-forward "^{") + (forward-list 1) + (skip-chars-forward " \t\n") + (setq boundary "\\S ")) + ((looking-at "item\\s ") + (setq cc (+ cc 6)) + (setq boundary (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b"))) + ((looking-at "bibitem") + (setq labelholder "bibitem")) ; label holder is bibitem itself + ((string-match YaTeX::ref-mathenv-regexp + (setq env (or (YaTeX-inner-environment t) "document"))) + (setq mathp t) + (setq boundary (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)"))) + ((looking-at "caption\\|\\(begin\\)") + (skip-chars-forward "^{") + (if (match-beginning 1) (forward-list 1)) + (setq boundary (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b"))) + (t )) + (if (save-excursion (skip-chars-forward " \t") (looking-at "%")) + (forward-line 1)) + (if (and (save-excursion + (YaTeX-re-search-active-forward + (concat "\\(" labelholder "\\)\\|\\(" boundary "\\)") + (regexp-quote YaTeX-comment-prefix) + nil 1)) + (match-beginning 1)) + ;; if \label{hoge} found, return it + (buffer-substring + (progn + (goto-char (match-end 0)) + (skip-chars-forward "^{") (1+ (point))) + (progn + (forward-sexp 1) (1- (point)))) + ;;else make a label + (goto-char (match-beginning 0)) + (skip-chars-backward " \t\n") + (save-excursion (setq newlabel (YaTeX::ref-generate-label))) + (delete-region (point) (progn (skip-chars-backward " \t") (point))) + (if mathp nil + (insert "\n") + (YaTeX-reindent cc)) + (insert (format "\\label{%s}" newlabel)) + newlabel)))) + +(defvar YaTeX::ref-labeling-regexp-alist + '(("\\\\begin{java}{\\([^}]+\\)}" . 1) + ("\\\\elabel{\\([^}]+\\)}" . 1))) +(defvar YaTeX::ref-labeling-regexp + (mapconcat 'car YaTeX::ref-labeling-regexp-alist "\\|")) +(defvar YaTeX::ref-mathenv-regexp + "equation\\|eqnarray\\|align\\|gather\\|alignat\\|xalignat") +(defvar YaTeX::ref-enumerateenv-regexp + "enumerate") + +(defvar YaTeX::ref-labeling-section-level 2 + "ref�⊮�Ŏ��W����Z�N�V���j���O�R�}���h�̉������x�� +YaTeX-sectioning-level�̐��l�Ŏw��.") + (defun YaTeX::ref (argp &optional labelcmd refcmd) + (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache + (require 'yatexsec) (cond ((= argp 1) - (let ((lnum 0) e0 label label-list (buf (current-buffer)) - (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref")) - (p (point)) initl line cf) + (let*((lnum 0) e0 x cmd label match-point point-list boundary + (buf (current-buffer)) + (llv YaTeX::ref-labeling-section-level) + (mathenvs YaTeX::ref-mathenv-regexp) + (enums YaTeX::ref-enumerateenv-regexp) + (counter + (or labelcmd + (concat + YaTeX-ec-regexp "\\(\\(" + (mapconcat + 'concat + (delq nil + (mapcar + (lambda (s) + (if (>= llv (cdr s)) + (car s))) + YaTeX-sectioning-level)) + "\\|") + "\\|caption\\){" + "\\|\\(begin{\\(" mathenvs "\\|" enums "\\)\\)\\)"))) + (regexp (concat "\\(" counter + "\\)\\|\\(" YaTeX::ref-labeling-regexp "\\)")) + (itemsep (concat YaTeX-ec-regexp + "\\(\\(bib\\)?item\\|begin\\|end\\)")) + (refcmd (or refcmd "ref")) + (p (point)) initl line cf + (percent (regexp-quote YaTeX-comment-prefix)) + (output + (function + (lambda (label p) + (while (setq x (string-match "\n" label)) + (aset label x ? )) + (while (setq x (string-match "[ \t\n][ \t\n]+" label)) + (setq label (concat + (substring label 0 (1+ (match-beginning 0))) + (substring label (match-end 0))))) + (princ (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label)) + (setq point-list (cons p point-list)) + (message "Collecting labels... %d" lnum) + (setq lnum (1+ lnum))))) + ) (message "Collecting labels...") (save-window-excursion (YaTeX-showup-buffer @@ -386,35 +586,106 @@ (progn (other-window 1) (setq buf (current-buffer)) - (set-buffer buf) - ;(message "cb=%s" buf)(sit-for 3) - )) + (set-buffer buf))) (save-excursion (set-buffer (get-buffer-create YaTeX-label-buffer)) (setq buffer-read-only nil) (erase-buffer)) (save-excursion + (set-buffer buf) (goto-char (point-min)) (let ((standard-output (get-buffer YaTeX-label-buffer))) (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) (while (YaTeX-re-search-active-forward - (concat "\\\\" labelcmd "\\b") - (regexp-quote YaTeX-comment-prefix) nil t) - (goto-char (match-beginning 0)) - (skip-chars-forward "^{") - (setq label - (buffer-substring - (1+ (point)) - (prog2 (forward-list 1) (setq e0 (1- (point))))) - label-list (cons label label-list)) - (or initl - (if (< p (point)) (setq initl lnum))) - (beginning-of-line) - (skip-chars-forward " \t\n" nil) - (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label - (buffer-substring (point) (point-end-of-line)))) - (setq lnum (1+ lnum)) - (message "Collecting \\%s{}... %d" labelcmd lnum) + regexp ;;counter + percent nil t) + ;(goto-char (match-beginning 0)) + (setq e0 (match-end 0)) + (cond + ((match-string 1) + ;;if standard counter commands found + (setq cmd (YaTeX-match-string 2)) + (setq match-point (match-beginning 0)) + (or initl + (if (< p (point)) (setq initl lnum))) + (cond + ((string-match mathenvs cmd) ;;if matches mathematical env + ;(skip-chars-forward "} \t\n") + (forward-line 1) + (setq x (point)) + (catch 'scan + (while (YaTeX-re-search-active-forward + (concat "\\\\\\\\$\\|\\\\end{\\(" mathenvs "\\)") + percent nil t) + (let ((quit (match-beginning 1))) + (funcall output + (buffer-substring x (match-beginning 0)) + x) + (if quit (throw 'scan t))) + (setq x (point)))) + (setq e0 (point))) + ((string-match enums cmd) + ;(skip-chars-forward "} \t\n") + (save-restriction + (narrow-to-region + (point) + (save-excursion + (YaTeX-goto-corresponding-environment) (point))) + (forward-line 1) + (while (YaTeX-re-search-active-forward + (concat YaTeX-ec-regexp "item\\s ") + percent nil t) + (setq x (match-beginning 0)) + (funcall + output + (buffer-substring + (match-beginning 0) + (if (re-search-forward itemsep nil t) + (progn (goto-char (match-beginning 0)) + (skip-chars-backward " \t") + (1- (point))) + (point-end-of-line))) + x)))) + + ((= (char-after (1- (point))) ?{) + (setq label (buffer-substring + (match-beginning 0) + (progn (forward-char -1) + (forward-list 1) + (point)))) + (funcall output label match-point)) + (t + (skip-chars-forward " \t") + (setq label (buffer-substring + (match-beginning 0) + (if (re-search-forward + itemsep + nil t) + (progn + (goto-char (match-beginning 0)) + (skip-chars-backward " \t") + (1- (point))) + (point-end-of-line)))) + (funcall output label match-point) + )) + ) ;;put label buffer + ;; + ;; if user defined label found + (t + ;; memorize line number and label into property + (goto-char (match-beginning 0)) + (let ((list YaTeX::ref-labeling-regexp-alist) + (cache (symbol-plist 'YaTeX::ref-labeling-regexp))) + (while list + (if (looking-at (car (car list))) + (progn + (setq label (YaTeX-match-string 0)) + (put 'YaTeX::ref-labeling-regexp lnum + (YaTeX-match-string (cdr (car list)))) + (funcall output label 0) ;;0 is dummy, never used + (setq list nil))) + (setq list (cdr list)))) + )) (goto-char e0)) (princ YaTeX-label-menu-other) (princ YaTeX-label-menu-repeat) @@ -422,7 +693,7 @@ );standard-output (goto-char p) (or initl (setq initl lnum)) - (message "Collecting %s...Done" labelcmd) + (message "Collecting labels...Done") (if (fboundp 'select-frame) (select-frame cf)) (YaTeX-showup-buffer YaTeX-label-buffer nil t) (YaTeX::label-setup-key-map) @@ -435,6 +706,7 @@ (unwind-protect (progn (recursive-edit) + (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion (beginning-of-line) (setq line (1- (count-lines (point-min)(point)))) @@ -451,17 +723,112 @@ (setq label "")))) ((>= line (+ lnum 2)) (setq label (read-string (format "\\%s{???}: " refcmd)))) - (t (setq label (nth (- lnum line 1) label-list))))) + (t ;(setq label (nth (- lnum line 1) label-list)) + (setq label + (or (get 'YaTeX::ref-labeling-regexp line) + (YaTeX::ref-getset-label + buf (nth (- lnum line 1) point-list)))) + ))) (bury-buffer YaTeX-label-buffer))) label))))) (fset 'YaTeX::pageref 'YaTeX::ref) + +(defun YaTeX::cite-collect-bibs-external (&rest files) + "Collect bibentry from FILES(variable length argument); +and print them to standard output." + ;;Thanks; http://icarus.ilcs.hokudai.ac.jp/comp/biblio.html + (let ((tb (get-buffer-create " *bibtmp*"))) + (save-excursion + (set-buffer tb) + (while files + (erase-buffer) + (cond + ((file-exists-p (car files)) + (insert-file-contents (car files))) + ((file-exists-p (concat (car files) ".bib")) + (insert-file-contents (concat (car files) ".bib")))) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\\s *@[A-Za-z]" nil t) + (skip-chars-forward "^{,") + (if (= (char-after (point)) ?{) + (princ (format "%sbibitem{%s}%s\n" + YaTeX-ec + (buffer-substring + (1+ (point)) + (progn (skip-chars-forward "^,\n") + (point))) + (if (re-search-forward "title\\s *=" nil t) + (buffer-substring + (progn + (goto-char (match-end 0)) + (skip-chars-forward " \t\n") + (point)) + (progn + (if (looking-at "[{\"]") + (forward-sexp 1) + (forward-char 1) + (skip-chars-forward "^,")) + (point))))))))) + (setq files (cdr files)))))) + +(defun YaTeX::cite-collect-bibs-internal () + "Collect bibentry in the current buffer and print them to standard output." + (let ((ptn (concat YaTeX-ec-regexp "bibitem\\b")) + (pcnt (regexp-quote YaTeX-comment-prefix))) + (save-excursion + (while (YaTeX-re-search-active-forward ptn pcnt nil t) + (skip-chars-forward "^{\n") + (or (eolp) + (princ (format "%sbibitem{%s}\n" + YaTeX-ec + (buffer-substring + (1+ (point)) + (progn (forward-sexp 1) (point)))))))))) + (defun YaTeX::cite (argp) (cond ((eq argp 1) - (YaTeX::ref argp "bibitem\\(\\[.*\\]\\)?" "cite")) + (let* ((cb (current-buffer)) + (f (file-name-nondirectory buffer-file-name)) + (d default-directory) + (hilit-auto-highlight nil) + (pcnt (regexp-quote YaTeX-comment-prefix)) + (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}")) + (bbuf (get-buffer-create " *bibitems*")) + (standard-output bbuf) + bibs files) + (set-buffer bbuf)(erase-buffer)(set-buffer cb) + (save-excursion + (goto-char (point-min)) + ;;(1)search external bibdata + (while (YaTeX-re-search-active-forward bibrx pcnt nil t) + (apply 'YaTeX::cite-collect-bibs-external + (YaTeX-split-string + (YaTeX-match-string 1) ","))) + ;;(2)search direct \bibitem usage + (YaTeX::cite-collect-bibs-internal) + (if (progn + (YaTeX-visit-main t) + (not (eq (current-buffer) cb))) + (save-excursion + (goto-char (point-min)) + ;;(1)search external bibdata + (while (YaTeX-re-search-active-forward bibrx pcnt nil t) + (apply 'YaTeX::cite-collect-bibs-external + (YaTeX-split-string + (YaTeX-match-string 1) ","))) + ;;(2)search internal + (YaTeX::cite-collect-bibs-internal))) + ;;Now bbuf holds the list of bibitem + (set-buffer bbuf) + (YaTeX::ref argp "\\\\\\(bibitem\\)\\(\\[.*\\]\\)?" "cite")))) + (t nil))) +(and YaTeX-use-AMS-LaTeX (fset 'YaTeX::eqref 'YaTeX::ref)) + (defun YaTeX-yatex-buffer-list () (save-excursion (delq nil (mapcar (function (lambda (buf) @@ -749,9 +1116,10 @@ ;;; -------------------- LaTeX2e stuff -------------------- (defvar YaTeX:documentclass-options-default - '(("a4paper") ("a5paper") ("b5paper") ("10pt") ("11pt") ("12pt") + '(("a4paper") ("a5paper") ("b4paper") ("b5paper") ("10pt") ("11pt") ("12pt") ("latterpaper") ("legalpaper") ("executivepaper") ("landscape") ("oneside") ("twoside") ("draft") ("final") ("leqno") ("fleqn") ("openbib") + ("tombow") ("titlepage") ("notitlepage") ("dvips") ("clock") ;for slides class only ) "Default options list for documentclass") @@ -773,6 +1141,7 @@ (if (string< "" opt) (progn (while substr + (setq o (substring substr 0 (string-match delim substr))) (or (assoc o dt) (YaTeX-update-table @@ -811,6 +1180,77 @@ (if (string= "" sname) (setq sname YaTeX-default-documentclass)) (setq YaTeX-default-documentclass sname))))) +(defvar YaTeX:latex2e-named-color-alist + '(("GreenYellow") ("Yellow") ("Goldenrod") ("Dandelion") ("Apricot") + ("Peach") ("Melon") ("YellowOrange") ("Orange") ("BurntOrange") + ("Bittersweet") ("RedOrange") ("Mahogany") ("Maroon") ("BrickRed") + ("Red") ("OrangeRed") ("RubineRed") ("WildStrawberry") ("Salmon") + ("CarnationPink") ("Magenta") ("VioletRed") ("Rhodamine") ("Mulberry") + ("RedViolet") ("Fuchsia") ("Lavender") ("Thistle") ("Orchid")("DarkOrchid") + ("Purple") ("Plum") ("Violet") ("RoyalPurple") ("BlueViolet") + ("Periwinkle") ("CadetBlue") ("CornflowerBlue") ("MidnightBlue") + ("NavyBlue") ("RoyalBlue") ("Blue") ("Cerulean") ("Cyan") ("ProcessBlue") + ("SkyBlue") ("Turquoise") ("TealBlue") ("Aquamarine") ("BlueGreen") + ("Emerald") ("JungleGreen") ("SeaGreen") ("Green") ("ForestGreen") + ("PineGreen") ("LimeGreen") ("YellowGreen") ("SpringGreen") ("OliveGreen") + ("RawSienna") ("Sepia") ("Brown") ("Tan") ("Gray") ("Black") ("White")) + "Colors defined in $TEXMF/tex/plain/colordvi.tex") + +(defvar YaTeX:latex2e-basic-color-alist + '(("black") ("white") ("red") ("blue") ("yellow") ("green") ("cyan") + ("magenta")) + "Basic colors") + +(defun YaTeX:textcolor () + "Add-in for \\color's option" + (if (y-or-n-p "Use `named' color? ") + "[named]")) + +(defun YaTeX::color-completing-read (prompt) + (let ((completion-ignore-case t) + (namedp (save-excursion + (skip-chars-backward "^\n\\[\\\\") + (looking-at "named")))) + (completing-read + prompt + (if namedp + YaTeX:latex2e-named-color-alist + YaTeX:latex2e-basic-color-alist) + nil t))) + +(defun YaTeX::textcolor (argp) + "Add-in for \\color's argument" + (cond + ((= argp 1) (YaTeX::color-completing-read "Color: ")) + ((= argp 2) (read-string "Colored string: ")))) + +(fset 'YaTeX:color 'YaTeX:textcolor) +(fset 'YaTeX::color 'YaTeX::textcolor) +(fset 'YaTeX:colorbox 'YaTeX:textcolor) +(fset 'YaTeX::colorbox 'YaTeX::textcolor) +(fset 'YaTeX:fcolorbox 'YaTeX:textcolor) + +(defun YaTeX::fcolorbox (argp) + (cond + ((= argp 1) (YaTeX::color-completing-read "Frame color: ")) + ((= argp 2) (YaTeX::color-completing-read "Inner color: ")) + ((= argp 3) (read-string "Colored string: ")))) + +(defun YaTeX:scalebox () + "Add-in for \\rotatebox" + (let ((vmag (read-string (if YaTeX-japan "�{��: " "Magnification: "))) + (hmag (read-string (if YaTeX-japan "���{��(�ȗ���): " + "Horizontal magnification(Optional): ")))) + (if (and hmag (string< "" hmag)) + (format "{%s}[%s]" vmag hmag) + (format "{%s}" vmag)))) + +(defun YaTeX::includegraphics (argp) + "Add-in for \\includegraphics" + (cond + ((= argp 1) + (read-file-name "EPS File: " "")))) + (defun YaTeX:caption () (setq section-name "label") nil) diff --git a/yatexenv.el b/yatexenv.el index 0d166e6..8330ad1 100644 --- a/yatexenv.el +++ b/yatexenv.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX environment-specific functions. ;;; yatexenv.el -;;; (c ) 1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Wed Jan 14 16:44:36 1998 on firestorm +;;; (c ) 1994-1997 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Thu Aug 26 18:14:51 1999 on firestorm ;;; $Id$ ;;; diff --git a/yatexgen.el b/yatexgen.el index 9653165..d0bede0 100644 --- a/yatexgen.el +++ b/yatexgen.el @@ -1,12 +1,11 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX add-in function generator. ;;; yatexgen.el rev.5 -;;; (c )1991-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Thu Feb 15 01:44:24 1996 on nsr +;;; (c )1991-1995,1999 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Thu Aug 26 18:15:14 1999 on firestorm ;;; $Id$ (require 'yatex) -(provide 'yatexgen) (defmacro YaTeX-setq (var japanese english) (list 'setq var @@ -143,7 +142,7 @@ 10 "Window height of YaTeX-generate-message-buffer") ;; Do you need learning for generated function? -;; If you need, please tell me (yuuji@ae.keio.ac.jp) +;; If you need, please tell me (yuuji@yatex.org) ;;(defvar YaTeX-generate-variables-for-learning nil) ;;(defvar YaTeX-generate-current-completion-table nil) @@ -153,7 +152,7 @@ (defun YaTeX-generate () "Genarate YaTeX add-in function with enquiry." (interactive) - (if (< (screen-height) (+ YaTeX-generate-message-height 10)) + (if (< (YaTeX-screen-height) (+ YaTeX-generate-message-height 10)) (error YaTeX-generate-narrow-message)) (put 'YaTeX-generate 'disabled t) (save-window-excursion @@ -609,3 +608,4 @@ command (string-to-int (read-string "How many arguments?: ")))) nil) ) +(provide 'yatexgen) diff --git a/yatexhie.el b/yatexhie.el index b836e5f..b030e2a 100644 --- a/yatexhie.el +++ b/yatexhie.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX hierarchy browser. ;;; yatexhie.el -;;; (c )1995 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Thu Sep 17 21:46:29 1998 on firestorm +;;; (c )1995 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Wed Dec 1 23:41:01 1999 on firestorm ;;; $Id$ ;; ----- Customizable variables ----- @@ -55,10 +55,14 @@ (set-buffer cb) (nreverse list)))) -(defun YaTeX-document-hierarchy (&optional file) +(defun YaTeX-document-hierarchy (&optional file basedir) "Return the document hierarchy beginning from FILE as a list. If FILE is nil, beginning with current buffer's file." (setq file (or file buffer-file-name)) + (and YaTeX-search-file-from-top-directory + (not (file-exists-p file)) + (string-match "^[^/].*/" file) + (setq file (expand-file-name file basedir))) (message "Parsing [%s]..." (file-name-nondirectory file)) (prog1 (save-excursion @@ -71,7 +75,8 @@ (YaTeX-get-builtin "!") (setq YaTeX-parent-file parent)))) (cons (buffer-file-name (current-buffer)) - (mapcar 'YaTeX-document-hierarchy ;return value + (mapcar '(lambda (f) ;return value + (YaTeX-document-hierarchy f basedir)) (YaTeX-all-included-files)))))) (message "Parsing [%s]...done" (file-name-nondirectory file)))) @@ -145,12 +150,11 @@ (boundp 'win:current-config) win:current-config))) (let*((b-in (YaTeX-get-builtin "!")) - (default (or YaTeX-parent-file - (and b-in (YaTeX-guess-parent b-in)) - buffer-file-name))) + default) ;;$B$`!<$s"-$3$N$X$s$N;EMM$I$&$7$?$i$$$$$+NI$/J,$+$i$s(B... (if default (setq default (expand-file-name default))) (YaTeX-visit-main t) ;move to parent file + (setq default buffer-file-name) (setq file (or (if use-default default file) (read-file-name @@ -162,13 +166,14 @@ "" default 1)))) (setq file (expand-file-name file)) (setq YaTeX-hierarchy-current-main file) - (let ((dbuf "*document hierarchy*")) + (let ((dbuf "*document hierarchy*") + (topdir default-directory)) (YaTeX-showup-buffer dbuf nil t) (set-buffer (get-buffer dbuf)) (setq truncate-lines t) (let ((buffer-read-only nil)) (erase-buffer) - (YaTeX-display-a-hierachy (YaTeX-document-hierarchy file) 0)) + (YaTeX-display-a-hierachy (YaTeX-document-hierarchy file topdir) 0)) (goto-char (point-min)) (YaTeX-hierarchy-next 0) (set-buffer-modified-p nil) diff --git a/yatexhlp.el b/yatexhlp.el index 20bb833..0890733 100644 --- a/yatexhlp.el +++ b/yatexhlp.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX helper with LaTeX commands and macros. ;;; yatexhlp.el -;;; (c )1994,1998 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Thu Mar 12 11:10:07 1998 on crx +;;; (c )1994,1998 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Thu Aug 26 18:15:39 1999 on firestorm ;;; $Id$ (let ((help-file (concat "YATEXHLP." diff --git a/yatexlib.el b/yatexlib.el index 5e49499..b2ab322 100644 --- a/yatexlib.el +++ b/yatexlib.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX and yahtml common libraries, general functions and definitions ;;; yatexlib.el -;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org] -;;; Last modified Tue May 4 10:25:55 1999 on firestorm +;;; (c )1994-2000 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sun Apr 9 12:36:25 2000 on firestorm ;;; $Id$ ;; General variables @@ -16,6 +16,9 @@ (defvar YaTeX-japan (or (boundp 'NEMACS) (boundp 'MULE) YaTeX-emacs-20) "Whether yatex mode is running on Japanese environment or not.") +;; autoload from yahtml.el +(autoload 'yahtml-inner-environment-but "yahtml" "yahtml internal func." t) + (defvar YaTeX-kanji-code-alist (cond ((boundp '*junet*) @@ -318,7 +321,14 @@ "Switch to buffer if buffer exists, find file if not. Optional second arg SETBUF t make use set-buffer instead of switch-to-buffer." (interactive "Fswitch to file: ") - (if (bufferp file) (setq file (buffer-file-name file))) + (if (bufferp file) + (setq file (buffer-file-name file)) + (and (string-match "^[^/].*/" file) + (eq major-mode 'yatex-mode) + YaTeX-search-file-from-top-directory + (save-excursion + (YaTeX-visit-main t) + (setq file (expand-file-name file))))) (let (buf (hilit-auto-highlight (not setbuf))) (cond ((setq buf (get-file-buffer file)) @@ -337,6 +347,13 @@ (defun YaTeX-switch-to-buffer-other-window (file) "Switch to buffer if buffer exists, find file if not." (interactive "Fswitch to file: ") + (and (eq major-mode 'yatex-mode) + (stringp file) + (string-match "^[^/].*/" file) + YaTeX-search-file-from-top-directory + (save-excursion + (YaTeX-visit-main t) + (setq file (expand-file-name file)))) (if (bufferp file) (setq file (buffer-file-name file))) (cond ((get-file-buffer file) @@ -347,13 +364,24 @@ (t (message "%s was not found in this directory." file) nil))) +(defun YaTeX-get-file-buffer (file) + "Return the FILE's buffer. +Base directory is that of main file or current directory." + (let (dir main (cdir default-directory)) + (or (and (eq major-mode 'yatex-mode) + YaTeX-search-file-from-top-directory + (save-excursion + (YaTeX-visit-main t) + (get-file-buffer file))) + (get-file-buffer file)))) + (defun YaTeX-replace-format-sub (string format repl) (let ((beg (or (string-match (concat "^\\(%" format "\\)") string) (string-match (concat "[^%]\\(%" format "\\)") string))) (len (length format))) (if (null beg) string ;no conversion (concat - (substring string 0 (match-beginning 1)) repl + (substring string 0 (match-beginning 1)) (or repl "") (substring string (match-end 1)))))) ;;;###autoload @@ -367,6 +395,15 @@ string)) ;;;###autoload +(defun YaTeX-replace-formats (string replace-list) + (let ((list replace-list)) + (while list + (setq string (YaTeX-replace-format + string (car (car list)) (cdr (car list))) + list (cdr list))) + string)) + +;;;###autoload (defun YaTeX-replace-format-args (string &rest args) "Translate the argument mark #1, #2, ... #n in the STRING into the corresponding real arguments ARGS." @@ -643,13 +680,49 @@ (fset 'YaTeX-rassoc (if (and nil (fboundp 'rassoc) (subrp (symbol-function 'rassoc))) (symbol-function 'rassoc) - (lambda (key list) - (let ((l list)) - (catch 'found - (while l - (if (equal key (cdr (car l))) - (throw 'found (car l))) - (setq l (cdr l)))))))) + (function + (lambda (key list) + (let ((l list)) + (catch 'found + (while l + (if (equal key (cdr (car l))) + (throw 'found (car l))) + (setq l (cdr l))))))))) + +(defun YaTeX-insert-file-contents (file visit &optional beg end) + (cond + ((string< "19" emacs-version) + (insert-file-contents file visit beg end)) + ((string-match "unix" (symbol-name system-type)) + (let ((default-process-coding-system + (and (boundp '*noconv*) (list *noconv*))) + file-coding-system (and (boundp '*noconv*) *noconv*) + kanji-fileio-code + (default-process-kanji-code 0)) + (call-process shell-file-name file (current-buffer) nil + (or (and (boundp 'shell-command-option) + shell-command-option) + "-c") + (format "head -c %d | tail -c +%d" end beg)))) + (t (insert-file-contents file)))) + +(defun YaTeX-split-string (str &optional sep null) + "Split string STR by every occurrence of SEP(regexp). +If the optional second argument SEP is nil, it defaults to \"[ \f\t\n\r\v]+\". +Do not include null string by default. Non-nil for optional third argument +NULL includes null string in a list." + (let ((sep (or sep "[ \f\t\n\r\v]+")) + list m) + (while str + (if (setq m (string-match sep str)) + (progn + (if (or (> m 0) null) + (setq list (cons (substring str 0 m) list))) + (setq str (substring str (match-end 0)))) + (if (or null (string< "" str)) + (setq list (cons str list))) + (setq str nil))) + (nreverse list))) ;;; ;; Interface function for windows.el @@ -752,6 +825,52 @@ (YaTeX-replace-format-args YaTeX-struct-begin env "" "") (count-lines (point-min) (point)))))))) +(defun YaTeX-beginning-of-environment (&optional limit-search-bound end) + "Goto the beginning of the current environment. +Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound to +most recent sectioning command. Non-nil for optional third argument END +goes to end of environment." + (interactive) + (let ((op (point))) + (if (YaTeX-inner-environment limit-search-bound) + (progn + (goto-char (get 'YaTeX-inner-environment 'point)) + (and end (YaTeX-goto-corresponding-environment)) + (if (interactive-p) (push-mark op)) + t)))) + +(defun YaTeX-end-of-environment (&optional limit-search-bound) + "Goto the end of the current environment. +Optional argument LIMIT-SEARCH-BOUND non-nil limits the search bound +to most recent sectioning command." + (interactive) + (YaTeX-beginning-of-environment limit-search-bound t)) + +(defun YaTeX-mark-environment () + "Mark current position and move point to end of environment." + (interactive) + (let ((curp (point))) + (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin + (forward-line 1) + (beginning-of-line)) + (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1 + (progn + (goto-char curp) + (error "Cannot found the end of current environment.")) + (YaTeX-goto-corresponding-environment) + (beginning-of-line) ;for confirmation + (if (< curp (point)) + (progn + (message "Mark this environment?(y or n): ") + (if (= (read-char) ?y) nil + (goto-char curp) + (error "Abort. Please call again at more proper position.")))) + (set-mark-command nil) + (YaTeX-goto-corresponding-environment) + (end-of-line) + (if (eobp) nil (forward-char 1))))) + + ;;;VER2 (defun YaTeX-insert-struc (what env) (cond @@ -817,5 +936,4 @@ (mapcar 'byte-compile-file command-line-args-left) (kill-emacs)))) - (provide 'yatexlib) diff --git a/yatexm-o.el b/yatexm-o.el index fe8830f..d90ce03 100644 --- a/yatexm-o.el +++ b/yatexm-o.el @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- ;;; Sample startup file to invoke yatex-mode with outline-minor mode. -;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Mon Jan 29 21:38:26 1996 on pajero +;;; (c )1993 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Thu Aug 26 18:16:00 1999 on firestorm ;;; ;; outline-minor-mode(�g�p���Ȃ��ꍇ�͕s�v�ł�) diff --git a/yatexmth.el b/yatexmth.el index c04c453..fa68f0f 100644 --- a/yatexmth.el +++ b/yatexmth.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX math-mode-specific functions. ;;; yatexmth.el -;;; (c )1993-1999 by HIROSE Yuuji [yuuji@gentei.org] -;;; Last modified Thu Apr 29 17:39:10 1999 on firestorm +;;; (c )1993-1999 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Thu Sep 23 16:39:40 1999 on firestorm ;;; $Id$ ;;; [Customization guide] @@ -551,7 +551,7 @@ (defun YaTeX-math-show-menu (match-str) (save-window-excursion (YaTeX-showup-buffer YaTeX-math-menu-buffer nil t) - (let ((maxcols (max 1 (/ (screen-width) YaTeX-math-sign-width))) + (let ((maxcols (max 1 (/ (YaTeX-screen-width) YaTeX-math-sign-width))) (case-fold-search nil) (cols 0) (list alist) command) (erase-buffer) @@ -560,7 +560,7 @@ (insert YaTeX-math-indicator "\t") (insert YaTeX-math-indicator) (newline 1) - (insert-char ?- (1- (screen-width))) + (insert-char ?- (1- (YaTeX-screen-width))) (newline 1) (while list (if (string-match match-str (car (car list))) diff --git a/yatexprc.el b/yatexprc.el index 4c4995a..a83e161 100644 --- a/yatexprc.el +++ b/yatexprc.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX process handler. ;;; yatexprc.el -;;; (c )1993-1999 by HIROSE Yuuji.[yuuji@gentei.org] -;;; Last modified Tue Jul 13 13:47:46 1999 on firestorm +;;; (c )1993-1999 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sat Dec 18 22:16:11 1999 on firestorm ;;; $Id$ ;(require 'yatex) @@ -479,7 +479,7 @@ (buffer-substring (point) (progn (skip-chars-forward "0-9" (match-end 0)) (point)))) - error-buffer (YaTeX-get-error-file cur-buf)) + error-buffer (expand-file-name (YaTeX-get-error-file cur-buf))) (if (or (null error-line) (equal 0 error-line)) (error "Can't detect error position.")) (YaTeX-set-virtual-error-position 'error-buffer 'error-line) @@ -517,7 +517,8 @@ (goto-char (match-beginning 0)) (setq error-line (string-to-int (buffer-substring (match-beginning 1) (match-end 1))) - error-file (YaTeX-get-error-file YaTeX-current-TeX-buffer)) + error-file (expand-file-name + (YaTeX-get-error-file YaTeX-current-TeX-buffer))) (YaTeX-set-virtual-error-position 'error-file 'error-line) (setq error-buf (YaTeX-switch-to-buffer error-file t))) (if (null error-buf) @@ -710,7 +711,9 @@ (YaTeX-parent-file (eq (get-file-buffer YaTeX-parent-file) (current-buffer))) ((YaTeX-get-builtin "!") - (string-match (YaTeX-guess-parent (YaTeX-get-builtin "!")) (buffer-name))) + (string-match + (concat "^" (YaTeX-guess-parent (YaTeX-get-builtin "!"))) + (buffer-name))) (t (save-excursion (let ((latex-main-id @@ -724,7 +727,11 @@ SETBUF is t(Use it only from Emacs-Lisp program)." (interactive "P") (if (and (interactive-p) setbuf) (setq YaTeX-parent-file nil)) - (let (b-in main-file) + (let ((ff (function (lambda (f) + (if setbuf (set-buffer (find-file-noselect f)) + (find-file f))))) + b-in main-file YaTeX-create-file-prefix-g + (hilit-auto-highlight (not setbuf))) (if (setq b-in (YaTeX-get-builtin "!")) (setq main-file (YaTeX-guess-parent b-in))) (if YaTeX-parent-file @@ -733,18 +740,30 @@ (if (YaTeX-main-file-p) (if (interactive-p) (message "I think this is main LaTeX source.") nil) (cond - ((and (interactive-p) main-file (get-file-buffer main-file)) - (goto-buffer-window main-file)) - ((and main-file (YaTeX-switch-to-buffer main-file setbuf))) + ((and ;;(interactive-p) + main-file + (cond ((get-file-buffer main-file) + (cond + (setbuf (set-buffer (get-file-buffer main-file))) + ((get-buffer-window (get-file-buffer main-file)) + (select-window + (get-buffer-window (get-file-buffer main-file)))) + (t (switch-to-buffer (get-file-buffer main-file))))) + ((file-exists-p main-file) + (funcall ff main-file))))) + ;;((and main-file (YaTeX-switch-to-buffer main-file setbuf))) ((and main-file (file-exists-p (setq main-file (concat "../" main-file))) (y-or-n-p (concat (expand-file-name main-file) " is main file?:"))) (setq YaTeX-parent-file main-file) - (YaTeX-switch-to-buffer main-file setbuf)) + ;(YaTeX-switch-to-buffer main-file setbuf) + (funcall ff main-file) + ) (t (setq main-file (read-file-name "Enter your main text: " nil nil 1)) (setq YaTeX-parent-file main-file) - (YaTeX-switch-to-buffer main-file setbuf)) + ; (YaTeX-switch-to-buffer main-file setbuf)) + (funcall ff main-file)) ))) nil) diff --git a/yatexsec.el b/yatexsec.el index 615b904..a05057e 100644 --- a/yatexsec.el +++ b/yatexsec.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX sectioning browser. ;;; yatexsec.el -;;; (c ) 1994, 1998 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Wed Sep 30 20:09:35 1998 on firestorm +;;; (c ) 1994, 1998 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Sun Dec 19 13:13:17 1999 on firestorm ;;; $Id$ (defvar YaTeX-sectioning-level @@ -287,6 +287,7 @@ (save-excursion (set-buffer (get-buffer-create YaTeX-sectioning-buffer)) (setq buffer-read-only nil) + (erase-buffer) (set-buffer cb) (YaTeX-showup-buffer YaTeX-sectioning-buffer) ;show buffer (goto-char (point-min))