annotate yatex.el @ 313:fcdb9189cd9c dev

\cref Update (c)-line
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 08 Jan 2014 07:52:12 +0900
parents 0d42b3d7f958
children fae84a98372c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 285
diff changeset
1 ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*-
313
HIROSE Yuuji <yuuji@gentei.org>
parents: 312
diff changeset
2 ;;; (c)1991-2014 by HIROSE Yuuji.[yuuji@yatex.org]
HIROSE Yuuji <yuuji@gentei.org>
parents: 312
diff changeset
3 ;;; Last modified Wed Jan 8 07:49:58 2014 on firestorm
119
34096706b634 Bind local variable source-window for YaTeX-read-section-with-overview
yuuji@gentei.org
parents: 107
diff changeset
4 ;;; $Id$
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
5 ;;; The latest version of this software is always available at;
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
6 ;;; http://www.yatex.org/
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
7
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 285
diff changeset
8 ;;; Code:
3
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
9 (require 'comment)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
10 (require 'yatexlib)
313
HIROSE Yuuji <yuuji@gentei.org>
parents: 312
diff changeset
11 (defconst YaTeX-revision-number "1.77.2"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
12 "Revision number of running yatex.el")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
13
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
14 ;---------- Local variables ----------
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
15 (defvar YaTeX-prefix "\C-c"
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
16 "*Prefix key to call YaTeX functions.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
17 You can select favorite prefix key by setq in your ~/.emacs.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
18
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
19 (defvar YaTeX-environment-indent 1
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
20 "*Indentation depth at column width in LaTeX environments.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
21
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
22 (defvar YaTeX-fill-prefix nil
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
23 "*fill-prefix used for auto-fill-mode.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
24 The default value is nil.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
25
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
26 (defvar YaTeX-fill-column 72
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
27 "*fill-column used for auto-fill-mode.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
28
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
29 (defvar YaTeX-comment-prefix "%"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
30 "TeX comment prefix.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
31
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
32 (defvar YaTeX-current-position-register ?3
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
33 "*Position register to keep where the last completion was done.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
34 All of YaTeX completing input store the current position into
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
35 the register YaTeX-current-position-register. So every time you
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
36 make a trip to any other part of text other than you are writing, you can
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
37 return to the editing paragraph by calling register-to-point with argument
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
38 YaTeX-current-position-register.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
39
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
40 ;;(defvar YaTeX-tmp-dic-unit 'main-file
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
41 ;; "*Default switching unit of temporary dictionary.
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
42 ;;There are two switching unit:
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
43 ;;'main-file : switch tmp-dic according to main-file directory.
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
44 ;;'directory : switch tmp-dic dir by dir."
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
45 ;;)
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 285
diff changeset
46 (defvar YaTeX-use-LaTeX2e t "*Use LaTeX2e or not. Nil means latex 2.09")
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
47
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
48 (defvar tex-command
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
49 (cond
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
50 (YaTeX-use-LaTeX2e "platex")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
51 (YaTeX-japan "jlatex")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
52 (t "latex"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
53 "*Default command for typesetting LaTeX text.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
54
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
55 (defvar bibtex-command (if YaTeX-japan "jbibtex" "bibtex")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
56 "*Default command of BibTeX.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
57
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
58 (defvar dvi2-command ;previewer command for your site
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
59 (if YaTeX-dos "dviout -wait=0"
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
60 "xdvi -geo +0+0 -s 4")
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
61 "*Default previewer command including its option.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
62 This default value is for X window system.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
63
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
64 (defvar makeindex-command (if YaTeX-dos "makeind" "makeindex")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
65 "*Default makeindex command.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
66
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
67 (defvar dviprint-command-format
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
68 (if YaTeX-dos "dviprt %s %f%t"
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
69 "dvi2ps %f %t %s | lpr")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
70 "*Command line string to print out current file.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
71 Format string %s will be replaced by the filename. Do not forget to
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
72 specify the `from usage' and `to usage' with their option by format string
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
73 %f and %t.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
74 See also documentation of dviprint-from-format and dviprint-to-format.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
75
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
76 (defvar dviprint-from-format
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
77 (if YaTeX-dos "%b-" "-f %b")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
78 "*`From' page format of dvi filter. %b will turn to beginning page number.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
79
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
80 (defvar dviprint-to-format
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
81 (if YaTeX-dos "%e" "-t %e")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
82 "*`To' page format of dvi filter. %e will turn to end page number.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
83
123
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
84 (defvar YaTeX-dvipdf-command
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
85 "dvipdfmx"
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
86 "*Command name to convert dvi file to PDF.")
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
87
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
88 (defvar YaTeX-default-document-style
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
89 (concat (if YaTeX-japan "j") "article")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
90 "*Default LaTeX Documentstyle for YaTeX-typeset-region.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
91
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
92 (defvar YaTeX-need-nonstop nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
93 "*T for adding `\\nonstopmode{}' to text before invoking latex command.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
94
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
95 (defvar latex-warning-regexp "line.* [0-9]*"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
96 "*Regular expression of line number of warning message by latex command.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
97
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
98 (defvar latex-error-regexp "l\\.[1-9][0-9]*"
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
99 "*Regular expression of line number of latex error.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
100 Perhaps your latex command stops at this error message with line number of
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
101 LaTeX source text.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
102
1
912f6e258cba Support %#! usage to specify latex command.
yuuji
parents: 0
diff changeset
103 (defvar latex-dos-emergency-message
3
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
104 "Emergency stop" ;<- for Micro tex, ASCII-pTeX 1.6
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
105 "Message pattern of emergency stop of typesetting.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
106 Because Demacs (GNU Emacs on DOS) cannot have concurrent process, the
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
107 latex command which is stopping on a LaTeX error, is terminated by Demacs.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
108 Many latex command on DOS display some messages when it is terminated by
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
109 other process, user or OS. Define to this variable a message string of your
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
110 latex command on DOS shown at abnormal termination.
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
111 Remember Demacs's call-process function is not oriented for interactive
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
112 process.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
113
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
114 (defvar NTT-jTeX nil
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
115 "*T for using NTT-jTeX for latex command.
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
116 More precisely, setting t to this variables inhibits inter-word break on
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
117 typeset document by line-break of source text. That is, YaTeX automatically
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
118 put % after each line at filling.
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
119 ‰üs+ƒCƒ“ƒfƒ“ƒg‚É‚æ‚Á‚ÄAƒ^ƒCƒvƒZƒbƒgŒã‚ÌŽšŠÔ‚ª‹ó‚¢‚Ä‚µ‚Ü‚¤‚Ì‚ð—}§‚·‚éꇂÉ
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
120 t‚É‚·‚é(ŒÃ‚¢NTT-jTeX‚ÅŒ°’˜‚ÉŒ»‚ê‚é)B‹ï‘Ì“I‚É‚ÍAfill‚·‚é‚Æ‚«‚ÉŠes‚ÌI‚í‚è‚É
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
121 %‚ð•t‰Á‚·‚éB")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
122
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
123
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
124 (defvar YaTeX-item-regexp
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
125 (concat (regexp-quote "\\") "\\(sub\\|bib\\)*item")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
126 "*Regular expression of item command.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
127
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
128 (defvar YaTeX-sectioning-regexp
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
129 "\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\)\\(\\*\\|\\b\\)"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
130 "*LaTeX sectioning commands regexp.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
131
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
132 (defvar YaTeX-paragraph-start
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
133 (concat "^[ \t]*%\\|^[ \t]*$\\|\\'\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\("
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
134 YaTeX-sectioning-regexp ;sectioning commands
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
135 "\\|[A-z]*item\\|begin{\\|end{" ;special declaration
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
136 "\\|\\[\\|\\]"
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
137 "\\|newpage\\b\\|vspace\\b"
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
138 "\\)")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
139 "*Paragraph starting regexp of common LaTeX source. Use this value
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
140 for YaTeX-uncomment-paragraph.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
141
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
142 (defvar YaTeX-paragraph-separate
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
143 (concat "^[ \t]*%\\|^[ \t]*$\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\("
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
144 YaTeX-sectioning-regexp ;sectioning commands
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
145 "\\|begin{\\|end{" ;special declaration
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
146 "\\|\\[\\|\\]"
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
147 "\\|newpage\\b\\|vspace\\b"
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
148 "\\)")
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
149 "*Paragraph delimiter regexp of common LaTeX source. Use this value
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
150 for YaTeX-uncomment-paragraph.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
151
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
152 (defvar YaTeX-verbatim-environments
177
9c5a764a871f Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents: 176
diff changeset
153 '("verbatim" "verbatim*" "alltt")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
154 "*Assume these environments of this variable disable LaTeX commands.")
177
9c5a764a871f Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents: 176
diff changeset
155 (defvar YaTeX-verb-regexp "verb\\*?\\|path"
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
156 "*Regexp of verb family. Do not contain preceding \\\\ nor \\(\\).")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
157 (defvar YaTeX-fill-inhibit-environments
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
158 (append '("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*"
307
326bd21ad995 Add 'longtable to array like environment
HIROSE Yuuji <yuuji@gentei.org>
parents: 294
diff changeset
159 "longtable"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
160 "equation" "equation*" "math" "displaymath")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
161 YaTeX-verbatim-environments)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
162 "*In these environments, YaTeX inhibits fill-paragraph from formatting.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
163 Define those environments as a form of list.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
164
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
165 (defvar YaTeX-itemizing-env-regexp
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
166 "itemize\\|enumerate\\|description\\|list\\|thebibliography"
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
167 "*Regexp of itemizing environments")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
168 (defvar YaTeX-equation-env-regexp
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
169 "array\\*?\\|equation\\*?"
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
170 "*Regexp of environments for equations")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
171 (defvar YaTeX-array-env-regexp
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
172 (concat
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
173 "array\\*?\\|eqnarray\\*?\\|tabbing\\|tabular\\*?\\|" ;LaTeX
307
326bd21ad995 Add 'longtable to array like environment
HIROSE Yuuji <yuuji@gentei.org>
parents: 294
diff changeset
174 "longtable\\|" ;LaTeX2e
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
175 "matrix\\|pmatrix\\|bmatrix\\|vmatrix\\|Vmatrix\\|" ;AMS-LaTeX
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
176 "align\\*?\\|split\\*?\\|aligned\\*?\\|alignat\\*?\\|" ;AMS-LaTeX
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
177 "[bpvV]?matrix\\|smallmatrix\\|cases\\|" ;AMS-LaTeX
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
178 "xalignat\\*?\\|xxalignat\\*?") ;AMS-LaTeX
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
179 "*Regexp of environments where `&' becomes field delimiter.")
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
180 (defvar YaTeX-uncomment-once t
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
181 "*T for removing all continuous commenting character(%).
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
182 Nil for removing only one commenting character at the beginning-of-line.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
183
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
184 (defvar YaTeX-close-paren-always t
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
185 "*Close parenthesis always when YaTeX-modify-mode is nil.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
186
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
187 (defvar YaTeX-greek-by-maketitle-completion nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
188 "*T for greek letters completion by maketitle-type completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
189
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
190 (defvar YaTeX-auto-math-mode t
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
191 "*T for changing YaTeX-math mode automatically.")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
192 (defvar YaTeX-use-AMS-LaTeX nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
193 "*T for using AMS-LaTeX")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
194
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
195 (defvar yatex-mode-hook nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
196 "*List of functions to be called at the end of yatex-mode initializations.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
197
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
198 (defvar YaTeX-search-file-from-top-directory t
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
199 "*Non-nil means to search input-files from the directory where main file exists.")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
200
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
201 (defvar YaTeX-use-font-lock (and (featurep 'font-lock)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
202 (fboundp 'x-color-values)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
203 (fboundp 'font-lock-fontify-region))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
204 "*Use font-lock to fontify buffer or not.")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
205
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
206 (defvar YaTeX-use-hilit19 (and (featurep 'hilit19) (fboundp 'x-color-values)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
207 (fboundp 'hilit-translate)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
208 (not YaTeX-use-font-lock))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
209 "*Use hilit19 to highlight buffer or not.")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
210
82
yuuji
parents: 79
diff changeset
211 (defvar YaTeX-tabular-indentation 4
yuuji
parents: 79
diff changeset
212 "*Indentation column-depth of continueing line in tabular environment.")
yuuji
parents: 79
diff changeset
213
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
214 ;;-- Math mode values --
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
215
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
216 (defvar YaTeX-math-key-list-default
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
217 '((";" . YaTeX-math-sign-alist)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
218 (":" . YaTeX-greek-key-alist))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
219 "Default key sequence to invoke math-mode's image completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
220
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
221 (defvar YaTeX-math-key-list-private nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
222 "*User defined alist, math-mode-prefix vs completion alist.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
223
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
224 (defvar YaTeX-math-key-list
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
225 (append YaTeX-math-key-list-private YaTeX-math-key-list-default)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
226 "Key sequence to invoke math-mode's image completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
227
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
228 (defvar YaTeX-skip-default-reader nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
229 "Non-nil skips default argument reader of section-type completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
230
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
231 (defvar YaTeX-simple-messages nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
232 "Non-nil makes minibuffer messages simpler.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
233
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
234 (defvar YaTeX-template-file "~/work/template.tex"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
235 "*Template TeX source file. This will be inserted to empty file.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
236
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
237 (defvar YaTeX-addin-prefix "YaTeX:")
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
238
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
239 (defvar yatex-mode-abbrev-table nil
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
240 "*Abbrev table in use in yatex-mode buffers.")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
241 (define-abbrev-table 'yatex-mode-abbrev-table ())
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
242
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
243
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
244 ;------------ Completion table ------------
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
245 ; Set tex-section-like command possible completion
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
246 (defvar section-table
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
247 (append
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
248 '(("part") ("chapter") ("chapter*") ("section") ("section*")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
249 ("subsection") ("subsection*")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
250 ("subsubsection") ("paragraph") ("subparagraph")
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
251 ("author") ("thanks") ("documentstyle") ("pagestyle") ("thispagestyle")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
252 ("title") ("underline") ("label") ("makebox")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
253 ("footnote") ("footnotetext") ("index")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
254 ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
255 ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption")
82
yuuji
parents: 79
diff changeset
256 ("arabic")
yuuji
parents: 79
diff changeset
257 ("newcounter")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
258 ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
259 ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
260 ("newcommand" 2) ("renewcommand" 2)
82
yuuji
parents: 79
diff changeset
261 ("newenvironment" 3) ("newtheorem" 2)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
262 ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox")
82
yuuji
parents: 79
diff changeset
263 ("date") ("put") ("ref") ("pageref") ("tabref") ("figref") ("raisebox" 2)
312
0d42b3d7f958 Add completion of \cref
HIROSE Yuuji <yuuji@gentei.org>
parents: 309
diff changeset
264 ("cref") ;cleveref
82
yuuji
parents: 79
diff changeset
265 ("multicolumn" 3) ("shortstack") ("parbox" 2)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
266 ;; for mathmode accent
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
267 ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
268 ("widetilde") ("widehat") ("overline") ("overrightarrow")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
269 ;; section types in mathmode
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
270 ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
271
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
272 )
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
273 (if YaTeX-use-LaTeX2e
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
274 '(("documentclass") ("usepackage")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
275 ("textbf") ("textgt") ("textit") ("textmc") ("textmd") ("textnormal")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
276 ("textrm") ("textsc") ("textsf") ("textsl") ("texttt") ("textup")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
277 ("mathbf") ("mathcal") ("mathit") ("mathnormal") ("mathrm")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
278 ("mathsf") ("mathtt")
82
yuuji
parents: 79
diff changeset
279 ("textcircled")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
280 ("scalebox" 1) ;is faking of argument position
82
yuuji
parents: 79
diff changeset
281 ("rotatebox" 2) ("resizebox" 3) ("reflectbox")
yuuji
parents: 79
diff changeset
282 ("colorbox" 2) ("fcolorbox" 3) ("textcolor" 2) ("color") ("pagecolor")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
283 ("includegraphics") ("includegraphics*")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
284 ("bou") ;defined in plext
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
285 ("url") ;defined in url
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
286 ("shadowbox") ("doublebox") ("ovalbox") ("Ovalbox")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
287 ("fancyoval") ;defined in fancybox
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
288 ("keytop") ("mask" 2) ("maskbox" 5) ;defined in ascmac
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
289 ("bm") ;deined in bm
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
290 ("verbfile") ("listing") ;defined in misc
82
yuuji
parents: 79
diff changeset
291 ("slashbox" 2) ("backslashbox" 2) ;defined in slashbox
yuuji
parents: 79
diff changeset
292 ))
yuuji
parents: 79
diff changeset
293 (if YaTeX-use-AMS-LaTeX
yuuji
parents: 79
diff changeset
294 '(("DeclareMathOperator" 2) ("boldsymbol") ("pmb") ("eqref")
yuuji
parents: 79
diff changeset
295 ("tag") ("tag*"))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
296 "Default completion table for section-type completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
297
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
298 (defvar user-section-table nil)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
299 (defvar tmp-section-table nil)
82
yuuji
parents: 79
diff changeset
300 (defvar YaTeX-ams-math-begin-alist
yuuji
parents: 79
diff changeset
301 '(("align") ("align*") ("multline") ("multline*") ("gather") ("gather*")
yuuji
parents: 79
diff changeset
302 ("alignat") ("alignat*") ("xalignat") ("xalignat*")
yuuji
parents: 79
diff changeset
303 ("xxalignat") ("xxalignat*") ("flalign") ("flalign*") ("equation*")))
yuuji
parents: 79
diff changeset
304 (defvar YaTeX-ams-math-gathering-alist
yuuji
parents: 79
diff changeset
305 '(("matrix") ("pmatrix") ("bmatrix") ("Bmatrix") ("vmatrix") ("Vmatrix")
yuuji
parents: 79
diff changeset
306 ("split") ("split*") ("aligned") ("aligned*") ("alignedat") ("gathered")
yuuji
parents: 79
diff changeset
307 ("smallmatrix") ("cases") ("subequations")))
yuuji
parents: 79
diff changeset
308 ;; Prepare list(not alist) for YaTeX::ref in yatexadd.el
yuuji
parents: 79
diff changeset
309 (defvar YaTeX-math-begin-list
yuuji
parents: 79
diff changeset
310 (mapcar 'car YaTeX-ams-math-begin-alist))
yuuji
parents: 79
diff changeset
311 (defvar YaTeX-math-gathering-list ;used in yatexadd.el#yatex::ref
yuuji
parents: 79
diff changeset
312 (mapcar 'car YaTeX-ams-math-gathering-alist))
yuuji
parents: 79
diff changeset
313
yuuji
parents: 79
diff changeset
314
yuuji
parents: 79
diff changeset
315 (defvar YaTeX-ams-env-table
yuuji
parents: 79
diff changeset
316 (append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist)
yuuji
parents: 79
diff changeset
317 "*Standard AMS-LaTeX(2e) environment completion table.")
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
318
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
319 ; Set tex-environment possible completion
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
320 (defvar env-table
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
321 (append
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
322 '(("quote") ("quotation") ("center") ("verse") ("document")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
323 ("verbatim") ("itemize") ("enumerate") ("description")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
324 ("list") ("tabular") ("tabular*") ("table") ("tabbing") ("titlepage")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
325 ("sloppypar") ("picture") ("displaymath")
240
5ab3322d0f03 Intelligent newline of eqnarray(*) is same as align's.
yuuji@gentei.org
parents: 239
diff changeset
326 ("eqnarray") ("eqnarray*") ("figure") ("equation") ("equation*")
5ab3322d0f03 Intelligent newline of eqnarray(*) is same as align's.
yuuji@gentei.org
parents: 239
diff changeset
327 ("abstract") ("array")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
328 ("thebibliography") ("theindex") ("flushleft") ("flushright")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
329 ("minipage")
82
yuuji
parents: 79
diff changeset
330 ("supertabular")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
331 )
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
332 (if YaTeX-use-LaTeX2e
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
333 '(("comment") ;defined in version
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
334 ("longtable") ;defined in longtable
82
yuuji
parents: 79
diff changeset
335 ("screen") ("boxnote") ("shadebox") ;; ("itembox") ;in ascmac
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
336 ("alltt") ;defined in alltt
82
yuuji
parents: 79
diff changeset
337 ("multicols") ;defined in multicol
yuuji
parents: 79
diff changeset
338 ("breakbox"))) ;defined in eclbkbox
yuuji
parents: 79
diff changeset
339 (if YaTeX-use-AMS-LaTeX YaTeX-ams-env-table))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
340 "Default completion table for begin-type completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
341
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
342 (defvar user-env-table nil)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
343 (defvar tmp-env-table nil)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
344
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
345 ; Set {\Large }-like completion
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
346 (defvar fontsize-table
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
347 '(("rm") ("em") ("bf") ("boldmath") ("it") ("sl") ("sf") ("sc") ("tt")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
348 ("dg") ("dm")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
349 ("tiny") ("scriptsize") ("footnotesize") ("small")("normalsize")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
350 ("large") ("Large") ("LARGE") ("huge") ("Huge")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
351 ("rmfamily") ("sffamily") ("ttfamily")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
352 ("mdseries") ("bfseries") ("upshape")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
353 ("itshape") ("slshape") ("scshape")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
354 )
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
355 "Default completion table for large-type completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
356
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
357 (defvar LaTeX2e-fontstyle-alist
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
358 '(("rm" . "rmfamily")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
359 ("sf" . "sffamily")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
360 ("tt" . "ttfamily")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
361 ("md" . "mdseries")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
362 ("bf" . "bfseries")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
363 ("up" . "upshape")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
364 ("it" . "itshape")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
365 ("sl" . "slshape")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
366 ("sc" . "scshape")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
367
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
368 (defvar user-fontsize-table nil)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
369 (defvar tmp-fontsize-table nil)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
370
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
371 (defvar singlecmd-table
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
372 (append
106
45b54410c794 Add 'par to default maketitle-type completion table.
yuuji@gentei.org
parents: 88
diff changeset
373 '(("maketitle") ("makeindex") ("sloppy") ("protect") ("par")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
374 ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") ("kill")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
375 ;;("rightarrow") ("Rightarrow") ("leftarrow") ("Leftarrow")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
376 ("pagebreak") ("nopagebreak") ("tableofcontents")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
377 ("newpage") ("clearpage") ("cleardoublepage")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
378 ("footnotemark") ("verb") ("verb*")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
379 ("linebreak") ("pagebreak") ("noindent") ("indent")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
380 ("left") ("right") ("dots") ("smallskip") ("medskip") ("bigskip")
82
yuuji
parents: 79
diff changeset
381 ("displaystyle")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
382 )
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
383 (if YaTeX-greek-by-maketitle-completion
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
384 '(("alpha") ("beta") ("gamma") ("delta") ("epsilon")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
385 ("varepsilon") ("zeta") ("eta") ("theta")("vartheta")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
386 ("iota") ("kappa") ("lambda") ("mu") ("nu") ("xi") ("pi")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
387 ("varpi") ("rho") ("varrho") ("sigma") ("varsigma") ("tau")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
388 ("upsilon") ("phi") ("varphi") ("chi") ("psi") ("omega")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
389 ("Gamma") ("Delta") ("Theta") ("Lambda")("Xi") ("Pi")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
390 ("Sigma") ("Upsilon") ("Phi") ("Psi") ("Omega")))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
391 (if YaTeX-use-LaTeX2e
82
yuuji
parents: 79
diff changeset
392 '(("return") ("Return") ("yen"))) ;defined in ascmac
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
393 (if YaTeX-use-AMS-LaTeX
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
394 '(("nonumber")))
82
yuuji
parents: 79
diff changeset
395 )
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
396 "Default completion table for maketitle-type completion.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
397
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
398 (defvar user-singlecmd-table nil)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
399 (defvar tmp-singlecmd-table nil)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
400
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
401 ;---------- Key mode map ----------
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
402 ;;;
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
403 ;; Create new key map: YaTeX-mode-map
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
404 ;; Do not change this section.
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
405 ;;;
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
406 (defvar YaTeX-mode-map nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
407 "Keymap used in YaTeX mode")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
408
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
409 (defvar YaTeX-prefix-map nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
410 "Keymap used when YaTeX-prefix key pushed")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
411
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
412 (defvar YaTeX-user-extensional-map (make-sparse-keymap)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
413 "*Keymap used for the user's customization")
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
414 (defvar YaTeX-current-completion-type nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
415 "Has current completion type. This may be used in YaTeX addin functions.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
416
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
417 (defvar YaTeX-modify-mode nil
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
418 "*Current editing mode.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
419 When non-nil, each opening parentheses only opens,
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
420 nil enters both open/close parentheses when opening parentheses key pressed.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
421
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
422 (defvar YaTeX-math-mode nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
423 "Holds whether current mode is math-mode.")
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
424 ;;;
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
425 ;; Define key table
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
426 ;;;
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
427 (if YaTeX-mode-map
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
428 nil
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
429 (setq YaTeX-mode-map (make-sparse-keymap))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
430 (setq YaTeX-prefix-map (make-sparse-keymap))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
431 (define-key YaTeX-mode-map "\"" 'YaTeX-insert-quote)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
432 (define-key YaTeX-mode-map "{" 'YaTeX-insert-braces)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
433 (define-key YaTeX-mode-map "(" 'YaTeX-insert-parens)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
434 (define-key YaTeX-mode-map "$" 'YaTeX-insert-dollar)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
435 (define-key YaTeX-mode-map "|" 'YaTeX-insert-bar)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
436 (define-key YaTeX-mode-map "&" 'YaTeX-insert-amper)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
437 (define-key YaTeX-mode-map "[" 'YaTeX-insert-brackets)
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
438 (define-key YaTeX-mode-map YaTeX-prefix YaTeX-prefix-map)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
439 (define-key YaTeX-mode-map "\M-\C-@" 'YaTeX-mark-environment)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
440 (define-key YaTeX-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
441 (define-key YaTeX-mode-map "\M-\C-e" 'YaTeX-end-of-environment)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
442 (define-key YaTeX-mode-map "\M-\C-m" 'YaTeX-intelligent-newline)
32
546c4baad92f The first typesetting splits window into 3 on Nemacs. Fixed.
yuuji
parents: 22
diff changeset
443 (define-key YaTeX-mode-map "\C-i" 'YaTeX-indent-line)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
444 (YaTeX-define-key "%" 'YaTeX-%-menu)
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
445 (YaTeX-define-key "t" 'YaTeX-typeset-menu)
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
446 (YaTeX-define-key "w" 'YaTeX-switch-mode-menu)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
447 (YaTeX-define-key "'" 'YaTeX-prev-error)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
448 (YaTeX-define-key "^" 'YaTeX-visit-main)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
449 (YaTeX-define-key "4^" 'YaTeX-visit-main-other-window)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
450 (YaTeX-define-key "4g" 'YaTeX-goto-corresponding-*-other-window)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
451 (YaTeX-define-key "44" 'YaTeX-switch-to-window)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
452 (and YaTeX-emacs-19 window-system
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
453 (progn
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
454 (YaTeX-define-key "5^" 'YaTeX-visit-main-other-frame)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
455 (YaTeX-define-key "5g" 'YaTeX-goto-corresponding-*-other-frame)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
456 (YaTeX-define-key "55" 'YaTeX-switch-to-window)))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
457 (YaTeX-define-key " " 'YaTeX-do-completion)
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
458 (YaTeX-define-key "v" 'YaTeX-version)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
459
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
460 (YaTeX-define-key "}" 'YaTeX-insert-braces-region)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
461 (YaTeX-define-key "]" 'YaTeX-insert-brackets-region)
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
462 (YaTeX-define-key ")" 'YaTeX-insert-parens-region)
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
463 (YaTeX-define-key "$" 'YaTeX-insert-dollars-region)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
464 (YaTeX-define-key "i" 'YaTeX-fill-item)
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
465 (YaTeX-define-key "\\"
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
466 '(lambda () (interactive)
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
467 (insert (if (YaTeX-in-math-mode-p) "\\backslash" "\\textbackslash"))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
468 (if YaTeX-no-begend-shortcut
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
469 (progn
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
470 (YaTeX-define-key "B" 'YaTeX-make-begin-end-region)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
471 (YaTeX-define-key "b" 'YaTeX-make-begin-end))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
472 (YaTeX-define-begend-key "bc" "center")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
473 (YaTeX-define-begend-key "bd" "document")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
474 (YaTeX-define-begend-key "bD" "description")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
475 (YaTeX-define-begend-key "be" "enumerate")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
476 (YaTeX-define-begend-key "bE" "equation")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
477 (YaTeX-define-begend-key "bi" "itemize")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
478 (YaTeX-define-begend-key "bl" "flushleft")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
479 (YaTeX-define-begend-key "bm" "minipage")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
480 (YaTeX-define-begend-key "bt" "tabbing")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
481 (YaTeX-define-begend-key "bT" "tabular")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
482 (YaTeX-define-begend-key "b\^t" "table")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
483 (YaTeX-define-begend-key "bp" "picture")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
484 (YaTeX-define-begend-key "bq" "quote")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
485 (YaTeX-define-begend-key "bQ" "quotation")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
486 (YaTeX-define-begend-key "br" "flushright")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
487 (YaTeX-define-begend-key "bv" "verbatim")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
488 (YaTeX-define-begend-key "bV" "verse")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
489 (YaTeX-define-key "B " 'YaTeX-make-begin-end-region)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
490 (YaTeX-define-key "b " 'YaTeX-make-begin-end))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
491 (YaTeX-define-key "e" 'YaTeX-end-environment)
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
492 (YaTeX-define-key "S" 'YaTeX-make-section-region)
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
493 (YaTeX-define-key "s" 'YaTeX-make-section)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
494 (YaTeX-define-key "L" 'YaTeX-make-fontsize-region)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
495 (YaTeX-define-key "l" 'YaTeX-make-fontsize)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
496 (YaTeX-define-key "m" 'YaTeX-make-singlecmd)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
497 (YaTeX-define-key "." 'YaTeX-comment-paragraph)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
498 (YaTeX-define-key "," 'YaTeX-uncomment-paragraph)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
499 (YaTeX-define-key ">" 'YaTeX-comment-region)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
500 (YaTeX-define-key "<" 'YaTeX-uncomment-region)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
501 (YaTeX-define-key "g" 'YaTeX-goto-corresponding-*)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
502 (YaTeX-define-key "k" 'YaTeX-kill-*)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
503 (YaTeX-define-key "c" 'YaTeX-change-*)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
504 (YaTeX-define-key "a" 'YaTeX-make-accent)
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
505 (YaTeX-define-key "?" 'YaTeX-help)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
506 (YaTeX-define-key "/" 'YaTeX-apropos)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
507 (YaTeX-define-key "&" 'YaTeX-what-column)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
508 (YaTeX-define-key "d" 'YaTeX-display-hierarchy)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
509 (YaTeX-define-key "x" YaTeX-user-extensional-map)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
510 (YaTeX-define-key "n"
82
yuuji
parents: 79
diff changeset
511 '(lambda () (interactive)
yuuji
parents: 79
diff changeset
512 (insert "\\" (if (YaTeX-on-section-command-p "o?oalign") "crcr" "\\"))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
513 (if YaTeX-dos
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
514 (define-key YaTeX-prefix-map "\C-r"
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
515 '(lambda () (interactive)
182
67b1e094e151 Direct call to screen-{height,width} avoided for coming emacsen.
yuuji@gentei.org
parents: 181
diff changeset
516 (YaTeX-set-screen-height YaTeX-saved-screen-height) (recenter)))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
517
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
518 (defvar YaTeX-section-completion-map nil
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
519 "*Key map used at YaTeX completion in the minibuffer.")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
520 (if YaTeX-section-completion-map nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
521 (setq YaTeX-section-completion-map
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
522 (copy-keymap (or (and (boundp 'gmhist-completion-map)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
523 gmhist-completion-map)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
524 minibuffer-local-completion-map)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
525 (define-key YaTeX-section-completion-map
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
526 " " 'YaTeX-minibuffer-complete)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
527 (define-key YaTeX-section-completion-map
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
528 "\C-i" 'YaTeX-minibuffer-complete)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
529 (define-key YaTeX-section-completion-map
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
530 "\C-v" 'YaTeX-read-section-with-overview))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
531
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
532 (defvar YaTeX-recursive-map nil
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
533 "*Key map used at YaTeX reading arguments in the minibuffer.")
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
534 (if YaTeX-recursive-map nil
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
535 (setq YaTeX-recursive-map (copy-keymap global-map))
82
yuuji
parents: 79
diff changeset
536 (define-key YaTeX-recursive-map YaTeX-prefix YaTeX-prefix-map)
yuuji
parents: 79
diff changeset
537 (mapcar
yuuji
parents: 79
diff changeset
538 (function
yuuji
parents: 79
diff changeset
539 (lambda (key)
yuuji
parents: 79
diff changeset
540 (define-key YaTeX-mode-map (car key) 'YaTeX-math-insert-sequence)
yuuji
parents: 79
diff changeset
541 (define-key YaTeX-recursive-map (car key) 'YaTeX-math-insert-sequence)))
yuuji
parents: 79
diff changeset
542 YaTeX-math-key-list))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
543 ;---------- Define other variable ----------
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
544 (defvar YaTeX-env-name "document" "*Initial tex-environment completion")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
545 (defvar YaTeX-section-name
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
546 (if YaTeX-use-LaTeX2e "documentclass" "documentstyle")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
547 "*Initial tex-section completion")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
548 (defvar YaTeX-fontsize-name "large" "*Initial fontsize completion")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
549 (defvar YaTeX-single-command "maketitle" "*Initial LaTeX single command")
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
550 (defvar YaTeX-kanji-code (if YaTeX-dos 1 2)
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
551 "*File kanji code used by Japanese TeX.
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
552 nil: Do not care (Preserve coding-system)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
553 0: no-converion (mule)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
554 1: Shift JIS
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
555 2: JIS
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
556 3: EUC
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
557 4: UTF-8")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
558
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
559 (defvar YaTeX-coding-system nil "File coding system used by Japanese TeX.")
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
560 (cond
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
561 (YaTeX-emacs-20
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
562 (setq YaTeX-coding-system
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
563 (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
564 ((boundp 'MULE)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
565 (setq YaTeX-coding-system
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
566 (symbol-value (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist))))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
567
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
568 (defvar YaTeX-mode-syntax-table nil
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
569 "*Syntax table for yatex-mode")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
570
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
571 (if YaTeX-mode-syntax-table nil
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
572 (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
573 (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
574 (modify-syntax-entry ?\{ "(}" YaTeX-mode-syntax-table)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
575 (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
576 (modify-syntax-entry ?\t " " YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
577 (modify-syntax-entry ?\f ">" YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
578 (modify-syntax-entry ?\n ">" YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
579 (modify-syntax-entry ?$ "$$" YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
580 (modify-syntax-entry ?% "<" YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
581 (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
582 (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
583
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
584 ;---------- Provide YaTeX-mode ----------
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
585 ;;;
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
586 ;; Major mode definition
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
587 ;;;
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
588 (defun yatex-mode ()
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
589 " Yet Another LaTeX mode: Major mode for editing input files of LaTeX.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
590 -You can invoke processes concerning LaTeX typesetting by
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
591 \\[YaTeX-typeset-menu]
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
592 -Complete LaTeX environment form of `\\begin{env} ... \\end{env}' by
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
593 \\[YaTeX-make-begin-end]
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
594 -Enclose region into some environment by
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
595 \\[universal-argument] \\[YaTeX-make-begin-end]
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
596 -Complete LaTeX command which takes argument like `\\section{}' by
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
597 \\[YaTeX-make-section]
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
598 -Put LaTeX command which takes no arguments like `\\maketitle' by
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
599 \\[YaTeX-make-singlecmd]
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
600 -Complete font or character size descriptor like `{\\large }' by
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
601 \\[YaTeX-make-fontsize]
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
602 -Enclose region into those descriptors above by
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
603 \\[universal-argument] \\[YaTeX-make-fontsize]
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
604 -Enter European accent notations by
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
605 \\[YaTeX-make-accent]
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
606 -Toggle various modes of YaTeX by
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
607 \\[YaTeX-switch-mode-menu]
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
608 -Change environt name (on the begin/end line) by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
609 \\[YaTeX-change-*]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
610 -Kill LaTeX command/environment sequences by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
611 \\[YaTeX-kill-*]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
612 -Kill LaTeX command/environment with its contents
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
613 \\[universal-argument] \\[YaTeX-kill-*]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
614 -Go to corresponding object (begin/end, file, labels) by
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
615 \\[YaTeX-goto-corresponding-*] or
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
616 \\[YaTeX-goto-corresponding-*-other-window] (in other window)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
617 \\[YaTeX-goto-corresponding-*-other-frame] (in other frame)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
618 -Go to main LaTeX source text by
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
619 \\[YaTeX-visit-main] or
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
620 \\[YaTeX-visit-main-other-window] (in other window)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
621 \\[YaTeX-visit-main-other-frame] (in other frame)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
622 -Comment out or uncomment region by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
623 \\[YaTeX-comment-region] or \\[YaTeX-uncomment-region]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
624 -Comment out or uncomment paragraph by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
625 \\[YaTeX-comment-paragraph] or \\[YaTeX-uncomment-paragraph]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
626 -Make an \\item entry hang-indented by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
627 \\[YaTeX-fill-item]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
628 -Enclose the region with parentheses by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
629 \\[YaTeX-insert-parens-region]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
630 \\[YaTeX-insert-braces-region]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
631 \\[YaTeX-insert-brackets-region]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
632 \\[YaTeX-insert-dollars-region]
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
633 -Look up the corresponding column header of tabular environment by
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
634 \\[YaTeX-what-column]
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
635 -Enter a newline and an entry suitable for environment by
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
636 \\[YaTeX-intelligent-newline]
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
637 -View the structure of file inclusion by
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
638 \\[YaTeX-display-hierarchy]
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
639 -Refer the online help of popular LaTeX commands by
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
640 \\[YaTeX-help] (help)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
641 \\[YaTeX-apropos] (apropos)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
642 -Edit `%# notation' by
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
643 \\[YaTeX-%-menu]
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
644
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
645 Those are enough for fastening your editing of LaTeX source. But further
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
646 more features are available and they are documented in the manual.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
647 "
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
648 (interactive)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
649 (kill-all-local-variables)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
650 (setq major-mode 'yatex-mode)
55
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
651 (setq mode-name (if YaTeX-japan "‚â‚Ä‚Ó" "YaTeX"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
652 (mapcar 'make-local-variable
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
653 '(dvi2-command fill-column fill-prefix
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
654 tmp-env-table tmp-section-table tmp-fontsize-table
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
655 tmp-singlecmd-table paragraph-start paragraph-separate
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
656 YaTeX-math-mode indent-line-function comment-line-break-function
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
657 comment-start comment-start-skip
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
658 ))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
659 (cond ((null YaTeX-kanji-code)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
660 nil)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
661 ((boundp 'MULE)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
662 (set-file-coding-system YaTeX-coding-system))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
663 ((and YaTeX-emacs-20 (boundp 'buffer-file-coding-system))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
664 (setq buffer-file-coding-system
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
665 (or (and (fboundp 'set-auto-coding) buffer-file-name
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
666 (save-excursion
82
yuuji
parents: 79
diff changeset
667 (goto-char (point-min))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
668 (set-auto-coding buffer-file-name (buffer-size))))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
669 YaTeX-coding-system)))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
670 ((featurep 'mule)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
671 (set-file-coding-system YaTeX-coding-system))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
672 ((boundp 'NEMACS)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
673 (make-local-variable 'kanji-fileio-code)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
674 (setq kanji-fileio-code YaTeX-kanji-code)))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
675 (setq fill-column YaTeX-fill-column
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
676 fill-prefix YaTeX-fill-prefix
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
677 paragraph-start YaTeX-paragraph-start
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
678 paragraph-separate YaTeX-paragraph-separate
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
679 indent-line-function 'YaTeX-indent-line
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
680 comment-start YaTeX-comment-prefix
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
681 comment-end ""
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
682 comment-start-skip "[^\\\\]%+[ \t]*"
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
683 local-abbrev-table yatex-mode-abbrev-table)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
684 (if (fboundp 'comment-indent-new-line) ;for Emacs21
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
685 (setq comment-line-break-function 'YaTeX-comment-line-break))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
686
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
687 (if (and YaTeX-use-font-lock (featurep 'font-lock))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
688 (progn
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
689 (require 'yatex19)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
690 (YaTeX-font-lock-set-default-keywords)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
691 (or (featurep 'xemacs)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
692 (set (make-local-variable 'font-lock-defaults)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
693 (get 'yatex-mode 'font-lock-defaults)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
694 ;;(font-lock-mode 1)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
695 ))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
696 (use-local-map YaTeX-mode-map)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
697 (set-syntax-table YaTeX-mode-syntax-table)
182
67b1e094e151 Direct call to screen-{height,width} avoided for coming emacsen.
yuuji@gentei.org
parents: 181
diff changeset
698 (if YaTeX-dos (setq YaTeX-saved-screen-height (YaTeX-screen-height)))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
699 (YaTeX-read-user-completion-table)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
700 (and (fboundp 'YaTeX-hilit-setup-alist) (YaTeX-hilit-setup-alist))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
701 (makunbound 'inenv)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
702 (turn-on-auto-fill) ;1.63
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
703 (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
704 (y-or-n-p (format "Insert %s?" YaTeX-template-file))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
705 (insert-file-contents (expand-file-name YaTeX-template-file)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
706 (run-hooks 'text-mode-hook 'yatex-mode-hook))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
707
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
708 ;---------- Define YaTeX-mode functions ----------
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
709 (defvar YaTeX-ec "\\" "Escape character of current mark-up language.")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
710 (defvar YaTeX-ec-regexp (regexp-quote YaTeX-ec))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
711 (defvar YaTeX-struct-begin
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
712 (concat YaTeX-ec "begin{%1}%2")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
713 "Keyword format of begin-environment.")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
714 (defvar YaTeX-struct-end
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
715 (concat YaTeX-ec "end{%1}")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
716 "Keyword format of end-environment.")
217
e59126447ee7 Recognize null environment name as \begin{} ... \end{}.
yuuji@gentei.org
parents: 216
diff changeset
717 (defvar YaTeX-struct-name-regexp "[^}]*"
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
718 "Environment name regexp.")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
719 (defvar YaTeX-TeX-token-regexp
82
yuuji
parents: 79
diff changeset
720 (cond (YaTeX-japan "[A-Za-z*‚Ÿ-‚ñˆŸ-êž]+")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
721 (t "[A-Za-z*]+"))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
722 "Regexp of characters which can be a member of TeX command's name.")
82
yuuji
parents: 79
diff changeset
723 (defvar YaTeX-kanji-regexp "[‚Ÿ-‚ñˆŸ-êž]"
yuuji
parents: 79
diff changeset
724 "Generic regexp of Japanese Kanji (and symbol) characters.")
32
546c4baad92f The first typesetting splits window into 3 on Nemacs. Fixed.
yuuji
parents: 22
diff changeset
725 (defvar YaTeX-command-token-regexp YaTeX-TeX-token-regexp
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
726 "Regexp of characters which can be a member of current mark up language's command name.")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
727
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
728 ;;(defvar YaTeX-struct-section
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
729 ;; (concat YaTeX-ec "%1{%2}")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
730 ;; "Keyword to make section.")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
731
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
732 ;;;
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
733 ;; autoload section
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
734 ;;;
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
735
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
736 ;;autoload from yatexprc.el
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
737 (autoload 'YaTeX-visit-main "yatexprc" "Visit main LaTeX file." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
738 (autoload 'YaTeX-visit-main-other-window "yatexprc"
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
739 "Visit main other window." t)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
740 (autoload 'YaTeX-main-file-p "yatexprc" "Check if the file is main." t)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
741 (autoload 'YaTeX-get-builtin "yatexprc" "Get %# built-in." t)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
742 (autoload 'YaTeX-system "yatexprc" "Call system command" t)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
743 (autoload 'YaTeX-save-buffers "yatexprc" "Save buffers of same major mode" t)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
744
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
745 ;;autoload from yatexmth.el
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
746 (autoload 'YaTeX-math-insert-sequence "yatexmth" "Image input." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
747 (autoload 'YaTeX-in-math-mode-p "yatexmth" "Check if in math-env." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
748 (autoload 'YaTeX-toggle-math-mode "yatexmth" "YaTeX math-mode interfaces." t)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
749 (autoload 'YaTeX-math-member-p "yatexmth" "Check if a word is math command." t)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
750 (autoload 'YaTeX-insert-amsparens-region "yatexmth" "AMS parens region" t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
751 (autoload 'YaTeX-insert-amsbraces-region "yatexmth" "AMS braces region" t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
752 (autoload 'YaTeX-insert-amsbrackets-region "yatexmth" "AMS brackets region" t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
753 (autoload 'YaTeX-on-parenthesis-p "yatexmth" "Check if on math-parens" t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
754 (autoload 'YaTeX-goto-open-paren "yatexmth" "Goto opening paren" t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
755 (autoload 'YaTeX-change-parentheses "yatexmth" "Change corresponding parens" t)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
756 (autoload 'YaTeX-goto-corresponding-paren "yatexmth" "\bigl\bigr jumps" t)
130
8703f090c628 `[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents: 129
diff changeset
757 (autoload 'YaTeX-typeset-math-region "yatexmth" "Typeset math-region" t)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
758
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
759 ;;autoload from yatexhlp.el
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
760 (autoload 'YaTeX-help "yatexhlp" "YaTeX helper with LaTeX commands." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
761 (autoload 'YaTeX-apropos "yatexhlp" "Apropos for (La)TeX commands." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
762
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
763 ;;autoload from yatexgen.el
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
764 (autoload 'YaTeX-generate "yatexgen" "YaTeX add-in function generator." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
765 (autoload 'YaTeX-generate-simple "yatexgen" "YaTeX add-in support." t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
766
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
767 ;;autoload from yatexsec.el
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
768 (autoload 'YaTeX-section-overview "yatexsec" "YaTeX sectioning(view)" t)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
769 (autoload 'YaTeX-read-section-in-minibuffer "yatexsec" "YaTeX sectioning" t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
770 (autoload 'YaTeX-make-section-with-overview "yatexsec" "YaTeX sectioning" t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
771
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
772 ;;autoload from yatexenv.el
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
773 (autoload 'YaTeX-what-column "yatexenv" "YaTeX env. specific funcs" t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
774 (autoload 'YaTeX-intelligent-newline "yatexenv" "YaTeX env. specific funcs" t)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
775 (autoload 'YaTeX-indent-line-equation "yatexenv" "Indent equation lines." t)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
776 (autoload 'YaTeX-goto-corresponding-leftright "yatexenv" "\left\right jumps" t)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
777
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
778 ;;autoload from yatexhie.el
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
779 (autoload 'YaTeX-display-hierarchy "yatexhie"
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
780 "YaTeX document hierarchy browser" t)
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
781 (autoload 'YaTeX-display-hierarchy-directly "yatexhie"
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
782 "Same as YaTeX-display-hierarchy. Call from mouse." t)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
783
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
784 ;;autoload from yatexpkg.el
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
785 (autoload 'YaTeX-package-auto-usepackage "yatexpkg" "Auto \\usepackage" t)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
786
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
787 ;;;
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
788 ;; YaTeX-mode functions
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
789 ;;;
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
790 (defun YaTeX-insert-begin-end (env region-mode)
45
b0fc9c2950cd Prepare for supporting Emacs-19.
yuuji
parents: 36
diff changeset
791 "Insert \\begin{mode-name} and \\end{mode-name}.
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
792 This works also for other defined begin/end tokens to define the structure."
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
793 (setq YaTeX-current-completion-type 'begin)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
794 (let*((ccol (current-column)) beg beg2 exchange
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
795 (arg region-mode) ;for old compatibility
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
796 (indent-column (+ ccol YaTeX-environment-indent))(i 1) func)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
797 (if (and region-mode (> (point) (mark)))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
798 (progn (exchange-point-and-mark)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
799 (setq exchange t
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
800 ccol (current-column)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
801 indent-column (+ ccol YaTeX-environment-indent))))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
802 ;;VER2 (insert "\\begin{" env "}" (YaTeX-addin env))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
803 (setq beg (point))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
804 (YaTeX-insert-struc 'begin env)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
805 (setq beg2 (point))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
806 (insert "\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
807 (indent-to indent-column)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
808 (save-excursion
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
809 ;;indent optional argument of \begin{env}, if any
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
810 (while (> (point-beginning-of-line) beg)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
811 (skip-chars-forward "\\s " (point-end-of-line))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
812 (indent-to indent-column)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
813 (forward-line -1)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
814 (require 'yatexenv)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
815 (if region-mode
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
816 ;;if region-mode, indent all text in the region
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
817 (save-excursion
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
818 (if (fboundp (intern-soft (concat "YaTeX-enclose-" env)))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
819 (funcall (intern-soft (concat "YaTeX-enclose-" env))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
820 (point) (mark))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
821 (while (< (progn (forward-line 1) (point)) (mark))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
822 (if (eolp) nil
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
823 (skip-chars-forward " \t\n")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
824 (indent-to indent-column))))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
825 (if region-mode (exchange-point-and-mark))
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
826 (indent-to ccol)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
827 ;;VER2 (insert "\\end{" env "}\n")
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
828 (YaTeX-insert-struc 'end env)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
829 (YaTeX-reindent ccol)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
830 (if region-mode
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
831 (progn
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
832 (insert "\n")
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
833 (or exchange (exchange-point-and-mark)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
834 (goto-char beg2)
215
a67236df3199 Intelligent-newline should always be called.
yuuji@gentei.org
parents: 212
diff changeset
835 (YaTeX-intelligent-newline nil)
218
58a023f16e07 Guidance of intelligent-newline shoud check fboundp.
yuuji@fusion.yk.gentei.org
parents: 217
diff changeset
836 (if (fboundp (intern-soft (concat "YaTeX-intelligent-newline-" env)))
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
837 (progn
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
838 (message
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
839 (cond
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
840 (YaTeX-japan "%s ‚ÅŽŸ‚Ìs‚Ì“ü—Í‚Éi‚Ý‚Ü‚·B")
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
841 (t "`%s' produces the next line's template."))
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
842 (key-description
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
843 (car (where-is-internal 'YaTeX-intelligent-newline))))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
844 (YaTeX-indent-line))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
845 (YaTeX-package-auto-usepackage env 'env)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
846 (if YaTeX-current-position-register
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
847 (point-to-register YaTeX-current-position-register))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
848
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
849 (defun YaTeX-make-begin-end (arg)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
850 "Make LaTeX environment command of \\begin{env.} ... \\end{env.}
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
851 by completing read.
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
852 If you invoke this command with universal argument,
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
853 \(key binding for universal-argument is \\[universal-argument]\)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
854 you can put REGION into that environment between \\begin and \\end."
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
855 (interactive "P")
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
856 (let*
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
857 ((mode (if arg " region" ""))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
858 (env
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
859 (YaTeX-read-environment
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
860 (format "Begin environment%s(default %s): " mode YaTeX-env-name))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
861 (if (string= env "")
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
862 (setq env YaTeX-env-name))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
863 (setq YaTeX-env-name env)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
864 (YaTeX-update-table
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
865 (list YaTeX-env-name) 'env-table 'user-env-table 'tmp-env-table)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
866 (YaTeX-insert-begin-end YaTeX-env-name arg)))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
867
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
868 (defun YaTeX-make-begin-end-region ()
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
869 "Call YaTeX-make-begin-end with ARG to specify region mode."
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
870 (interactive)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
871 (YaTeX-make-begin-end t))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
872
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
873 (defun YaTeX-guess-section-type ()
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
874 (if (eq major-mode 'yatex-mode)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
875 (save-excursion
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
876 (cond
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
877 ((save-excursion (not (search-backward YaTeX-ec nil t)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
878 (if YaTeX-use-LaTeX2e "documentclass" "documentstyle"))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
879 ((progn
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
880 (if (= (char-after (1- (point))) ?~) (forward-char -1))
82
yuuji
parents: 79
diff changeset
881 (forward-char -1) (looking-at "•\\\|}\\|Ž®\\|‘æ"))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
882 "ref")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
883 ((and (looking-at "[a-z \t]")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
884 (progn (skip-chars-backward "a-z \t")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
885 (looking-at "table\\|figure\\|formula")))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
886 "ref")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
887 ((save-excursion
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
888 (skip-chars-backward "[^ƒA-ƒ“]")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
889 (looking-at "ƒvƒƒOƒ‰ƒ€\\|ƒŠƒXƒg"))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
890 "ref")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
891 ((YaTeX-re-search-active-backward
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
892 (concat YaTeX-ec-regexp "begin{\\([^}]+\\)}")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
893 (regexp-quote YaTeX-comment-prefix)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
894 (save-excursion (forward-line -1) (point))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
895 t)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
896 (let ((env (YaTeX-match-string 1)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
897 (cdr (assoc env
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
898 '(("table" . "caption"))))))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
899 ))))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
900
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
901 (defun YaTeX-make-section (arg &optional beg end cmd)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
902 "Make LaTeX \\section{} type command with completing read.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
903 With numeric ARG, you can specify the number of arguments of
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
904 LaTeX command.
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
905 For example, if you want to produce LaTeX command
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
906
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
907 \\addtolength{\\topmargin}{8mm}
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
908
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
909 which has two arguments. You can produce that sequence by typing...
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
910 ESC 2 C-c s add SPC RET \\topm SPC RET 8mm RET
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
911 \(by default\)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
912 Then yatex will automatically complete `addtolength' with two arguments
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
913 next time.
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
914 You can complete symbol at LaTeX command and the 1st argument.
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
915
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
916 If the optional 2nd and 3rd argument BEG END are specified, enclose
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
917 the region from BEG to END into the first argument of the LaTeX sequence.
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
918 Optional 4th arg CMD is LaTeX command name, for non-interactive use."
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
919 (interactive "P")
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
920 (setq YaTeX-current-completion-type 'section)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
921 (if (equal arg '(4)) (setq beg (region-beginning) end (region-end)))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
922 (unwind-protect
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
923 (let*
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
924 ((source-window (selected-window))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
925 guess
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
926 (section
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
927 (or cmd
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
928 (progn
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
929 (setq guess
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
930 (or (YaTeX-guess-section-type) YaTeX-section-name))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
931 (YaTeX-read-section
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
932 (if YaTeX-simple-messages
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
933 (format "Section-type (default %s): " guess)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
934 (if (> (minibuffer-depth) 0)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
935 (format "%s???{} (default %s)%s: "
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
936 YaTeX-ec guess
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
937 (format "[level:%d]" (minibuffer-depth)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
938 (format "(C-v for view-section) %s???{%s} (default %s): "
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
939 YaTeX-ec (if beg "region" "") guess)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
940 nil))))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
941 (section (if (string= section "") guess section))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
942 (numarg ;; The number of section-type command's argument
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
943 (or (and (numberp arg) arg)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
944 (nth 1 (YaTeX-lookup-table section 'section))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
945 1))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
946 (arg-reader (intern-soft (concat "YaTeX::" section)))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
947 (addin-args (and arg-reader (fboundp arg-reader)))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
948 (title "")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
949 (j 1)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
950 (after-change-functions nil) ;inhibit font-locking temporarily
82
yuuji
parents: 79
diff changeset
951 (enable-recursive-minibuffers t)
yuuji
parents: 79
diff changeset
952 (mkarg-func
yuuji
parents: 79
diff changeset
953 (function
yuuji
parents: 79
diff changeset
954 (lambda (n)
yuuji
parents: 79
diff changeset
955 (while (<= j n)
216
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
956 (unwind-protect
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
957 (setq title
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
958 (cond
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
959 (addin-args (funcall arg-reader j))
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
960 (YaTeX-skip-default-reader "")
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
961 (t
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
962 (read-string
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
963 (format "Argument %d of %s: " j section)))))
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
964 (insert
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
965 (concat ;to allow nil return value
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
966 "{" title "}")))
82
yuuji
parents: 79
diff changeset
967 (setq j (1+ j))))))
yuuji
parents: 79
diff changeset
968 );;let
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
969 (setq YaTeX-section-name section)
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
970 (if beg
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
971 (let*((e (make-marker))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
972 (ar2 (intern-soft (concat "YaTeX::" section "-region")))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
973 (arp (and ar2 (fboundp ar2))))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
974 (goto-char end)
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
975 (insert "}")
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
976 (set-marker e (point))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
977 (goto-char beg)
216
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
978 (unwind-protect
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
979 (progn
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
980 (insert YaTeX-ec YaTeX-section-name
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
981 (YaTeX-addin YaTeX-section-name))
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
982 (if (> numarg 1) (funcall mkarg-func (1- numarg))))
c1edf0fbab32 Leave `{}' after C-g at section-type completion.
yuuji@gentei.org
parents: 215
diff changeset
983 (insert "{"))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
984 (if arp (funcall ar2 (point) e))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
985 (goto-char e)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
986 (set-marker e nil))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
987 (use-global-map YaTeX-recursive-map)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
988 (if (= numarg 0) (YaTeX-make-singlecmd YaTeX-section-name)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
989 (progn (insert YaTeX-ec YaTeX-section-name)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
990 (insert (YaTeX-addin YaTeX-section-name))))
82
yuuji
parents: 79
diff changeset
991 ;;read arguments with add-in
yuuji
parents: 79
diff changeset
992 (funcall mkarg-func numarg))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
993 (YaTeX-update-table
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
994 (if (/= numarg 1) (list section numarg)
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
995 (list section))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
996 'section-table 'user-section-table 'tmp-section-table)
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
997 (if YaTeX-current-position-register
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
998 (point-to-register YaTeX-current-position-register))
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
999 (if (string= (YaTeX-buffer-substring (- (point) 2) (point))
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1000 "{}")
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1001 (forward-char -1))
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1002 (while (string= (YaTeX-buffer-substring (- (point) 3) (1- (point)))
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1003 "{}")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1004 (forward-char -2))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1005 (YaTeX-package-auto-usepackage section 'section))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1006 (if (<= (minibuffer-depth) 0) (use-global-map global-map))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1007 (insert ""))) ;insert dummy string to fontify(Emacs20)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1008
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
1009 (defun YaTeX-make-section-region (args beg end)
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
1010 "Call YaTeX-make-section with arguments to specify region mode."
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
1011 (interactive "P\nr")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1012 (YaTeX-make-section args beg end))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1013
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1014 (defun YaTeX-make-fontsize (arg &optional fontsize)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1015 "Make completion like {\\large ...} or {\\slant ...} in minibuffer.
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1016 If you invoke this command with universal argument, you can put region
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1017 into {\\xxx } braces.
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1018 \(key binding for universal-argument is \\[universal-argument]\)"
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1019 (interactive "P")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1020 (YaTeX-sync-local-table 'tmp-fontsize-table)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1021 (let* ((mode (if arg "region" ""))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1022 (fontsize
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1023 (or fontsize
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1024 (YaTeX-read-fontsize
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1025 (if YaTeX-simple-messages
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1026 (format "Font or size (default %s): " YaTeX-fontsize-name)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1027 (format "{\\??? %s} (default %s)%s: " mode YaTeX-fontsize-name
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1028 (if (> (minibuffer-depth) 0)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1029 (format "[level:%d]" (minibuffer-depth)) "")))
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1030 nil nil))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1031 (if (string= fontsize "")
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1032 (setq fontsize YaTeX-fontsize-name))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1033 (setq YaTeX-current-completion-type 'large)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1034 (setq YaTeX-fontsize-name fontsize)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1035 (YaTeX-update-table
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1036 (list YaTeX-fontsize-name)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1037 'fontsize-table 'user-fontsize-table 'tmp-fontsize-table)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1038 (and YaTeX-use-LaTeX2e
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1039 (YaTeX-latex2e-p)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1040 (setq fontsize
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1041 (cdr (assoc YaTeX-fontsize-name LaTeX2e-fontstyle-alist)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1042 (setq YaTeX-fontsize-name fontsize))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1043 (if arg
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1044 (save-excursion
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1045 (if (> (point) (mark)) (exchange-point-and-mark))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1046 (insert "{\\" YaTeX-fontsize-name " ")
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1047 (exchange-point-and-mark)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1048 (insert "}"))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1049 (insert (concat "{\\" YaTeX-fontsize-name " }"))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1050 (forward-char -1)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1051 (if YaTeX-current-position-register
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1052 (point-to-register YaTeX-current-position-register))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1053 (save-excursion
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1054 (insert (YaTeX-addin YaTeX-fontsize-name)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1055 (YaTeX-package-auto-usepackage YaTeX-fontsize-name 'large))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1056
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1057 (defun YaTeX-make-fontsize-region ()
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1058 "Call function:YaTeX-make-fontsize with ARG to specify region mode."
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1059 (interactive)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1060 (YaTeX-make-fontsize t))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1061
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1062 (defvar YaTeX-singlecmd-suffix "" "*Suffix for maketitle-type commands.")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1063 (defvar YaTeX-read-singlecmd-history nil "Holds maketitle-type history.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1064 (put 'YaTeX-read-singlecmd-history 'no-default t)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1065 (defun YaTeX-make-singlecmd (single)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1066 (interactive
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1067 (list (YaTeX-cplread-with-learning
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1068 (if YaTeX-simple-messages
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1069 (format "maketitle-type (default %s): " YaTeX-single-command)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1070 (format "%s??? (default %s)%s: " YaTeX-ec YaTeX-single-command
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1071 (if (> (minibuffer-depth) 0)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1072 (format "[level:%d]" (minibuffer-depth)) "")))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1073 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1074 nil nil nil 'YaTeX-read-singlecmd-history)))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1075 (if (string= single "")
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1076 (setq single YaTeX-single-command))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1077 (setq YaTeX-single-command single)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1078 (setq YaTeX-current-completion-type 'maketitle)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1079 (let ((dollar (and (not (YaTeX-in-math-mode-p))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1080 (YaTeX-math-member-p YaTeX-single-command)))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1081 p q)
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1082 (if dollar (insert "$"))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1083 (insert YaTeX-ec YaTeX-single-command)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1084 (setq p (point))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1085 (insert (YaTeX-addin single) YaTeX-singlecmd-suffix)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1086 (if dollar (insert "$"))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1087 (setq q (point))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1088 (goto-char p)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1089 (forward-char -2)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1090 (if (looking-at "\\[\\]") (forward-char 1) (goto-char q)))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1091 (YaTeX-package-auto-usepackage YaTeX-single-command 'maketitle)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1092 (if YaTeX-current-position-register
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1093 (point-to-register YaTeX-current-position-register)))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1094
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1095 (defvar YaTeX-completion-begin-regexp "[{\\]"
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1096 "Regular expression of limit where LaTeX command's completion begins.")
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1097
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1098 (defun YaTeX-do-completion ()
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1099 "Try completion on LaTeX command preceding point."
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1100 (interactive)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1101 (if
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1102 (or (eq (preceding-char) ? )
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1103 (eq (preceding-char) ?\t)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1104 (eq (preceding-char) ?\n)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1105 (bobp))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1106 (message "Nothing to complete.") ;Do not complete
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1107 (let* ((end (point))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1108 (limit (point-beginning-of-line))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1109 (completion-begin
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1110 (progn (re-search-backward "[ \t\n]" limit 1) (point)))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1111 (begin (progn
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1112 (goto-char end)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1113 (if (re-search-backward YaTeX-completion-begin-regexp
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1114 completion-begin t)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1115 (1+ (point))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1116 nil))))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1117 (goto-char end)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1118 (cond
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1119 ((null begin)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1120 (message "I think it is not a LaTeX sequence."))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1121 (t
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1122 (mapcar 'YaTeX-sync-local-table
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1123 '(tmp-section-table tmp-env-table tmp-singlecmd-table))
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1124 (let*((pattern (YaTeX-buffer-substring begin end))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1125 (all-table
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1126 (append
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1127 section-table user-section-table tmp-section-table
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1128 env-table user-env-table tmp-env-table
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1129 singlecmd-table user-singlecmd-table tmp-singlecmd-table))
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1130 ;; First,
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1131 ;; search completion without backslash.
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
1132 (completion (try-completion pattern all-table)))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1133 (if
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1134 (eq completion nil)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1135 ;; Next,
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1136 ;; search completion with backslash
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1137 (setq completion
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1138 (try-completion
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1139 (YaTeX-buffer-substring (1- begin) end)
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1140 all-table nil)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1141 begin (1- begin)))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1142 (cond
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1143 ((null completion)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1144 (message (concat "Can't find completion for '" pattern "'"))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1145 (ding))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1146 ((eq completion t) (message "Sole completion."))
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1147 ((not (string= completion pattern))
82
yuuji
parents: 79
diff changeset
1148 (delete-region begin end)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1149 (insert completion)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1150 )
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1151 (t
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1152 (message "Making completion list...")
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1153 (with-output-to-temp-buffer "*Help*"
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1154 (display-completion-list
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1155 (all-completions pattern all-table)))))))))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1156
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1157 (defun YaTeX-toggle-modify-mode (&optional arg)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1158 (interactive "P")
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1159 (or (memq 'YaTeX-modify-mode mode-line-format)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1160 (setq mode-line-format
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1161 (append (list "" 'YaTeX-modify-mode) mode-line-format)))
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1162 (if (or arg (null YaTeX-modify-mode))
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1163 (progn
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1164 (setq YaTeX-modify-mode "*m*")
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1165 (message "Modify mode"))
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1166 (setq YaTeX-modify-mode nil)
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1167 (message "Cancel modify mode."))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1168 (set-buffer-modified-p (buffer-modified-p))) ;redraw mode-line
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1169
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1170 (defun YaTeX-switch-mode-menu (arg &optional char)
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1171 (interactive "P")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1172 (message "Toggle: (M)odify-mode ma(T)h-mode")
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1173 (let ((c (or char (read-char))))
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1174 (cond
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1175 ((= c ?m) (YaTeX-toggle-modify-mode arg))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1176 ((or (= c ?$) (= c ?t))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1177 (if YaTeX-auto-math-mode
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1178 (message "Makes no sense in YaTeX-auto-math-mode.")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1179 (YaTeX-toggle-math-mode arg))))))
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1180
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1181 (defun YaTeX-insert-quote ()
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1182 (interactive)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1183 (insert
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1184 (cond
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1185 ((YaTeX-literal-p) ?\")
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1186 ((= (preceding-char) ?\\ ) ?\")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1187 ;((= (preceding-char) ?\( ) ?\")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1188 ((or (= (preceding-char) 32)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1189 (= (preceding-char) 9)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1190 (= (preceding-char) ?\n)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1191 (bobp)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1192 (string-match
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1193 (regexp-quote (char-to-string (preceding-char)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1194 "ABCDHIuvwxyz()"))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1195 "``")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1196 (t "''"))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1197
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1198 (defun YaTeX-closable-p ()
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1199 (and (not YaTeX-modify-mode)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
1200 (not (eq YaTeX-close-paren-always 'never))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1201 (or YaTeX-close-paren-always (eolp))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1202 (not (input-pending-p))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1203 (not (YaTeX-literal-p)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1204 ;;(or YaTeX-modify-mode
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1205 ;; (and (not YaTeX-close-paren-always) (not (eolp)))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1206 ;; (input-pending-p)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1207 ;; (YaTeX-quick-in-environment-p "verbatim"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1208 )
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1209
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1210 (defun YaTeX-insert-braces-region (beg end &optional open close)
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1211 (interactive "r")
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1212 (save-excursion
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1213 (goto-char end)
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1214 (YaTeX-insert-inherit (or close "}"))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1215 (goto-char beg)
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1216 (YaTeX-insert-inherit (or open "{"))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1217
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1218 (defun YaTeX-get-macro-at-point (&optional p)
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1219 "Get (La)TeX macro around point P."
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1220 (interactive "d")
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1221 (save-excursion
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1222 (goto-char (setq p (or p (point))))
198
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1223 (let ((token (substring (substring YaTeX-TeX-token-regexp 1) 0 -2))
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1224 bsend)
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1225 (and (not (bobp))
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1226 (or (looking-at YaTeX-TeX-token-regexp)
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1227 (string-match
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1228 YaTeX-TeX-token-regexp (char-to-string (preceding-char))))
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1229 (progn
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1230 (skip-chars-backward token)
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1231 (equal (preceding-char) ?\\))
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1232 (save-excursion
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1233 (setq bsend (point))
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1234 (skip-chars-backward "\\\\") ;emacs18 doesn't return distance
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1235 (/= (% (- bsend (point)) 2) 0)) ;consider \\
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1236 (looking-at YaTeX-TeX-token-regexp)
768ff443ef84 More accurate check for YaTeX-get-macro-at-point.
yuuji@gentei.org
parents: 197
diff changeset
1237 (YaTeX-match-string 0)))))
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1238
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1239 (defun YaTeX-insert-braces (arg &optional open close)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1240 (interactive "p")
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1241 (let ((begend-guide
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1242 (function
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1243 (lambda ()
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1244 (if (equal (get 'YaTeX-insert-braces 'begend-guide) 2)
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1245 nil ;if triggered thrice, do nothing
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1246 (momentary-string-display
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1247 (format
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1248 (cond
196
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1249 (YaTeX-japan "begin/end“ü—Í‚É‚Í %s ‚ðŽg‚¢‚Ü‚µ‚傤")
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1250 (t "You don't understand Zen of `%s'!"))
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1251 (key-description
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1252 (car (where-is-internal 'YaTeX-make-begin-end))))
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1253 (point))
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1254 (put 'YaTeX-insert-braces 'begend-guide
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1255 (+ 1 (string-to-int ;increment counter of beg-end guidance
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1256 (prin1-to-string
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1257 (get 'YaTeX-insert-braces 'begend-guide)))))))))
196
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1258 env macro not-literal b e)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1259 (cond
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1260 ((YaTeX-jmode) (YaTeX-self-insert arg))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1261 ((not (YaTeX-closable-p)) (YaTeX-self-insert arg))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1262 ((save-excursion
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1263 (and (> (- (point) (point-min)) 6)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1264 (condition-case () (forward-char -6) (error nil)))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1265 (looking-at "\\\\left\\\\"))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1266 (insert "{\\right\\}")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1267 (forward-char -8))
193
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 192
diff changeset
1268 ((save-excursion ;from matsu<at>math.s.chiba-u.ac.jp
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1269 (and (> (- (point) (point-min)) 6) (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1270 (looking-at "\\\\[bB]igl\\\\"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1271 (insert
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1272 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1273 "{" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\}"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1274 (forward-char -7))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1275 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1276 (and (> (- (point) (point-min)) 7)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1277 (condition-case () (forward-char -7) (error nil)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1278 (looking-at "\\\\[bB]iggl\\\\"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1279 (insert
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1280 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1281 "{" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\}"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1282 (forward-char -8))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1283 ((= (preceding-char) ?\\ )
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1284 (insert "{\\}")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1285 (forward-char -2)) ;matsu's hack ends here
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1286 ((and (setq not-literal (not (YaTeX-literal-p)))
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1287 (equal "end" (setq macro (YaTeX-get-macro-at-point)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1288 (setq env (YaTeX-inner-environment)))
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1289 (funcall begend-guide)
196
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1290 (insert "{" env "}"))
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1291 ((and not-literal (equal "begin" macro))
196
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1292 (insert "{")
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1293 (save-excursion
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1294 (indent-to (prog1 (- (current-column) 7) (insert "}\n")))
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1295 (insert "\\end{}")
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1296 (setq e (point)))
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1297 (setq env
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1298 (YaTeX-read-environment
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1299 (format "Begin environment(default %s): " YaTeX-env-name)))
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1300 (if (string= "" env) (setq env YaTeX-env-name))
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1301 (setq YaTeX-env-name env)
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1302 (funcall begend-guide)
196
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1303 (delete-region (- (point) 7) e)
194
2af7a6ba45cd Add guidance completion for `\begin{'.
yuuji@gentei.org
parents: 193
diff changeset
1304 (YaTeX-insert-begin-end env nil))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1305 (t
47
d7e7b4654058 Support special popup frame.
yuuji
parents: 46
diff changeset
1306 (insert (or open "{") (or close "}"))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1307 (forward-char -1)
196
701d87b607e0 The indentation of automatically inserted \end, fixed.
yuuji@gentei.org
parents: 195
diff changeset
1308 (if (and (eq (char-after (point)) ?\}) ;; the case `\\{}'
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1309 (eq (char-after (- (point) 2)) ?\\ ))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1310 (progn (insert "\\") (forward-char -1)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1311 ))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1312
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1313 (defun YaTeX-jmode ()
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1314 (or (and (boundp 'canna:*japanese-mode*) canna:*japanese-mode*)
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1315 (and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*)
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1316 (and (boundp 'skk-mode) skk-mode (not skk-latin-mode))
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1317 (and (boundp 'default-input-method) default-input-method
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1318 current-input-method)))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1319
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1320 (defun YaTeX-jmode-off ()
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1321 (if (cond
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1322 ((and (boundp 'canna:*japanese-mode*) canna:*japanese-mode*)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1323 (canna-toggle-japanese-mode) t)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1324 ((and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1325 (egg:toggle-egg-mode-on-off) t)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1326 ((and (fboundp 'skk-mode) (boundp 'skk-mode) skk-mode)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1327 (cond
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1328 ((fboundp 'skk-latin-mode)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1329 (or (and (boundp 'skk-henkan-mode) skk-henkan-mode)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1330 (and (boundp 'skk-henkan-on)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1331 (or skk-henkan-mode skk-henkan-active))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1332 (and (boundp 'j-henkan-on)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1333 (or j-henkan-on j-henkan-active))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1334 ;; Deactivate jmode if henkan-mode is not running.
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1335 ;; Suggested by tt.tetsuo.tsukamoto.
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1336 (progn
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1337 (put 'YaTeX-jmode-on 'skkkata skk-katakana)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1338 (skk-latin-mode t))))
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1339 ((fboundp 'skk-mode-off) (skk-mode-off))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1340 (t (j-mode-off)))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1341 t)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1342 ((and (fboundp 'toggle-input-method) current-input-method)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1343 (toggle-input-method) t)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1344 ((and (fboundp 'fep-force-off) (fep-force-off))))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1345 (put 'YaTeX-jmode 'jmode t)))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1346
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1347 (defun YaTeX-jmode-on ()
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1348 (cond
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1349 ((boundp 'canna:*japanese-mode*)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1350 (if (not canna:*japanese-mode*) (canna-toggle-japanese-mode)))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1351 ((boundp 'egg:*mode-on*)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1352 (and (not egg:*mode-on*) (not egg:*input-mode*)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1353 (egg:toggle-egg-mode-on-off)))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1354 ((and (fboundp 'skk-mode) (boundp 'skk-mode))
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1355 (if (get 'YaTeX-jmode-on 'skkkata)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1356 (skk-j-mode-on t)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1357 (skk-mode 1))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1358 (put 'YaTeX-jmode-on 'skkkata nil))
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1359 ((fboundp 'toggle-input-method)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1360 (if (not current-input-method) (toggle-input-method)))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1361 ((and (fboundp 'fep-force-on) (fep-force-on)))))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1362
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1363 (defun YaTeX-jmode-back ()
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1364 (if (get 'YaTeX-jmode 'jmode)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1365 (YaTeX-jmode-on))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1366 (setplist 'YaTeX-jmode nil))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1367
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1368 (defun YaTeX-self-insert (arg)
290
1a4332ecc58b For emacs-24.3+ and NEmacs(last-command-{char,event} handling)
HIROSE Yuuji <yuuji@gentei.org>
parents: 288
diff changeset
1369 (call-interactively (global-key-binding (char-to-string (YaTeX-last-key)))))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1370 (defun YaTeX-insert-inherit (&rest args)
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1371 (apply (if (fboundp 'insert-and-inherit) 'insert-and-inherit 'insert)
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1372 args))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
1373
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1374 (defun YaTeX-insert-brackets (arg)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1375 "Insert Kagi-kakko or \\ [ \\] pair or simply \[."
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1376 (interactive "p")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1377 (let ((col (1- (current-column))))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1378 (cond
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1379 ((YaTeX-jmode) (YaTeX-self-insert arg))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1380 ((not (YaTeX-closable-p))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1381 (YaTeX-self-insert arg))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1382 ((save-excursion
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1383 (and (> (- (point) (point-min)) 5) (forward-char -5))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1384 (looking-at "\\\\left"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1385 (YaTeX-insert-inherit "[\\right]")
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1386 (forward-char -7))
193
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 192
diff changeset
1387 ((save-excursion ;from matsu<at>math.s.chiba-u.ac.jp
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1388 (and (> (- (point) (point-min)) 5) (forward-char -5))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1389 (looking-at "\\\\[bB]igl"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1390 (YaTeX-insert-inherit
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1391 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1392 "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1393 (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1394 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1395 (and (> (- (point) (point-min)) 6) (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1396 (looking-at "\\\\[bB]iggl"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1397 (YaTeX-insert-inherit
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1398 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1399 "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1400 (forward-char -7)) ;matsu's hack ends here
36
47659405d1af Added `verb' and `verb*'.
yuuji
parents: 34
diff changeset
1401 ((and (= (preceding-char) ?\\ )
47659405d1af Added `verb' and `verb*'.
yuuji
parents: 34
diff changeset
1402 (/= (char-after (- (point) 2)) ?\\ )
47659405d1af Added `verb' and `verb*'.
yuuji
parents: 34
diff changeset
1403 (not (YaTeX-in-math-mode-p)))
290
1a4332ecc58b For emacs-24.3+ and NEmacs(last-command-{char,event} handling)
HIROSE Yuuji <yuuji@gentei.org>
parents: 288
diff changeset
1404 (YaTeX-insert-inherit (YaTeX-last-key) "\n")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1405 (indent-to (max 0 col))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1406 (YaTeX-insert-inherit "\\]")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1407 (beginning-of-line)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1408 (open-line 1)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1409 (delete-region (point) (progn (beginning-of-line) (point)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1410 (indent-to (+ YaTeX-environment-indent (max 0 col)))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1411 (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1412 ((YaTeX-closable-p)
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1413 (YaTeX-insert-inherit "[]")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1414 (backward-char 1))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1415 (t (YaTeX-self-insert arg)))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1416
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1417 (defun YaTeX-insert-brackets-region (beg end)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1418 (interactive "r")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1419 (YaTeX-insert-braces-region beg end "[" "]"))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1420
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1421 (defun YaTeX-insert-parens (arg)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1422 "Insert parenthesis pair."
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1423 (interactive "p")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1424 (cond
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1425 ((YaTeX-jmode) (YaTeX-self-insert arg))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1426 ((not (YaTeX-closable-p)) (YaTeX-self-insert arg))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1427 ((save-excursion
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1428 (and (> (- (point) (point-min)) 5) (forward-char -5))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1429 (looking-at "\\\\left"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1430 (YaTeX-insert-inherit "(\\right)")
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1431 (forward-char -7))
193
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 192
diff changeset
1432 ((save-excursion ;from matsu<at>math.s.chiba-u.ac.jp
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1433 (and (> (- (point) (point-min)) 5) (forward-char -5))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1434 (looking-at "\\\\[bB]igl"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1435 (YaTeX-insert-inherit
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1436 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1437 "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1438 (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1439 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1440 (and (> (- (point) (point-min)) 6) (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1441 (looking-at "\\\\[bB]iggl"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1442 (YaTeX-insert-inherit
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1443 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1444 "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1445 (forward-char -7))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1446 ((= (preceding-char) ?\\ ) ;matsu's hack ends here
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1447 (YaTeX-insert-inherit "(\\)")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1448 (backward-char 2))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1449 ((YaTeX-closable-p)
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1450 (YaTeX-insert-inherit "()")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1451 (backward-char 1))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1452 (t (YaTeX-self-insert arg))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1453
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1454 (defun YaTeX-insert-parens-region (beg end)
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1455 (interactive "r")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1456 (YaTeX-insert-braces-region beg end "(" ")"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1457
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1458 (defun YaTeX-insert-bar (arg)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1459 "Insert bar pair."
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1460 (interactive "p")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1461 (cond
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1462 ((YaTeX-jmode) (YaTeX-self-insert arg))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1463 ((not (YaTeX-closable-p)) (YaTeX-self-insert arg))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1464 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1465 (and (> (- (point) (point-min)) 5) (forward-char -5))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1466 (looking-at "\\\\left"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1467 (YaTeX-insert-inherit "|\\right|")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1468 (forward-char -7))
193
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 192
diff changeset
1469 ((save-excursion ;from matsu<at>math.s.chiba-u.ac.jp
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1470 (and (> (- (point) (point-min)) 5) (forward-char -5))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1471 (looking-at "\\\\[bB]igl"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1472 (insert
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1473 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1474 "|" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r|"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1475 (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1476 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1477 (and (> (- (point) (point-min)) 6) (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1478 (looking-at "\\\\[bB]iggl"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1479 (insert
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1480 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1481 "|" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r|"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1482 (forward-char -7))
193
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 192
diff changeset
1483 ((save-excursion ; added by Jin <MAF01011<at>nifty.ne.jp>
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1484 (and (> (- (point) (point-min)) 6) (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1485 (looking-at "\\\\left\\\\"))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1486 (YaTeX-insert-inherit "|\\right\\|")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1487 (forward-char -8))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1488 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1489 (and (> (- (point) (point-min)) 6) (forward-char -6))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1490 (looking-at "\\\\[bB]igl\\\\"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1491 (insert
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1492 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1493 "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1494 (forward-char -7))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1495 ((save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1496 (and (> (- (point) (point-min)) 7) (forward-char -7))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1497 (looking-at "\\\\[bB]iggl\\\\"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1498 (insert
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1499 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1500 "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1501 (forward-char -8)) ; added by Jin up to here.
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1502 ((= (preceding-char) ?\\ )
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1503 (YaTeX-insert-inherit "|\\|")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1504 (backward-char 2))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1505 ; ((and (YaTeX-closable-p)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1506 ; (/= (preceding-char) ?|)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1507 ; (/= (following-char) ?|))
184
bdc00b25045d The text-property for math-mode should be front-sticky and rear-nonsticky.
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 181
diff changeset
1508 ; (YaTeX-insert-inherit "||")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1509 ; (backward-char 1))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1510 (t (YaTeX-self-insert arg))))
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1511
285
032d08cdcca2 Activate YaTeX-use-jmode-hook only if using canna.
HIROSE Yuuji <yuuji@gentei.org>
parents: 282
diff changeset
1512 (defvar YaTeX-use-jmode-hook
032d08cdcca2 Activate YaTeX-use-jmode-hook only if using canna.
HIROSE Yuuji <yuuji@gentei.org>
parents: 282
diff changeset
1513 (and (featurep 'canna) (boundp 'canna:*initialized*) canna:*initialized*)
032d08cdcca2 Activate YaTeX-use-jmode-hook only if using canna.
HIROSE Yuuji <yuuji@gentei.org>
parents: 282
diff changeset
1514 ;; (not (and (fboundp 'skk-mode) (boundp 'skk-mode)))
197
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1515 "*Non-nil means activate automatic jmode switcher within/out math mode.
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1516 Hopefully, change default to t in the next version of 1.75.")
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1517 (defun YaTeX-jmode-hook (old new)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1518 "A hook controling jmode on/off."
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1519 ;; This function is called via point-entered/leave hook, so that
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1520 ;; codes in it is evaluated on such emacsen as having text-properties.
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1521 (let ((inhibit-point-motion-hooks t)
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1522 (oldp (plist-get (text-properties-at old) 'point-left))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1523 (newp (plist-get (text-properties-at new) 'point-left))
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1524 (lnew (plist-get (text-properties-at new) 'last-new))
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1525 (mjmode (plist-get (text-properties-at new) 'mjmode))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1526 (bmp (buffer-modified-p))
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1527 (jm (YaTeX-jmode)) b e)
181
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1528 (unwind-protect
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1529 (cond
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1530 ((eq lnew new) nil) ;Do nothing if continuous entry
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1531 ((and (not (eq newp 'YaTeX-jmode-hook))
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1532 (eq oldp 'YaTeX-jmode-hook)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1533 (plist-get (text-properties-at old) 'entered))
181
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1534 ;; leave
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1535 (remove-text-properties
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1536 (setq b (1+ (or (previous-single-property-change old 'point-left)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1537 (1- (point)))))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1538 (setq e (1- (or (next-single-property-change old 'point-left)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1539 (1+ (point)))))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1540 (list 'last-new nil 'entered nil))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1541 (add-text-properties b e (list 'mjmode jm))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1542 (if (boundp 'skk-katakana)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1543 (put 'YaTeX-jmode-on 'skkkata skk-katakana))
181
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1544 (if (plist-get (text-properties-at old) 'jmode)
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1545 (YaTeX-jmode-on)))
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1546 ((and (not (eq oldp 'YaTeX-jmode-hook))
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1547 (eq newp 'YaTeX-jmode-hook)
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1548 (not (plist-get (text-properties-at new) 'entered)))
181
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1549 ;; enter
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1550 (add-text-properties
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1551 (1+ (or (previous-single-property-change new 'point-left)
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1552 (1- (point))))
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1553 (1- (or (next-single-property-change new 'point-left)
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1554 (1+ (point))))
186
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1555 (list 'jmode jm 'last-new new 'entered t))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1556 (if (boundp 'skk-katakana) ;care for skk katakana mode
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1557 (put 'YaTeX-jmode-on 'skkkata skk-katakana))
61996cd55816 Ensure point-entered/point-left hook should not run continuously.
yuuji@gentei.org
parents: 185
diff changeset
1558 (if mjmode (YaTeX-jmode-on) (YaTeX-jmode-off))))
181
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1559 ;;unwind job
ab7cd5129797 Keep buffer-modified-p in YaTeX-jmode-hook().
yuuji@gentei.org
parents: 179
diff changeset
1560 (set-buffer-modified-p bmp))))
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
1561
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1562 (defun YaTeX-insert-dollar ()
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1563 (interactive)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1564 (if (or (not (YaTeX-closable-p))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1565 (= (preceding-char) 92)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1566 (and (YaTeX-in-math-mode-p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1567 (or (/= (preceding-char) ?$) (/= (following-char) ?$))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1568 (insert "$")
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1569 (insert "$$")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1570 (forward-char -1)
197
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1571 (and YaTeX-use-jmode-hook
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1572 (fboundp 'add-text-properties)
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1573 (add-text-properties
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1574 (1- (point)) (1+ (point))
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1575 (list 'point-left 'YaTeX-jmode-hook
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1576 'point-entered 'YaTeX-jmode-hook
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1577 'front-sticky t
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1578 'rear-nonsticky t
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1579 'mjmode nil
3842e55025aa Note on { after \begin.
yuuji@gentei.org
parents: 196
diff changeset
1580 'jmode (YaTeX-jmode))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1581 (YaTeX-jmode-off)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1582 (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1583
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1584 (defun YaTeX-insert-dollars-region (beg end)
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1585 (interactive "r")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1586 (YaTeX-insert-braces-region beg end "$" "$"))
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
1587
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1588 (defun YaTeX-insert-amper ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1589 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1590 (if (or (string-match YaTeX-array-env-regexp
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1591 (or (YaTeX-inner-environment t) "document"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1592 (= (preceding-char) 92)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1593 (YaTeX-literal-p)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1594 (YaTeX-in-math-mode-p))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1595 (insert "&")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1596 (insert "\\&")))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
1597
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1598 (defun YaTeX-version ()
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1599 "Return string of the version of running YaTeX."
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1600 (interactive)
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1601 (message
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1602 (concat "Yet Another tex-mode "
55
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
1603 (if YaTeX-japan "u–ì’¹v" "`Wild Bird'")
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1604 " Revision "
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1605 YaTeX-revision-number)))
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
1606
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1607 (defun YaTeX-typeset-menu (arg &optional char)
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1608 "Typeset, preview, visit error and miscellaneous convenient menu.
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1609 Optional second argument CHAR is for non-interactive call from menu."
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1610 (interactive "P")
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1611 (message
130
8703f090c628 `[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents: 129
diff changeset
1612 (concat "J)latex R)egion E)nv B)ibtex mk(I)dx "
123
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
1613 "latex+p(D)f "
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
1614 (if (fboundp 'start-process) "K)ill ")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1615 "P)review "
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1616 (and (boundp 'window-system) window-system "S)earch ")
123
590fc51462c7 New typeset menu `latex+p(D)f' added.
yuuji@gentei.org
parents: 119
diff changeset
1617 "V)iewErr L)pr"))
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1618 (let ((sw (selected-window)) (c (or char (read-char))))
32
546c4baad92f The first typesetting splits window into 3 on Nemacs. Fixed.
yuuji
parents: 22
diff changeset
1619 (require 'yatexprc) ;for Nemacs's bug
546c4baad92f The first typesetting splits window into 3 on Nemacs. Fixed.
yuuji
parents: 22
diff changeset
1620 (select-window sw)
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
1621 (cond
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1622 ((= c ?j) (YaTeX-typeset-buffer))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1623 ((= c ?r) (YaTeX-typeset-region))
130
8703f090c628 `[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents: 129
diff changeset
1624 ((= c ?e) (YaTeX-typeset-environment))
224
9705855793ca YaTeX-typeset-auto-rerun for labels and bibitems reference resolution.
yuuji@gentei.org
parents: 218
diff changeset
1625 ((= c ?b) (YaTeX-call-builtin-on-file
227
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1626 "BIBTEX" bibtex-command arg))
224
9705855793ca YaTeX-typeset-auto-rerun for labels and bibitems reference resolution.
yuuji@gentei.org
parents: 218
diff changeset
1627 ((= c ?i) (YaTeX-call-builtin-on-file
227
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1628 "MAKEINDEX" makeindex-command arg))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1629 ((= c ?k) (YaTeX-kill-typeset-process YaTeX-typeset-process))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
1630 ((= c ?p) (call-interactively 'YaTeX-preview))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1631 ((= c ?q) (YaTeX-system "lpq" "*Printer queue*"))
288
dffc0d979ae0 Use %#DVIPDF on `[prefix] t d'.
HIROSE Yuuji <yuuji@gentei.org>
parents: 286
diff changeset
1632 ((= c ?d) (YaTeX-typeset-buffer
dffc0d979ae0 Use %#DVIPDF on `[prefix] t d'.
HIROSE Yuuji <yuuji@gentei.org>
parents: 286
diff changeset
1633 (or (YaTeX-get-builtin "DVIPDF") YaTeX-dvipdf-command)))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
1634 ((= c ?v) (YaTeX-view-error))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1635 ((= c ?l) (YaTeX-lpr arg))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1636 ((= c ?m) (YaTeX-switch-mode-menu arg))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1637 ((= c ?b) (YaTeX-insert-string "\\"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1638 ((= c ?s) (YaTeX-xdvi-remote-search arg)))))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
1639
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1640 (if (fboundp 'wrap-function-to-control-ime)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1641 (wrap-function-to-control-ime 'YaTeX-typeset-menu t "P"))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1642
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1643
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1644 (defun YaTeX-%-menu (&optional beg end char)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1645 "Operate %# notation."
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
1646 ;;Do not use interactive"r" for the functions which require no mark
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
1647 (interactive)
231
d329bbed72cd MAKEINDEX's short-cut should be `i'.
yuuji@gentei.org
parents: 228
diff changeset
1648 (message "!)Edit-%%#! B)EGIN-END-region P)review L)Edit-%%#LPR make(I)ndex B)ibtex")
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
1649 (let ((c (or char (read-char))) (string "") key
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1650 (b (make-marker)) (e (make-marker)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1651 (save-excursion
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1652 (cond
231
d329bbed72cd MAKEINDEX's short-cut should be `i'.
yuuji@gentei.org
parents: 228
diff changeset
1653 ((rindex "!plib" c) ;Edit %#xxx
227
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1654 (setq key (cdr (assq c '((?! . "!")
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1655 (?p . "PREVIEW")
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1656 (?l . "LPR")
231
d329bbed72cd MAKEINDEX's short-cut should be `i'.
yuuji@gentei.org
parents: 228
diff changeset
1657 (?i . "MAKEINDEX")
227
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1658 (?b . "BIBTEX")))))
3b2ac4652810 Handling of built-in is changed to use YaTeX-getset-builtin.
yuuji@gentei.org
parents: 224
diff changeset
1659 (YaTeX-getset-builtin key t))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1660
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1661 ((= c ?b) ;%#BEGIN %#END region
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
1662 (or end (setq beg (min (point) (mark)) end (max (point) (mark))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1663 (set-marker b beg)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1664 (set-marker e end)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1665 (goto-char (point-min))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1666 (while (re-search-forward "^%#\\(BEGIN\\)\\|\\(END\\)$" nil t)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1667 (beginning-of-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1668 (delete-region (point) (progn (forward-line 1) (point))))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1669 (goto-char b)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1670 (open-line 1)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1671 (delete-region (point) (progn (beginning-of-line)(point)));for 19 :-<
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1672 (insert "%#BEGIN")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1673 (goto-char e)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1674 (insert "%#END\n")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1675 (set-marker b nil)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1676 (set-marker e nil))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1677 ))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1678
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1679 (defvar YaTeX-refcommand-def-regexp-default
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1680 "label\\|bibitem")
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1681 (defvar YaTeX-refcommand-def-regexp-private nil
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1682 "*Regexp of defining label commands")
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1683 (defvar YaTeX-refcommand-def-regexp
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1684 (concat (if YaTeX-refcommand-def-regexp-private
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1685 (concat YaTeX-refcommand-def-regexp-private "\\|"))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1686 YaTeX-refcommand-def-regexp-default))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1687
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1688 (defvar YaTeX-refcommand-ref-regexp-default
313
HIROSE Yuuji <yuuji@gentei.org>
parents: 312
diff changeset
1689 "\\(page\\|eq\\|fig\\|c\\)?ref\\|cite")
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1690 (defvar YaTeX-refcommand-ref-regexp-private nil
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1691 "*Regexp of referring label commands")
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1692 (defvar YaTeX-refcommand-ref-regexp
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1693 (concat (if YaTeX-refcommand-ref-regexp-private
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1694 (concat YaTeX-refcommand-ref-regexp-private "\\|"))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1695 YaTeX-refcommand-ref-regexp-default))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1696
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1697 (defvar YaTeX-refcommand-regexp
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1698 (concat YaTeX-refcommand-def-regexp
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1699 "\\|" YaTeX-refcommand-ref-regexp)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1700 "Regexp of label defining/referring command name.")
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1701
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1702 (defun YaTeX-goto-corresponding-label (reverse &optional otherwin)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1703 "Jump to corresponding \\label{} and \\ref{} or \\cite and \\bibitem.
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1704 The default search direction depends on the command at the cursor position.
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1705 When the cursor is on \\ref(\\cite), YaTeX will try to search the
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1706 corresponding \\label(\\bibitem) backward,
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1707 and if it fails search forward again. And when the cursor is
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1708 on \\label(\\bibitem), YaTeX will search the corresponding \\ref(\\cite)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1709 forward at first and secondary backward.
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1710 Argument REVERSE non-nil makes the default
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1711 direction rule reverse. Since Search string is automatically set in
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1712 search-last-string, you can repeat search the same label/ref by typing
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1713 \\[isearch-forward] or \\[isearch-backward].
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1714 If optional second argument OTHERWIN is non-nil, move to other window."
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1715
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1716 (let ((scmd "") label direc string blist (p (point)) (cb (current-buffer))
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 166
diff changeset
1717 (refcommands YaTeX-refcommand-regexp)
82
yuuji
parents: 79
diff changeset
1718 (foundmsg (format "Type %s %c to return to original position."
yuuji
parents: 79
diff changeset
1719 (key-description
yuuji
parents: 79
diff changeset
1720 (car
yuuji
parents: 79
diff changeset
1721 (or (where-is-internal 'register-to-point)
yuuji
parents: 79
diff changeset
1722 (where-is-internal 'jump-to-register))))
yuuji
parents: 79
diff changeset
1723 YaTeX-current-position-register))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1724 (func (function (lambda (string sfunc)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1725 (or
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1726 (funcall sfunc string nil t)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1727 (funcall (if (eq sfunc 're-search-forward)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1728 're-search-backward 're-search-forward)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1729 string nil t))))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1730 (cond
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1731 ((YaTeX-on-section-command-p refcommands)
82
yuuji
parents: 79
diff changeset
1732 (setq scmd
yuuji
parents: 79
diff changeset
1733 (cdr
yuuji
parents: 79
diff changeset
1734 (assoc
yuuji
parents: 79
diff changeset
1735 (YaTeX-match-string 1)
yuuji
parents: 79
diff changeset
1736 '(("label" . "\\\\\\(page\\|eq\\)?ref{%k}")
yuuji
parents: 79
diff changeset
1737 ("ref" . "\\\\label{%k}")
yuuji
parents: 79
diff changeset
1738 ("eqref" . "\\\\label{%k}")
yuuji
parents: 79
diff changeset
1739 ("pageref" . "\\\\label{%k}")
yuuji
parents: 79
diff changeset
1740 ("cite" .
yuuji
parents: 79
diff changeset
1741 "\\\\bibitem\\(\\[[^]]+\\]\\)?{%k}\\|^\\s *@[a-z]+{%k,")
yuuji
parents: 79
diff changeset
1742 ("bibitem" . "\\\\cite\\(\\[[^]]+\\]\\)?")))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1743 (goto-char (match-end 0))
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1744 (let ((label (YaTeX-buffer-substring
82
yuuji
parents: 79
diff changeset
1745 (1- (point)) (progn (backward-list 1) (1+ (point)))))
yuuji
parents: 79
diff changeset
1746 (fp (make-marker))fl fn
yuuji
parents: 79
diff changeset
1747 (goother (function (lambda (buffer point)
yuuji
parents: 79
diff changeset
1748 (goto-char point)
yuuji
parents: 79
diff changeset
1749 (if (one-window-p)
yuuji
parents: 79
diff changeset
1750 (split-window-calculate-height
yuuji
parents: 79
diff changeset
1751 YaTeX-default-pop-window-height))
yuuji
parents: 79
diff changeset
1752 (select-window (get-lru-window))
yuuji
parents: 79
diff changeset
1753 (switch-to-buffer buffer)))))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1754 ;(setq string (concat "\\" scmd "{" label "}"))
82
yuuji
parents: 79
diff changeset
1755 ;(setq string (concat "\\\\" scmd "{" (regexp-quote label) "}"))
yuuji
parents: 79
diff changeset
1756 (setq string (YaTeX-replace-format scmd "k" (regexp-quote label)))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1757 (setq direc (if (string-match "ref\\|cite" scmd)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1758 're-search-forward 're-search-backward))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1759 (if YaTeX-current-position-register
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1760 (point-to-register YaTeX-current-position-register))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1761 (if reverse (setq direc (if (eq direc 're-search-forward)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1762 're-search-backward 're-search-forward)))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1763 (if (funcall func string direc) ;label/ref found!
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1764 (progn
82
yuuji
parents: 79
diff changeset
1765 (if otherwin (funcall goother cb p))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1766 (goto-char (match-beginning 0))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1767 (push-mark p))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1768 ;;if label/ref not found, search through all yatex buffers.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1769 (goto-char p) ;resume position of current buffer
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1770 (catch 'found
82
yuuji
parents: 79
diff changeset
1771 (setq blist (YaTeX-yatex-buffer-list))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1772 (while blist
82
yuuji
parents: 79
diff changeset
1773 ;; search for corresponding keyword
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1774 (set-buffer (car blist))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1775 (if (YaTeX-on-section-command-p refcommands)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1776 (goto-char (match-beginning 0)))
82
yuuji
parents: 79
diff changeset
1777 (cond
yuuji
parents: 79
diff changeset
1778 ; cond1
yuuji
parents: 79
diff changeset
1779 ((funcall func string direc)
yuuji
parents: 79
diff changeset
1780 (cond
yuuji
parents: 79
diff changeset
1781 (otherwin
yuuji
parents: 79
diff changeset
1782 (set-buffer cb)
yuuji
parents: 79
diff changeset
1783 (funcall goother (car blist) p))
yuuji
parents: 79
diff changeset
1784 ((or (get-buffer-window (car blist))
yuuji
parents: 79
diff changeset
1785 (and YaTeX-emacs-19
yuuji
parents: 79
diff changeset
1786 (get-buffer-window (car blist) t)))
yuuji
parents: 79
diff changeset
1787 (goto-buffer-window (car blist)))
yuuji
parents: 79
diff changeset
1788 (t
yuuji
parents: 79
diff changeset
1789 (switch-to-buffer (car blist))
yuuji
parents: 79
diff changeset
1790 (message foundmsg)))
yuuji
parents: 79
diff changeset
1791 (goto-char (match-beginning 0))
yuuji
parents: 79
diff changeset
1792 (throw 'found t))
yuuji
parents: 79
diff changeset
1793 ; cond2
yuuji
parents: 79
diff changeset
1794 ((and
yuuji
parents: 79
diff changeset
1795 (string-match "bibitem" scmd)
yuuji
parents: 79
diff changeset
1796 (catch 'found2
yuuji
parents: 79
diff changeset
1797 (save-excursion
yuuji
parents: 79
diff changeset
1798 (goto-char (point-min))
yuuji
parents: 79
diff changeset
1799 (while (YaTeX-re-search-active-forward
yuuji
parents: 79
diff changeset
1800 "\\\\bibliography{\\([^}]*\\)}" "%" nil t)
yuuji
parents: 79
diff changeset
1801 (setq fl (YaTeX-split-string (YaTeX-match-string 1) ","))
yuuji
parents: 79
diff changeset
1802 (while fl
yuuji
parents: 79
diff changeset
1803 (if (or (file-exists-p (setq fn (car fl)))
yuuji
parents: 79
diff changeset
1804 (file-exists-p (setq fn (concat fn ".bib"))))
yuuji
parents: 79
diff changeset
1805 (progn
yuuji
parents: 79
diff changeset
1806 (set-buffer (find-file-noselect fn))
yuuji
parents: 79
diff changeset
1807 (save-excursion
yuuji
parents: 79
diff changeset
1808 (goto-char (point-min))
yuuji
parents: 79
diff changeset
1809 (if (YaTeX-re-search-active-forward
yuuji
parents: 79
diff changeset
1810 string "%" nil t)
yuuji
parents: 79
diff changeset
1811 (throw 'found2
yuuji
parents: 79
diff changeset
1812 (set-marker fp (point)))))))
yuuji
parents: 79
diff changeset
1813 (setq fl (cdr fl)))))))
yuuji
parents: 79
diff changeset
1814 (if otherwin
yuuji
parents: 79
diff changeset
1815 (funcall goother (marker-buffer fp) fp)
yuuji
parents: 79
diff changeset
1816 (switch-to-buffer (marker-buffer fp))
yuuji
parents: 79
diff changeset
1817 (goto-char fp))
yuuji
parents: 79
diff changeset
1818 (set-marker fp nil)
yuuji
parents: 79
diff changeset
1819 (message foundmsg)
yuuji
parents: 79
diff changeset
1820 (throw 'found t)))
yuuji
parents: 79
diff changeset
1821 (setq blist (cdr blist)))
yuuji
parents: 79
diff changeset
1822 ;; search for bibliography
yuuji
parents: 79
diff changeset
1823 )))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
1824 (if YaTeX-emacs-19
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1825 (setq regexp-search-ring
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1826 (cons string (delete string regexp-search-ring)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1827 (setq search-last-regexp string)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1828 (t nil))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1829
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1830 ;;YaTeX-goto-corresponding-environment was moved to yatexlib
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1831
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1832 (defun YaTeX-goto-corresponding-file (&optional other)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1833 "Visit or switch buffer of corresponding file,
176
ad313119ba15 Add `alltt' to YaTeX-verb-regexp.
yuuji@gentei.org
parents: 169
diff changeset
1834 looking at \\input or \\include or \\includeonly on current line."
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1835 (if (not (YaTeX-on-includes-p)) nil
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1836 (let ((parent buffer-file-name) input-file b)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1837 (save-excursion
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
1838 (if (and (re-search-forward "[{%]" (point-end-of-line) t)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
1839 (= ?{ (char-after (match-beginning 0))))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1840 nil
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1841 (skip-chars-backward "^,{"))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1842 (setq input-file
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
1843 (YaTeX-buffer-substring
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1844 (point) (progn (skip-chars-forward "^ ,}") (point))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1845 (if (not (string-match "\\.\\(tex\\|sty\\)$" input-file))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1846 (setq input-file (concat input-file ".tex"))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1847 (cond
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1848 (other (YaTeX-switch-to-buffer-other-window input-file))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1849 ((setq b (YaTeX-get-file-buffer input-file))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1850 (goto-buffer-window b))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1851 (t (YaTeX-switch-to-buffer input-file)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1852 (or (YaTeX-get-builtin "!")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1853 YaTeX-parent-file
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1854 (setq YaTeX-parent-file parent)))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1855
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1856 (defun YaTeX-goto-corresponding-BEGIN-END ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1857 (if (not (YaTeX-on-BEGIN-END-p)) nil
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1858 (if (cond
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1859 ((equal (match-beginning 0) (match-beginning 1)) ;if on %#BEGIN
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1860 (not (search-forward "%#END" nil t)))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1861 (t ; if on %#END
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1862 (not (search-backward "%#BEGIN" nil t))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
1863 (error "Corresponding %%#BEGIN/END not found."))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1864 (beginning-of-line)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1865 t))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
1866
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1867 (defvar YaTeX-processed-file-regexp-alist nil
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1868 "Alist of regexp of processed file regexp vs. its file name part;
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1869 For example, if you include image file with `\\epsfile{file=FILE}' where
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1870 `FILE' is processed file. You might want to view FILE with other previewer
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1871 such as ghostview, or want to preview its source which was drawn with
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1872 other drawing tool, tgif for example. Then you should set entire regexp
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1873 of including expression and enclose its file name part with \\\\( and \\\\).
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1874
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1875 Ex. (\"\\\\\\\\epsfile{[^}]*file=\\\\([^,} ]+\\\\)\\\\(\\\\.e?ps\\\\)?[^}]*}\" 1)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1876
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1877 Where the first group surrounded by \\\\( and \\\\) is the file name part
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1878 of expression. So you should set 1 to second element. And the first
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1879 matching group is sent to (image) processor defined by the variable
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1880 YaTeX-file-processor-alist. See also the documentation of
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1881 YaTeX-file-processor-alist.
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1882
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1883 ª‚¶‚á—Ç‚­‚í‚©‚ñ‚È‚¢‚·‚ËB—Ⴆ‚Î tgif hoge.obj ‚µ‚Ä hoge.eps ‚ð
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1884 \\epsfile{file=hoge.eps} ‚ŃCƒ“ƒNƒ‹[ƒh‚µ‚Ä‚¢‚é‚Æ‚µ‚悤B‚»‚Ìs‚Å
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1885 \[prefix\] g ‚ð‰Ÿ‚µ‚½Žž‚É tgif ‚ð‹N“®‚µ‚Ä—~‚µ‚©‚Á‚½‚çA‚Ü‚¸ã‚̂悤‚È
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1886 ³‹K•\Œ»‚ðÝ’è‚·‚éB\\\\(‚Æ\\\\)‚ň͂ñ‚¾‚Æ‚±‚낪ƒtƒ@ƒCƒ‹–¼‚É‚È‚é‚悤‚É
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1887 ’ˆÓ‚·‚éB‚Ńtƒ@ƒCƒ‹–¼•”•ª‚ª‰½”Ô–Ú‚Ì\\\\(\\\\)‚É‚È‚é‚©‚ðƒŠƒXƒg‚Ì2”Ô–Ú‚É‘‚­B
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1888 ‚·‚é‚ÆA‚»‚Ì•”•ª‚ª•Ï” YaTeX-file-processor-alist ‚Å’è‹`‚³‚ꂽ
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1889 ˆ—ƒvƒƒOƒ‰ƒ€‚É“n‚³‚ê‚éB‚Æ‚¢‚¤‚킯B
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1890 ‚ñ`‚â‚Á‚Ï‚è‚Þ‚¸‚©‚µ‚¢‚ËB•ª‚©‚ç‚È‚¢Žž‚Í—×‚Ì Lisper ‚É•·‚­‚©A
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1891 fj–ì’¹‚̉ï‚Å•·‚±‚¤!
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1892 ")
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1893
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1894 (defvar YaTeX-processed-file-regexp-alist-default
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1895 '(("\\\\epsfile\\(\\[[^]]+\\]\\)?{[^},]*file=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 2)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1896 ("\\\\epsfig{[^},]*fi\\(le\\|gure\\)=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 2)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1897 ("\\\\postscriptbox{[^}]*}{[^}]*}{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 1)
274
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1898 ("\\\\\\(epsfbox\\|epsfig\\)\\*?{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 2) ;\epsfbox{hoge.ps}
275
45350f20793d Fix regexp for \includegraphics
HIROSE Yuuji <yuuji@koeki-u.ac.jp>
parents: 274
diff changeset
1899 ("\\\\includegraphics\\*?\\(.*\\]\\|\\s \\)?{\\(.*\\)\\(\\.ai\\|\\.pdf\\|\\.svg\\|\\.png\\|\\.jpe?g\\|\\.e?ps\\)}" 2) ;\includegraphics[options...]{hoge.eps}
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1900 ("\\\\\\(psbox\\)\\(\\[[^]]+\\]\\)?{\\(\\([^,} ]*/\\)?[^} ]+\\)\\(\\.e?ps\\)}" 3) ;\psbox[options...]{hoge.eps} (97/1/11)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1901 ("\\\\input{\\([^} ]+\\)\\(\\.tps\\)}" 1) ;tgif2tex (1998/9/16)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1902 )
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1903 "See the documentation of YaTeX-processed-file-regexp-alist.")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1904
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1905 (defvar YaTeX-file-processor-alist nil
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1906 "*Alist of files' processor vs. its extension;
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1907 See also the documentation of YaTeX-processed-file-regexp-alist.")
274
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1908
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1909 (defvar YaTeX-file-processor-alist-default
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1910 '(("tgif" . ".obj")
274
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1911 ("gimp" . ".xcf") ("gimp" . ".xcf.gz") ("gimp" . ".xcf.bz2")
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1912 ("inkscape" . ".svg") ("inkscape" . ".svgz") ("inkscape" . ".ai")
276
6188dcbf8d2f Command name of StarOffice derivatives set to soffice
HIROSE Yuuji <yuuji@gentei.org>
parents: 275
diff changeset
1913 ("soffice" . ".odg")
274
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1914 ("gimp" . ".jpeg") ("gimp" . ".jpg") ("gimp" . ".png")
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1915 ("evince" . ".ps")
27aaf7d5e513 Candidate: change default file processor.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1916 ("evince" . ".eps")
276
6188dcbf8d2f Command name of StarOffice derivatives set to soffice
HIROSE Yuuji <yuuji@gentei.org>
parents: 275
diff changeset
1917 ("soffice" . ".pdf")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1918 (t . ".tex")
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1919 (t . ".sty")
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1920 (t . ""))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1921 "See the documentation of YaTeX-file-processor-alist.")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1922
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1923 (defun YaTeX-goto-corresponding-file-processor (&optional other)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1924 "Execute corresponding file processor."
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1925 (save-excursion
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1926 (or (looking-at YaTeX-ec-regexp)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1927 (skip-chars-backward (concat "^" YaTeX-ec) (point-beginning-of-line)))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1928 (let ((list (append YaTeX-processed-file-regexp-alist
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1929 YaTeX-processed-file-regexp-alist-default))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1930 (p (point)) flist file
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1931 (peol (point-end-of-line))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1932 (basedir
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1933 (if YaTeX-search-file-from-top-directory
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1934 (save-excursion (YaTeX-visit-main t) default-directory)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1935 ".")))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1936 (setq flist (catch 'found
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1937 (while list
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1938 (goto-char p)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1939 (if (re-search-forward (car (car list)) peol t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1940 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1941 (setq file (YaTeX-match-string
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1942 (car (cdr (car list)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1943 (throw 'found (cdr (car list)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1944 (setq list (cdr list)))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1945 (if flist ;if pattern and file name found
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1946 (let*((plist (append YaTeX-file-processor-alist
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1947 YaTeX-file-processor-alist-default))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1948 (plist0 plist)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1949 ext cmd src buf (alt (car (cdr flist))))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1950 (if (and (re-search-forward
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1951 (concat YaTeX-comment-prefix "\\s *\\(.*\\)$") peol t)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1952 (assoc (setq cmd (YaTeX-match-string 1))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1953 YaTeX-file-processor-alist))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1954 (setq src ;if processor is specified
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1955 (concat file
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1956 (cdr (assoc cmd YaTeX-file-processor-alist))))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1957 (while plist ;if processor is not specified
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1958 (setq ext (cdr (car plist)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1959 (if (and (string< "" (concat file ext))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1960 (file-exists-p
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1961 (expand-file-name (concat file ext) basedir)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1962 (setq cmd (car (car plist))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1963 src (concat file ext) plist nil))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1964 (setq plist (cdr plist)))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1965 (if (and (null src) alt YaTeX-create-file-prefix-g)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1966 (setq cmd alt
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1967 src (concat file (cdr (assoc alt plist0))))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1968 (if src ;if processor and src file found
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1969 (let ((default-directory basedir))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1970 (cond
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1971 ((stringp cmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1972 (let ((buf (concat "* " cmd " " src " *")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1973 (YaTeX-system (concat cmd " " src) buf)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1974 t))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1975 ((eq t cmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1976 (let ((parent buffer-file-name))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1977 (funcall
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1978 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1979 (other 'YaTeX-switch-to-buffer-other-window)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1980 ((get-file-buffer src) 'goto-buffer-window)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1981 (t 'YaTeX-switch-to-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1982 src)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1983 (or (YaTeX-get-builtin "!")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1984 YaTeX-parent-file
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1985 (setq YaTeX-parent-file parent))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1986 t))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1987 ((symbolp cmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1988 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1989 ((symbol-function cmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1990 (funcall cmd src other)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1991 t)))))))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1992
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
1993 (defun YaTeX-on-section-command-p (command)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
1994 "Check if point is on the LaTeX command: COMMAND(regexp).
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1995 Return nil if point is not on it. Otherwise return the
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1996 number of argument position.
82
yuuji
parents: 79
diff changeset
1997 Section command name is stored in match-data #1.
yuuji
parents: 79
diff changeset
1998 Parsing information is stored to plist.
yuuji
parents: 79
diff changeset
1999 Macros name stored to propname 'command.
yuuji
parents: 79
diff changeset
2000 Macro's argument number stored to propname 'argc."
yuuji
parents: 79
diff changeset
2001 (let ((p (point)) md (parg 0) (argc 1) word (grouping 0) (i 0)
yuuji
parents: 79
diff changeset
2002 (ec+command (concat YaTeX-ec-regexp "\\(" command "\\)")))
yuuji
parents: 79
diff changeset
2003 (setplist 'YaTeX-on-section-command-p nil)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2004 (while (setq i (string-match "\\\\(" command i))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2005 (setq grouping (1+ grouping) i (+ i 2)))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2006 (save-excursion
82
yuuji
parents: 79
diff changeset
2007 (if (looking-at ec+command) nil
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2008 (catch 'found ;caught value has no meaning
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2009 ;;(1) looking at current position
82
yuuji
parents: 79
diff changeset
2010 (and (looking-at command)
yuuji
parents: 79
diff changeset
2011 (save-excursion
yuuji
parents: 79
diff changeset
2012 (while (and (not (bobp)) (looking-at command))
yuuji
parents: 79
diff changeset
2013 (forward-char -1))
yuuji
parents: 79
diff changeset
2014 (looking-at ec+command))
yuuji
parents: 79
diff changeset
2015 (goto-char (match-beginning 0))
yuuji
parents: 79
diff changeset
2016 (throw 'found t))
245
8ad85ce1ee98 YaTeX-on-section-command-p tries to escape parentheses.
yuuji@gentei.org
parents: 240
diff changeset
2017 ;;If inside of parentheses, try to escape.
8ad85ce1ee98 YaTeX-on-section-command-p tries to escape parentheses.
yuuji@gentei.org
parents: 240
diff changeset
2018 (while (condition-case err
8ad85ce1ee98 YaTeX-on-section-command-p tries to escape parentheses.
yuuji@gentei.org
parents: 240
diff changeset
2019 (progn (up-list -1) t)
8ad85ce1ee98 YaTeX-on-section-command-p tries to escape parentheses.
yuuji@gentei.org
parents: 240
diff changeset
2020 (error nil)))
8ad85ce1ee98 YaTeX-on-section-command-p tries to escape parentheses.
yuuji@gentei.org
parents: 240
diff changeset
2021 (while (equal (preceding-char) ?\]) (backward-list))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2022 ;;(2) search command directly
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2023 (skip-chars-forward "^{}[]")
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2024 (and (YaTeX-re-search-active-backward
82
yuuji
parents: 79
diff changeset
2025 ec+command
yuuji
parents: 79
diff changeset
2026 YaTeX-comment-prefix nil t)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2027 (>= p (match-beginning 0))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2028 (throw 'found (goto-char (match-beginning 0))))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2029 ;;(3) search token
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2030 (goto-char p)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2031 (while t
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2032 (if (bobp) (throw 'found nil))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2033 (cond
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2034 ((looking-at YaTeX-ec-regexp) (throw 'found t))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2035 ((looking-at "[[{]") nil)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2036 ((looking-at "[]}]")(condition-case nil (up-list -1) (error nil)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2037 (t (skip-chars-backward " \t\r\n")))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2038 (skip-chars-backward (concat "^ \t\r\n{}[]" YaTeX-ec-regexp))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2039 (or (bobp) (forward-char -1)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2040 (if (and
82
yuuji
parents: 79
diff changeset
2041 (looking-at (concat ec+command
yuuji
parents: 79
diff changeset
2042 "\\(\\(\\[[^]]+\\]\\|([0-9,]+)\\)*\\)" ;optional arg
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2043 ;"[ \t\n\r]*{[^}]+}")) ;arg braces
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2044 "[ \t\n\r]*{[^}]*}")) ;arg braces
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2045 (not (YaTeX-lookup-table
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2046 (setq word (YaTeX-match-string 1)) 'singlecmd)))
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2047 (progn
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2048 (setq md (match-data))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2049 (skip-chars-forward "^{")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2050 (if (<= (point) p) (setq parg (1+ parg)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2051 (setq argc
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2052 (or (car (cdr (YaTeX-lookup-table word 'section)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2053 argc))
82
yuuji
parents: 79
diff changeset
2054 (put 'YaTeX-on-section-command-p 'argc argc)
yuuji
parents: 79
diff changeset
2055 (put 'YaTeX-on-section-command-p 'command argc)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2056 (while (and (>= (setq argc (1- argc)) 0)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2057 (progn (skip-chars-forward " \t\n\r")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2058 (looking-at "{")))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2059 (forward-list 1)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2060 (if (<= (point) p) (setq parg (1+ parg))))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2061 (store-match-data md)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2062 (setq i (+ 2 grouping))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2063 (if (and (match-beginning i)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2064 (>= p (match-beginning i)) (< p (match-end i)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2065 -1 ;return -1 if point is on optional arg
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2066 (if (< p (point)) parg))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2067 )))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2068
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2069 (defun YaTeX-on-maketitle-p ()
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2070 "Check if point is on maketitle type commands.
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2071 Call this function after YaTeX-on-section-command-p."
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2072 (let ((p (point)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2073 (save-excursion
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2074 (or (= (char-after (point)) ?\\ )
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2075 (progn
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2076 (skip-chars-backward
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2077 (concat "^" YaTeX-ec-regexp) (point-beginning-of-line))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2078 (or (bobp) (bolp) (backward-char 1))))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2079 (and (looking-at (concat YaTeX-ec-regexp YaTeX-TeX-token-regexp))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2080 (<= (match-beginning 0) p)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2081 (> (match-end 0) p)))))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2082
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2083 (defun YaTeX-on-begin-end-p ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2084 (save-excursion
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2085 (if (and (boundp 'in-leftright-p) in-leftright-p)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2086 ;; Dirty workaround for YaTeX-goto-corresponding-leftright 2003/3/28
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2087 (let ((md (match-data))) ; for safety
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2088 (if (looking-at YaTeX-ec-regexp)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2089 nil ; stay here
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2090 (cond
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2091 ((looking-at "\\w") (skip-chars-backward "A-Za-z"))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2092 ((looking-at "\\.()\\[\\]|") (forward-char -1)))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2093 (if (equal (char-after (1- (point)))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2094 (string-to-char YaTeX-ec))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2095 (forward-char -1))))
82
yuuji
parents: 79
diff changeset
2096 ;(beginning-of-line)
yuuji
parents: 79
diff changeset
2097 (if (equal (char-after (point)) ?\\) nil ;stay here
yuuji
parents: 79
diff changeset
2098 (skip-chars-backward "^\n\\\\")
yuuji
parents: 79
diff changeset
2099 (or (bolp) (forward-char -1))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2100 (re-search-forward
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2101 ;;"\\\\begin{\\([^}]+\\)}\\|\\\\end{\\([^}]+\\)}"
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2102 (concat
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2103 (YaTeX-replace-format-args
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2104 (regexp-quote YaTeX-struct-begin)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2105 (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2106 "\\|"
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2107 (YaTeX-replace-format-args
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2108 (regexp-quote YaTeX-struct-end)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2109 (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2110 "\\|\\("
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2111 YaTeX-ec-regexp ;;"[][()]\\)"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2112 "[][]\\)"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2113 )
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2114 (point-end-of-line) t)))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
2115
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2116 (defun YaTeX-on-includes-p ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2117 (save-excursion
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2118 (beginning-of-line)
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 82
diff changeset
2119 (re-search-forward "\\(\\(include[^}]*\\)\\|\\(input\\)\\){[^}]*}"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2120 (point-end-of-line) t)))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
2121
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2122 (defun YaTeX-on-comment-p (&optional sw)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2123 "Return t if current line is commented out.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2124 Optional argument SW t to treat all `%' lines as comment,
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2125 even if on `%#' notation."
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2126 (save-excursion
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2127 (beginning-of-line)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2128 (skip-chars-forward "\\s ")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2129 (looking-at (if sw "%" "%[^#]"))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2130
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2131 (defun YaTeX-on-BEGIN-END-p ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2132 (save-excursion
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2133 (let ((case-fold-search nil))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2134 (beginning-of-line)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2135 (re-search-forward
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2136 "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t))))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents: 5
diff changeset
2137
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2138 (defun YaTeX-goto-corresponding-* (arg)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2139 "Parse current line and call suitable function."
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2140 (interactive "P")
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2141 (let (mm)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2142 (cond
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2143 ((YaTeX-goto-corresponding-label arg))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2144 ((YaTeX-goto-corresponding-environment))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2145 ((YaTeX-goto-corresponding-file-processor arg))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2146 ((YaTeX-goto-corresponding-file arg))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2147 ((YaTeX-goto-corresponding-BEGIN-END))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2148 ((and (setq mm (YaTeX-in-math-mode-p))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2149 (YaTeX-goto-corresponding-leftright)))
82
yuuji
parents: 79
diff changeset
2150 ((and ;;mm YaTeX-use-AMS-LaTeX
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2151 (YaTeX-goto-corresponding-paren)))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2152 ;;((and (string-match
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2153 ;; YaTeX-equation-env-regexp ;to delay loading
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2154 ;; (or (YaTeX-inner-environment t) "document"))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2155 ;; (YaTeX-goto-corresponding-leftright)))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2156 (t (message "I don't know where to go.")))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2157
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2158 (defun YaTeX-goto-corresponding-*-other-window (arg)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2159 "Parse current line and call suitable function."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2160 (interactive "P")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2161 (cond
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2162 ((YaTeX-goto-corresponding-label arg t))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2163 ;;((YaTeX-goto-corresponding-environment))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2164 ((YaTeX-goto-corresponding-file t))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2165 ;;((YaTeX-goto-corresponding-BEGIN-END))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2166 (t (message "I don't know where to go."))))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2167
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2168 (defun YaTeX-comment-region (alt-prefix)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2169 "Comment out region by '%'.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2170 If you call this function on the 'begin{}' or 'end{}' line,
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2171 it comments out whole environment"
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2172 (interactive "P")
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2173 (if (not (YaTeX-on-begin-end-p))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2174 (comment-out-region
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2175 (if alt-prefix
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2176 (read-string "Insert prefix: ")
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2177 YaTeX-comment-prefix))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2178 (YaTeX-comment-uncomment-env 'comment-out-region)))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2179
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2180 (defun YaTeX-uncomment-region (alt-prefix)
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2181 "Uncomment out region by '%'."
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2182 (interactive "P")
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2183 (if (not (YaTeX-on-begin-end-p))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2184 (uncomment-out-region
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2185 (if alt-prefix (read-string "Remove prefix: ")
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
2186 YaTeX-comment-prefix)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2187 (region-beginning) (region-end) YaTeX-uncomment-once)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2188 (YaTeX-comment-uncomment-env 'uncomment-out-region)))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2189
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2190 (defun YaTeX-comment-uncomment-env (func)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2191 "Comment or uncomment out one LaTeX environment switching function by FUNC."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2192 (let (beg (p (point)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2193 (save-excursion
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2194 (beginning-of-line)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2195 (setq beg (point))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2196 (YaTeX-goto-corresponding-environment)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2197 (beginning-of-line)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2198 (if (> p (point)) (setq beg (1+ beg)) (forward-char 1))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2199 (funcall func YaTeX-comment-prefix beg (point) YaTeX-uncomment-once)))
45
b0fc9c2950cd Prepare for supporting Emacs-19.
yuuji
parents: 36
diff changeset
2200 (message "%sommented out current environment."
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2201 (if (eq func 'comment-out-region) "C" "Un-c")))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2202
3
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2203 (defun YaTeX-comment-paragraph ()
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2204 "Comment out current paragraph."
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2205 (interactive)
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2206 (save-excursion
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2207 (cond
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2208 ((YaTeX-on-begin-end-p)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2209 (beginning-of-line)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2210 (insert YaTeX-comment-prefix)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2211 (YaTeX-goto-corresponding-environment)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2212 (beginning-of-line)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2213 (insert YaTeX-comment-prefix))
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2214 ((YaTeX-on-comment-p)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2215 (message "Already commented out."))
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2216 (t
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2217 (mark-paragraph)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2218 (if (looking-at paragraph-separate) (forward-line 1))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2219 (comment-out-region "%")))))
3
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2220
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2221 (defun YaTeX-uncomment-paragraph ()
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2222 "Uncomment current paragraph."
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2223 (interactive)
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2224 (save-excursion
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2225 (if (YaTeX-on-begin-end-p)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2226 (let ((p (point-marker)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2227 (YaTeX-goto-corresponding-environment)
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
2228 (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2229 (goto-char p)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2230 (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2231 (set-marker p nil))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2232 (if (YaTeX-on-comment-p)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2233 (let*((fill-prefix "")
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2234 ;;append `^%' to head of paragraph delimiter.
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2235 (paragraph-start
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2236 (concat
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2237 "^$\\|^%\\(" YaTeX-paragraph-separate "\\)"))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2238 (paragraph-separate paragraph-start))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2239 (mark-paragraph)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2240 (if (not (bobp)) (forward-line 1))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
2241 (uncomment-out-region "%" nil nil YaTeX-uncomment-once))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2242 (message "This line is not a comment line.")))))
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2243
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2244 (defun YaTeX-remove-prefix (prefix &optional once)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2245 "Remove prefix on current line as far as prefix detected. But
4
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2246 optional argument ONCE makes deletion once."
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2247 (interactive "sPrefix:")
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2248 (beginning-of-line)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2249 (while (re-search-forward (concat "^" prefix) (point-end-of-line) t)
78dfe28b6a35 Provide service function to define begin/end insert key-bind.
yuuji
parents: 3
diff changeset
2250 (replace-match "")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2251 (if once (end-of-line))))
3
191610912c8b Add comment out region/paragraph.
yuuji
parents: 1
diff changeset
2252
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2253 (defun YaTeX-kill-some-pairs (predicate gofunc kill-contents)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2254 "Kill some matching pair.
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2255 This function assumes that pairs occupy whole of each line where they resid."
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2256 (if (not (funcall predicate)) nil
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2257 (let ((b1 (match-beginning 0)) (e1 (match-end 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2258 b2 e2)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2259 (save-excursion
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2260 (funcall gofunc)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2261 (funcall predicate) ;get match data
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2262 (if (< (point) e1) ;if currently on begin-line
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2263 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2264 (setq b2 b1 e2 e1
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2265 b1 (match-beginning 0) e1 (match-end 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2266 (goto-char e2)) ;goto end-line's end
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2267 (setq b2 (match-beginning 0)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2268 e2 (match-end 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2269 (goto-char e2)) ;now e2 has surely end-line's end
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2270 (skip-chars-forward " \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2271 (and (eolp)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2272 (not (eobp))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2273 (setq e2 (1+ (point))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2274 (if (not kill-contents)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2275 (kill-region
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2276 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2277 (goto-char b2)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2278 (skip-chars-backward " \t%")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2279 (if (bolp) (point) b2))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2280 e2))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2281 (goto-char b1)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2282 (skip-chars-backward " \t%")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2283 (if (not kill-contents)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2284 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2285 (kill-append
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2286 (buffer-substring
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2287 (setq b1 (if (bolp) (point) b1))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2288 (setq e1
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2289 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2290 (goto-char e1)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2291 (while (looking-at "{\\| \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2292 (forward-list 1))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2293 (skip-chars-forward " \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2294 (if (and (eolp) (not (eobp)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2295 (1+ (point))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2296 (point)))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2297 t)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2298 (delete-region b1 e1))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2299 (kill-region
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2300 (if (bolp) (point) b1)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2301 e2)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2302 t)))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2303
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2304 (defun YaTeX-kill-section-command (point kill-all)
82
yuuji
parents: 79
diff changeset
2305 "Kill section-type command at POINT leaving its last argument.
yuuji
parents: 79
diff changeset
2306 Non-nil for the second argument kill its last argument too."
yuuji
parents: 79
diff changeset
2307 (let ((cmd (get 'YaTeX-on-section-command-p 'command))
yuuji
parents: 79
diff changeset
2308 (argc (get 'YaTeX-on-section-command-p 'argc))
yuuji
parents: 79
diff changeset
2309 beg (end (make-marker)))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
2310 (save-excursion
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2311 (goto-char point)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2312 (or (looking-at YaTeX-ec-regexp)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2313 (progn
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2314 (skip-chars-backward (concat "^" YaTeX-ec-regexp))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2315 (forward-char -1)))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2316 (setq beg (point))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2317 (skip-chars-forward "^{")
82
yuuji
parents: 79
diff changeset
2318 (while (> (setq argc (1- argc)) 0)
yuuji
parents: 79
diff changeset
2319 (skip-chars-forward "^{")
yuuji
parents: 79
diff changeset
2320 (forward-list 1))
yuuji
parents: 79
diff changeset
2321 (kill-region beg (point))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2322 (forward-list 1)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2323 (set-marker end (point))
82
yuuji
parents: 79
diff changeset
2324 (if kill-all
yuuji
parents: 79
diff changeset
2325 (progn
yuuji
parents: 79
diff changeset
2326 (kill-append (buffer-substring beg end) nil)
yuuji
parents: 79
diff changeset
2327 (delete-region beg end))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2328 (goto-char beg)
82
yuuji
parents: 79
diff changeset
2329 (kill-append
yuuji
parents: 79
diff changeset
2330 (buffer-substring
yuuji
parents: 79
diff changeset
2331 (point) (progn (skip-chars-forward "^{" end) (1+ (point))))
yuuji
parents: 79
diff changeset
2332 nil)
yuuji
parents: 79
diff changeset
2333 (delete-region beg (1+ (point)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2334 (goto-char end)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2335 (set-marker end nil)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2336 (kill-append (buffer-substring (point) (1- (point))) nil)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2337 (delete-backward-char 1)))))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
2338
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2339 (defun YaTeX-kill-paren (kill-contents)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2340 "Kill parentheses leaving its contents.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2341 But kill its contents if the argument KILL-CONTENTS is non-nil."
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2342 (interactive "P")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2343 (let (p bsl (backslash-syntax (char-to-string (char-syntax ?\\)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2344 (md (match-data)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2345 (unwind-protect
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2346 (save-excursion
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2347 (modify-syntax-entry ?\\ " ")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2348 (if (looking-at "\\s(\\|\\(\\s)\\)")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2349 (progn
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2350 (if (match-beginning 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2351 (up-list -1))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2352 (if (and (> (point) (point-min))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2353 (= (char-after (1- (point))) ?\\ ))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2354 (setq p (1- (point)) bsl t)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2355 (setq p (point)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2356 (forward-list 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2357 ;(YaTeX-goto-open-paren t)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2358 (if kill-contents (delete-region p (point))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2359 (backward-delete-char 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2360 (cond
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2361 ((save-excursion
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2362 (forward-char -2)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2363 (looking-at (concat YaTeX-ec-regexp "/")))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2364 (backward-delete-char 2))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2365 ((= (char-after (1- (point))) ?\\)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2366 (backward-delete-char 1)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2367 (goto-char p)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2368 (if (looking-at
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2369 (concat "{" YaTeX-ec-regexp
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2370 YaTeX-command-token-regexp "+"
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2371 "\\s +"))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2372 (delete-region (point) (match-end 0))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2373 (delete-char 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2374 (if bsl (delete-char 1))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2375 t)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2376 (modify-syntax-entry ?\\ backslash-syntax)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2377 (store-match-data md))))
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
2378
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2379 (defvar YaTeX-read-environment-history nil "Holds history of environments.")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2380 (put 'YaTeX-read-environment-history 'no-default t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2381 (defun YaTeX-read-environment (prompt &optional predicate must-match initial)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2382 "Read a LaTeX environment name with completion."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2383 (YaTeX-sync-local-table 'tmp-env-table)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2384 (completing-read-with-history
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2385 prompt
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2386 (append tmp-env-table user-env-table env-table)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2387 predicate must-match initial
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2388 'YaTeX-read-environment-history))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2389
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2390 (defvar YaTeX-read-section-history nil "Holds history of section-types.")
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2391 (put 'YaTeX-read-section-history 'no-default t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2392 (defun YaTeX-read-section (prompt &optional predicate initial)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2393 "Read a LaTeX section-type command with completion."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2394 (YaTeX-sync-local-table 'tmp-section-table)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2395 (let ((minibuffer-completion-table
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2396 (append tmp-section-table user-section-table section-table)))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2397 (read-from-minibuffer-with-history
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2398 prompt initial YaTeX-section-completion-map nil
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2399 'YaTeX-read-section-history)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2400
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2401 (defun YaTeX-read-section-with-overview ()
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2402 "Read sectioning command with overview.
119
34096706b634 Bind local variable source-window for YaTeX-read-section-with-overview
yuuji@gentei.org
parents: 107
diff changeset
2403 This function refers a local variable `source-window' in YaTeX-make-section,
34096706b634 Bind local variable source-window for YaTeX-read-section-with-overview
yuuji@gentei.org
parents: 107
diff changeset
2404 because this function is called with no argument."
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2405 (interactive)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2406 (require 'yatexsec) ;some case needs this
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2407 (if (> (minibuffer-depth) 1)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2408 (error "Too many minibuffer levels for overview."))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2409 (let ((sw (selected-window))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2410 (minibuffer-max-depth nil) ; for XEmacs20
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2411 (enable-recursive-minibuffers t) sect)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2412 (unwind-protect
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2413 (progn
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2414 (select-window source-window)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2415 (setq sect (YaTeX-read-section-in-minibuffer
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2416 "Sectioning(Up=C-p, Down=C-n, Help=?): "
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2417 YaTeX-sectioning-level (YaTeX-section-overview))))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2418 (select-window sw))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2419 (YaTeX-minibuffer-erase)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2420 (insert sect)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2421 (exit-minibuffer)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2422
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2423 (defvar YaTeX-read-fontsize-history nil "Holds history of font designator.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2424 (put 'YaTeX-read-fontsize-history 'no-default t)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2425 (defun YaTeX-read-fontsize (prompt &optional predicate must-match initial)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2426 "Read a LaTeX font changing command with completion."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2427 (YaTeX-sync-local-table 'tmp-fontsize-table)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2428 (completing-read-with-history
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2429 prompt (append tmp-fontsize-table user-fontsize-table fontsize-table)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2430 predicate must-match initial 'YaTeX-read-fontsize-history))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2431
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2432 (defun YaTeX-change-environment ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2433 "Change the name of environment."
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2434 (interactive)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2435 (if (not (YaTeX-on-begin-end-p)) nil
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2436 (save-excursion
179
a925cf5222f3 mew, skk
yuuji@gentei.org
parents: 177
diff changeset
2437 (let (p env newenv (m1 (match-beginning 1)) (m2 (match-beginning 2)))
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2438 (setq env (if m1 (YaTeX-buffer-substring m1 (match-end 1))
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2439 (YaTeX-buffer-substring m2 (match-end 2))))
11
390df0e505da Label completion works.
yuuji
parents: 7
diff changeset
2440 (goto-char (match-beginning 0))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2441 (set-mark-command nil)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2442 (YaTeX-goto-corresponding-environment)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2443 (setq newenv (YaTeX-read-environment
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2444 (format "Change environment `%s' to: " env)))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2445 (cond
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2446 ((string= newenv "") (message "Change environment cancelled."))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2447 ((string= newenv env) (message "No need to change."))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
2448 (t
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2449 (search-forward (concat "{" env) (point-end-of-line) t)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2450 (replace-match (concat "{" newenv) t)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2451 (exchange-point-and-mark)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2452 (search-forward (concat "{" env) (point-end-of-line) t)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2453 (replace-match (concat "{" newenv) t)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2454 t))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2455
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2456 (defun YaTeX-change-section ()
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2457 "Change section-type command."
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2458 (interactive)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2459 (let*((where (YaTeX-on-section-command-p YaTeX-command-token-regexp))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2460 (p (point)) (cmd (YaTeX-match-string 1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2461 (beg (make-marker)) (end (make-marker)) old new)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2462 (if (null where) nil
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2463 (unwind-protect
119
34096706b634 Bind local variable source-window for YaTeX-read-section-with-overview
yuuji@gentei.org
parents: 107
diff changeset
2464 (let ((source-window (selected-window)))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2465 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2466 ((equal where 0);;if point is on section command
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2467 (set-marker beg (match-beginning 1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2468 (set-marker end (match-end 1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2469 (goto-char beg) ;beginning of the command
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2470 (setq new (YaTeX-read-section
169
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2471 (format "Change `%s' to: " cmd) nil)
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2472 old cmd))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2473
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2474 ((= where -1);;if point is on a optional parameter
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2475 (set-marker beg (match-beginning 2))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2476 (skip-chars-forward "^{")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2477 (set-marker end (point))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2478 (goto-char p)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2479 (setq new
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2480 (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2481 (YaTeX-addin cmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2482 (concat "["
169
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2483 (read-string
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2484 (format "Change `%s' to: "
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2485 (setq old (YaTeX-buffer-substring
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2486 (1+ beg) (1- end)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2487 "]"))))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2488
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2489 ((> where 0);;if point is in arguments' braces
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2490 (or (looking-at "{")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2491 (progn (skip-chars-backward "^{") (forward-char -1)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2492 (set-marker beg (1+ (point)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2493 (forward-list 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2494 (forward-char -1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2495 (set-marker end (point))
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2496 (setq old (YaTeX-buffer-substring beg end))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2497 (goto-char p)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2498 (if (> (length old) 40)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2499 (setq old (concat (substring old 0 12) "..."
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2500 (substring old -12))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2501 (setq new
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2502 (if (intern-soft (concat "YaTeX::" cmd))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2503 (funcall (intern-soft (concat "YaTeX::" cmd)) where)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2504 (read-string (format "Change `%s' to: " old)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2505 ) ;cond
169
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2506 (if (string= old new)
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2507 nil ;do not replace
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2508 (delete-region beg end)
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2509 (goto-char beg)
0cb6c6a78e9e YaTeX-change-section: If new string equals to old one, do not change text.
yuuji@gentei.org
parents: 168
diff changeset
2510 (insert-before-markers new)))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2511 (set-marker beg nil)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2512 (set-marker end nil))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2513 ;;(goto-char (marker-position p))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2514 new)))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2515
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2516 (defun YaTeX-change-fontsize ()
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2517 "Change large-type command."
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2518 (let ((lt (append tmp-fontsize-table user-fontsize-table fontsize-table))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2519 (p (point)) large old new beg end)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2520 ;;(and (looking-at "}") (up-list -1))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2521 ;;(and (looking-at "{") (forward-char 1))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2522 ;;Is above convenient?
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2523 (save-excursion
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2524 (or (looking-at YaTeX-ec-regexp)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2525 (progn
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2526 (skip-chars-backward (concat "^" YaTeX-ec-regexp))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2527 (forward-char -1)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2528 (cond
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2529 ((and
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2530 (looking-at
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2531 (concat YaTeX-ec-regexp "\\(" YaTeX-TeX-token-regexp "\\)"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2532 (< p (match-end 0))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2533 (assoc (setq old (YaTeX-match-string 1)) lt))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2534 (goto-char p)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2535 (setq beg (match-beginning 1) end (match-end 1) ;save match position
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2536 new (completing-read
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2537 (format "Change font/size `%s' to : " old) lt))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2538 (delete-region beg end)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2539 (goto-char beg)
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2540 (insert-before-markers new)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2541 new)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2542 (t nil)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2543 ))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2544
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2545 (defun YaTeX-change-math-image ()
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2546 "Change with image completion."
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2547 (let (maketitle memberp beg end)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2548 (if (and (YaTeX-on-maketitle-p)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2549 (progn
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2550 (setq maketitle (substring (YaTeX-match-string 0) 1))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2551 (setq memberp (YaTeX-math-member-p maketitle))))
291
027c4e8d98ce Set last-command-event locally too.
HIROSE Yuuji <yuuji@gentei.org>
parents: 290
diff changeset
2552 (let*((last-command-char (string-to-char (car memberp)))
027c4e8d98ce Set last-command-event locally too.
HIROSE Yuuji <yuuji@gentei.org>
parents: 290
diff changeset
2553 (last-command-event last-command-char))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2554 (setq beg (match-beginning 0) end (match-end 0))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2555 (delete-region beg end)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2556 (YaTeX-math-insert-sequence t (cdr memberp))))))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2557
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2558 (defun YaTeX-kill-* (&optional arg)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2559 "Parse current line and call suitable function.
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2560 Non-nil for ARG kills its contents too."
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2561 (interactive "P")
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2562 (cond
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2563 ((YaTeX-kill-some-pairs 'YaTeX-on-begin-end-p
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2564 'YaTeX-goto-corresponding-environment arg))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2565 ((YaTeX-kill-some-pairs 'YaTeX-on-BEGIN-END-p
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2566 'YaTeX-goto-corresponding-BEGIN-END arg))
32
546c4baad92f The first typesetting splits window into 3 on Nemacs. Fixed.
yuuji
parents: 22
diff changeset
2567 ((YaTeX-on-section-command-p YaTeX-command-token-regexp);on any command
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2568 (YaTeX-kill-section-command (match-beginning 0) arg))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2569 ((YaTeX-kill-paren arg))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2570 (t (message "I don't know what to kill."))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2571
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2572 (defun YaTeX-change-* ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2573 "Parse current line and call suitable function."
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2574 (interactive)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2575 (cond
82
yuuji
parents: 79
diff changeset
2576 ((YaTeX-change-parentheses))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2577 ((YaTeX-change-environment))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2578 ((YaTeX-change-section))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2579 ((YaTeX-change-fontsize))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2580 ((YaTeX-change-math-image))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2581 (t (message "I don't know what to change."))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2582
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2583 ;;;
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
2584 ;Check availability of add-in functions
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2585 ;;;
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2586 (cond
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
2587 ((featurep 'yatexadd) nil) ;Already provided.
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
2588 ((progn (load "yatexadd" t) (featurep 'yatexadd)) nil)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2589 (t (message "YaTeX add-in functions not supplied.")))
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2590
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2591 (defun YaTeX-addin (name)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2592 "Check availability of addin function and call it if exists."
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2593 (if (and (not (get 'YaTeX-generate 'disabled))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
2594 (intern-soft (concat YaTeX-addin-prefix name))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
2595 (fboundp (intern-soft (concat YaTeX-addin-prefix name))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 56
diff changeset
2596 (let ((s (funcall (intern (concat YaTeX-addin-prefix name)))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2597 (if (stringp s) s ""))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2598 "")) ;Add in function is not bound.
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2599
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2600
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2601 (defun YaTeX-on-item-p (&optional point)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2602 "Return t if POINT (default is (point)) is on \\item."
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2603 (let ((p (or point (point))))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2604 (save-excursion
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2605 (goto-char p)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2606 (end-of-line)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2607 (setq p (point))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2608 (re-search-backward YaTeX-paragraph-delimiter nil t)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2609 (re-search-forward YaTeX-item-regexp p t))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2610
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2611 (defun YaTeX-in-verb-p (&optional point)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2612 "Check if POINT is in verb or verb*. Default of POINT is (point)."
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2613 (setq point (or point (point)))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2614 (save-excursion
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2615 (let ((md (match-data)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2616 (goto-char point)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2617 (unwind-protect
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2618 (if (not (re-search-backward
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2619 (concat YaTeX-ec-regexp
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2620 "\\(" YaTeX-verb-regexp "\\)"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2621 "\\([^-A-Za-z_*]\\)")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2622 (point-beginning-of-line) t))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2623 nil
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2624 (goto-char (match-end 2))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2625 (skip-chars-forward
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2626 (concat "^" (YaTeX-buffer-substring
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2627 (match-beginning 2) (match-end 2))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2628 (and (< (match-beginning 2) point) (< (1- point) (point))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2629 (store-match-data md)))))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2630
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2631 (defun YaTeX-literal-p (&optional point)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2632 "Check if POINT is in verb or verb* or verbatime environment family.
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2633 Default of POINT is (point)."
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2634 (let ((md (match-data)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2635 (unwind-protect
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2636 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2637 ((equal YaTeX-ec "\\") ;maybe LaTeX
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2638 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2639 (and point (goto-char point))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2640 (or (YaTeX-in-verb-p (point))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2641 (and (not (looking-at "\\\\end{verb"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2642 (YaTeX-quick-in-environment-p
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2643 YaTeX-verbatim-environments))))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2644 (store-match-data md))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2645
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2646 (defun YaTeX-in-environment-p (env)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2647 "Return if current LaTeX environment is ENV.
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2648 ENV is given in the form of environment's name or its list."
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2649 (let ((md (match-data)) (nest 0) p envrx)
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2650 (cond
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2651 ((atom env)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2652 (setq envrx
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2653 (concat "\\("
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2654 (regexp-quote
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2655 (YaTeX-replace-format-args
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2656 YaTeX-struct-begin env "" ""))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2657 "\\)\\|\\("
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2658 (regexp-quote
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2659 (YaTeX-replace-format-args
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2660 YaTeX-struct-end env "" ""))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2661 "\\)"))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2662 (save-excursion
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2663 (setq p (catch 'open
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2664 (while (YaTeX-re-search-active-backward
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2665 envrx YaTeX-comment-prefix nil t)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2666 (if (match-beginning 2)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2667 (setq nest (1+ nest))
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2668 (setq nest (1- nest)))
129
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2669 (if (< nest 0)
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2670 (throw 'open (cons env (match-beginning 0)))))))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2671 ((listp env)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2672 (setq p
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2673 (or (YaTeX-in-environment-p (car env))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2674 (and (cdr env) (YaTeX-in-environment-p (cdr env)))))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2675 (store-match-data md)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2676 p;(or p (YaTeX-in-verb-p (match-beginning 0)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2677 ))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2678
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2679 (defun YaTeX-quick-in-environment-p (env)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2680 "Check quickly but unsure if current environment is ENV.
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2681 ENV is given in the form of environment's name or its list.
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2682 This function returns correct result only if ENV is NOT nested."
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2683 (save-excursion
129
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2684 (let ((md (match-data)) m0 (p (point)) rc clfound)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2685 (cond
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2686 ((listp env)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2687 (or (YaTeX-quick-in-environment-p (car env))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
2688 (and (cdr env) (YaTeX-quick-in-environment-p (cdr env)))))
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
2689 (t
129
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2690 (unwind-protect
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2691 (if (prog1
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2692 (YaTeX-search-active-backward
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2693 (YaTeX-replace-format-args YaTeX-struct-begin env "" "")
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2694 YaTeX-comment-prefix nil t)
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2695 (setq m0 (match-beginning 0)))
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2696 (if (YaTeX-search-active-forward
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2697 (YaTeX-replace-format-args
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2698 YaTeX-struct-end env)
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2699 YaTeX-comment-prefix p t nil)
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2700 nil ;if \end{env} found, return nil
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2701 (cons env m0))) ;else, return meaningful values
b11d6271207e YaTeX-{quick-,}in-environment-p return cons of envname and the begpoint
yuuji@gentei.org
parents: 123
diff changeset
2702 (store-match-data md)))))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2703
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2704 ;; Filling \item
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2705 (defun YaTeX-remove-trailing-comment (start end)
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2706 "Remove trailing comment from START to end."
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2707 (save-excursion
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2708 (let ((trcom (concat YaTeX-comment-prefix "$")))
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2709 (goto-char start)
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2710 (while (re-search-forward trcom end t)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 53
diff changeset
2711 (if (/= (char-after (1- (match-beginning 0))) ?\\ )
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2712 (replace-match "\\1"))))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2713
82
yuuji
parents: 79
diff changeset
2714 (defvar YaTeX-itemize-withlabel-max-indent-depth 8)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2715 (defun YaTeX-get-item-info (&optional recent thisenv)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2716 "Return the list of the beginning of \\item and column of its item.
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2717 If it seems to be outside of itemizing environment, just return nil.
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2718 Non-nil for optional argument RECENT refers recent \\item.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2719 Optional second argument THISENV omits calling YaTeX-inner-environment."
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2720 (save-excursion
82
yuuji
parents: 79
diff changeset
2721 (let* ((p (point)) env e0 c cc md
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2722 (bndry (and (setq env (or thisenv (YaTeX-inner-environment t)))
82
yuuji
parents: 79
diff changeset
2723 (get 'YaTeX-inner-environment 'point))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2724 (end-of-line)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2725 (if (if recent
82
yuuji
parents: 79
diff changeset
2726 (catch 'found
yuuji
parents: 79
diff changeset
2727 (while (YaTeX-re-search-active-backward
yuuji
parents: 79
diff changeset
2728 YaTeX-item-regexp YaTeX-comment-prefix bndry t)
yuuji
parents: 79
diff changeset
2729 (setq md (match-data))
yuuji
parents: 79
diff changeset
2730 (YaTeX-inner-environment t)
yuuji
parents: 79
diff changeset
2731 (store-match-data md)
yuuji
parents: 79
diff changeset
2732 (if (= bndry (get 'YaTeX-inner-environment 'point))
yuuji
parents: 79
diff changeset
2733 (throw 'found t))))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2734 (goto-char bndry)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2735 (YaTeX-re-search-active-forward
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2736 YaTeX-item-regexp YaTeX-comment-prefix p t))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2737 (progn
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2738 (goto-char (match-end 0))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2739 ;(setq c (current-column))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2740 (if (string-match "desc" env)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2741 (setq c 6)
82
yuuji
parents: 79
diff changeset
2742 (setq cc (current-column))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2743 (if (equal (following-char) ?\[) (forward-list 1))
82
yuuji
parents: 79
diff changeset
2744 (if (< (- (current-column) cc)
yuuji
parents: 79
diff changeset
2745 YaTeX-itemize-withlabel-max-indent-depth)
yuuji
parents: 79
diff changeset
2746 (setq c 0)
yuuji
parents: 79
diff changeset
2747 (move-to-column cc)
yuuji
parents: 79
diff changeset
2748 (setq c YaTeX-itemize-withlabel-max-indent-depth)))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2749 (skip-chars-forward " \t" (point-end-of-line))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2750 (list (point-beginning-of-line) (+ c (current-column))))))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2751
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2752 (defun YaTeX-fill-item ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2753 "Fill item in itemize environment."
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2754 (interactive)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2755 (save-excursion
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2756 (let* ((p (point))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2757 (item-term (concat
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2758 "\\(^[ \t]*$\\)\\|" YaTeX-item-regexp "\\|\\("
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2759 YaTeX-ec-regexp "\\(begin\\|end\\)\\)"))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2760 ;;This value depends on LaTeX.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2761 fill-prefix start col
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2762 (info (YaTeX-get-item-info t)))
55
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2763 (if (null info) nil ;not on \item, do nothing
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2764 (setq start (car info)
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2765 col (car (cdr info)))
55
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2766 (save-excursion
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2767 (if (re-search-backward "^\\s *$" start t)
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2768 ;;if separated from \item line, isolate this block
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2769 (progn
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2770 (setq start (1+ (match-end 0)))
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2771 (goto-char start)
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2772 (skip-chars-forward " \t")
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2773 (delete-region (point) start) ;is this your favor???
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
2774 (indent-to col))))
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2775 (beginning-of-line)
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2776 (if (<= (save-excursion
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2777 (re-search-forward
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2778 (concat "\\\\end{\\|\\\\begin{\\|^[ \t]*$") nil t)
46
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2779 (match-beginning 0))
cd1b63102eed Support Mule2
yuuji
parents: 45
diff changeset
2780 p)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2781 (progn (message "Not on itemize.") nil)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2782 (end-of-line)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2783 (newline)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2784 (indent-to col)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2785 (setq fill-prefix
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2786 (YaTeX-buffer-substring (point-beginning-of-line)(point)))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2787 (beginning-of-line)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2788 (delete-region (point) (progn (forward-line 1) (point)))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2789 (re-search-forward item-term nil 1)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2790 (YaTeX-remove-trailing-comment start (point))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2791 (beginning-of-line)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2792 (push-mark (point) t)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2793 (goto-char start)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2794 (forward-line 1)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2795 (while (< (point) (mark))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2796 (delete-region (point) (progn (skip-chars-forward " \t") (point)))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2797 (forward-line 1))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2798 (fill-region-as-paragraph start (mark))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2799 (if NTT-jTeX
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2800 (while (progn(forward-line -1)(end-of-line) (> (point) start))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2801 (insert ?%)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2802 (pop-mark))))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2803
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2804 (defun YaTeX-fill-paragraph (arg)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2805 "YaTeX adjustment function for fill-paragraph.
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2806 *Protect \\verb from unexpected broken up."
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2807 (interactive "P")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2808 (cond
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2809 ((not (eq major-mode 'yatex-mode)) (fill-paragraph arg))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2810 ((YaTeX-quick-in-environment-p YaTeX-fill-inhibit-environments) nil)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2811 ((YaTeX-in-math-mode-p) nil)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2812 (t
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2813 (save-excursion
82
yuuji
parents: 79
diff changeset
2814 (let*((verbrex (concat YaTeX-ec-regexp
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2815 "\\(" YaTeX-verb-regexp "\\)" ;match#1
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2816 "\\(.\\).*\\(\\2\\)")) ;match #2 and #3
82
yuuji
parents: 79
diff changeset
2817 (tilderex (concat "\\("
yuuji
parents: 79
diff changeset
2818 YaTeX-kanji-regexp "~"
yuuji
parents: 79
diff changeset
2819 "\\)" YaTeX-ec-regexp
yuuji
parents: 79
diff changeset
2820 "\\|\\("
yuuji
parents: 79
diff changeset
2821 "~" YaTeX-kanji-regexp
yuuji
parents: 79
diff changeset
2822 "\\)"))
yuuji
parents: 79
diff changeset
2823 (p (point)) ii end poslist spacelist lenlist b e n
yuuji
parents: 79
diff changeset
2824 (fill-prefix fill-prefix)
yuuji
parents: 79
diff changeset
2825 (inenv (or (YaTeX-inner-environment t) "document"))
yuuji
parents: 79
diff changeset
2826 (border (get 'YaTeX-inner-environment 'point)))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2827 (cond
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2828 ((save-excursion (beginning-of-line) ;if point is on the first
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2829 (setq end (point)) ;non-whitespace char
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2830 (skip-chars-forward " \t")
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2831 (equal (point) p))
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2832 (setq fill-prefix (YaTeX-buffer-substring p end)))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2833 ((and ;;(not YaTeX-emacs-19)
82
yuuji
parents: 79
diff changeset
2834 (string-match YaTeX-itemizing-env-regexp inenv)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2835 (setq ii (YaTeX-get-item-info)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2836 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2837 (beginning-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2838 (indent-to-column (car (cdr ii)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2839 (setq fill-prefix
165
b9f0c694f30e Two fixes;
yuuji@gentei.org
parents: 130
diff changeset
2840 (YaTeX-buffer-substring (point) (point-beginning-of-line)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2841 (delete-region (point) (progn (beginning-of-line) (point))))))
82
yuuji
parents: 79
diff changeset
2842 (cond
yuuji
parents: 79
diff changeset
2843 ((string-match "tabular" inenv)
yuuji
parents: 79
diff changeset
2844 (let ((b (point-beginning-of-line))
yuuji
parents: 79
diff changeset
2845 (e (point-end-of-line)))
yuuji
parents: 79
diff changeset
2846 (if (re-search-backward
yuuji
parents: 79
diff changeset
2847 "&\\|\\\\\\\\\\|\\\\\\(begin\\|end\\){" border t)
yuuji
parents: 79
diff changeset
2848 (setq b (if (match-beginning 1)
yuuji
parents: 79
diff changeset
2849 (progn (forward-line 1) (point))
yuuji
parents: 79
diff changeset
2850 (point-beginning-of-line))))
yuuji
parents: 79
diff changeset
2851 (goto-char p)
yuuji
parents: 79
diff changeset
2852 (if (re-search-forward
yuuji
parents: 79
diff changeset
2853 "&\\|\\\\\\\\\\|\\\\\\(end\\|begin\\){" nil t)
yuuji
parents: 79
diff changeset
2854 (setq e (if (match-beginning 1)
yuuji
parents: 79
diff changeset
2855 (progn (forward-line -1)
yuuji
parents: 79
diff changeset
2856 (point-end-of-line))
yuuji
parents: 79
diff changeset
2857 (match-beginning 0))))
yuuji
parents: 79
diff changeset
2858 (set-mark e)
yuuji
parents: 79
diff changeset
2859 (goto-char b)))
yuuji
parents: 79
diff changeset
2860 (t
yuuji
parents: 79
diff changeset
2861 (mark-paragraph)))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2862 (save-restriction
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2863 (narrow-to-region (region-beginning) (region-end))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2864 (YaTeX-remove-trailing-comment (point-min) (point-max))
82
yuuji
parents: 79
diff changeset
2865 ;; First, replace spaces in verb to _ temporarily.
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2866 (goto-char (point-min))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2867 (while (YaTeX-re-search-active-forward
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2868 verbrex YaTeX-comment-prefix (point-max) t)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2869 (setq end (match-beginning 3))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2870 (goto-char (match-beginning 2))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2871 (while (re-search-forward "\\s " end t)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2872 (setq poslist (cons (make-marker) poslist)
82
yuuji
parents: 79
diff changeset
2873 spacelist (cons (preceding-char) spacelist)
yuuji
parents: 79
diff changeset
2874 lenlist (cons 1 lenlist))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2875 (replace-match "_")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2876 (set-marker (car poslist) (match-beginning 0))))
82
yuuji
parents: 79
diff changeset
2877 ;; Second, replace "•\~\ref{...}" to "\\\ref{...}"
yuuji
parents: 79
diff changeset
2878 (goto-char (point-min))
yuuji
parents: 79
diff changeset
2879 (while (YaTeX-re-search-active-forward
yuuji
parents: 79
diff changeset
2880 tilderex YaTeX-comment-prefix (point-max) t)
yuuji
parents: 79
diff changeset
2881 (if (match-beginning 1)
yuuji
parents: 79
diff changeset
2882 (setq b (match-beginning 1) e (match-end 1) n 1)
yuuji
parents: 79
diff changeset
2883 (setq b (match-beginning 2) e (match-end 2) n 2))
yuuji
parents: 79
diff changeset
2884 (setq poslist (cons (make-marker) poslist)
yuuji
parents: 79
diff changeset
2885 spacelist (cons (YaTeX-match-string n) spacelist)
yuuji
parents: 79
diff changeset
2886 lenlist (cons 2 lenlist))
yuuji
parents: 79
diff changeset
2887 (goto-char (match-beginning 0))
yuuji
parents: 79
diff changeset
2888 (delete-region (point) e)
yuuji
parents: 79
diff changeset
2889 (insert YaTeX-ec YaTeX-ec) ;set-marker should be here
yuuji
parents: 79
diff changeset
2890 (set-marker (car poslist) b))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2891 ;;(fill-paragraph arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2892 (fill-region-as-paragraph (point-min) (point-max) arg)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2893 (while spacelist
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2894 (goto-char (car poslist))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2895 (set-marker (car poslist) nil)
82
yuuji
parents: 79
diff changeset
2896 (and (eolp) (skip-chars-forward "\n\t "))
yuuji
parents: 79
diff changeset
2897 (delete-char (car lenlist))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2898 (insert (car spacelist))
82
yuuji
parents: 79
diff changeset
2899 (setq spacelist (cdr spacelist)
yuuji
parents: 79
diff changeset
2900 poslist (cdr poslist)
yuuji
parents: 79
diff changeset
2901 lenlist (cdr lenlist)))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2902 (goto-char (point-min))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2903 (forward-word 1)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2904 (beginning-of-line)
82
yuuji
parents: 79
diff changeset
2905 (while (re-search-forward "\\\\\\([a-z]*ref\\|cite\\){" nil t)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2906 (if (< (point-end-of-line)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2907 (save-excursion (forward-char -1) (forward-list 1) (point)))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2908 (progn (end-of-line)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2909 (if (save-excursion
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2910 (backward-word 1)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2911 (looking-at "[^0-9A-z!-)]"))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2912 (insert YaTeX-comment-prefix)))))
82
yuuji
parents: 79
diff changeset
2913 ;; Nonbreak space `~'
yuuji
parents: 79
diff changeset
2914 (goto-char (point-min))
yuuji
parents: 79
diff changeset
2915 (while (YaTeX-re-search-active-forward
yuuji
parents: 79
diff changeset
2916 "~\\(\\s *\\)$" YaTeX-comment-prefix (point-max) t)
yuuji
parents: 79
diff changeset
2917 (delete-region (match-beginning 1) (match-end 1))
yuuji
parents: 79
diff changeset
2918 (insert YaTeX-comment-prefix))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2919 (goto-char (point-min))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2920 (if (and NTT-jTeX (looking-at "[ \t]\\|^$"))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2921 (progn
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2922 (goto-char (point-min))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2923 (while (not (eobp))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2924 (end-of-line)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2925 (or (bolp)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2926 (save-excursion
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2927 (backward-word 1)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2928 (looking-at "[0-9A-z!-)]")) ;is not japanese string
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2929 (progn (setq p (point)) (insert YaTeX-comment-prefix)))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2930 (forward-line 1))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2931 (goto-char p)
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2932 (if (looking-at "%") (delete-char 1)) ;remove last inserted `%'
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2933 ))))))))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2934
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2935 (if (fboundp 'YaTeX-saved-indent-new-comment-line) nil
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2936 (fset 'YaTeX-saved-indent-new-comment-line
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2937 (symbol-function 'indent-new-comment-line))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2938 (fset 'indent-new-comment-line 'YaTeX-indent-new-comment-line))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2939
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2940 (defun YaTeX-indent-new-comment-line (&optional soft)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2941 "Tuned `indent-new-comment-line' function for yatex.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2942 See the documentation of `YaTeX-saved-indent-new-comment-line'."
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2943 (interactive)
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
2944 (cond
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2945 ((or (not (memq major-mode '(yatex-mode yahtml-mode)))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2946 (string-match
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2947 "document"
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2948 (or (and (boundp 'inenv) inenv)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2949 (or (YaTeX-inner-environment t) "document"))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2950 (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft))))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2951 ; ((and (eq major-mode 'yahtml-mode)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2952 ; (string-match
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2953 ; "^[Pp][Rr][Ee]" (yahtml-inner-environment-but "^[Aa]\\b" t)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2954 ; (yahtml-indent-new-commnet-line))
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2955 ((and (eq major-mode 'yatex-mode) ;1997/2/4
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2956 (YaTeX-in-math-mode-p)) nil) ;1996/12/30
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2957 (t (let (fill-prefix)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2958 (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))))))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
2959
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2960 (defun YaTeX-fill-* ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2961 "Fill paragraph according to its condition."
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2962 (interactive)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2963 (cond
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2964 ((YaTeX-fill-item))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2965 ))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2966
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2967 ;; Accent completion
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2968 (defun YaTeX-read-accent-char (x)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2969 "Read char in accent braces."
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2970 (let ((c (read-char)))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2971 (concat
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2972 (if (and (or (= c ?i) (= c ?j))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2973 (not (string-match (regexp-quote x) "cdb")))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2974 "\\" "")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2975 (char-to-string c))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2976
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2977 (defun YaTeX-make-accent ()
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2978 "Make accent usage."
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2979 (interactive)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2980 (message "1:` 2:' 3:^ 4:\" 5:~ 6:= 7:. u v H t c d b")
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2981 (let ((c (read-char))(case-fold-search nil))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2982 (setq c (cond ((and (> c ?0) (< c ?8))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2983 (substring "`'^\"~=." (1- (- c ?0)) (- c ?0)))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2984 ((= c ?h) "H")
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2985 (t (char-to-string c))))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2986 (if (not (string-match c "`'^\"~=.uvHtcdb")) nil
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2987 (insert "\\" c "{}")
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2988 (backward-char 1)
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2989 (insert (YaTeX-read-accent-char c))
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2990 (if (string= c "t") (insert (YaTeX-read-accent-char c)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2991 (forward-char 1))))
5
370a391533fd Post fj.sources.
yuuji
parents: 4
diff changeset
2992
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2993 ;; Indentation
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2994 (defun YaTeX-current-indentation ()
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2995 "Return the indentation of current environment."
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2996 (save-excursion
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2997 ;;(beginning-of-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2998 (if (YaTeX-beginning-of-environment t)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
2999 (goto-char (get 'YaTeX-inner-environment 'point))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3000 (forward-line -1)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3001 (beginning-of-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3002 (skip-chars-forward " \t"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3003 (current-column)))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
3004
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3005 (defun YaTeX-previous-line-indentation ()
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3006 (save-excursion
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3007 (forward-line -1)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3008 (skip-chars-forward " \t")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3009 (current-column)))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3010
82
yuuji
parents: 79
diff changeset
3011 (defvar YaTeX-noindent-env-regexp "verbatim\\*?\\|alltt"
yuuji
parents: 79
diff changeset
3012 "*Regexp of environment names that should begin with no indentation.
yuuji
parents: 79
diff changeset
3013 All verbatime-like environment name should match with.")
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
3014 (defun YaTeX-indent-line ()
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
3015 "Indent corrent line referrin current environment."
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
3016 (interactive)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3017 (let ((indent-relative
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3018 (function
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3019 (lambda (&optional additional)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3020 (YaTeX-reindent
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3021 (+ (YaTeX-current-indentation)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3022 (or additional 0)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3023 YaTeX-environment-indent)))))
82
yuuji
parents: 79
diff changeset
3024 sect depth iteminfo (p (point)) pp (peol (point-end-of-line)) begend
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3025 ;;inenv below is sometimes defined in YaTeX-indent-new-comment-line
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3026 (inenv (or (and (boundp 'inenv) inenv) (YaTeX-inner-environment t))))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3027 ;;(if NTT-jTeX ;;Do you need this section?
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3028 ;; (save-excursion
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3029 ;; (end-of-line)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3030 ;; (let ((p (point)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3031 ;; (forward-line -1)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3032 ;; (end-of-line)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3033 ;; (or (= p (point))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3034 ;; (progn (backward-char (length YaTeX-comment-prefix))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3035 ;; (not (looking-at (regexp-quote YaTeX-comment-prefix))))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3036 ;; (progn
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3037 ;; (skip-chars-backward YaTeX-comment-prefix)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3038 ;; (kill-line))))))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3039 (or inenv (setq inenv "document")) ;is the default environment
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3040 (cond
82
yuuji
parents: 79
diff changeset
3041 ((and
yuuji
parents: 79
diff changeset
3042 (prog1 (YaTeX-on-begin-end-p)
yuuji
parents: 79
diff changeset
3043 (setq begend (match-beginning 0)))
yuuji
parents: 79
diff changeset
3044 (or (match-beginning 2) ;if \end
yuuji
parents: 79
diff changeset
3045 (and (match-beginning 3) ;if \) \]
yuuji
parents: 79
diff changeset
3046 (= (char-syntax (char-after (1+ (match-beginning 3)))) ?\)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3047 (YaTeX-reindent
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3048 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3049 (YaTeX-goto-corresponding-environment)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3050 (current-column))))
82
yuuji
parents: 79
diff changeset
3051 ;; on the begining of verbatime line, remove all indentation
yuuji
parents: 79
diff changeset
3052 ((and begend ;; match-beginning 0 of \begin
yuuji
parents: 79
diff changeset
3053 YaTeX-noindent-env-regexp
yuuji
parents: 79
diff changeset
3054 (stringp YaTeX-noindent-env-regexp)
yuuji
parents: 79
diff changeset
3055 (save-excursion
yuuji
parents: 79
diff changeset
3056 (and ;; if the \begin is the first declaration of this line
yuuji
parents: 79
diff changeset
3057 (progn (beginning-of-line) (skip-chars-forward " \t")
yuuji
parents: 79
diff changeset
3058 (= begend (point)))
yuuji
parents: 79
diff changeset
3059 (progn
yuuji
parents: 79
diff changeset
3060 (goto-char begend)
yuuji
parents: 79
diff changeset
3061 (looking-at
yuuji
parents: 79
diff changeset
3062 (concat YaTeX-ec-regexp
yuuji
parents: 79
diff changeset
3063 "begin{\\(" YaTeX-noindent-env-regexp "\\)}"))))))
yuuji
parents: 79
diff changeset
3064 (save-excursion
yuuji
parents: 79
diff changeset
3065 (goto-char begend)
yuuji
parents: 79
diff changeset
3066 (delete-region (point) (point-beginning-of-line))))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3067 ((string-match YaTeX-equation-env-regexp inenv)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3068 (YaTeX-indent-line-equation)) ;autoload-ed from yatexenv
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3069 (;(YaTeX-in-environment-p '("itemize" "enumerate" "description" "list"))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3070 (string-match YaTeX-itemizing-env-regexp inenv)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3071 ;;(YaTeX-on-item-p) ??
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3072 ;;(setq iteminfo (YaTeX-get-item-info t))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3073 (if (save-excursion
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3074 (beginning-of-line)
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3075 (re-search-forward YaTeX-item-regexp peol t))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3076 (progn
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3077 (save-excursion
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3078 (goto-char (1+ (match-beginning 0)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3079 (setq depth
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3080 (* YaTeX-environment-indent
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3081 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3082 ((looking-at "subsubsub") 3)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3083 ((looking-at "subsub") 2)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3084 ((looking-at "sub") 1)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3085 (t 0)))))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3086 (funcall indent-relative depth))
82
yuuji
parents: 79
diff changeset
3087 (YaTeX-reindent (or (car (cdr (YaTeX-get-item-info t inenv)))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3088 (+ (save-excursion
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3089 (beginning-of-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3090 (YaTeX-current-indentation))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3091 YaTeX-environment-indent))))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3092 )
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
3093 ((YaTeX-literal-p) ;verbatims
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3094 (tab-to-tab-stop))
82
yuuji
parents: 79
diff changeset
3095 ((string-match "\\(tabular\\|array\\)" inenv) ;1.73
yuuji
parents: 79
diff changeset
3096 (let ((n 1))
yuuji
parents: 79
diff changeset
3097 (condition-case err
yuuji
parents: 79
diff changeset
3098 (save-excursion
yuuji
parents: 79
diff changeset
3099 (beginning-of-line)
yuuji
parents: 79
diff changeset
3100 (skip-chars-forward "[ \t]")
yuuji
parents: 79
diff changeset
3101 ;;(if (looking-at "&") (forward-char 1))
yuuji
parents: 79
diff changeset
3102 (require 'yatexenv)
yuuji
parents: 79
diff changeset
3103 (setq n (car (YaTeX-array-what-column-internal))))
yuuji
parents: 79
diff changeset
3104 (error nil))
yuuji
parents: 79
diff changeset
3105 (YaTeX-reindent
yuuji
parents: 79
diff changeset
3106 (+ (YaTeX-current-indentation)
yuuji
parents: 79
diff changeset
3107 YaTeX-environment-indent
yuuji
parents: 79
diff changeset
3108 (* (1- n) YaTeX-tabular-indentation)))))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3109 ((and inenv (not (equal "document" inenv)))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3110 (funcall indent-relative))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3111 ((YaTeX-on-section-command-p YaTeX-sectioning-regexp)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3112 (require 'yatexsec) ;to know YaTeX-sectioning-level
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3113 (setq sect (YaTeX-match-string 1))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3114 (if (string-match "\\*$" sect)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3115 (setq sect (substring sect 0 -1)))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3116 (YaTeX-reindent
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3117 (* (max
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3118 (1- ;I want chapter to have indentation 0
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3119 (or (cdr (assoc sect YaTeX-sectioning-level))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3120 0))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3121 0)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3122 YaTeX-environment-indent)))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3123 ;;Default movement
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3124 ((and (bolp) fill-prefix) (insert fill-prefix))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3125 (t (save-excursion
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 47
diff changeset
3126 (beginning-of-line)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3127 (if fill-prefix
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3128 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3129 (delete-region (point)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3130 (progn (skip-chars-forward " \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3131 (point)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3132 (insert fill-prefix))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3133 (skip-chars-forward " \t")
82
yuuji
parents: 79
diff changeset
3134 (if (bobp)
yuuji
parents: 79
diff changeset
3135 nil
yuuji
parents: 79
diff changeset
3136 (indent-relative-maybe))))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3137 (skip-chars-forward " \t")))
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3138 ;;if current line is \begin, re-indent \end too
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3139 (if (and (YaTeX-on-begin-end-p) (match-beginning 1))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3140 (save-excursion
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3141 ;;(beginning-of-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3142 ;;(search-forward "\\begin")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3143 (goto-char (match-beginning 0))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3144 (setq depth (current-column))
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3145 (YaTeX-goto-corresponding-environment)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3146 (YaTeX-reindent depth)))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3147 (if (or
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3148 (and NTT-jTeX
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3149 (save-excursion (beginning-of-line) (looking-at "[ \t]")))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3150 (save-excursion
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3151 (beginning-of-line)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3152 (and
82
yuuji
parents: 79
diff changeset
3153 (not (bobp))
yuuji
parents: 79
diff changeset
3154 (progn
yuuji
parents: 79
diff changeset
3155 (backward-char 1)
yuuji
parents: 79
diff changeset
3156 (re-search-backward
yuuji
parents: 79
diff changeset
3157 "\\\\\\(\\(page\\)?ref\\|cite\\){" (point-beginning-of-line) t))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3158 (goto-char (1- (match-end 0)))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3159 (> (save-excursion
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3160 (condition-case ()
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3161 (progn (forward-list 1) (point))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3162 (error (point-max))))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3163 (point-end-of-line)))))
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3164 (save-excursion
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3165 (end-of-line)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3166 (let ((p (point)))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3167 (forward-line -1)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3168 (end-of-line)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3169 (or (= p (point))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3170 (looking-at (regexp-quote YaTeX-comment-prefix))
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3171 (bobp) (bolp)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3172 (save-excursion
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3173 (backward-word 1)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
3174 (looking-at "\\sw+")) ;is not japanese string
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3175 (insert YaTeX-comment-prefix)))))))
22
9d2387100375 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
3176
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
3177 (defun YaTeX-comment-line-break (&optional soft)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
3178 "Call comment-indent-new-line and YaTeX-indent-line"
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
3179 (comment-indent-new-line soft)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
3180 (YaTeX-indent-line))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
3181
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3182 (defun YaTeX-latex2e-p ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3183 (let ((b (current-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3184 (ptn (concat YaTeX-ec "documentclass")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3185 (unwind-protect
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3186 (or (save-excursion (search-backward ptn nil t))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3187 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3188 (YaTeX-visit-main t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3189 (save-excursion (search-backward ptn nil t))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3190 (set-buffer b))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3191
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
3192 (provide 'yatex)
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
3193 (defvar yatex-mode-load-hook nil
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
3194 "*List of functions to be called when yatex.el is loaded.")
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3195 (if (and YaTeX-emacs-19 YaTeX-display-color-p (not (featurep 'yatex19)))
55
790d0be0d0f8 Bug fix version
yuuji
parents: 54
diff changeset
3196 (load "yatex19"))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3197 (load "yatexhks" t)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3198
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3199 ;;-------------------- Final hook jobs --------------------
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3200 (substitute-all-key-definition
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3201 'fill-paragraph 'YaTeX-fill-paragraph YaTeX-mode-map)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3202 (substitute-all-key-definition
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3203 'kill-buffer 'YaTeX-kill-buffer YaTeX-mode-map)
7
9a56acb6c287 Fill-paragraph and (un)comment-paragraph work fine.
yuuji
parents: 6
diff changeset
3204 (run-hooks 'yatex-mode-load-hook)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3205
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
3206 ;; `History' was moved to ChangeLog
0
9c72144baf95 First releas version (at ftp.ae).
yuuji
parents:
diff changeset
3207 ;----------------------------- End of yatex.el -----------------------------
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3208
82
yuuji
parents: 79
diff changeset
3209 ; Local variables:
yuuji
parents: 79
diff changeset
3210 ; coding: sjis
yuuji
parents: 79
diff changeset
3211 ; End:

yatex.org