annotate yatex.el @ 239:5de195a540c7 dev

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

yatex.org