annotate lisp/=ada.el @ 17684:e486cbd2419d

(MOUSE_SUPPORT): Delete menu-bar.elc. (lisp): Move menu-bar.elc here. Add custom.elc and cus-start.elc.
author Richard M. Stallman <rms@gnu.org>
date Tue, 06 May 1997 19:42:05 +0000
parents 60d97d9b359d
children
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
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
3 ;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
5 ;; Author: Vincent Broman <broman@bugs.nosc.mil>
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
6 ;; Keywords: languages
39
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
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
39
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
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
24 ;;; Commentary:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
25
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
26 ;; Created May 1987.
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
27 ;; (borrows heavily from Mick Jordan's Modula-2 package for GNU,
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
28 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.)
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
29
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
30 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
31
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 (defvar ada-mode-syntax-table nil
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
33 "Syntax table in use in Ada-mode buffers.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
35 (let ((table (make-syntax-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)
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
44 (modify-syntax-entry ?- ". 12" table)
39
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 (modify-syntax-entry ?\\ "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
56 (modify-syntax-entry ?: "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
57 (modify-syntax-entry ?\; "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58 (modify-syntax-entry ?\' "." table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 (modify-syntax-entry ?\" "\"" table)
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
60 (modify-syntax-entry ?\n ">" table)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 (setq ada-mode-syntax-table table))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
63 ;; Strings are a real pain in Ada because both ' and " can appear in a
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
64 ;; non-string quote context (the former as an operator, the latter as a
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
65 ;; character string). We follow the least losing solution, in which only " is
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
66 ;; a string quote. Therefore a character string of the form '"' will throw
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
67 ;; fontification off on the wrong track.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
68
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
69 (defconst ada-font-lock-keywords-1
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
70 (list
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
71 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
72 ;; Function, package (body), pragma, procedure, task (body) plus name.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
73 (list (concat "\\<\\("
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
74 "function\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
75 "p\\(ackage\\(\\|[ \t]+body\\)\\|r\\(agma\\|ocedure\\)\\)\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
76 "task\\(\\|[ \t]+body\\)"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
77 "\\)\\>[ \t]*\\(\\sw+\\(\\.\\sw*\\)*\\)?")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
78 '(1 font-lock-keyword-face) '(6 font-lock-function-name-face nil t)))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
79 "For consideration as a value of `ada-font-lock-keywords'.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
80 This does fairly subdued highlighting.")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
81
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
82 (defconst ada-font-lock-keywords-2
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
83 (append ada-font-lock-keywords-1
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
84 (list
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
85 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
86 ;; Main keywords, except those treated specially below.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
87 (concat "\\<\\("
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
88 ; ("abort" "abs" "abstract" "accept" "access" "aliased" "all"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
89 ; "and" "array" "at" "begin" "case" "declare" "delay" "delta"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
90 ; "digits" "do" "else" "elsif" "entry" "exception" "exit" "for"
9531
41a73e2f439e Add "in" to list of Font Lock keywords that appear in non-type contexts.
Simon Marshall <simon@gnu.org>
parents: 9501
diff changeset
91 ; "generic" "if" "in" "is" "limited" "loop" "mod" "not"
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
92 ; "null" "or" "others" "private" "protected"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
93 ; "range" "record" "rem" "renames" "requeue" "return" "reverse"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
94 ; "select" "separate" "tagged" "task" "terminate" "then" "until"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
95 ; "while" "xor")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
96 "a\\(b\\(ort\\|s\\(\\|tract\\)\\)\\|cce\\(pt\\|ss\\)\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
97 "l\\(iased\\|l\\)\\|nd\\|rray\\|t\\)\\|begin\\|case\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
98 "d\\(e\\(clare\\|l\\(ay\\|ta\\)\\)\\|igits\\|o\\)\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
99 "e\\(ls\\(e\\|if\\)\\|ntry\\|x\\(ception\\|it\\)\\)\\|for\\|"
9531
41a73e2f439e Add "in" to list of Font Lock keywords that appear in non-type contexts.
Simon Marshall <simon@gnu.org>
parents: 9501
diff changeset
100 "generic\\|i[fns]\\|l\\(imited\\|oop\\)\\|mod\\|n\\(ot\\|ull\\)\\|"
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
101 "o\\(r\\|thers\\)\\|pr\\(ivate\\|otected\\)\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
102 "r\\(ange\\|e\\(cord\\|m\\|names\\|queue\\|turn\\|verse\\)\\)\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
103 "se\\(lect\\|parate\\)\\|"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
104 "t\\(a\\(gged\\|sk\\)\\|erminate\\|hen\\)\\|until\\|while\\|xor"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
105 "\\)\\>")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
106 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
107 ;; Anything following end and not already fontified is a body name.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
108 '("\\<\\(end\\)\\>[ \t]*\\(\\sw+\\)?"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
109 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
110 ; ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
111 ; ;; Variable name plus optional keywords followed by a type name. Slow.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
112 ; (list (concat "\\<\\(\\sw+\\)\\>[ \t]*:"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
113 ; "[ \t]*\\(constant\\|in\\|in[ \t]+out\\|out\\)?[ \t]*"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
114 ; "\\(\\sw+\\(\\.\\sw*\\)*\\)?")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
115 ; '(1 font-lock-variable-name-face)
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
116 ; '(2 font-lock-keyword-face nil t) '(3 font-lock-type-face nil t))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
117 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
118 ;; Optional keywords followed by a type name.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
119 (list (concat ":[ \t]*\\<\\(constant\\|in\\|in[ \t]+out\\|out\\)\\>?[ \t]*"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
120 "\\(\\sw+\\(\\.\\sw*\\)*\\)?")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
121 '(1 font-lock-keyword-face nil t) '(2 font-lock-type-face nil t))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
122 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
123 ;; Keywords followed by a type or function name.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
124 (list (concat "\\<\\("
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
125 "new\\|of\\|subtype\\|type"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
126 "\\)\\>[ \t]*\\(\\sw+\\(\\.\\sw*\\)*\\)?[ \t]*\\((\\)?")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
127 '(1 font-lock-keyword-face)
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
128 '(2 (if (match-beginning 4)
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
129 font-lock-function-name-face
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
130 font-lock-type-face) nil t))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
131 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
132 ;; Keywords followed by a reference.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
133 (list (concat "\\<\\(goto\\|raise\\|use\\|when\\|with\\)\\>"
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
134 "[ \t]*\\(\\sw+\\(\\.\\sw*\\)*\\)?")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
135 '(1 font-lock-keyword-face) '(2 font-lock-reference-face nil t))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
136 ;;
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
137 ;; Goto tags.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
138 '("<<\\(\\sw+\\(\\.\\sw*\\)*\\)>>" 1 font-lock-reference-face)
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
139 ))
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
140 "For consideration as a value of `ada-font-lock-keywords'.
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
141 This does a lot more highlighting.")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
142
10881
60d97d9b359d Use font-lock-maximum-decoration to set ada-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 10866
diff changeset
143 (defvar ada-font-lock-keywords (if font-lock-maximum-decoration
60d97d9b359d Use font-lock-maximum-decoration to set ada-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 10866
diff changeset
144 ada-font-lock-keywords-2
60d97d9b359d Use font-lock-maximum-decoration to set ada-font-lock-keywords.
Simon Marshall <simon@gnu.org>
parents: 10866
diff changeset
145 ada-font-lock-keywords-1)
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
146 "Additional expressions to highlight in Ada mode.")
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
147
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148 (defvar ada-mode-map nil
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
149 "Keymap used in Ada mode.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
150
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
151 (let ((map (make-sparse-keymap)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
152 (define-key map "\C-m" 'ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
153 (define-key map "\C-?" 'backward-delete-char-untabify)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154 (define-key map "\C-i" 'ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
155 (define-key map "\C-c\C-i" 'ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156 (define-key map "\C-c<" 'ada-backward-to-same-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
157 (define-key map "\C-c>" 'ada-forward-to-same-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (define-key map "\C-ch" 'ada-header)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 (define-key map "\C-c(" 'ada-paired-parens)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160 (define-key map "\C-c-" 'ada-inline-comment)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
161 (define-key map "\C-c\C-a" 'ada-array)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 (define-key map "\C-cb" 'ada-exception-block)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 (define-key map "\C-cd" 'ada-declare-block)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164 (define-key map "\C-c\C-e" 'ada-exception)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 (define-key map "\C-cc" 'ada-case)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166 (define-key map "\C-c\C-k" 'ada-package-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167 (define-key map "\C-ck" 'ada-package-body)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
168 (define-key map "\C-c\C-p" 'ada-procedure-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
169 (define-key map "\C-cp" 'ada-subprogram-body)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
170 (define-key map "\C-c\C-f" 'ada-function-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 (define-key map "\C-cf" 'ada-for-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
172 (define-key map "\C-cl" 'ada-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
173 (define-key map "\C-ci" 'ada-if)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
174 (define-key map "\C-cI" 'ada-elsif)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
175 (define-key map "\C-ce" 'ada-else)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
176 (define-key map "\C-c\C-v" 'ada-private)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
177 (define-key map "\C-c\C-r" 'ada-record)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
178 (define-key map "\C-c\C-s" 'ada-subtype)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
179 (define-key map "\C-cs" 'ada-separate)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
180 (define-key map "\C-c\C-t" 'ada-type)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
181 (define-key map "\C-ct" 'ada-tabsize)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
182 ;; (define-key map "\C-c\C-u" 'ada-use)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
183 ;; (define-key map "\C-c\C-w" 'ada-with)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
184 (define-key map "\C-cw" 'ada-while-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
185 (define-key map "\C-c\C-w" 'ada-when)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
186 (define-key map "\C-cx" 'ada-exit)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
187 (define-key map "\C-cC" 'ada-compile)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
188 (define-key map "\C-cB" 'ada-bind)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
189 (define-key map "\C-cE" 'ada-find-listing)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
190 (define-key map "\C-cL" 'ada-library-name)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
191 (define-key map "\C-cO" 'ada-options-for-bind)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
192 (setq ada-mode-map map))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
193
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
194 (defvar ada-indent 4 "*Value is the number of columns to indent in Ada-Mode.")
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
195
9501
93bb180ef5da (ada-mode): Rename end-comment-column to ada-comment-end-column.
Richard M. Stallman <rms@gnu.org>
parents: 9469
diff changeset
196 (defvar ada-comment-end-column)
93bb180ef5da (ada-mode): Rename end-comment-column to ada-comment-end-column.
Richard M. Stallman <rms@gnu.org>
parents: 9469
diff changeset
197
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
198 (defun ada-mode ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
199 "This is a mode intended to support program development in Ada.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
200 Most control constructs and declarations of Ada can be inserted in the buffer
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
201 by typing Control-C followed by a character mnemonic for the construct.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
202
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
203 \\<ada-mode-map>\\[ada-array] array \\[ada-exception-block] exception block
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
204 \\[ada-exception] exception \\[ada-declare-block] declare block
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
205 \\[ada-package-spec] package spec \\[ada-package-body] package body
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
206 \\[ada-procedure-spec] procedure spec \\[ada-subprogram-body] proc/func body
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
207 \\[ada-function-spec] func spec \\[ada-for-loop] for loop
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
208 \\[ada-if] if
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
209 \\[ada-elsif] elsif
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
210 \\[ada-else] else
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
211 \\[ada-private] private \\[ada-loop] loop
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
212 \\[ada-record] record \\[ada-case] case
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
213 \\[ada-subtype] subtype \\[ada-separate] separate
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
214 \\[ada-type] type \\[ada-tabsize] tab spacing for indents
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
215 \\[ada-when] when \\[ada-while] while
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
216 \\[ada-exit] exit
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
217 \\[ada-paired-parens] paired parens \\[ada-inline-comment] inline comment
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
218 \\[ada-header] header spec
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
219 \\[ada-compile] compile \\[ada-bind] bind
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
220 \\[ada-find-listing] find error list
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
221 \\[ada-library-name] name library \\[ada-options-for-bind] options for bind
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
222
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
223 \\[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
224 having the same (or lesser) level of indentation.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
225
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
226 Variable `ada-indent' controls the number of spaces for indent/undent."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
227 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
228 (kill-all-local-variables)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
229 (use-local-map ada-mode-map)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
230 (setq major-mode 'ada-mode)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
231 (setq mode-name "Ada")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
232 (make-local-variable 'comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
233 (setq comment-column 41)
9501
93bb180ef5da (ada-mode): Rename end-comment-column to ada-comment-end-column.
Richard M. Stallman <rms@gnu.org>
parents: 9469
diff changeset
234 (make-local-variable 'ada-comment-end-column)
93bb180ef5da (ada-mode): Rename end-comment-column to ada-comment-end-column.
Richard M. Stallman <rms@gnu.org>
parents: 9469
diff changeset
235 (setq ada-comment-end-column 72)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
236 (set-syntax-table ada-mode-syntax-table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
237 (make-local-variable 'paragraph-start)
10866
d299e8b59919 (ada-mode): Remove ^ from paragraph-start & -separate.
Boris Goldowsky <boris@gnu.org>
parents: 10706
diff changeset
238 (setq paragraph-start (concat "$\\|" page-delimiter))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
239 (make-local-variable 'paragraph-separate)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
240 (setq paragraph-separate paragraph-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
241 (make-local-variable 'paragraph-ignore-fill-prefix)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
242 (setq paragraph-ignore-fill-prefix t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
243 ; (make-local-variable 'indent-line-function)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
244 ; (setq indent-line-function 'c-indent-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
245 (make-local-variable 'require-final-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
246 (setq require-final-newline t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
247 (make-local-variable 'comment-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
248 (setq comment-start "--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
249 (make-local-variable 'comment-end)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
250 (setq comment-end "")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
251 (make-local-variable 'comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
252 (setq comment-column 41)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
253 (make-local-variable 'comment-start-skip)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
254 (setq comment-start-skip "--+ *")
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1233
diff changeset
255 (make-local-variable 'comment-indent-function)
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1233
diff changeset
256 (setq comment-indent-function 'c-comment-indent)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
257 (make-local-variable 'parse-sexp-ignore-comments)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
258 (setq parse-sexp-ignore-comments t)
9469
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
259 (make-local-variable 'font-lock-defaults)
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
260 (setq font-lock-defaults '(ada-font-lock-keywords nil t ((?\_ . "w"))))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
261 (run-hooks 'ada-mode-hook))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
262
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
263 (defun ada-tabsize (s)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
264 "Changes spacing used for indentation.
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
265 The prefix argument is used as the new spacing."
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
266 (interactive "p")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
267 (setq ada-indent s))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
268
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
269 (defun ada-newline ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
270 "Start new line and indent to current tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
271 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
272 (let ((ada-cc (current-indentation)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
273 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
274 (indent-to ada-cc)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
275
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
276 (defun ada-tab ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
277 "Indent to next tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
278 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
279 (indent-to (* (1+ (/ (current-indentation) ada-indent)) ada-indent)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
280
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
281 (defun ada-untab ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
282 "Delete backwards to previous tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
283 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
284 (backward-delete-char-untabify ada-indent nil))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
285
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
286 (defun ada-go-to-this-indent (step indent-level)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
287 "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
288 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
289 Ignore blank lines, statement labels and block or loop names."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
290 (while (and
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
291 (zerop (forward-line step))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
292 (or (looking-at "^[ ]*$")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
293 (looking-at "^[ ]*--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
294 (looking-at "^<<[A-Za-z0-9_]+>>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
295 (looking-at "^[A-Za-z0-9_]+:")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
296 (> (current-indentation) indent-level)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
297 nil))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
298
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
299 (defun ada-backward-to-same-indent ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
300 "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
301 If not found, point is left at the top of the buffer."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
302 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
303 (ada-go-to-this-indent -1 (current-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
304 (back-to-indentation))
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-forward-to-same-indent ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
307 "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
308 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
309 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
310 (ada-go-to-this-indent 1 (current-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
311 (back-to-indentation))
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-array ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
314 "Insert array type definition. Uses the minibuffer to prompt
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
315 for component type and index subtypes."
39
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 "array ()")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
318 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
319 (insert (read-string "index subtype[s]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
320 (end-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
321 (insert " of ;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
322 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
323 (insert (read-string "component-type: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
324 (end-of-line))
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-case ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
327 "Build skeleton case statement.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
328 Uses the minibuffer to prompt for the selector expression.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
329 Also builds the first when clause."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
330 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
331 (insert "case ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
332 (insert (read-string "selector expression: ") " is")
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-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
335 (insert "end case;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
336 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
337 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
338 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
339 (ada-when))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
340
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
341 (defun ada-declare-block ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
342 "Insert a block with a declare part.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
343 Indent for the first declaration."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
344 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
345 (let ((ada-block-name (read-string "[block name]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
346 (insert "declare")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
347 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
348 ( (not (string-equal ada-block-name ""))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
349 (beginning-of-line)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
350 (open-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
351 (insert ada-block-name ":")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
352 (next-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
353 (end-of-line)))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
354 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
355 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
356 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
357 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
358 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
359 (if (string-equal ada-block-name "")
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
360 (insert "end;")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
361 (insert "end " ada-block-name ";"))
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
362 )
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
363 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
364 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
365
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
366 (defun ada-exception-block ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
367 "Insert a block with an exception part.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
368 Indent for the first line of code."
39
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 (let ((block-name (read-string "[block name]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
371 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
372 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
373 ( (not (string-equal block-name ""))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
374 (beginning-of-line)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
375 (open-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
376 (insert block-name ":")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
377 (next-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
378 (end-of-line)))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
379 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
380 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
381 (insert "exception")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
382 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
383 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
384 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
385 ( (string-equal block-name "")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
386 (insert "end;"))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
387 ( t
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
388 (insert "end " block-name ";")))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
389 )
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
390 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
391 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
392
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
393 (defun ada-exception ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
394 "Insert an indented exception part into a block."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
395 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
396 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
397 (insert "exception")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
398 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
399 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
400
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
401 (defun ada-else ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
402 "Add an else clause inside an if-then-end-if clause."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
403 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
404 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
405 (insert "else")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
406 (ada-newline)
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-exit ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
410 "Insert an exit statement, prompting for loop name and condition."
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 "exit")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
413 (let ((ada-loop-name (read-string "[name of loop to exit]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
414 (if (not (string-equal ada-loop-name "")) (insert " " ada-loop-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
415 (let ((ada-exit-condition (read-string "[exit condition]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
416 (if (not (string-equal ada-exit-condition ""))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
417 (if (string-match "^ *[Ww][Hh][Ee][Nn] +" ada-exit-condition)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
418 (insert " " ada-exit-condition)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
419 (insert " when " ada-exit-condition))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
420 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
421
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
422 (defun ada-when ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
423 "Start a case statement alternative with a when clause."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
424 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
425 (ada-untab) ; we were indented in code for the last alternative.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
426 (insert "when ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
427 (insert (read-string "'|'-delimited choice list: ") " =>")
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 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
430
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
431 (defun ada-for-loop ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
432 "Build a skeleton for-loop statement, prompting for the loop parameters."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
433 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
434 (insert "for ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
435 (let* ((ada-loop-name (read-string "[loop name]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
436 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
437 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
438 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
439 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
440 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
441 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
442 (next-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
443 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
444 (insert (read-string "loop variable: ") " in ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
445 (insert (read-string "range: ") " loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
446 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
447 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
448 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
449 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
450 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
451 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
452 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
453
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
454 (defun ada-header ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
455 "Insert a comment block containing the module title, author, etc."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
456 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
457 (insert "--\n-- Title: \t")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
458 (insert (read-string "Title: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
459 (insert "\n-- Created:\t" (current-time-string))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
460 (insert "\n-- Author: \t" (user-full-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
461 (insert "\n--\t\t<" (user-login-name) "@" (system-name) ">\n--\n"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
462
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
463 (defun ada-if ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
464 "Insert skeleton if statment, prompting for a boolean-expression."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
465 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
466 (insert "if ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
467 (insert (read-string "condition: ") " then")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
468 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
469 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
470 (insert "end if;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
471 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
472 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
473
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
474 (defun ada-elsif ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
475 "Add an elsif clause to an if statement, prompting for the boolean-expression."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
476 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
477 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
478 (insert "elsif ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
479 (insert (read-string "condition: ") " then")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
480 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
481 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
482
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
483 (defun ada-loop ()
1233
e795fe80b14e Doc fix.
Christopher Zaborsky <rogue@erratum.com>
parents: 845
diff changeset
484 "Insert a skeleton loop statement. The exit statement is added by hand."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
485 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
486 (insert "loop ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
487 (let* ((ada-loop-name (read-string "[loop name]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
488 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
489 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
490 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
491 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
492 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
493 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
494 (forward-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
495 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
496 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
497 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
498 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
499 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
500 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
501 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
502 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
503
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
504 (defun ada-package-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
505 "Insert a skeleton package specification."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
506 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
507 (insert "package ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
508 (let ((ada-package-name (read-string "package name: " )))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
509 (insert ada-package-name " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
510 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
511 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
512 (insert "end " ada-package-name ";")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
513 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
514 (ada-tab)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
515
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
516 (defun ada-package-body ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
517 "Insert a skeleton package body -- includes a begin statement."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
518 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
519 (insert "package body ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
520 (let ((ada-package-name (read-string "package name: " )))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
521 (insert ada-package-name " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
522 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
523 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
524 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
525 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
526 (insert "end " ada-package-name ";")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
527 (end-of-line -1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
528 (ada-tab)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
529
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
530 (defun ada-private ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
531 "Undent and start a private section of a package spec. Reindent."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
532 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
533 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
534 (insert "private")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
535 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
536 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
537
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
538 (defun ada-get-arg-list ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
539 "Read from the user a procedure or function argument list.
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
540 Add parens unless arguments absent, and insert into buffer.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
541 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
542 Arguments ending with `;' are presumed single and stacked."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
543 (insert " (")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
544 (let ((ada-arg-indent (current-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
545 (ada-args (read-string "[arguments]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
546 (if (string-equal ada-args "")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
547 (backward-delete-char 2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
548 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
549 (while (string-match ";$" ada-args)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
550 (insert ada-args)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
551 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
552 (indent-to ada-arg-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
553 (setq ada-args (read-string "next argument: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
554 (insert ada-args ")")))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
555
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
556 (defun ada-function-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
557 "Insert a function specification. Prompts for name and arguments."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
558 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
559 (insert "function ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
560 (insert (read-string "function name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
561 (ada-get-arg-list)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
562 (insert " return ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
563 (insert (read-string "result type: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
564
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
565 (defun ada-procedure-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
566 "Insert a procedure specification, prompting for its name and arguments."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
567 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
568 (insert "procedure ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
569 (insert (read-string "procedure name: " ))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
570 (ada-get-arg-list))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
571
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
572 (defun get-ada-subprogram-name ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
573 "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
574 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
575 CDR is the column number where the procedure/function keyword was found."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
576 (save-excursion
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
577 (let ((ada-proc-indent 0))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
578 (if (re-search-backward
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
579 ;;;; Unfortunately, comments are not ignored in this string search.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
580 "[PpFf][RrUu][OoNn][Cc][EeTt][DdIi][UuOo][RrNn]" nil t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
581 (if (or (looking-at "\\<[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee]\\>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
582 (looking-at "\\<[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\>"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
583 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
584 (setq ada-proc-indent (current-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
585 (forward-word 2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
586 (let ((p2 (point)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
587 (forward-word -1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
588 (cons (buffer-substring (point) p2) ada-proc-indent)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
589 (get-ada-subprogram-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
590 (cons "NAME?" ada-proc-indent)))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
591
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
592 (defun ada-subprogram-body ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
593 "Insert frame for subprogram body.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
594 Invoke right after `ada-function-spec' or `ada-procedure-spec'."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
595 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
596 (insert " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
597 (let ((ada-subprogram-name-col (get-ada-subprogram-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
598 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
599 (indent-to (cdr ada-subprogram-name-col))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
600 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
601 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
602 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
603 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
604 (insert "end " (car ada-subprogram-name-col) ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
605 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
606 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
607
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
608 (defun ada-separate ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
609 "Finish a body stub with `is separate'."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
610 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
611 (insert " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
612 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
613 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
614 (insert "separate;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
615 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
616 (ada-untab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
617
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
618 ;(defun ada-with ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
619 ; "Inserts a with clause, prompting for the list of units depended upon."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
620 ; (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
621 ; (insert "with ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
622 ; (insert (read-string "list of units depended upon: ") ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
623 ;
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
624 ;(defun ada-use ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
625 ; "Inserts a use clause, prompting for the list of packages used."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
626 ; (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
627 ; (insert "use ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
628 ; (insert (read-string "list of packages to use: ") ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
629
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
630 (defun ada-record ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
631 "Insert a skeleton record type declaration."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
632 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
633 (insert "record")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
634 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
635 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
636 (insert "end record;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
637 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
638 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
639
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
640 (defun ada-subtype ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
641 "Start insertion of a subtype declaration, prompting for the subtype name."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
642 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
643 (insert "subtype " (read-string "subtype name: ") " is ;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
644 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
645 (message "insert subtype indication."))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
646
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
647 (defun ada-type ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
648 "Start insertion of a type declaration, prompting for the type name."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
649 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
650 (insert "type " (read-string "type name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
651 (let ((disc-part (read-string "discriminant specs: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
652 (if (not (string-equal disc-part ""))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
653 (insert "(" disc-part ")")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
654 (insert " is ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
655 (message "insert type definition."))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
656
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
657 (defun ada-while-loop ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
658 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
659 (insert "while ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
660 (let* ((ada-loop-name (read-string "loop name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
661 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
662 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
663 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
664 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
665 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
666 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
667 (next-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
668 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
669 (insert (read-string "entry condition: ") " loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
670 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
671 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
672 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
673 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
674 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
675 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
676 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
677
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
678 (defun ada-paired-parens ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
679 "Insert a pair of round parentheses, placing point between them."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
680 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
681 (insert "()")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
682 (backward-char))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
683
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
684 (defun ada-inline-comment ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
685 "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
686 `comment-column' spaces. If starting after `end-comment-column',
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
687 start a new line."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
688 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
689 (end-of-line)
9501
93bb180ef5da (ada-mode): Rename end-comment-column to ada-comment-end-column.
Richard M. Stallman <rms@gnu.org>
parents: 9469
diff changeset
690 (if (> (current-column) ada-comment-end-column) (newline))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
691 (if (< (current-column) comment-column) (indent-to comment-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
692 (insert " -- "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
693
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
694 (defun ada-display-comment ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
695 "Inserts three comment lines, making a display comment."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
696 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
697 (insert "--\n-- \n--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
698 (end-of-line 0))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
699
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
700 ;; Much of this is specific to Ada-Ed
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
701
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
702 (defvar ada-lib-dir-name "lib" "*Current Ada program library directory.")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
703 (defvar ada-bind-opts "" "*Options to supply for binding.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
704
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
705 (defun ada-library-name (ada-lib-name)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
706 "Specify name of Ada library directory for later compilations."
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
707 (interactive "DName of Ada library directory: ")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
708 (setq ada-lib-dir-name ada-lib-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
709
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
710 (defun ada-options-for-bind ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
711 "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
712 (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
713
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
714 (defun ada-compile (arg)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
715 "Save the current buffer and compile it into the current program library.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
716 Initialize the library if a prefix arg is given."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
717 (interactive "P")
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
718 (let* ((ada-init (if (null arg) "" "-n "))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
719 (ada-source-file (buffer-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
720 (compile
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
721 (concat "adacomp " ada-init "-l " ada-lib-dir-name " " ada-source-file))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
722
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
723 (defun ada-find-listing ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
724 "Find listing file for ada source in current buffer, using other window."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
725 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
726 (find-file-other-window (concat (substring (buffer-name) 0 -4) ".lis"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
727 (search-forward "*** ERROR"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
728
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
729 (defun ada-bind ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
730 "Bind the current program library, using the current binding options."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
731 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
732 (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
733
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 178
diff changeset
734 ;;; ada.el ends here