annotate yatex.el @ 61:b9f753846b6b

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

yatex.org