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