annotate lisp/=ada.el @ 680:f99c8512cd41

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