Mercurial > emacs
annotate lisp/progmodes/ada-stmt.el @ 42811:cf0c0ef57504
*** empty log message ***
| author | Jason Rumney <jasonr@gnu.org> |
|---|---|
| date | Thu, 17 Jan 2002 19:29:24 +0000 |
| parents | 7a94f1c588c4 |
| children | e34b692b2fa9 |
| 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 |
|
32301
0f1f7e931493
Fix header line, copyright notice.
Dave Love <fx@gnu.org>
parents:
30409
diff
changeset
|
3 ;; Copyright(C) 1987, 1993, 1994, 1996, 1997, 1998, 1999 |
|
0f1f7e931493
Fix header line, copyright notice.
Dave Love <fx@gnu.org>
parents:
30409
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
| 23868 | 5 |
|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Jan?k <Pavel@Janik.cz>
parents:
34400
diff
changeset
|
6 ;; Ada Core Technologies's version: $Revision: 1.9 $ |
|
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: | |
| 16 | |
| 17 ;; | |
| 18 ;; put the following statement in your .emacs: | |
| 19 ;; (require 'ada-stmt) | |
| 20 ;; | |
| 21 | |
| 22 ;;; History: | |
| 23 | |
| 24 ;; Created May 1987. | |
| 25 ;; Original version from V. Bowman as in ada.el of Emacs-18 | |
| 26 ;; (borrowed heavily from Mick Jordan's Modula-2 package for GNU, | |
| 27 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.) | |
| 28 ;; | |
| 29 ;; Sep 1993. Daniel Pfeiffer <pfeiffer@cict.fr> (DP) | |
| 30 ;; Introduced statement.el for smaller code and user configurability. | |
| 31 ;; | |
| 32 ;; Nov 1993. Rolf Ebert <ebert@enpc.fr> (RE) Moved the | |
| 33 ;; skeleton generation into this separate file. The code still is | |
| 34 ;; essentially written by DP | |
| 35 ;; | |
| 36 ;; Adapted Jun 1994. Markus Heritsch | |
| 37 ;; <Markus.Heritsch@studbox.uni-stuttgart.de> (MH) | |
| 38 ;; added menu bar support for templates | |
| 39 ;; | |
| 40 ;; 1994/12/02 Christian Egli <cegli@hcsd.hac.com> | |
| 41 ;; General cleanup and bug fixes. | |
| 42 ;; | |
| 43 ;; 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
|
44 ;; made it work with skeleton.el from Emacs-19.30. Several |
| 23868 | 45 ;; enhancements and bug fixes. |
| 46 | |
| 47 ;; BUGS: | |
| 48 ;;;> I have the following suggestions for the function template: 1) I | |
| 49 ;;;> don't want it automatically assigning it a name for the return variable. I | |
| 50 ;;;> never want it to be called "Result" because that is nondescriptive. If you | |
| 51 ;;;> must define a variable, give me the ability to specify its name. | |
| 52 ;;;> | |
| 53 ;;;> 2) You do not provide a type for variable 'Result'. Its type is the same | |
| 54 ;;;> as the function's return type, which the template knows, so why force me | |
| 55 ;;;> to type it in? | |
| 56 ;;;> | |
| 57 | |
| 58 ;;;It would be nice if one could configure such layout details separately | |
| 59 ;;;without patching the LISP code. Maybe the metalanguage used in ada-stmt.el | |
| 60 ;;;could be taken even further, providing the user with some nice syntax | |
| 61 ;;;for describing layout. Then my own hacks would survive the next | |
| 62 ;;;update of the package :-) | |
| 63 | |
| 64 | |
| 65 ;;; Code: | |
| 66 | |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
67 (eval-when-compile |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
68 (condition-case nil (require 'skeleton) |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
69 (error nil))) |
|
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
70 |
| 23868 | 71 (require 'easymenu) |
| 72 | |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
73 (defun ada-stmt-add-to-ada-menu () |
|
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
|
74 "Add a new submenu to the Ada menu." |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
75 (interactive) |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
76 (let ((menu '(["Header" ada-header t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
77 ["-" nil nil] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
78 ["Package Body" ada-package-body t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
79 ["Package Spec" ada-package-spec t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
80 ["Function Spec" ada-function-spec t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
81 ["Procedure Spec" ada-procedure-spec t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
82 ["Proc/func Body" ada-subprogram-body t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
83 ["Task Body" ada-task-body t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
84 ["Task Spec" ada-task-spec t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
85 ["Declare Block" ada-declare-block t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
86 ["Exception Block" ada-exception-block t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
87 ["--" nil nil] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
88 ["Entry" ada-entry t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
89 ["Entry family" ada-entry-family t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
90 ["Select" ada-select t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
91 ["Accept" ada-accept t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
92 ["Or accept" ada-or-accep t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
93 ["Or delay" ada-or-delay t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
94 ["Or terminate" ada-or-terminate t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
95 ["---" nil nil] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
96 ["Type" ada-type t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
97 ["Private" ada-private t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
98 ["Subtype" ada-subtype t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
99 ["Record" ada-record t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
100 ["Array" ada-array t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
101 ["----" nil nil] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
102 ["If" ada-if t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
103 ["Else" ada-else t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
104 ["Elsif" ada-elsif t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
105 ["Case" ada-case t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
106 ["-----" nil nil] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
107 ["While Loop" ada-while-loop t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
108 ["For Loop" ada-for-loop t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
109 ["Loop" ada-loop t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
110 ["------" nil nil] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
111 ["Exception" ada-exception t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
112 ["Exit" ada-exit t] |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
113 ["When" ada-when t]))) |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
114 (if ada-xemacs |
|
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
115 (funcall (symbol-function 'add-submenu) |
|
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
116 '("Ada") (append (list "Statements" |
|
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
117 :included '(string= mode-name "Ada")) |
|
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
118 menu)) |
| 23868 | 119 |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
120 (define-key-after (lookup-key ada-mode-map [menu-bar Ada]) [Statements] |
|
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
121 (list 'menu-item |
|
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
122 "Statements" |
|
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
123 (easy-menu-create-menu "Statements" menu) |
|
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
124 :visible '(string= mode-name "Ada")) |
|
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
|
125 t)))) |
| 23868 | 126 |
| 127 | |
| 128 | |
| 129 | |
| 130 (defun ada-func-or-proc-name () | |
| 131 ;; Get the name of the current function or procedure." | |
| 132 (save-excursion | |
| 133 (let ((case-fold-search t)) | |
| 134 (if (re-search-backward ada-procedure-start-regexp nil t) | |
| 135 (buffer-substring (match-beginning 2) (match-end 2)) | |
| 136 "NAME?")))) | |
| 137 | |
|
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
|
138 (defvar ada-template-map |
|
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
|
139 (let ((map (make-sparse-keymap))) |
|
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
|
140 (define-key map "h" 'ada-header) |
|
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
|
141 (define-key map "\C-a" 'ada-array) |
|
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
|
142 (define-key map "b" 'ada-exception-block) |
|
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
|
143 (define-key map "d" 'ada-declare-block) |
|
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
|
144 (define-key map "c" 'ada-case) |
|
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
|
145 (define-key map "\C-e" 'ada-elsif) |
|
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
|
146 (define-key map "e" 'ada-else) |
|
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
|
147 (define-key map "\C-k" 'ada-package-spec) |
|
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
|
148 (define-key map "k" 'ada-package-body) |
|
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
|
149 (define-key map "\C-p" 'ada-procedure-spec) |
|
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
|
150 (define-key map "p" 'ada-subprogram-body) |
|
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
|
151 (define-key map "\C-f" 'ada-function-spec) |
|
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
|
152 (define-key map "f" 'ada-for-loop) |
|
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
|
153 (define-key map "i" 'ada-if) |
|
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
|
154 (define-key map "l" 'ada-loop) |
|
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
|
155 (define-key map "\C-r" 'ada-record) |
|
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
|
156 (define-key map "\C-s" 'ada-subtype) |
|
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
|
157 (define-key map "S" 'ada-tabsize) |
|
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
|
158 (define-key map "\C-t" 'ada-task-spec) |
|
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
|
159 (define-key map "t" 'ada-task-body) |
|
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
|
160 (define-key map "\C-y" 'ada-type) |
|
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 (define-key map "\C-v" 'ada-private) |
|
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
|
162 (define-key map "u" 'ada-use) |
|
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
|
163 (define-key map "\C-u" 'ada-with) |
|
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
|
164 (define-key map "\C-w" 'ada-when) |
|
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
|
165 (define-key map "w" 'ada-while-loop) |
|
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
|
166 (define-key map "\C-x" 'ada-exception) |
|
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
|
167 (define-key map "x" 'ada-exit) |
|
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
|
168 map) |
| 23868 | 169 "Keymap used in Ada mode for smart template operations.") |
| 170 | |
|
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
|
171 (define-key ada-mode-map "\C-ct" ada-template-map) |
| 23868 | 172 |
| 173 ;;; ---- statement skeletons ------------------------------------------ | |
| 174 | |
| 175 (define-skeleton ada-array | |
| 26000 | 176 "Insert array type definition. |
|
26226
b63d041c9108
Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents:
26000
diff
changeset
|
177 Prompt for component type and index subtypes." |
| 23868 | 178 () |
| 179 "array (" ("index definition: " str ", " ) -2 ") of " _ ?\;) | |
| 180 | |
| 181 | |
| 182 (define-skeleton ada-case | |
| 26000 | 183 "Build skeleton case statement. |
| 184 Prompt for the selector expression. Also builds the first when clause." | |
| 23868 | 185 "[selector expression]: " |
| 186 "case " str " is" \n | |
| 187 > "when " ("discrete choice: " str " | ") -3 " =>" \n | |
| 188 > _ \n | |
| 189 < < "end case;") | |
| 190 | |
| 191 | |
| 192 (define-skeleton ada-when | |
| 193 "Start a case statement alternative with a when clause." | |
| 194 () | |
| 195 < "when " ("discrete choice: " str " | ") -3 " =>" \n | |
| 196 >) | |
| 197 | |
| 198 | |
| 199 (define-skeleton ada-declare-block | |
| 200 "Insert a block with a declare part. | |
| 201 Indent for the first declaration." | |
| 202 "[block name]: " | |
| 203 < str & ?: & \n | |
| 204 > "declare" \n | |
| 205 > _ \n | |
| 206 < "begin" \n | |
| 207 > \n | |
| 208 < "end " str | -1 ?\;) | |
| 209 | |
| 210 | |
| 211 (define-skeleton ada-exception-block | |
| 212 "Insert a block with an exception part. | |
| 213 Indent for the first line of code." | |
| 214 "[block name]: " | |
| 215 < str & ?: & \n | |
| 216 > "begin" \n | |
| 217 > _ \n | |
| 218 < "exception" \n | |
| 219 > \n | |
| 220 < "end " str | -1 ?\;) | |
| 221 | |
| 222 | |
| 223 (define-skeleton ada-exception | |
| 224 "Insert an indented exception part into a block." | |
| 225 () | |
| 226 < "exception" \n | |
| 227 >) | |
| 228 | |
| 229 | |
| 230 (define-skeleton ada-exit-1 | |
| 231 "Insert then exit condition of the exit statement, prompting for condition." | |
| 232 "[exit condition]: " | |
| 233 "when " str | -5) | |
| 234 | |
| 235 | |
| 236 (define-skeleton ada-exit | |
| 237 "Insert an exit statement, prompting for loop name and condition." | |
| 238 "[name of loop to exit]: " | |
|
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
|
239 "exit " str & ?\ (ada-exit-1) | -1 ?\;) |
| 23868 | 240 |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
241 ;;;###autoload |
| 23868 | 242 (defun ada-header () |
| 243 "Insert a descriptive header at the top of the file." | |
| 244 (interactive "*") | |
| 245 (save-excursion | |
| 246 (goto-char (point-min)) | |
| 247 (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
|
248 (funcall (symbol-function 'make-header)) |
| 23868 | 249 (ada-header-tmpl)))) |
| 250 | |
| 251 | |
| 252 (define-skeleton ada-header-tmpl | |
| 253 "Insert a comment block containing the module title, author, etc." | |
| 254 "[Description]: " | |
| 255 "-- -*- 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
|
256 "\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
|
257 "\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
|
258 "\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
|
259 "\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
|
260 "\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
|
261 "\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
|
262 "\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
|
263 "\n" ada-fill-comment-prefix "Status : Unknown, Use with caution!" |
| 23868 | 264 "\n") |
| 265 | |
| 266 | |
| 267 (define-skeleton ada-display-comment | |
| 268 "Inserts three comment lines, making a display comment." | |
| 269 () | |
|
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
270 "--\n" ada-fill-comment-prefix _ "\n--") |
| 23868 | 271 |
| 272 | |
| 273 (define-skeleton ada-if | |
| 274 "Insert skeleton if statment, prompting for a boolean-expression." | |
| 275 "[condition]: " | |
| 276 "if " str " then" \n | |
| 277 > _ \n | |
| 278 < "end if;") | |
| 279 | |
| 280 | |
| 281 (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
|
282 "Add an elsif clause to an if statement, |
| 23868 | 283 prompting for the boolean-expression." |
| 284 "[condition]: " | |
| 285 < "elsif " str " then" \n | |
| 286 >) | |
| 287 | |
| 288 | |
| 289 (define-skeleton ada-else | |
| 290 "Add an else clause inside an if-then-end-if clause." | |
| 291 () | |
| 292 < "else" \n | |
| 293 >) | |
| 294 | |
| 295 | |
| 296 (define-skeleton ada-loop | |
| 297 "Insert a skeleton loop statement. The exit statement is added by hand." | |
| 298 "[loop name]: " | |
| 299 < str & ?: & \n | |
| 300 > "loop" \n | |
| 301 > _ \n | |
| 302 < "end loop " str | -1 ?\;) | |
| 303 | |
| 304 | |
| 305 (define-skeleton ada-for-loop-prompt-variable | |
| 306 "Prompt for the loop variable." | |
| 307 "[loop variable]: " | |
| 308 str) | |
| 309 | |
| 310 | |
| 311 (define-skeleton ada-for-loop-prompt-range | |
| 312 "Prompt for the loop range." | |
| 313 "[loop range]: " | |
| 314 str) | |
| 315 | |
| 316 | |
| 317 (define-skeleton ada-for-loop | |
| 318 "Build a skeleton for-loop statement, prompting for the loop parameters." | |
| 319 "[loop name]: " | |
| 320 < str & ?: & \n | |
| 321 > "for " | |
| 322 (ada-for-loop-prompt-variable) | |
| 323 " in " | |
| 324 (ada-for-loop-prompt-range) | |
| 325 " loop" \n | |
| 326 > _ \n | |
| 327 < "end loop " str | -1 ?\;) | |
| 328 | |
| 329 | |
| 330 (define-skeleton ada-while-loop-prompt-entry-condition | |
| 331 "Prompt for the loop entry condition." | |
| 332 "[entry condition]: " | |
| 333 str) | |
| 334 | |
| 335 | |
| 336 (define-skeleton ada-while-loop | |
| 337 "Insert a skeleton while loop statement." | |
| 338 "[loop name]: " | |
| 339 < str & ?: & \n | |
| 340 > "while " | |
| 341 (ada-while-loop-prompt-entry-condition) | |
| 342 " loop" \n | |
| 343 > _ \n | |
| 344 < "end loop " str | -1 ?\;) | |
| 345 | |
| 346 | |
| 347 (define-skeleton ada-package-spec | |
| 348 "Insert a skeleton package specification." | |
| 349 "[package name]: " | |
| 350 "package " str " is" \n | |
| 351 > _ \n | |
| 352 < "end " str ?\;) | |
| 353 | |
| 354 | |
| 355 (define-skeleton ada-package-body | |
| 356 "Insert a skeleton package body -- includes a begin statement." | |
| 357 "[package name]: " | |
| 358 "package body " str " is" \n | |
| 359 > _ \n | |
| 360 ; < "begin" \n | |
| 361 < "end " str ?\;) | |
| 362 | |
| 363 | |
| 364 (define-skeleton ada-private | |
| 365 "Undent and start a private section of a package spec. Reindent." | |
| 366 () | |
| 367 < "private" \n | |
| 368 >) | |
| 369 | |
| 370 | |
| 371 (define-skeleton ada-function-spec-prompt-return | |
| 372 "Prompts for function result type." | |
| 373 "[result type]: " | |
| 374 str) | |
| 375 | |
| 376 | |
| 377 (define-skeleton ada-function-spec | |
| 378 "Insert a function specification. Prompts for name and arguments." | |
| 379 "[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
|
380 "function " str |
| 23868 | 381 " (" ("[parameter_specification]: " str "; " ) -2 ")" |
| 382 " return " | |
| 383 (ada-function-spec-prompt-return) | |
| 384 ";" \n ) | |
| 385 | |
| 386 | |
| 387 (define-skeleton ada-procedure-spec | |
| 388 "Insert a procedure specification, prompting for its name and arguments." | |
| 389 "[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
|
390 "procedure " str |
| 23868 | 391 " (" ("[parameter_specification]: " str "; " ) -2 ")" |
| 392 ";" \n ) | |
| 393 | |
| 394 | |
| 395 (define-skeleton ada-subprogram-body | |
| 396 "Insert frame for subprogram body. | |
| 397 Invoke right after `ada-function-spec' or `ada-procedure-spec'." | |
| 398 () | |
| 399 ;; Remove `;' from subprogram decl | |
| 400 (save-excursion | |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
401 (let ((pos (1+ (point)))) |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
402 (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
|
403 (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
|
404 (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
|
405 (forward-sexp 1))) |
| 23868 | 406 (if (looking-at ";") |
| 407 (delete-char 1))) | |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
408 " is" \n |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
409 _ \n |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
410 < "begin" \n |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
411 \n |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
412 < "exception" \n |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
413 "when others => null;" \n |
|
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
414 < < "end " |
| 23868 | 415 (ada-func-or-proc-name) |
|
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
416 ";" \n) |
| 23868 | 417 |
| 418 | |
| 419 (define-skeleton ada-separate | |
| 420 "Finish a body stub with `separate'." | |
| 421 () | |
| 422 > "separate;" \n | |
| 423 <) | |
| 424 | |
| 425 | |
| 426 ;(define-skeleton ada-with | |
| 427 ; "Inserts a with clause, prompting for the list of units depended upon." | |
| 428 ; "[list of units depended upon]: " | |
| 429 ; "with " str ?\;) | |
| 430 | |
| 431 ;(define-skeleton ada-use | |
| 432 ; "Inserts a use clause, prompting for the list of packages used." | |
| 433 ; "[list of packages used]: " | |
| 434 ; "use " str ?\;) | |
| 435 | |
| 436 | |
| 437 (define-skeleton ada-record | |
| 438 "Insert a skeleton record type declaration." | |
| 439 () | |
| 440 "record" \n | |
| 441 > _ \n | |
| 442 < "end record;") | |
| 443 | |
| 444 | |
| 445 (define-skeleton ada-subtype | |
| 446 "Start insertion of a subtype declaration, prompting for the subtype name." | |
| 447 "[subtype name]: " | |
| 448 "subtype " str " is " _ ?\; | |
| 449 (not (message "insert subtype indication."))) | |
| 450 | |
| 451 | |
| 452 (define-skeleton ada-type | |
| 453 "Start insertion of a type declaration, prompting for the type name." | |
| 454 "[type name]: " | |
| 455 "type " str ?\( | |
| 456 ("[discriminant specs]: " str " ") | |
| 457 | (backward-delete-char 1) | ?\) | |
| 458 " is " | |
| 459 (not (message "insert type definition."))) | |
| 460 | |
| 461 | |
| 462 (define-skeleton ada-task-body | |
| 463 "Insert a task body, prompting for the task name." | |
| 464 "[task name]: " | |
| 465 "task body " str " is\n" | |
| 466 "begin\n" | |
| 467 > _ \n | |
| 468 < "end " str ";" ) | |
| 469 | |
| 470 | |
| 471 (define-skeleton ada-task-spec | |
| 472 "Insert a task specification, prompting for the task name." | |
| 473 "[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
|
474 "task " str |
| 23868 | 475 " (" ("[discriminant]: " str "; ") ") is\n" |
| 476 > "entry " _ \n | |
| 477 <"end " str ";" ) | |
| 478 | |
| 479 | |
| 480 (define-skeleton ada-get-param1 | |
| 481 "Prompt for arguments and if any enclose them in brackets." | |
| 482 () | |
|
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
|
483 ("[parameter_specification]: " str "; " ) & -2 & ")") |
| 23868 | 484 |
| 485 | |
| 486 (define-skeleton ada-get-param | |
| 487 "Prompt for arguments and if any enclose them in brackets." | |
| 488 () | |
|
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
|
489 " (" |
|
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
|
490 (ada-get-param1) | -2) |
| 23868 | 491 |
| 492 | |
| 493 (define-skeleton ada-entry | |
| 494 "Insert a task entry, prompting for the entry name." | |
| 495 "[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
|
496 "entry " str |
| 23868 | 497 (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
|
498 ";" \n) |
| 23868 | 499 |
| 500 | |
| 501 (define-skeleton ada-entry-family-prompt-discriminant | |
| 502 "Insert a entry specification, prompting for the entry name." | |
| 503 "[discriminant name]: " | |
| 504 str) | |
| 505 | |
| 506 | |
| 507 (define-skeleton ada-entry-family | |
| 508 "Insert a entry specification, prompting for the entry name." | |
| 509 "[entry name]: " | |
| 510 "entry " str | |
| 511 " (" (ada-entry-family-prompt-discriminant) ")" | |
| 512 (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
|
513 ";" \n) |
| 23868 | 514 |
| 515 | |
| 516 (define-skeleton ada-select | |
| 517 "Insert a select block." | |
| 518 () | |
| 519 "select\n" | |
| 520 > _ \n | |
| 521 < "end select;") | |
| 522 | |
| 523 | |
| 524 (define-skeleton ada-accept-1 | |
| 525 "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
|
526 "[condition]: " |
| 23868 | 527 "when " str | -5 ) |
| 528 | |
| 529 | |
| 530 (define-skeleton ada-accept-2 | |
| 531 "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
|
532 "[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
|
533 > "accept " str |
| 23868 | 534 (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
|
535 ;;; " (" ("[parameter_specification]: " str "; ") -2 ")" |
| 23868 | 536 " do" \n |
| 537 > _ \n | |
| 538 < "end " str ";" ) | |
| 539 | |
| 540 | |
| 541 (define-skeleton ada-accept | |
| 542 "Insert an accept statement (prompt for condition, name and arguments)." | |
| 543 () | |
| 544 > (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
|
545 (ada-accept-2)) |
| 23868 | 546 |
| 547 | |
| 548 (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
|
549 "Insert an or statement, prompting for the condition name." |
| 23868 | 550 () |
| 551 < "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
|
552 (ada-accept)) |
| 23868 | 553 |
| 554 | |
| 555 (define-skeleton ada-or-delay | |
| 556 "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
|
557 "[delay value]: " |
| 23868 | 558 < "or\n" |
| 559 > "delay " str ";") | |
| 560 | |
| 561 | |
| 562 (define-skeleton ada-or-terminate | |
| 563 "Insert a terminate statement." | |
| 564 () | |
| 565 < "or\n" | |
| 566 > "terminate;") | |
| 567 | |
| 568 | |
|
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
|
569 ;; ---- |
| 23868 | 570 (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
|
571 "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
|
572 (save-excursion |
| 23868 | 573 (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
|
574 (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
|
575 (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
|
576 (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
|
577 |
|
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
|
578 (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
|
579 (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
|
580 '((< '(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
|
581 (min ada-indent (current-column)))))) |
|
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
|
582 (add-hook 'skeleton-end-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
|
583 'ada-adjust-case-skeleton nil t) |
|
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
|
584 (ada-stmt-add-to-ada-menu)) |
| 23868 | 585 |
|
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
|
586 (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
|
587 |
| 23868 | 588 (provide 'ada-stmt) |
| 589 | |
| 590 ;;; ada-stmt.el ends here |
