annotate lisp/=ada.el @ 381:0673e72f6c8c

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Sun, 11 Aug 1991 04:35:38 +0000
parents 1fe1ce5c6c43
children 8a533acedb77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1 ; Ada editing support package in GNUlisp. v1.0
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
2 ; Author: Vincent Broman <broman@bugs.nosc.mil> May 1987.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
3 ; (borrows heavily from Mick Jordan's Modula-2 package for GNU,
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
4 ; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
5
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
6 ;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
7
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 1, or (at your option)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 ;; any later version.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
23
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24 (setq auto-mode-alist (cons (cons "\\.ada$" 'ada-mode) auto-mode-alist))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
25
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
26 (defvar ada-mode-syntax-table nil
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
27 "Syntax table in use in Ada-mode buffers.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29 (let ((table (make-syntax-table)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
30 (modify-syntax-entry ?_ "_" table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
31 (modify-syntax-entry ?\# "_" table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 (modify-syntax-entry ?\( "()" table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
33 (modify-syntax-entry ?\) ")(" table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34 (modify-syntax-entry ?$ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
35 (modify-syntax-entry ?* "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
36 (modify-syntax-entry ?/ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37 (modify-syntax-entry ?+ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
38 (modify-syntax-entry ?- "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 (modify-syntax-entry ?= "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40 (modify-syntax-entry ?\& "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 (modify-syntax-entry ?\| "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 (modify-syntax-entry ?< "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 (modify-syntax-entry ?> "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44 (modify-syntax-entry ?\[ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 (modify-syntax-entry ?\] "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 (modify-syntax-entry ?\{ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47 (modify-syntax-entry ?\} "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48 (modify-syntax-entry ?. "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 (modify-syntax-entry ?\\ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50 (modify-syntax-entry ?: "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
51 (modify-syntax-entry ?\; "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 (modify-syntax-entry ?\' "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
53 (modify-syntax-entry ?\" "\"" table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
54 (setq ada-mode-syntax-table table))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
55
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
56 (defvar ada-mode-map nil
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
57 "Keymap used in Ada mode.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 (let ((map (make-sparse-keymap)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
60 (define-key map "\C-m" 'ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 (define-key map "\C-?" 'backward-delete-char-untabify)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62 (define-key map "\C-i" 'ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63 (define-key map "\C-c\C-i" 'ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
64 (define-key map "\C-c<" 'ada-backward-to-same-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65 (define-key map "\C-c>" 'ada-forward-to-same-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66 (define-key map "\C-ch" 'ada-header)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
67 (define-key map "\C-c(" 'ada-paired-parens)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68 (define-key map "\C-c-" 'ada-inline-comment)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
69 (define-key map "\C-c\C-a" 'ada-array)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
70 (define-key map "\C-cb" 'ada-exception-block)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
71 (define-key map "\C-cd" 'ada-declare-block)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 (define-key map "\C-c\C-e" 'ada-exception)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73 (define-key map "\C-cc" 'ada-case)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
74 (define-key map "\C-c\C-k" 'ada-package-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75 (define-key map "\C-ck" 'ada-package-body)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
76 (define-key map "\C-c\C-p" 'ada-procedure-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
77 (define-key map "\C-cp" 'ada-subprogram-body)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
78 (define-key map "\C-c\C-f" 'ada-function-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
79 (define-key map "\C-cf" 'ada-for-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
80 (define-key map "\C-cl" 'ada-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
81 (define-key map "\C-ci" 'ada-if)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
82 (define-key map "\C-cI" 'ada-elsif)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
83 (define-key map "\C-ce" 'ada-else)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84 (define-key map "\C-c\C-v" 'ada-private)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
85 (define-key map "\C-c\C-r" 'ada-record)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
86 (define-key map "\C-c\C-s" 'ada-subtype)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
87 (define-key map "\C-cs" 'ada-separate)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
88 (define-key map "\C-c\C-t" 'ada-type)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
89 (define-key map "\C-ct" 'ada-tabsize)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
90 ;; (define-key map "\C-c\C-u" 'ada-use)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
91 ;; (define-key map "\C-c\C-w" 'ada-with)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
92 (define-key map "\C-cw" 'ada-while-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
93 (define-key map "\C-c\C-w" 'ada-when)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 (define-key map "\C-cx" 'ada-exit)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
95 (define-key map "\C-cC" 'ada-compile)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
96 (define-key map "\C-cB" 'ada-bind)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
97 (define-key map "\C-cE" 'ada-find-listing)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98 (define-key map "\C-cL" 'ada-library-name)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99 (define-key map "\C-cO" 'ada-options-for-bind)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
100 (setq ada-mode-map map))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
101
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
102 (defvar ada-indent 4 "*Value is the number of columns to indent in Ada-Mode.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
103
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
104 (defun ada-mode ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
105 "This is a mode intended to support program development in Ada.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
106 Most control constructs and declarations of Ada can be inserted in the buffer
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
107 by typing Control-C followed by a character mnemonic for the construct.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
108
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
109 \\<ada-mode-map>\\[ada-array] array \\[ada-exception-block] exception block
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
110 \\[ada-exception] exception \\[ada-declare-block] declare block
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
111 \\[ada-package-spec] package spec \\[ada-package-body] package body
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
112 \\[ada-procedure-spec] procedure spec \\[ada-subprogram-body] proc/func body
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
113 \\[ada-function-spec] func spec \\[ada-for-loop] for loop
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
114 \\[ada-if] if
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
115 \\[ada-elsif] elsif
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
116 \\[ada-else] else
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
117 \\[ada-private] private \\[ada-loop] loop
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
118 \\[ada-record] record \\[ada-case] case
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
119 \\[ada-subtype] subtype \\[ada-separate] separate
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
120 \\[ada-type] type \\[ada-tabsize] tab spacing for indents
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
121 \\[ada-when] when \\[ada-while] while
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
122 \\[ada-exit] exit
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
123 \\[ada-paired-parens] paired parens \\[ada-inline-comment] inline comment
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
124 \\[ada-header] header spec
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
125 \\[ada-compile] compile \\[ada-bind] bind
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
126 \\[ada-find-listing] find error list
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
127 \\[ada-library-name] name library \\[ada-options-for-bind] options for bind
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
128
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
129 \\[ada-backward-to-same-indent] and \\[ada-forward-to-same-indent] move backward and forward respectively to the next line
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
130 having the same (or lesser) level of indentation.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
131
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
132 Variable `ada-indent' controls the number of spaces for indent/undent."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
134 (kill-all-local-variables)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
135 (use-local-map ada-mode-map)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
136 (setq major-mode 'ada-mode)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
137 (setq mode-name "Ada")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
138 (make-local-variable 'comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
139 (setq comment-column 41)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
140 (make-local-variable 'end-comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
141 (setq end-comment-column 72)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
142 (set-syntax-table ada-mode-syntax-table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
143 (make-local-variable 'paragraph-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
144 (setq paragraph-start (concat "^$\\|" page-delimiter))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
145 (make-local-variable 'paragraph-separate)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
146 (setq paragraph-separate paragraph-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
147 (make-local-variable 'paragraph-ignore-fill-prefix)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148 (setq paragraph-ignore-fill-prefix t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
149 ; (make-local-variable 'indent-line-function)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
150 ; (setq indent-line-function 'c-indent-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
151 (make-local-variable 'require-final-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
152 (setq require-final-newline t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
153 (make-local-variable 'comment-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154 (setq comment-start "--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
155 (make-local-variable 'comment-end)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156 (setq comment-end "")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
157 (make-local-variable 'comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (setq comment-column 41)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 (make-local-variable 'comment-start-skip)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160 (setq comment-start-skip "--+ *")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
161 (make-local-variable 'comment-indent-hook)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 (setq comment-indent-hook 'c-comment-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 (make-local-variable 'parse-sexp-ignore-comments)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164 (setq parse-sexp-ignore-comments t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 (run-hooks 'ada-mode-hook))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167 (defun ada-tabsize (s)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
168 "Changes spacing used for indentation.
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
169 The prefix argument is used as the new spacing."
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
170 (interactive "p")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 (setq ada-indent s))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
172
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
173 (defun ada-newline ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
174 "Start new line and indent to current tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
175 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
176 (let ((ada-cc (current-indentation)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
177 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
178 (indent-to ada-cc)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
179
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
180 (defun ada-tab ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
181 "Indent to next tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
182 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
183 (indent-to (* (1+ (/ (current-indentation) ada-indent)) ada-indent)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
184
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
185 (defun ada-untab ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
186 "Delete backwards to previous tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
187 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
188 (backward-delete-char-untabify ada-indent nil))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
189
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
190 (defun ada-go-to-this-indent (step indent-level)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
191 "Move point repeatedly by STEP lines until the current line has
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
192 given INDENT-LEVEL or less, or the start or end of the buffer is reached.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
193 Ignore blank lines, statement labels and block or loop names."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
194 (while (and
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
195 (zerop (forward-line step))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
196 (or (looking-at "^[ ]*$")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
197 (looking-at "^[ ]*--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
198 (looking-at "^<<[A-Za-z0-9_]+>>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
199 (looking-at "^[A-Za-z0-9_]+:")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
200 (> (current-indentation) indent-level)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
201 nil))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
202
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
203 (defun ada-backward-to-same-indent ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
204 "Move point backwards to nearest line with same indentation or less.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
205 If not found, point is left at the top of the buffer."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
206 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
207 (ada-go-to-this-indent -1 (current-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
208 (back-to-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
209
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
210 (defun ada-forward-to-same-indent ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
211 "Move point forwards to nearest line with same indentation or less.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
212 If not found, point is left at the start of the last line in the buffer."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
213 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
214 (ada-go-to-this-indent 1 (current-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
215 (back-to-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
216
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
217 (defun ada-array ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
218 "Insert array type definition. Uses the minibuffer to prompt
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
219 for component type and index subtypes."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
220 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
221 (insert "array ()")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
222 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
223 (insert (read-string "index subtype[s]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
224 (end-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
225 (insert " of ;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
226 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
227 (insert (read-string "component-type: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
228 (end-of-line))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
229
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
230 (defun ada-case ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
231 "Build skeleton case statement.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
232 Uses the minibuffer to prompt for the selector expression.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
233 Also builds the first when clause."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
234 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
235 (insert "case ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
236 (insert (read-string "selector expression: ") " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
237 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
238 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
239 (insert "end case;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
240 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
241 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
242 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
243 (ada-when))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
244
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
245 (defun ada-declare-block ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
246 "Insert a block with a declare part.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
247 Indent for the first declaration."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
248 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
249 (let ((ada-block-name (read-string "[block name]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
250 (insert "declare")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
251 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
252 ( (not (string-equal ada-block-name ""))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
253 (beginning-of-line)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
254 (open-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
255 (insert ada-block-name ":")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
256 (next-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
257 (end-of-line)))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
258 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
259 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
260 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
261 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
262 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
263 (if (string-equal ada-block-name "")
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
264 (insert "end;")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
265 (insert "end " ada-block-name ";"))
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
266 )
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
267 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
268 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
269
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
270 (defun ada-exception-block ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
271 "Insert a block with an exception part.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
272 Indent for the first line of code."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
273 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
274 (let ((block-name (read-string "[block name]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
275 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
276 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
277 ( (not (string-equal block-name ""))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
278 (beginning-of-line)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
279 (open-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
280 (insert block-name ":")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
281 (next-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
282 (end-of-line)))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
283 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
284 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
285 (insert "exception")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
286 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
287 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
288 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
289 ( (string-equal block-name "")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
290 (insert "end;"))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
291 ( t
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
292 (insert "end " block-name ";")))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
293 )
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
294 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
295 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
296
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
297 (defun ada-exception ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
298 "Insert an indented exception part into a block."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
299 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
300 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
301 (insert "exception")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
302 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
303 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
304
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
305 (defun ada-else ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
306 "Add an else clause inside an if-then-end-if clause."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
307 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
308 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
309 (insert "else")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
310 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
311 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
312
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
313 (defun ada-exit ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
314 "Insert an exit statement, prompting for loop name and condition."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
315 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
316 (insert "exit")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
317 (let ((ada-loop-name (read-string "[name of loop to exit]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
318 (if (not (string-equal ada-loop-name "")) (insert " " ada-loop-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
319 (let ((ada-exit-condition (read-string "[exit condition]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
320 (if (not (string-equal ada-exit-condition ""))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
321 (if (string-match "^ *[Ww][Hh][Ee][Nn] +" ada-exit-condition)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
322 (insert " " ada-exit-condition)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
323 (insert " when " ada-exit-condition))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
324 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
325
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
326 (defun ada-when ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
327 "Start a case statement alternative with a when clause."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
328 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
329 (ada-untab) ; we were indented in code for the last alternative.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
330 (insert "when ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
331 (insert (read-string "'|'-delimited choice list: ") " =>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
332 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
333 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
334
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
335 (defun ada-for-loop ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
336 "Build a skeleton for-loop statement, prompting for the loop parameters."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
337 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
338 (insert "for ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
339 (let* ((ada-loop-name (read-string "[loop name]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
340 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
341 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
342 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
343 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
344 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
345 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
346 (next-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
347 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
348 (insert (read-string "loop variable: ") " in ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
349 (insert (read-string "range: ") " loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
350 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
351 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
352 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
353 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
354 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
355 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
356 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
357
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
358 (defun ada-header ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
359 "Insert a comment block containing the module title, author, etc."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
360 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
361 (insert "--\n-- Title: \t")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
362 (insert (read-string "Title: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
363 (insert "\n-- Created:\t" (current-time-string))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
364 (insert "\n-- Author: \t" (user-full-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
365 (insert "\n--\t\t<" (user-login-name) "@" (system-name) ">\n--\n"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
366
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
367 (defun ada-if ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
368 "Insert skeleton if statment, prompting for a boolean-expression."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
369 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
370 (insert "if ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
371 (insert (read-string "condition: ") " then")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
372 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
373 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
374 (insert "end if;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
375 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
376 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
377
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
378 (defun ada-elsif ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
379 "Add an elsif clause to an if statement, prompting for the boolean-expression."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
380 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
381 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
382 (insert "elsif ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
383 (insert (read-string "condition: ") " then")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
384 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
385 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
386
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
387 (defun ada-loop ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
388 "Insert a skeleton loop statement. exit statement added by hand."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
389 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
390 (insert "loop ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
391 (let* ((ada-loop-name (read-string "[loop name]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
392 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
393 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
394 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
395 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
396 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
397 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
398 (forward-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
399 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
400 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
401 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
402 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
403 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
404 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
405 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
406 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
407
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
408 (defun ada-package-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
409 "Insert a skeleton package specification."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
410 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
411 (insert "package ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
412 (let ((ada-package-name (read-string "package name: " )))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
413 (insert ada-package-name " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
414 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
415 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
416 (insert "end " ada-package-name ";")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
417 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
418 (ada-tab)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
419
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
420 (defun ada-package-body ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
421 "Insert a skeleton package body -- includes a begin statement."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
422 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
423 (insert "package body ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
424 (let ((ada-package-name (read-string "package name: " )))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
425 (insert ada-package-name " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
426 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
427 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
428 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
429 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
430 (insert "end " ada-package-name ";")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
431 (end-of-line -1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
432 (ada-tab)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
433
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
434 (defun ada-private ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
435 "Undent and start a private section of a package spec. Reindent."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
436 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
437 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
438 (insert "private")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
439 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
440 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
441
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
442 (defun ada-get-arg-list ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
443 "Read from the user a procedure or function argument list.
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
444 Add parens unless arguments absent, and insert into buffer.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
445 Individual arguments are arranged vertically if entered one at a time.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
446 Arguments ending with `;' are presumed single and stacked."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
447 (insert " (")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
448 (let ((ada-arg-indent (current-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
449 (ada-args (read-string "[arguments]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
450 (if (string-equal ada-args "")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
451 (backward-delete-char 2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
452 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
453 (while (string-match ";$" ada-args)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
454 (insert ada-args)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
455 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
456 (indent-to ada-arg-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
457 (setq ada-args (read-string "next argument: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
458 (insert ada-args ")")))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
459
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
460 (defun ada-function-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
461 "Insert a function specification. Prompts for name and arguments."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
462 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
463 (insert "function ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
464 (insert (read-string "function name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
465 (ada-get-arg-list)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
466 (insert " return ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
467 (insert (read-string "result type: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
468
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
469 (defun ada-procedure-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
470 "Insert a procedure specification, prompting for its name and arguments."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
471 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
472 (insert "procedure ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
473 (insert (read-string "procedure name: " ))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
474 (ada-get-arg-list))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
475
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
476 (defun get-ada-subprogram-name ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
477 "Return (without moving point or mark) a pair whose CAR is the name of
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
478 the function or procedure whose spec immediately precedes point, and whose
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
479 CDR is the column number where the procedure/function keyword was found."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
480 (save-excursion
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
481 (let ((ada-proc-indent 0))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
482 (if (re-search-backward
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
483 ;;;; Unfortunately, comments are not ignored in this string search.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
484 "[PpFf][RrUu][OoNn][Cc][EeTt][DdIi][UuOo][RrNn]" nil t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
485 (if (or (looking-at "\\<[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee]\\>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
486 (looking-at "\\<[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\>"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
487 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
488 (setq ada-proc-indent (current-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
489 (forward-word 2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
490 (let ((p2 (point)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
491 (forward-word -1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
492 (cons (buffer-substring (point) p2) ada-proc-indent)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
493 (get-ada-subprogram-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
494 (cons "NAME?" ada-proc-indent)))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
495
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
496 (defun ada-subprogram-body ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
497 "Insert frame for subprogram body.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
498 Invoke right after `ada-function-spec' or `ada-procedure-spec'."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
499 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
500 (insert " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
501 (let ((ada-subprogram-name-col (get-ada-subprogram-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
502 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
503 (indent-to (cdr ada-subprogram-name-col))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
504 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
505 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
506 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
507 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
508 (insert "end " (car ada-subprogram-name-col) ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
509 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
510 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
511
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
512 (defun ada-separate ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
513 "Finish a body stub with `is separate'."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
514 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
515 (insert " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
516 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
517 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
518 (insert "separate;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
519 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
520 (ada-untab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
521
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
522 ;(defun ada-with ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
523 ; "Inserts a with clause, prompting for the list of units depended upon."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
524 ; (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
525 ; (insert "with ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
526 ; (insert (read-string "list of units depended upon: ") ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
527 ;
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
528 ;(defun ada-use ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
529 ; "Inserts a use clause, prompting for the list of packages used."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
530 ; (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
531 ; (insert "use ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
532 ; (insert (read-string "list of packages to use: ") ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
533
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
534 (defun ada-record ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
535 "Insert a skeleton record type declaration."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
536 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
537 (insert "record")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
538 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
539 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
540 (insert "end record;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
541 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
542 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
543
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
544 (defun ada-subtype ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
545 "Start insertion of a subtype declaration, prompting for the subtype name."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
546 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
547 (insert "subtype " (read-string "subtype name: ") " is ;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
548 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
549 (message "insert subtype indication."))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
550
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
551 (defun ada-type ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
552 "Start insertion of a type declaration, prompting for the type name."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
553 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
554 (insert "type " (read-string "type name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
555 (let ((disc-part (read-string "discriminant specs: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
556 (if (not (string-equal disc-part ""))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
557 (insert "(" disc-part ")")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
558 (insert " is ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
559 (message "insert type definition."))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
560
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
561 (defun ada-while-loop ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
562 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
563 (insert "while ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
564 (let* ((ada-loop-name (read-string "loop name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
565 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
566 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
567 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
568 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
569 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
570 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
571 (next-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
572 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
573 (insert (read-string "entry condition: ") " loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
574 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
575 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
576 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
577 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
578 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
579 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
580 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
581
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
582 (defun ada-paired-parens ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
583 "Insert a pair of round parentheses, placing point between them."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
584 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
585 (insert "()")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
586 (backward-char))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
587
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
588 (defun ada-inline-comment ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
589 "Start a comment after the end of the line, indented at least
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
590 `comment-column' spaces. If starting after `end-comment-column',
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
591 start a new line."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
592 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
593 (end-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
594 (if (> (current-column) end-comment-column) (newline))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
595 (if (< (current-column) comment-column) (indent-to comment-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
596 (insert " -- "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
597
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
598 (defun ada-display-comment ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
599 "Inserts three comment lines, making a display comment."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
600 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
601 (insert "--\n-- \n--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
602 (end-of-line 0))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
603
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
604 ;; Much of this is specific to Ada-Ed
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
605
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
606 (defvar ada-lib-dir-name "lib" "*Current Ada program library directory.")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
607 (defvar ada-bind-opts "" "*Options to supply for binding.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
608
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
609 (defun ada-library-name (ada-lib-name)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
610 "Specify name of Ada library directory for later compilations."
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
611 (interactive "DName of Ada library directory: ")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
612 (setq ada-lib-dir-name ada-lib-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
613
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
614 (defun ada-options-for-bind ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
615 "Specify options, such as -m and -i, needed for `ada-bind'."
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
616 (setq ada-bind-opts (read-string "-m and -i options for `ada-bind': ")))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
617
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
618 (defun ada-compile (arg)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
619 "Save the current buffer and compile it into the current program library.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
620 Initialize the library if a prefix arg is given."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
621 (interactive "P")
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
622 (let* ((ada-init (if (null arg) "" "-n "))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
623 (ada-source-file (buffer-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
624 (compile
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
625 (concat "adacomp " ada-init "-l " ada-lib-dir-name " " ada-source-file))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
626
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
627 (defun ada-find-listing ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
628 "Find listing file for ada source in current buffer, using other window."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
629 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
630 (find-file-other-window (concat (substring (buffer-name) 0 -4) ".lis"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
631 (search-forward "*** ERROR"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
632
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
633 (defun ada-bind ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
634 "Bind the current program library, using the current binding options."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
635 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
636 (compile (concat "adabind " ada-bind-opts " " ada-lib-dir-name)))