annotate yatexadd.el @ 18:adc2f1472409

Make variables for temporary dictionary buffer-local. Change the default value of YaTeX-nervous to t. Create a temporary dictionary file when `T' is selected at the dictionary selection menu.
author yuuji
date Mon, 16 May 1994 09:30:52 +0000
parents cb9afa9c1213
children b00c74813e56
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
1 ;;; -*- Emacs-Lisp -*-
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
2 ;;; YaTeX add-in functions.
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
3 ;;; yatexadd.el rev.8
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
4 ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
5 ;;; Last modified Sun May 15 18:00:12 1994 on 98fa
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
6 ;;; $Id$
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
7
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
8 (provide 'yatexadd)
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
9
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
10 ;;;
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
11 ;;Sample functions for LaTeX environment.
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
12 ;;;
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
13 (defvar YaTeX:tabular-default-rule
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
14 "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}"
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
15 "*Your favorite default rule format."
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
16 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
17 (defun YaTeX:tabular ()
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
18 "YaTeX add-in function for tabular environment.
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
19 Notice that this function refers the let-variable `env' in
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
20 YaTeX-make-begin-end."
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
21 (let ((width "") bars (rule "") (j 0) loc)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
22 (if (string= env "tabular*")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
23 (setq width (concat "{" (read-string "Width: ") "}")))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
24 (setq loc (YaTeX:read-position "tb")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
25 bars (string-to-int (read-string "Number of `|': ")))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
26 (if (> bars 0)
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
27 (while (< j bars) (setq rule (concat rule "|")) (setq j (1+ j)))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
28 (setq rule YaTeX:tabular-default-rule))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
29 (setq rule (read-string "rule format: " rule))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
30
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
31 (message "")
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
32 (format "%s%s{%s}" width loc rule))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
33 )
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
34 (fset 'YaTeX:tabular* 'YaTeX:tabular)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
35 (defun YaTeX:array ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
36 (concat (YaTeX:read-position "tb")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
37 "{" (read-string "Column format: ") "}")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
38 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
39
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
40 (defun YaTeX:read-position (oneof)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
41 (let ((pos "") loc)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
42 (while (not (string-match
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
43 (setq loc (read-key-sequence
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
44 (format "Position (`%s') [%s]: " oneof pos)))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
45 "\r\^g\n"))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
46 (cond
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
47 ((string-match loc oneof)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
48 (if (not (string-match loc pos))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
49 (setq pos (concat pos loc))))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
50 ((and (string-match loc "\C-h\C-?") (> (length pos) 0))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
51 (setq pos (substring pos 0 (1- (length pos)))))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
52 (t
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
53 (ding)
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
54 (message "Please input one of `%s'." oneof)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
55 (sit-for 3))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
56 (message "")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
57 (if (string= pos "") ""
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
58 (concat "[" pos "]")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
59 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
60
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
61 (defun YaTeX:table ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
62 "YaTeX add-in function for table environment."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
63 (YaTeX:read-position "htbp")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
64 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
65
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
66 (defun YaTeX:description ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
67 "Truly poor service:-)"
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
68 (setq single-command "item[]")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
69 ""
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
70 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
71
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
72 (defun YaTeX:itemize ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
73 "It's also poor service."
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
74 (setq single-command "item")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
75 ""
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
76 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
77
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
78 (fset 'YaTeX:enumerate 'YaTeX:itemize)
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
79
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
80 (defun YaTeX:picture ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
81 "Ask the size of coordinates of picture environment."
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
82 (concat (YaTeX:read-coordinates "Picture size")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
83 (YaTeX:read-coordinates "Initial position"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
84 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
85
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
86 (defun YaTeX:equation ()
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
87 (if (fboundp 'YaTeX-toggle-math-mode)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
88 (YaTeX-toggle-math-mode t)) ;force math-mode ON.
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
89 )
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
90 (fset 'YaTeX:eqnarray 'YaTeX:equation)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
91 (fset 'YaTeX:displaymath 'YaTeX:equation)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
92
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
93 (defun YaTeX:list ()
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
94 "%\n{} %default label\n{} %formatting parameter"
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
95 )
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
96
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
97 (defun YaTeX:minipage ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
98 (concat (YaTeX:read-position "cbt")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
99 "{" (read-string "Width: ") "}")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
100 )
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
101
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
102 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
103 ;;Sample functions for section-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
104 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
105 (defun YaTeX:multiput ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
106 (concat (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
107 (YaTeX:read-coordinates "Step")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
108 "{" (read-string "How many times: ") "}")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
109 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
110
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
111 (defun YaTeX:put ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
112 (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
113 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
114
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
115 (defun YaTeX:makebox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
116 (concat (YaTeX:read-coordinates "Dimension")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
117 (YaTeX:read-position "lrtb"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
118 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
119
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
120 (defun YaTeX:framebox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
121 (if (YaTeX-quick-in-environment-p "picture")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
122 (YaTeX:makebox))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
123 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
124
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
125 (defun YaTeX:dashbox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
126 (concat "{" (read-string "Dash dimension: ") "}"
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
127 (YaTeX:read-coordinates "Dimension"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
128 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
129
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
130 (defun YaTeX:read-coordinates (&optional mes varX varY)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
131 (concat
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
132 "("
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
133 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
134 ","
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
135 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
136 ")")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
137 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
138
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
139 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
140 ;;Sample functions for maketitle-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
141 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
142 (defun YaTeX:sum ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
143 "Read range of summation."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
144 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
145 (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
146 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
147
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
148 (fset 'YaTeX:int 'YaTeX:sum)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
149
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
150 (defun YaTeX:lim ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
151 "Insert limit notation of \\lim."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
152 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
153 (let ((var (read-string "Variable: ")) limit)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
154 (if (string= "" var) ""
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
155 (setq limit (read-string "Limit ($ means infinity): "))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
156 (if (string= "$" limit) (setq limit "\\infty"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
157 (concat "_{" var " \\rightarrow " limit "}")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
158 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
159
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
160 (defun YaTeX:gcd ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
161 "Add-in function for \\gcd(m,n)."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
162 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
163 (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
164 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
165
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
166 (defun YaTeX:read-boundary (ULchar)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
167 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar."
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
168 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): "))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
169 (if (string= bndry "") ""
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
170 (if (string= bndry "$") (setq bndry "\\infty"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
171 (concat ULchar "{" bndry "}")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
172 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
173
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
174 (defun YaTeX:verb ()
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
175 "Enclose \\verb's contents with the same characters."
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
176 (let ((quote-char (read-string "Quoting char: " "|"))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
177 (contents (read-string "Quoted contents: ")))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
178 (concat quote-char contents quote-char))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
179 )
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
180
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
181 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
182 ;;Subroutine
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
183 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
184
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
185 (defun YaTeX:check-completion-type (type)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
186 "Check valid completion type."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
187 (if (not (eq type YaTeX-current-completion-type))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
188 (error "This should be completed with %s-type completion." type))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
189 )
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
190
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
191
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
192 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
193 ;;; [[Add-in functions for reading section arguments]]
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
194 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
195 ;; All of add-in functions for reading sections arguments should
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
196 ;; take an argument ARGP that specify the argument position.
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
197 ;; If argument position is out of range, nil should be returned,
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
198 ;; else nil should NOT be returned.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
199
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
200 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
201 ; Label selection
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
202 ;;
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
203 (defvar YaTeX-label-menu-other
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
204 (if YaTeX-japan "':‘¼‚̃oƒbƒtƒ@‚̃‰ƒxƒ‹\n" "':LABEL IN OTHER BUFFER.\n"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
205 (defvar YaTeX-label-menu-any
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
206 (if YaTeX-japan "*:”CˆÓ‚Ì•¶Žš—ñ\n" "*:ANY STRING.\n"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
207 (defvar YaTeX-label-buffer "*Label completions*")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
208 (defvar YaTeX-label-guide-msg "Select label and hit RETURN.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
209 (defvar YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
210 "Key map used in label selection buffer.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
211 (defun YaTeX::label-setup-key-map ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
212 (if YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
213 (message "Setting up label selection mode map...")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
214 (setq YaTeX-label-select-map (copy-keymap global-map))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
215 (suppress-keymap YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
216 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
217 'previous-line 'YaTeX::label-previous YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
218 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
219 'next-line 'YaTeX::label-next YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
220 (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
221 (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
222 (define-key YaTeX-label-select-map "<" 'beginning-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
223 (define-key YaTeX-label-select-map ">" 'end-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
224 (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
225 (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
226 (define-key YaTeX-label-select-map " " 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
227 (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
228 (define-key YaTeX-label-select-map "/" 'isearch-forward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
229 (define-key YaTeX-label-select-map "?" 'isearch-backward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
230 (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
231 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
232 (message "Setting up label selection mode map...Done")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
233 (let ((key ?A))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
234 (while (<= key ?Z)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
235 (define-key YaTeX-label-select-map (char-to-string key)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
236 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
237 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
238 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
239 (setq key (1+ key)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
240 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
241 (defun YaTeX::label-next ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
242 (interactive) (forward-line 1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
243 (defun YaTeX::label-previous ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
244 (interactive) (forward-line -1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
245 (defun YaTeX::label-search-tag ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
246 (interactive)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
247 (let ((case-fold-search t))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
248 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
249 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
250 (forward-char 1)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
251 (re-search-forward (concat "^" (this-command-keys)) nil t))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
252 (goto-char (match-beginning 0)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
253 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
254 (goto-char (point-min))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
255 (re-search-forward (concat "^" (this-command-keys)) nil t))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
256 (goto-char (match-beginning 0))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
257 (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
258 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
259 (defun YaTeX::ref (argp)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
260 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
261 ((= argp 1)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
262 (save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
263 (let ((lnum 0) e0 m1 e1 label label-list (buf (current-buffer))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
264 (p (point)) initl line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
265 (goto-char (point-min))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
266 (message "Collecting labels...")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
267 (save-window-excursion
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
268 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
269 YaTeX-label-buffer (function (lambda (x) (window-width x))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
270 (with-output-to-temp-buffer YaTeX-label-buffer
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
271 (while (re-search-forward "\\label{\\([^}]+\\)}" nil t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
272 (setq e0 (match-end 0) m1 (match-beginning 1) e1 (match-end 1))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
273 (if (search-backward
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
274 YaTeX-comment-prefix (point-beginning-of-line) t) nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
275 (setq label (buffer-substring m1 e1)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
276 label-list (cons label label-list))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
277 (or initl
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
278 (if (< p (point)) (setq initl lnum)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
279 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
280 (skip-chars-forward " \t\n" nil)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
281 (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
282 (buffer-substring (point) (point-end-of-line))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
283 (setq lnum (1+ lnum))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
284 (message "Collecting \\label{}... %d" lnum))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
285 (goto-char e0))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
286 (princ YaTeX-label-menu-other)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
287 (princ YaTeX-label-menu-any)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
288 );with
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
289 (goto-char p)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
290 (message "Collecting labels...Done")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
291 (pop-to-buffer YaTeX-label-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
292 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
293 (setq truncate-lines t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
294 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
295 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
296 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
297 (goto-line (or initl lnum)) ;goto recently defined label line
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
298 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
299 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
300 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
301 (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
302 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
303 (setq line (count-lines (point-min)(point)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
304 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
305 ((= line lnum) (setq label (YaTeX-label-other)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
306 ((>= line (1+ lnum ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
307 (setq label (read-string "\\ref{???}: ")))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
308 (t (setq label (nth (- lnum line 1) label-list)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
309 (bury-buffer YaTeX-label-buffer)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
310 label
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
311 ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
312 ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
313 )
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
314 (fset 'YaTeX::pageref 'YaTeX::ref)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
315
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
316 (defun YaTeX-label-other ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
317 (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
318 (ff "**find-file**"))
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
319 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
320 lbuf (function (lambda (x) 1))) ;;Select next window surely.
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
321 (with-output-to-temp-buffer lbuf
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
322 (while blist
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
323 (if (and (buffer-file-name (setq buf (car blist)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
324 (progn (set-buffer buf) (eq major-mode 'yatex-mode)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
325 (princ
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
326 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
327 (buffer-name buf))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
328 (setq blist (cdr blist)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
329 (princ (format "':{%s}" ff)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
330 (pop-to-buffer lbuf)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
331 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
332 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
333 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
334 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
335 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
336 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
337 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
338 (set-buffer lbuf)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
339 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
340 (setq rv
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
341 (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
342 (buffer-substring (match-beginning 1) (match-end 1)) nil)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
343 (kill-buffer lbuf))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
344 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
345 ((null rv) "")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
346 ((string= rv ff)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
347 (call-interactively 'find-file)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
348 (YaTeX::ref argp))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
349 (t
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
350 (set-buffer rv)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
351 (YaTeX::ref argp)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
352 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
353 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
354
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
355 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
356 ; completion for the arguments of \newcommand
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
357 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
358 (defun YaTeX::newcommand (&optional argp)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
359 (cond
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
360 ((= argp 1)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
361 (let ((command (read-string "Define newcommand: " "\\")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
362 (put 'YaTeX::newcommand 'command (substring command 1))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
363 command))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
364 ((= argp 2)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
365 (let ((argc
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
366 (string-to-int (read-string "Number of arguments(Default 0): ")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
367 (def (read-string "Definition: "))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
368 (command (get 'YaTeX::newcommand 'command)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
369 ;;!!! It's illegal to insert string in the add-in function !!!
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
370 (if (> argc 0) (insert (format "[%d]" argc)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
371 (if (and (stringp command)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
372 (string< "" command)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
373 (y-or-n-p "Update user completion table?"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
374 (cond
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
375 ((= argc 0)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
376 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
377 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
378 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
379 ((= argc 1)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
380 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
381 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
382 'section-table 'user-section-table 'tmp-section-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
383 (t (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
384 (list command argc)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
385 'section-table 'user-section-table 'tmp-section-table))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
386 (message "")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
387 def ;return command name
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
388 ))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
389 (t ""))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
390 )
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
391
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
392 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
393 ; completion for the arguments of \pagestyle
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
394 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
395 (defun YaTeX::pagestyle (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
396 "Read the pagestyle with completion."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
397 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
398 "Page style: "
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
399 '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
400 )
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
401 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
402 ; completion for the arguments of \pagenumbering
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
403 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
404 (defun YaTeX::pagenumbering (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
405 "Read the numbering style."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
406 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
407 "Page numbering style: "
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
408 '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman")))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
409 )
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
410
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
411 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
412 ;; global subroutines
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
413 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
414 (defun substitute-all-key-definition (olddef newdef keymap)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
415 "Replace recursively OLDDEF with NEWDEF for any keys in KEYMAP now
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
416 defined as OLDDEF. In other words, OLDDEF is replaced with NEWDEF
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
417 where ever it appears."
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
418 (if (arrayp keymap)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
419 (let ((len (length keymap))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
420 (i 0))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
421 (while (< i len)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
422 (let ((map (aref keymap i)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
423 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
424 ((arrayp map) (substitute-key-definition olddef newdef map))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
425 ((equal map olddef)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
426 (aset keymap i newdef)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
427 (setq i (1+ i)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
428 (while keymap
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
429 (if (equal (cdr-safe (car-safe keymap)) olddef)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
430 (setcdr (car keymap) newdef))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
431 (setq keymap (cdr keymap)))))

yatex.org