annotate lisp/progmodes/ada-stmt.el @ 32771:61564c5b033d

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Mon, 23 Oct 2000 13:16:41 +0000
parents 0f1f7e931493
children d29063c1c480
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
32301
0f1f7e931493 Fix header line, copyright notice.
Dave Love <fx@gnu.org>
parents: 30409
diff changeset
6 ;; Ada Core Technologies's version: $Revision: 1.6 $
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>
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9 ;; Maintainer: Rolf Ebert <ebert@waporo.muc.de>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; Keywords: languages, ada
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; Rolf Ebert's version: 2.26
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;;; Commentary:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; put the following statement in your .emacs:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; (require 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;;; History:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22 ;; Created May 1987.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23 ;; Original version from V. Bowman as in ada.el of Emacs-18
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24 ;; (borrowed heavily from Mick Jordan's Modula-2 package for GNU,
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27 ;; Sep 1993. Daniel Pfeiffer <pfeiffer@cict.fr> (DP)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 ;; Introduced statement.el for smaller code and user configurability.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 ;; Nov 1993. Rolf Ebert <ebert@enpc.fr> (RE) Moved the
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 ;; skeleton generation into this separate file. The code still is
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32 ;; essentially written by DP
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 ;; Adapted Jun 1994. Markus Heritsch
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 ;; <Markus.Heritsch@studbox.uni-stuttgart.de> (MH)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 ;; added menu bar support for templates
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 ;; 1994/12/02 Christian Egli <cegli@hcsd.hac.com>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 ;; General cleanup and bug fixes.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40 ;;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;; enhancements and bug fixes.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 ;; BUGS:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
46 ;;;> I have the following suggestions for the function template: 1) I
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 ;;;> don't want it automatically assigning it a name for the return variable. I
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 ;;;> never want it to be called "Result" because that is nondescriptive. If you
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 ;;;> must define a variable, give me the ability to specify its name.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 ;;;>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51 ;;;> 2) You do not provide a type for variable 'Result'. Its type is the same
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52 ;;;> as the function's return type, which the template knows, so why force me
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53 ;;;> to type it in?
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54 ;;;>
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
55
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56 ;;;It would be nice if one could configure such layout details separately
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57 ;;;without patching the LISP code. Maybe the metalanguage used in ada-stmt.el
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 ;;;could be taken even further, providing the user with some nice syntax
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59 ;;;for describing layout. Then my own hacks would survive the next
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 ;;;update of the package :-)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
62
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
63 ;;; Code:
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
69 (require 'easymenu)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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 ()
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
72 "Add a new submenu to the Ada menu"
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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"))
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
123 t))
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
124 ))
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 (defun ada-func-or-proc-name ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 ;; Get the name of the current function or procedure."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132 (let ((case-fold-search t))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 (if (re-search-backward ada-procedure-start-regexp nil t)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 (buffer-substring (match-beginning 2) (match-end 2))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135 "NAME?"))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137 (defvar ada-template-map nil
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138 "Keymap used in Ada mode for smart template operations.")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
140 (define-key ada-mode-map "\C-cth" 'ada-header)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
141 (define-key ada-mode-map "\C-ct\C-a" 'ada-array)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
142 (define-key ada-mode-map "\C-ctb" 'ada-exception-block)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
143 (define-key ada-mode-map "\C-ctd" 'ada-declare-block)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
144 (define-key ada-mode-map "\C-ctc" 'ada-case)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
145 (define-key ada-mode-map "\C-ct\C-e" 'ada-elsif)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
146 (define-key ada-mode-map "\C-cte" 'ada-else)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
147 (define-key ada-mode-map "\C-ct\C-k" 'ada-package-spec)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
148 (define-key ada-mode-map "\C-ctk" 'ada-package-body)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
149 (define-key ada-mode-map "\C-ct\C-p" 'ada-procedure-spec)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
150 (define-key ada-mode-map "\C-ctp" 'ada-subprogram-body)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
151 (define-key ada-mode-map "\C-ct\C-f" 'ada-function-spec)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
152 (define-key ada-mode-map "\C-ctf" 'ada-for-loop)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
153 (define-key ada-mode-map "\C-cti" 'ada-if)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
154 (define-key ada-mode-map "\C-ctl" 'ada-loop)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
155 (define-key ada-mode-map "\C-ct\C-r" 'ada-record)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
156 (define-key ada-mode-map "\C-ct\C-s" 'ada-subtype)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
157 (define-key ada-mode-map "\C-ctS" 'ada-tabsize)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
158 (define-key ada-mode-map "\C-ct\C-t" 'ada-task-spec)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
159 (define-key ada-mode-map "\C-ctt" 'ada-task-body)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
160 (define-key ada-mode-map "\C-ct\C-y" 'ada-type)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
161 (define-key ada-mode-map "\C-ct\C-v" 'ada-private)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
162 (define-key ada-mode-map "\C-ctu" 'ada-use)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
163 (define-key ada-mode-map "\C-ct\C-u" 'ada-with)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
164 (define-key ada-mode-map "\C-ct\C-w" 'ada-when)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
165 (define-key ada-mode-map "\C-ctw" 'ada-while-loop)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
166 (define-key ada-mode-map "\C-ct\C-x" 'ada-exception)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
167 (define-key ada-mode-map "\C-ctx" 'ada-exit)
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 ;;; ---- statement skeletons ------------------------------------------
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
171 (define-skeleton ada-array
26000
c9e91fc553e6 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25902
diff changeset
172 "Insert array type definition.
26226
b63d041c9108 Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 26000
diff changeset
173 Prompt for component type and index subtypes."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
174 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
175 "array (" ("index definition: " str ", " ) -2 ") of " _ ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 (define-skeleton ada-case
26000
c9e91fc553e6 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25902
diff changeset
179 "Build skeleton case statement.
c9e91fc553e6 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25902
diff changeset
180 Prompt for the selector expression. Also builds the first when clause."
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181 "[selector expression]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182 "case " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183 > "when " ("discrete choice: " str " | ") -3 " =>" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185 < < "end case;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188 (define-skeleton ada-when
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 "Start a case statement alternative with a when clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
191 < "when " ("discrete choice: " str " | ") -3 " =>" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
194
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195 (define-skeleton ada-declare-block
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
196 "Insert a block with a declare part.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
197 Indent for the first declaration."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
198 "[block name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
199 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200 > "declare" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202 < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 < "end " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 (define-skeleton ada-exception-block
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
208 "Insert a block with an exception part.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 Indent for the first line of code."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210 "[block name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212 > "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 < "exception" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 > \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216 < "end " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
219 (define-skeleton ada-exception
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220 "Insert an indented exception part into a block."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222 < "exception" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
223 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226 (define-skeleton ada-exit-1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 "Insert then exit condition of the exit statement, prompting for condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 "[exit condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 "when " str | -5)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232 (define-skeleton ada-exit
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233 "Insert an exit statement, prompting for loop name and condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234 "[name of loop to exit]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 "exit " str & ?\
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 (ada-exit-1)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
239 ;;;###autoload
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240 (defun ada-header ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
241 "Insert a descriptive header at the top of the file."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
242 (interactive "*")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 (goto-char (point-min))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
247 (ada-header-tmpl))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
248
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
249
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250 (define-skeleton ada-header-tmpl
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
251 "Insert a comment block containing the module title, author, etc."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
252 "[Description]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
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 "Author : " (user-full-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 "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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
262 "\n")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
263
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
264
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265 (define-skeleton ada-display-comment
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 "Inserts three comment lines, making a display comment."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271 (define-skeleton ada-if
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 "Insert skeleton if statment, prompting for a boolean-expression."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
273 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 "if " str " then" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
276 < "end if;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
277
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
278
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
279 (define-skeleton ada-elsif
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
280 "Add an elsif clause to an if statement,
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
281 prompting for the boolean-expression."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
282 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 < "elsif " str " then" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
284 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
285
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
286
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
287 (define-skeleton ada-else
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
288 "Add an else clause inside an if-then-end-if clause."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
289 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
290 < "else" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
291 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
292
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 (define-skeleton ada-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 "Insert a skeleton loop statement. The exit statement is added by hand."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
297 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298 > "loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303 (define-skeleton ada-for-loop-prompt-variable
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
304 "Prompt for the loop variable."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
305 "[loop variable]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
306 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
307
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
308
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
309 (define-skeleton ada-for-loop-prompt-range
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
310 "Prompt for the loop range."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
311 "[loop range]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
312 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
313
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
314
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
315 (define-skeleton ada-for-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
316 "Build a skeleton for-loop statement, prompting for the loop parameters."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
317 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
318 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
319 > "for "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
320 (ada-for-loop-prompt-variable)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
321 " in "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
322 (ada-for-loop-prompt-range)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 " loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
324 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
325 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
326
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
327
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
328 (define-skeleton ada-while-loop-prompt-entry-condition
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
329 "Prompt for the loop entry condition."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
330 "[entry condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
331 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
332
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
333
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
334 (define-skeleton ada-while-loop
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
335 "Insert a skeleton while loop statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
336 "[loop name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
337 < str & ?: & \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
338 > "while "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
339 (ada-while-loop-prompt-entry-condition)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
340 " loop" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
341 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
342 < "end loop " str | -1 ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
343
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
344
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
345 (define-skeleton ada-package-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
346 "Insert a skeleton package specification."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347 "[package name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
348 "package " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
349 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
350 < "end " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
351
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
352
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
353 (define-skeleton ada-package-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
354 "Insert a skeleton package body -- includes a begin statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
355 "[package name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
356 "package body " str " is" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
357 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
358 ; < "begin" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
359 < "end " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
361
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
362 (define-skeleton ada-private
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
363 "Undent and start a private section of a package spec. Reindent."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
364 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365 < "private" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366 >)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
367
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
368
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369 (define-skeleton ada-function-spec-prompt-return
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
370 "Prompts for function result type."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371 "[result type]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
372 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
373
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
374
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
375 (define-skeleton ada-function-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
376 "Insert a function specification. Prompts for name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
377 "[function name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
378 "function " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379 " (" ("[parameter_specification]: " str "; " ) -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380 " return "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381 (ada-function-spec-prompt-return)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
382 ";" \n )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
383
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
384
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 (define-skeleton ada-procedure-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
386 "Insert a procedure specification, prompting for its name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
387 "[procedure name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
388 "procedure " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
389 " (" ("[parameter_specification]: " str "; " ) -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
390 ";" \n )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
391
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
392
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
393 (define-skeleton ada-subprogram-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
394 "Insert frame for subprogram body.
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
395 Invoke right after `ada-function-spec' or `ada-procedure-spec'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
396 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
397 ;; Remove `;' from subprogram decl
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
401 (if (ada-search-ignore-string-comment "(" nil pos t 'search-forward)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
402 (progn
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
403 (backward-char 1)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
404 (forward-sexp 1)))
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
405 )
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
406 (if (looking-at ";")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
418
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
419 (define-skeleton ada-separate
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
420 "Finish a body stub with `separate'."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
421 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
422 > "separate;" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
423 <)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
424
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
425
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
426 ;(define-skeleton ada-with
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
427 ; "Inserts a with clause, prompting for the list of units depended upon."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
428 ; "[list of units depended upon]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
429 ; "with " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
430
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
431 ;(define-skeleton ada-use
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
432 ; "Inserts a use clause, prompting for the list of packages used."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
433 ; "[list of packages used]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
434 ; "use " str ?\;)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
435
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
436
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
437 (define-skeleton ada-record
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
438 "Insert a skeleton record type declaration."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
439 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
440 "record" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
441 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
442 < "end record;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
443
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
444
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
445 (define-skeleton ada-subtype
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
446 "Start insertion of a subtype declaration, prompting for the subtype name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
447 "[subtype name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
448 "subtype " str " is " _ ?\;
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
449 (not (message "insert subtype indication.")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
450
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
451
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
452 (define-skeleton ada-type
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
453 "Start insertion of a type declaration, prompting for the type name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
454 "[type name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
455 "type " str ?\(
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456 ("[discriminant specs]: " str " ")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457 | (backward-delete-char 1) | ?\)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458 " is "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
459 (not (message "insert type definition.")))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
460
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
461
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462 (define-skeleton ada-task-body
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
463 "Insert a task body, prompting for the task name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
464 "[task name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465 "task body " str " is\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
466 "begin\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
467 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
468 < "end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
469
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
470
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 (define-skeleton ada-task-spec
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
472 "Insert a task specification, prompting for the task name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
473 "[task name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
474 "task " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
475 " (" ("[discriminant]: " str "; ") ") is\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
476 > "entry " _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
477 <"end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
479
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 (define-skeleton ada-get-param1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481 "Prompt for arguments and if any enclose them in brackets."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483 ("[parameter_specification]: " str "; " ) & -2 & ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
486
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
487 (define-skeleton ada-get-param
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
488 "Prompt for arguments and if any enclose them in brackets."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
489 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
490 " ("
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491 (ada-get-param1) | -2
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
492 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
494
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
495 (define-skeleton ada-entry
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
496 "Insert a task entry, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
497 "[entry name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498 "entry " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 ";" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
501 ; (ada-indent-current)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
502 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
503
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
504
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
505 (define-skeleton ada-entry-family-prompt-discriminant
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
506 "Insert a entry specification, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
507 "[discriminant name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
508 str)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
509
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
510
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
511 (define-skeleton ada-entry-family
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
512 "Insert a entry specification, prompting for the entry name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
513 "[entry name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
514 "entry " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
515 " (" (ada-entry-family-prompt-discriminant) ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
516 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
517 ";" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518 ;(ada-indent-current)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
520
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
522 (define-skeleton ada-select
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
523 "Insert a select block."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
524 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
525 "select\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
526 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
527 < "end select;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
529
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
530 (define-skeleton ada-accept-1
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
531 "Insert a condition statement, prompting for the condition name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
532 "[condition]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
533 "when " str | -5 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
534
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536 (define-skeleton ada-accept-2
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
537 "Insert an accept statement, prompting for the name and arguments."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
538 "[accept name]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
539 > "accept " str
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
540 (ada-get-param)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541 ; " (" ("[parameter_specification]: " str "; ") -2 ")"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
542 " do" \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
543 > _ \n
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
544 < "end " str ";" )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
545
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547 (define-skeleton ada-accept
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
548 "Insert an accept statement (prompt for condition, name and arguments)."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
549 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
550 > (ada-accept-1) & " =>\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
551 (ada-accept-2)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
552 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
553
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
554
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
555 (define-skeleton ada-or-accept
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
556 "Insert a or statement, prompting for the condition name."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
557 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
558 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
559 (ada-accept)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
560 )
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
561
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
562
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
563 (define-skeleton ada-or-delay
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
564 "Insert a delay statement, prompting for the delay value."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
565 "[delay value]: "
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
566 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
567 > "delay " str ";")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
568
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
569
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
570 (define-skeleton ada-or-terminate
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
571 "Insert a terminate statement."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
572 ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
573 < "or\n"
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
574 > "terminate;")
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
575
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
576
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
577 ;; ----
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578 (defun ada-adjust-case-skeleton ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
579 "Adjusts the case of the text inserted by a skeleton."
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
580 (save-excursion
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581 (let ((aa-end (point)))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
582 (ada-adjust-case-region
30409
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
583 (progn (goto-char (symbol-value 'beg)) (forward-word -1) (point))
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584 (goto-char aa-end))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585 )))
30409
a530830f8a3d (ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents: 26226
diff changeset
586
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
587 (add-hook 'ada-mode-hook '(lambda ()
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588 (setq skeleton-further-elements
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
589 '((< '(backward-delete-char-untabify
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
590 (min ada-indent (current-column))))))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
591 (add-hook 'skeleton-end-hook
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
592 'ada-adjust-case-skeleton)))
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
593
25902
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
594 (add-hook 'ada-mode-hook 'ada-stmt-add-to-ada-menu)
92828b88cfcc (ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents: 23869
diff changeset
595
23868
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
596 (provide 'ada-stmt)
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
597
ba852f2c146b Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
598 ;;; ada-stmt.el ends here