annotate lisp/=ada.el @ 10422:3c447e2caef3

(open-line, split-line, next-line): Use `newline' function to insert newline so it will be marked hard if appropriate. (indent-new-comment-line): Use `newline' function, unless called with (new) argument. (do-auto-fill): Call indent-new-comment-line with argument to make newline soft.
author Richard M. Stallman <rms@gnu.org>
date Fri, 13 Jan 1995 08:43:40 +0000
parents 41a73e2f439e
children 918e43cfede6
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
9a8f9905d724 * ada.el: (ada-mode-syntax-table): Made `-' and `\n' be comments.
Simon Marshall <simon@gnu.org>
parents: 9056
diff changeset
143 (defvar ada-font-lock-keywords 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
144 "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
145
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
146 (defvar ada-mode-map nil
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
147 "Keymap used in Ada mode.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
149 (let ((map (make-sparse-keymap)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
150 (define-key map "\C-m" 'ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
151 (define-key map "\C-?" 'backward-delete-char-untabify)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
152 (define-key map "\C-i" 'ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
153 (define-key map "\C-c\C-i" 'ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154 (define-key map "\C-c<" 'ada-backward-to-same-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
155 (define-key map "\C-c>" 'ada-forward-to-same-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156 (define-key map "\C-ch" 'ada-header)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
157 (define-key map "\C-c(" 'ada-paired-parens)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (define-key map "\C-c-" 'ada-inline-comment)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 (define-key map "\C-c\C-a" 'ada-array)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160 (define-key map "\C-cb" 'ada-exception-block)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
161 (define-key map "\C-cd" 'ada-declare-block)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 (define-key map "\C-c\C-e" 'ada-exception)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 (define-key map "\C-cc" 'ada-case)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164 (define-key map "\C-c\C-k" 'ada-package-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 (define-key map "\C-ck" 'ada-package-body)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166 (define-key map "\C-c\C-p" 'ada-procedure-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167 (define-key map "\C-cp" 'ada-subprogram-body)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
168 (define-key map "\C-c\C-f" 'ada-function-spec)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
169 (define-key map "\C-cf" 'ada-for-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
170 (define-key map "\C-cl" 'ada-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 (define-key map "\C-ci" 'ada-if)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
172 (define-key map "\C-cI" 'ada-elsif)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
173 (define-key map "\C-ce" 'ada-else)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
174 (define-key map "\C-c\C-v" 'ada-private)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
175 (define-key map "\C-c\C-r" 'ada-record)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
176 (define-key map "\C-c\C-s" 'ada-subtype)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
177 (define-key map "\C-cs" 'ada-separate)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
178 (define-key map "\C-c\C-t" 'ada-type)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
179 (define-key map "\C-ct" 'ada-tabsize)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
180 ;; (define-key map "\C-c\C-u" 'ada-use)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
181 ;; (define-key map "\C-c\C-w" 'ada-with)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
182 (define-key map "\C-cw" 'ada-while-loop)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
183 (define-key map "\C-c\C-w" 'ada-when)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
184 (define-key map "\C-cx" 'ada-exit)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
185 (define-key map "\C-cC" 'ada-compile)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
186 (define-key map "\C-cB" 'ada-bind)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
187 (define-key map "\C-cE" 'ada-find-listing)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
188 (define-key map "\C-cL" 'ada-library-name)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
189 (define-key map "\C-cO" 'ada-options-for-bind)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
190 (setq ada-mode-map map))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
191
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
192 (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
193
9501
93bb180ef5da (ada-mode): Rename end-comment-column to ada-comment-end-column.
Richard M. Stallman <rms@gnu.org>
parents: 9469
diff changeset
194 (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
195
9056
504324bc2741 (ada-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 2307
diff changeset
196 ;;;###autoload
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
197 (defun ada-mode ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
198 "This is a mode intended to support program development in Ada.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
199 Most control constructs and declarations of Ada can be inserted in the buffer
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
200 by typing Control-C followed by a character mnemonic for the construct.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
201
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
202 \\<ada-mode-map>\\[ada-array] array \\[ada-exception-block] exception block
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
203 \\[ada-exception] exception \\[ada-declare-block] declare block
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
204 \\[ada-package-spec] package spec \\[ada-package-body] package body
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
205 \\[ada-procedure-spec] procedure spec \\[ada-subprogram-body] proc/func body
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
206 \\[ada-function-spec] func spec \\[ada-for-loop] for loop
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
207 \\[ada-if] if
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
208 \\[ada-elsif] elsif
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
209 \\[ada-else] else
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
210 \\[ada-private] private \\[ada-loop] loop
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
211 \\[ada-record] record \\[ada-case] case
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
212 \\[ada-subtype] subtype \\[ada-separate] separate
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
213 \\[ada-type] type \\[ada-tabsize] tab spacing for indents
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
214 \\[ada-when] when \\[ada-while] while
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
215 \\[ada-exit] exit
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
216 \\[ada-paired-parens] paired parens \\[ada-inline-comment] inline comment
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
217 \\[ada-header] header spec
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
218 \\[ada-compile] compile \\[ada-bind] bind
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
219 \\[ada-find-listing] find error list
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
220 \\[ada-library-name] name library \\[ada-options-for-bind] options for bind
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
221
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
222 \\[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
223 having the same (or lesser) level of indentation.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
224
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
225 Variable `ada-indent' controls the number of spaces for indent/undent."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
226 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
227 (kill-all-local-variables)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
228 (use-local-map ada-mode-map)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
229 (setq major-mode 'ada-mode)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
230 (setq mode-name "Ada")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
231 (make-local-variable 'comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
232 (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
233 (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
234 (setq ada-comment-end-column 72)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
235 (set-syntax-table ada-mode-syntax-table)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
236 (make-local-variable 'paragraph-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
237 (setq paragraph-start (concat "^$\\|" page-delimiter))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
238 (make-local-variable 'paragraph-separate)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
239 (setq paragraph-separate paragraph-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
240 (make-local-variable 'paragraph-ignore-fill-prefix)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
241 (setq paragraph-ignore-fill-prefix t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
242 ; (make-local-variable 'indent-line-function)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
243 ; (setq indent-line-function 'c-indent-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
244 (make-local-variable 'require-final-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
245 (setq require-final-newline t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
246 (make-local-variable 'comment-start)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
247 (setq comment-start "--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
248 (make-local-variable 'comment-end)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
249 (setq comment-end "")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
250 (make-local-variable 'comment-column)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
251 (setq comment-column 41)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
252 (make-local-variable 'comment-start-skip)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
253 (setq comment-start-skip "--+ *")
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1233
diff changeset
254 (make-local-variable 'comment-indent-function)
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1233
diff changeset
255 (setq comment-indent-function 'c-comment-indent)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
256 (make-local-variable 'parse-sexp-ignore-comments)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
257 (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
258 (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
259 (setq font-lock-defaults '(ada-font-lock-keywords nil t ((?\_ . "w"))))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
260 (run-hooks 'ada-mode-hook))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
261
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
262 (defun ada-tabsize (s)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
263 "Changes spacing used for indentation.
178
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
264 The prefix argument is used as the new spacing."
1fe1ce5c6c43 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 171
diff changeset
265 (interactive "p")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
266 (setq ada-indent s))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
267
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
268 (defun ada-newline ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
269 "Start new line and indent to current tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
270 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
271 (let ((ada-cc (current-indentation)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
272 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
273 (indent-to ada-cc)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
274
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
275 (defun ada-tab ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
276 "Indent to next tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
277 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
278 (indent-to (* (1+ (/ (current-indentation) ada-indent)) ada-indent)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
279
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
280 (defun ada-untab ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
281 "Delete backwards to previous tab stop."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
282 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
283 (backward-delete-char-untabify ada-indent nil))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
284
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
285 (defun ada-go-to-this-indent (step indent-level)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
286 "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
287 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
288 Ignore blank lines, statement labels and block or loop names."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
289 (while (and
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
290 (zerop (forward-line step))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
291 (or (looking-at "^[ ]*$")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
292 (looking-at "^[ ]*--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
293 (looking-at "^<<[A-Za-z0-9_]+>>")
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 (> (current-indentation) indent-level)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
296 nil))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
297
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
298 (defun ada-backward-to-same-indent ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
299 "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
300 If not found, point is left at the top of the buffer."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
301 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
302 (ada-go-to-this-indent -1 (current-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
303 (back-to-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
304
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
305 (defun ada-forward-to-same-indent ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
306 "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
307 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
308 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
309 (ada-go-to-this-indent 1 (current-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
310 (back-to-indentation))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
311
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
312 (defun ada-array ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
313 "Insert array type definition. Uses the minibuffer to prompt
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
314 for component type and index subtypes."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
315 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
316 (insert "array ()")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
317 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
318 (insert (read-string "index subtype[s]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
319 (end-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
320 (insert " of ;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
321 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
322 (insert (read-string "component-type: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
323 (end-of-line))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
324
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
325 (defun ada-case ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
326 "Build skeleton case statement.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
327 Uses the minibuffer to prompt for the selector expression.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
328 Also builds the first when clause."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
329 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
330 (insert "case ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
331 (insert (read-string "selector expression: ") " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
332 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
333 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
334 (insert "end case;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
335 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
336 (ada-tab)
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-when))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
339
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
340 (defun ada-declare-block ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
341 "Insert a block with a declare part.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
342 Indent for the first declaration."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
343 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
344 (let ((ada-block-name (read-string "[block name]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
345 (insert "declare")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
346 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
347 ( (not (string-equal ada-block-name ""))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
348 (beginning-of-line)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
349 (open-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
350 (insert ada-block-name ":")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
351 (next-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
352 (end-of-line)))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
353 (ada-newline)
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 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
356 (ada-newline)
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 (if (string-equal ada-block-name "")
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
359 (insert "end;")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
360 (insert "end " ada-block-name ";"))
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
361 )
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
362 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
363 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
364
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
365 (defun ada-exception-block ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
366 "Insert a block with an exception part.
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
367 Indent for the first line of code."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
368 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
369 (let ((block-name (read-string "[block name]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
370 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
371 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
372 ( (not (string-equal block-name ""))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
373 (beginning-of-line)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
374 (open-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
375 (insert block-name ":")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
376 (next-line 1)
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
377 (end-of-line)))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
378 (ada-newline)
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 (insert "exception")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
381 (ada-newline)
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 (cond
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
384 ( (string-equal block-name "")
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
385 (insert "end;"))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
386 ( t
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
387 (insert "end " block-name ";")))
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
388 )
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
389 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
390 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
391
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
392 (defun ada-exception ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
393 "Insert an indented exception part into a block."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
394 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
395 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
396 (insert "exception")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
397 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
398 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
399
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
400 (defun ada-else ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
401 "Add an else clause inside an if-then-end-if clause."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
402 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
403 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
404 (insert "else")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
405 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
406 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
407
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
408 (defun ada-exit ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
409 "Insert an exit statement, prompting for loop name and condition."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
410 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
411 (insert "exit")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
412 (let ((ada-loop-name (read-string "[name of loop to exit]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
413 (if (not (string-equal ada-loop-name "")) (insert " " ada-loop-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
414 (let ((ada-exit-condition (read-string "[exit condition]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
415 (if (not (string-equal ada-exit-condition ""))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
416 (if (string-match "^ *[Ww][Hh][Ee][Nn] +" ada-exit-condition)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
417 (insert " " ada-exit-condition)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
418 (insert " when " ada-exit-condition))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
419 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
420
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
421 (defun ada-when ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
422 "Start a case statement alternative with a when clause."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
423 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
424 (ada-untab) ; we were indented in code for the last alternative.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
425 (insert "when ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
426 (insert (read-string "'|'-delimited choice list: ") " =>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
427 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
428 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
429
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
430 (defun ada-for-loop ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
431 "Build a skeleton for-loop statement, prompting for the loop parameters."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
432 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
433 (insert "for ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
434 (let* ((ada-loop-name (read-string "[loop name]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
435 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
436 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
437 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
438 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
439 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
440 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
441 (next-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
442 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
443 (insert (read-string "loop variable: ") " in ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
444 (insert (read-string "range: ") " loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
445 (ada-newline)
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 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
448 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
449 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
450 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
451 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
452
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
453 (defun ada-header ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
454 "Insert a comment block containing the module title, author, etc."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
455 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
456 (insert "--\n-- Title: \t")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
457 (insert (read-string "Title: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
458 (insert "\n-- Created:\t" (current-time-string))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
459 (insert "\n-- Author: \t" (user-full-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
460 (insert "\n--\t\t<" (user-login-name) "@" (system-name) ">\n--\n"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
461
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
462 (defun ada-if ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
463 "Insert skeleton if statment, prompting for a boolean-expression."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
464 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
465 (insert "if ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
466 (insert (read-string "condition: ") " then")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
467 (ada-newline)
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 (insert "end if;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
470 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
471 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
472
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
473 (defun ada-elsif ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
474 "Add an elsif clause to an if statement, prompting for the boolean-expression."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
475 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
476 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
477 (insert "elsif ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
478 (insert (read-string "condition: ") " then")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
479 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
480 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
481
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
482 (defun ada-loop ()
1233
e795fe80b14e Doc fix.
Christopher Zaborsky <rogue@erratum.com>
parents: 845
diff changeset
483 "Insert a skeleton loop statement. The exit statement is added by hand."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
484 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
485 (insert "loop ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
486 (let* ((ada-loop-name (read-string "[loop name]: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
487 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
488 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
489 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
490 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
491 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
492 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
493 (forward-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
494 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
495 (ada-newline)
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 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
498 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
499 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
500 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
501 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
502
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
503 (defun ada-package-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
504 "Insert a skeleton package specification."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
505 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
506 (insert "package ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
507 (let ((ada-package-name (read-string "package name: " )))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
508 (insert ada-package-name " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
509 (ada-newline)
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 (insert "end " ada-package-name ";")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
512 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
513 (ada-tab)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
514
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
515 (defun ada-package-body ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
516 "Insert a skeleton package body -- includes a begin statement."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
517 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
518 (insert "package body ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
519 (let ((ada-package-name (read-string "package name: " )))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
520 (insert ada-package-name " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
521 (ada-newline)
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 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
524 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
525 (insert "end " ada-package-name ";")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
526 (end-of-line -1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
527 (ada-tab)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
528
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
529 (defun ada-private ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
530 "Undent and start a private section of a package spec. Reindent."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
531 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
532 (ada-untab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
533 (insert "private")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
534 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
535 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
536
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
537 (defun ada-get-arg-list ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
538 "Read from the user a procedure or function argument list.
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
539 Add parens unless arguments absent, and insert into buffer.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
540 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
541 Arguments ending with `;' are presumed single and stacked."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
542 (insert " (")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
543 (let ((ada-arg-indent (current-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
544 (ada-args (read-string "[arguments]: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
545 (if (string-equal ada-args "")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
546 (backward-delete-char 2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
547 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
548 (while (string-match ";$" ada-args)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
549 (insert ada-args)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
550 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
551 (indent-to ada-arg-indent)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
552 (setq ada-args (read-string "next argument: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
553 (insert ada-args ")")))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
554
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
555 (defun ada-function-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
556 "Insert a function specification. Prompts for name and arguments."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
557 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
558 (insert "function ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
559 (insert (read-string "function name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
560 (ada-get-arg-list)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
561 (insert " return ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
562 (insert (read-string "result type: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
563
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
564 (defun ada-procedure-spec ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
565 "Insert a procedure specification, prompting for its name and arguments."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
566 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
567 (insert "procedure ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
568 (insert (read-string "procedure name: " ))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
569 (ada-get-arg-list))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
570
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
571 (defun get-ada-subprogram-name ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
572 "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
573 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
574 CDR is the column number where the procedure/function keyword was found."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
575 (save-excursion
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
576 (let ((ada-proc-indent 0))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
577 (if (re-search-backward
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
578 ;;;; Unfortunately, comments are not ignored in this string search.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
579 "[PpFf][RrUu][OoNn][Cc][EeTt][DdIi][UuOo][RrNn]" nil t)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
580 (if (or (looking-at "\\<[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee]\\>")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
581 (looking-at "\\<[Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\>"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
582 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
583 (setq ada-proc-indent (current-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
584 (forward-word 2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
585 (let ((p2 (point)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
586 (forward-word -1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
587 (cons (buffer-substring (point) p2) ada-proc-indent)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
588 (get-ada-subprogram-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
589 (cons "NAME?" ada-proc-indent)))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
590
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
591 (defun ada-subprogram-body ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
592 "Insert frame for subprogram body.
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
593 Invoke right after `ada-function-spec' or `ada-procedure-spec'."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
594 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
595 (insert " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
596 (let ((ada-subprogram-name-col (get-ada-subprogram-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
597 (newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
598 (indent-to (cdr ada-subprogram-name-col))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
599 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
600 (insert "begin")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
601 (ada-newline)
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 (insert "end " (car ada-subprogram-name-col) ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
604 (end-of-line -2)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
605 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
606
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
607 (defun ada-separate ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
608 "Finish a body stub with `is separate'."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
609 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
610 (insert " is")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
611 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
612 (ada-tab)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
613 (insert "separate;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
614 (ada-newline)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
615 (ada-untab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
616
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
617 ;(defun ada-with ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
618 ; "Inserts a with clause, prompting for the list of units depended upon."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
619 ; (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
620 ; (insert "with ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
621 ; (insert (read-string "list of units depended upon: ") ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
622 ;
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
623 ;(defun ada-use ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
624 ; "Inserts a use clause, prompting for the list of packages used."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
625 ; (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
626 ; (insert "use ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
627 ; (insert (read-string "list of packages to use: ") ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
628
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
629 (defun ada-record ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
630 "Insert a skeleton record type declaration."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
631 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
632 (insert "record")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
633 (ada-newline)
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 (insert "end record;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
636 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
637 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
638
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
639 (defun ada-subtype ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
640 "Start insertion of a subtype declaration, prompting for the subtype name."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
641 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
642 (insert "subtype " (read-string "subtype name: ") " is ;")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
643 (backward-char)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
644 (message "insert subtype indication."))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
645
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
646 (defun ada-type ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
647 "Start insertion of a type declaration, prompting for the type name."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
648 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
649 (insert "type " (read-string "type name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
650 (let ((disc-part (read-string "discriminant specs: ")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
651 (if (not (string-equal disc-part ""))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
652 (insert "(" disc-part ")")))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
653 (insert " is ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
654 (message "insert type definition."))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
655
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
656 (defun ada-while-loop ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
657 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
658 (insert "while ")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
659 (let* ((ada-loop-name (read-string "loop name: "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
660 (ada-loop-is-named (not (string-equal ada-loop-name ""))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
661 (if ada-loop-is-named
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
662 (progn
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
663 (beginning-of-line)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
664 (open-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
665 (insert ada-loop-name ":")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
666 (next-line 1)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
667 (end-of-line 1)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
668 (insert (read-string "entry condition: ") " loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
669 (ada-newline)
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 (insert "end loop")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
672 (if ada-loop-is-named (insert " " ada-loop-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
673 (insert ";"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
674 (end-of-line 0)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
675 (ada-tab))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
676
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
677 (defun ada-paired-parens ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
678 "Insert a pair of round parentheses, placing point between them."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
679 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
680 (insert "()")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
681 (backward-char))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
682
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
683 (defun ada-inline-comment ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
684 "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
685 `comment-column' spaces. If starting after `end-comment-column',
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
686 start a new line."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
687 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
688 (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
689 (if (> (current-column) ada-comment-end-column) (newline))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
690 (if (< (current-column) comment-column) (indent-to comment-column))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
691 (insert " -- "))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
692
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
693 (defun ada-display-comment ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
694 "Inserts three comment lines, making a display comment."
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
695 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
696 (insert "--\n-- \n--")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
697 (end-of-line 0))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
698
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
699 ;; Much of this is specific to Ada-Ed
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
700
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
701 (defvar ada-lib-dir-name "lib" "*Current Ada program library directory.")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
702 (defvar ada-bind-opts "" "*Options to supply for binding.")
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
703
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
704 (defun ada-library-name (ada-lib-name)
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
705 "Specify name of Ada library directory for later compilations."
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
706 (interactive "DName of Ada library directory: ")
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
707 (setq ada-lib-dir-name ada-lib-name))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
708
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
709 (defun ada-options-for-bind ()
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
710 "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
711 (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
712
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
713 (defun ada-compile (arg)
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
714 "Save the current buffer and compile it into the current program library.
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
715 Initialize the library if a prefix arg is given."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
716 (interactive "P")
171
6f1cd5f1d50f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 39
diff changeset
717 (let* ((ada-init (if (null arg) "" "-n "))
39
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
718 (ada-source-file (buffer-name)))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
719 (compile
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
720 (concat "adacomp " ada-init "-l " ada-lib-dir-name " " ada-source-file))))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
721
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
722 (defun ada-find-listing ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
723 "Find listing file for ada source in current buffer, using other window."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
724 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
725 (find-file-other-window (concat (substring (buffer-name) 0 -4) ".lis"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
726 (search-forward "*** ERROR"))
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
727
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
728 (defun ada-bind ()
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
729 "Bind the current program library, using the current binding options."
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
730 (interactive)
bd9c72156bbf Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
731 (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
732
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 178
diff changeset
733 ;;; ada.el ends here