Mercurial > emacs
annotate lisp/progmodes/ada-stmt.el @ 53426:adae6745b4c9
(Frames and Windows): Add set-frame-selected-window and frame-root-window.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 29 Dec 2003 20:58:40 +0000 |
parents | 695cf19ef79e |
children | f0eb34e60705 e8824c4f5f7e 375f2633d815 |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
34400
diff
changeset
|
1 ;;; ada-stmt.el --- an extension to Ada mode for inserting statement templates |
23868 | 2 |
50739
fbec4e6f73c8
(ada-stmt-add-to-ada-menu): Moved to ada-mode.el.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
3 ;; Copyright(C) 1987, 93, 94, 96, 97, 98, 99, 2000 |
32301
0f1f7e931493
Fix header line, copyright notice.
Dave Love <fx@gnu.org>
parents:
30409
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
23868 | 5 |
52401 | 6 ;; Ada Core Technologies's version: $Revision: 1.16 $ |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
34400
diff
changeset
|
7 |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
34400
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
9 |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
10 ;; Authors: Daniel Pfeiffer, Markus Heritsch, Rolf Ebert <ebert@waporo.muc.de> |
34400
a5fbe8c7b12d
Update `maintainer'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33823
diff
changeset
|
11 ;; Maintainer: Emmanuel Briot <briot@gnat.com> |
23868 | 12 ;; Keywords: languages, ada |
13 ;; Rolf Ebert's version: 2.26 | |
14 | |
15 ;;; Commentary: | |
44467
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
16 ;; This file is now automatically loaded from ada-mode.el, and creates a submenu |
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
17 ;; in Ada/ on the menu bar. |
23868 | 18 |
19 ;;; History: | |
20 | |
21 ;; Created May 1987. | |
22 ;; Original version from V. Bowman as in ada.el of Emacs-18 | |
23 ;; (borrowed heavily from Mick Jordan's Modula-2 package for GNU, | |
24 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.) | |
25 ;; | |
26 ;; Sep 1993. Daniel Pfeiffer <pfeiffer@cict.fr> (DP) | |
27 ;; Introduced statement.el for smaller code and user configurability. | |
28 ;; | |
29 ;; Nov 1993. Rolf Ebert <ebert@enpc.fr> (RE) Moved the | |
30 ;; skeleton generation into this separate file. The code still is | |
31 ;; essentially written by DP | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
32 ;; |
23868 | 33 ;; Adapted Jun 1994. Markus Heritsch |
34 ;; <Markus.Heritsch@studbox.uni-stuttgart.de> (MH) | |
35 ;; added menu bar support for templates | |
36 ;; | |
37 ;; 1994/12/02 Christian Egli <cegli@hcsd.hac.com> | |
38 ;; General cleanup and bug fixes. | |
39 ;; | |
40 ;; 1995/12/20 John Hutchison <hutchiso@epi.syr.ge.com> | |
26226
b63d041c9108
Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents:
26000
diff
changeset
|
41 ;; made it work with skeleton.el from Emacs-19.30. Several |
23868 | 42 ;; enhancements and bug fixes. |
43 | |
44 ;; BUGS: | |
45 ;;;> I have the following suggestions for the function template: 1) I | |
46 ;;;> don't want it automatically assigning it a name for the return variable. I | |
47 ;;;> never want it to be called "Result" because that is nondescriptive. If you | |
48 ;;;> must define a variable, give me the ability to specify its name. | |
49 ;;;> | |
50 ;;;> 2) You do not provide a type for variable 'Result'. Its type is the same | |
51 ;;;> as the function's return type, which the template knows, so why force me | |
52 ;;;> to type it in? | |
53 ;;;> | |
54 | |
55 ;;;It would be nice if one could configure such layout details separately | |
56 ;;;without patching the LISP code. Maybe the metalanguage used in ada-stmt.el | |
57 ;;;could be taken even further, providing the user with some nice syntax | |
58 ;;;for describing layout. Then my own hacks would survive the next | |
59 ;;;update of the package :-) | |
60 | |
61 | |
62 ;;; Code: | |
63 | |
50812
15929fed5553
(ada-xemacs): Variable removed, since it's better to use (featurep 'xemacs).
Juanma Barranquero <lekktu@gmail.com>
parents:
50739
diff
changeset
|
64 (require 'skeleton nil t) |
23868 | 65 (require 'easymenu) |
50812
15929fed5553
(ada-xemacs): Variable removed, since it's better to use (featurep 'xemacs).
Juanma Barranquero <lekktu@gmail.com>
parents:
50739
diff
changeset
|
66 (require 'ada-mode) |
23868 | 67 |
68 (defun ada-func-or-proc-name () | |
69 ;; Get the name of the current function or procedure." | |
70 (save-excursion | |
71 (let ((case-fold-search t)) | |
72 (if (re-search-backward ada-procedure-start-regexp nil t) | |
44467
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
73 (buffer-substring (match-beginning 3) (match-end 3)) |
23868 | 74 "NAME?")))) |
75 | |
76 ;;; ---- statement skeletons ------------------------------------------ | |
77 | |
78 (define-skeleton ada-array | |
26000 | 79 "Insert array type definition. |
26226
b63d041c9108
Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents:
26000
diff
changeset
|
80 Prompt for component type and index subtypes." |
23868 | 81 () |
82 "array (" ("index definition: " str ", " ) -2 ") of " _ ?\;) | |
83 | |
84 | |
85 (define-skeleton ada-case | |
26000 | 86 "Build skeleton case statement. |
87 Prompt for the selector expression. Also builds the first when clause." | |
23868 | 88 "[selector expression]: " |
89 "case " str " is" \n | |
90 > "when " ("discrete choice: " str " | ") -3 " =>" \n | |
91 > _ \n | |
92 < < "end case;") | |
93 | |
94 | |
95 (define-skeleton ada-when | |
96 "Start a case statement alternative with a when clause." | |
97 () | |
98 < "when " ("discrete choice: " str " | ") -3 " =>" \n | |
99 >) | |
100 | |
101 | |
102 (define-skeleton ada-declare-block | |
103 "Insert a block with a declare part. | |
104 Indent for the first declaration." | |
105 "[block name]: " | |
106 < str & ?: & \n | |
107 > "declare" \n | |
108 > _ \n | |
109 < "begin" \n | |
110 > \n | |
111 < "end " str | -1 ?\;) | |
112 | |
113 | |
114 (define-skeleton ada-exception-block | |
115 "Insert a block with an exception part. | |
116 Indent for the first line of code." | |
117 "[block name]: " | |
118 < str & ?: & \n | |
119 > "begin" \n | |
120 > _ \n | |
121 < "exception" \n | |
122 > \n | |
123 < "end " str | -1 ?\;) | |
124 | |
125 | |
126 (define-skeleton ada-exception | |
127 "Insert an indented exception part into a block." | |
128 () | |
129 < "exception" \n | |
130 >) | |
131 | |
132 | |
133 (define-skeleton ada-exit-1 | |
134 "Insert then exit condition of the exit statement, prompting for condition." | |
135 "[exit condition]: " | |
136 "when " str | -5) | |
137 | |
138 | |
139 (define-skeleton ada-exit | |
140 "Insert an exit statement, prompting for loop name and condition." | |
141 "[name of loop to exit]: " | |
44467
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
142 "exit " str & ?\ (ada-exit-1) | -1 ?\;) |
23868 | 143 |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
144 ;;;###autoload |
23868 | 145 (defun ada-header () |
146 "Insert a descriptive header at the top of the file." | |
147 (interactive "*") | |
148 (save-excursion | |
149 (goto-char (point-min)) | |
150 (if (fboundp 'make-header) | |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
151 (funcall (symbol-function 'make-header)) |
23868 | 152 (ada-header-tmpl)))) |
153 | |
154 | |
155 (define-skeleton ada-header-tmpl | |
156 "Insert a comment block containing the module title, author, etc." | |
157 "[Description]: " | |
158 "-- -*- Mode: Ada -*-" | |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
159 "\n" ada-fill-comment-prefix "Filename : " (buffer-name) |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
160 "\n" ada-fill-comment-prefix "Description : " str |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
161 "\n" ada-fill-comment-prefix "Author : " (user-full-name) |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
162 "\n" ada-fill-comment-prefix "Created On : " (current-time-string) |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
163 "\n" ada-fill-comment-prefix "Last Modified By: ." |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
164 "\n" ada-fill-comment-prefix "Last Modified On: ." |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
165 "\n" ada-fill-comment-prefix "Update Count : 0" |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
166 "\n" ada-fill-comment-prefix "Status : Unknown, Use with caution!" |
23868 | 167 "\n") |
168 | |
169 | |
170 (define-skeleton ada-display-comment | |
171 "Inserts three comment lines, making a display comment." | |
172 () | |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
173 "--\n" ada-fill-comment-prefix _ "\n--") |
23868 | 174 |
175 | |
176 (define-skeleton ada-if | |
177 "Insert skeleton if statment, prompting for a boolean-expression." | |
178 "[condition]: " | |
179 "if " str " then" \n | |
180 > _ \n | |
181 < "end if;") | |
182 | |
183 | |
184 (define-skeleton ada-elsif | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
185 "Add an elsif clause to an if statement, |
23868 | 186 prompting for the boolean-expression." |
187 "[condition]: " | |
188 < "elsif " str " then" \n | |
189 >) | |
190 | |
191 | |
192 (define-skeleton ada-else | |
193 "Add an else clause inside an if-then-end-if clause." | |
194 () | |
195 < "else" \n | |
196 >) | |
197 | |
198 | |
199 (define-skeleton ada-loop | |
200 "Insert a skeleton loop statement. The exit statement is added by hand." | |
201 "[loop name]: " | |
202 < str & ?: & \n | |
203 > "loop" \n | |
204 > _ \n | |
205 < "end loop " str | -1 ?\;) | |
206 | |
207 | |
208 (define-skeleton ada-for-loop-prompt-variable | |
209 "Prompt for the loop variable." | |
210 "[loop variable]: " | |
211 str) | |
212 | |
213 | |
214 (define-skeleton ada-for-loop-prompt-range | |
215 "Prompt for the loop range." | |
216 "[loop range]: " | |
217 str) | |
218 | |
219 | |
220 (define-skeleton ada-for-loop | |
221 "Build a skeleton for-loop statement, prompting for the loop parameters." | |
222 "[loop name]: " | |
223 < str & ?: & \n | |
224 > "for " | |
225 (ada-for-loop-prompt-variable) | |
226 " in " | |
227 (ada-for-loop-prompt-range) | |
228 " loop" \n | |
229 > _ \n | |
230 < "end loop " str | -1 ?\;) | |
231 | |
232 | |
233 (define-skeleton ada-while-loop-prompt-entry-condition | |
234 "Prompt for the loop entry condition." | |
235 "[entry condition]: " | |
236 str) | |
237 | |
238 | |
239 (define-skeleton ada-while-loop | |
240 "Insert a skeleton while loop statement." | |
241 "[loop name]: " | |
242 < str & ?: & \n | |
243 > "while " | |
244 (ada-while-loop-prompt-entry-condition) | |
245 " loop" \n | |
246 > _ \n | |
247 < "end loop " str | -1 ?\;) | |
248 | |
249 | |
250 (define-skeleton ada-package-spec | |
251 "Insert a skeleton package specification." | |
252 "[package name]: " | |
253 "package " str " is" \n | |
254 > _ \n | |
255 < "end " str ?\;) | |
256 | |
257 | |
258 (define-skeleton ada-package-body | |
259 "Insert a skeleton package body -- includes a begin statement." | |
260 "[package name]: " | |
261 "package body " str " is" \n | |
262 > _ \n | |
263 ; < "begin" \n | |
264 < "end " str ?\;) | |
265 | |
266 | |
267 (define-skeleton ada-private | |
268 "Undent and start a private section of a package spec. Reindent." | |
269 () | |
270 < "private" \n | |
271 >) | |
272 | |
273 | |
274 (define-skeleton ada-function-spec-prompt-return | |
275 "Prompts for function result type." | |
276 "[result type]: " | |
277 str) | |
278 | |
279 | |
280 (define-skeleton ada-function-spec | |
281 "Insert a function specification. Prompts for name and arguments." | |
282 "[function name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
283 "function " str |
23868 | 284 " (" ("[parameter_specification]: " str "; " ) -2 ")" |
285 " return " | |
286 (ada-function-spec-prompt-return) | |
287 ";" \n ) | |
288 | |
289 | |
290 (define-skeleton ada-procedure-spec | |
291 "Insert a procedure specification, prompting for its name and arguments." | |
292 "[procedure name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
293 "procedure " str |
23868 | 294 " (" ("[parameter_specification]: " str "; " ) -2 ")" |
295 ";" \n ) | |
296 | |
297 | |
298 (define-skeleton ada-subprogram-body | |
299 "Insert frame for subprogram body. | |
300 Invoke right after `ada-function-spec' or `ada-procedure-spec'." | |
301 () | |
302 ;; Remove `;' from subprogram decl | |
303 (save-excursion | |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
304 (let ((pos (1+ (point)))) |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
305 (ada-search-ignore-string-comment ada-subprog-start-re t nil) |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
306 (when (ada-search-ignore-string-comment "(" nil pos t 'search-forward) |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
307 (backward-char 1) |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
308 (forward-sexp 1))) |
23868 | 309 (if (looking-at ";") |
310 (delete-char 1))) | |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
311 " is" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
312 _ \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
313 < "begin" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
314 \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
315 < "exception" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
316 "when others => null;" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
317 < < "end " |
23868 | 318 (ada-func-or-proc-name) |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
319 ";" \n) |
23868 | 320 |
321 | |
322 (define-skeleton ada-separate | |
323 "Finish a body stub with `separate'." | |
324 () | |
325 > "separate;" \n | |
326 <) | |
327 | |
328 | |
329 ;(define-skeleton ada-with | |
330 ; "Inserts a with clause, prompting for the list of units depended upon." | |
331 ; "[list of units depended upon]: " | |
332 ; "with " str ?\;) | |
333 | |
334 ;(define-skeleton ada-use | |
335 ; "Inserts a use clause, prompting for the list of packages used." | |
336 ; "[list of packages used]: " | |
337 ; "use " str ?\;) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
338 |
23868 | 339 |
340 (define-skeleton ada-record | |
341 "Insert a skeleton record type declaration." | |
342 () | |
343 "record" \n | |
344 > _ \n | |
345 < "end record;") | |
346 | |
347 | |
348 (define-skeleton ada-subtype | |
349 "Start insertion of a subtype declaration, prompting for the subtype name." | |
350 "[subtype name]: " | |
351 "subtype " str " is " _ ?\; | |
352 (not (message "insert subtype indication."))) | |
353 | |
354 | |
355 (define-skeleton ada-type | |
356 "Start insertion of a type declaration, prompting for the type name." | |
357 "[type name]: " | |
358 "type " str ?\( | |
359 ("[discriminant specs]: " str " ") | |
360 | (backward-delete-char 1) | ?\) | |
361 " is " | |
362 (not (message "insert type definition."))) | |
363 | |
364 | |
365 (define-skeleton ada-task-body | |
366 "Insert a task body, prompting for the task name." | |
367 "[task name]: " | |
368 "task body " str " is\n" | |
369 "begin\n" | |
370 > _ \n | |
371 < "end " str ";" ) | |
372 | |
373 | |
374 (define-skeleton ada-task-spec | |
375 "Insert a task specification, prompting for the task name." | |
376 "[task name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
377 "task " str |
23868 | 378 " (" ("[discriminant]: " str "; ") ") is\n" |
379 > "entry " _ \n | |
380 <"end " str ";" ) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
381 |
23868 | 382 |
383 (define-skeleton ada-get-param1 | |
384 "Prompt for arguments and if any enclose them in brackets." | |
385 () | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
386 ("[parameter_specification]: " str "; " ) & -2 & ")") |
23868 | 387 |
388 | |
389 (define-skeleton ada-get-param | |
390 "Prompt for arguments and if any enclose them in brackets." | |
391 () | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
392 " (" |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
393 (ada-get-param1) | -2) |
23868 | 394 |
395 | |
396 (define-skeleton ada-entry | |
397 "Insert a task entry, prompting for the entry name." | |
398 "[entry name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
399 "entry " str |
23868 | 400 (ada-get-param) |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
401 ";" \n) |
23868 | 402 |
403 | |
404 (define-skeleton ada-entry-family-prompt-discriminant | |
405 "Insert a entry specification, prompting for the entry name." | |
406 "[discriminant name]: " | |
407 str) | |
408 | |
409 | |
410 (define-skeleton ada-entry-family | |
411 "Insert a entry specification, prompting for the entry name." | |
412 "[entry name]: " | |
413 "entry " str | |
414 " (" (ada-entry-family-prompt-discriminant) ")" | |
415 (ada-get-param) | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
416 ";" \n) |
23868 | 417 |
418 | |
419 (define-skeleton ada-select | |
420 "Insert a select block." | |
421 () | |
422 "select\n" | |
423 > _ \n | |
424 < "end select;") | |
425 | |
426 | |
427 (define-skeleton ada-accept-1 | |
428 "Insert a condition statement, prompting for the condition name." | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
429 "[condition]: " |
23868 | 430 "when " str | -5 ) |
431 | |
432 | |
433 (define-skeleton ada-accept-2 | |
434 "Insert an accept statement, prompting for the name and arguments." | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
435 "[accept name]: " |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
436 > "accept " str |
23868 | 437 (ada-get-param) |
438 " do" \n | |
439 > _ \n | |
440 < "end " str ";" ) | |
441 | |
442 | |
443 (define-skeleton ada-accept | |
444 "Insert an accept statement (prompt for condition, name and arguments)." | |
445 () | |
446 > (ada-accept-1) & " =>\n" | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
447 (ada-accept-2)) |
23868 | 448 |
449 | |
450 (define-skeleton ada-or-accept | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
451 "Insert an or statement, prompting for the condition name." |
23868 | 452 () |
453 < "or\n" | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
454 (ada-accept)) |
23868 | 455 |
456 | |
457 (define-skeleton ada-or-delay | |
458 "Insert a delay statement, prompting for the delay value." | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
459 "[delay value]: " |
23868 | 460 < "or\n" |
461 > "delay " str ";") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
462 |
23868 | 463 |
464 (define-skeleton ada-or-terminate | |
465 "Insert a terminate statement." | |
466 () | |
467 < "or\n" | |
468 > "terminate;") | |
469 | |
470 | |
471 (defun ada-adjust-case-skeleton () | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
472 "Adjust the case of the text inserted by a skeleton." |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
473 (save-excursion |
23868 | 474 (let ((aa-end (point))) |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
475 (ada-adjust-case-region |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
476 (progn (goto-char (symbol-value 'beg)) (forward-word -1) (point)) |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
477 (goto-char aa-end))))) |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
478 |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
479 (defun ada-stmt-mode-hook () |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
480 (set (make-local-variable 'skeleton-further-elements) |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
481 '((< '(backward-delete-char-untabify |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
482 (min ada-indent (current-column)))))) |
50739
fbec4e6f73c8
(ada-stmt-add-to-ada-menu): Moved to ada-mode.el.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
483 (add-hook 'skeleton-end-hook 'ada-adjust-case-skeleton nil t)) |
23868 | 484 |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
485 (add-hook 'ada-mode-hook 'ada-stmt-mode-hook) |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
486 |
23868 | 487 (provide 'ada-stmt) |
488 | |
52401 | 489 ;;; arch-tag: 94f51555-cc0e-44e5-8865-8788aae8ecd3 |
23868 | 490 ;;; ada-stmt.el ends here |