]> code.delx.au - gnu-emacs-elpa/blob - packages/ada-mode/ada-indent-user-options.el
fabe076d496c2cecd47b8f300618bfd46610afce
[gnu-emacs-elpa] / packages / ada-mode / ada-indent-user-options.el
1 ;;; user options shared by Ada mode indentation engines
2 ;;
3 ;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
4 ;;
5 ;; Author: Stephen Leake <stephen_leake@member.fsf.org>
6 ;; Contributors: Simon Wright <simon.j.wright@mac.com>
7 ;;
8 ;; This file is part of GNU Emacs.
9 ;;
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14 ;;
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19 ;;
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;;
23 ;;; History: see ada_mode.el
24
25 ;;;; code
26
27 (defgroup ada-indentation nil
28 "Indentation options for Ada source."
29 :group 'ada)
30
31 (defcustom ada-indent 3
32 "Size of Ada default indentation, when no other indentation is used.
33
34 Example :
35 procedure Foo is
36 begin
37 >>>null;"
38 :type 'integer
39 :group 'ada-indentation
40 :safe 'integerp)
41 (make-variable-buffer-local 'ada-indent)
42
43 (defvar ada-broken-indent nil)
44 (make-obsolete-variable
45 'ada-broken-indent
46 'ada-indent-broken
47 "Emacs 24.4, Ada mode 5.0")
48
49 (defcustom ada-indent-broken
50 (if ada-broken-indent
51 (progn
52 (message "WARNING: setting `ada-indent-broken' to obsolete `ada-broken-indent'")
53 ada-broken-indent)
54 2)
55 "Indentation for the continuation of a broken line.
56
57 Example :
58 My_Var : My_Type :=
59 >>(Field1 => Value);"
60 :type 'integer
61 :group 'ada-indentation
62 :safe 'integerp)
63 (make-variable-buffer-local 'ada-indent-broken)
64
65 (defcustom ada-indent-comment-col-0 nil
66 "If non-nil, comments currently starting in column 0 are left in column 0.
67 Otherwise, they are indented with previous comments or code."
68 :type 'boolean
69 :group 'ada-indentation
70 :safe 'booleanp)
71 (make-variable-buffer-local 'ada-indent-comment-col-0)
72
73 (defvar ada-label-indent nil)
74 (make-obsolete-variable
75 'ada-label-indent
76 'ada-indent-label
77 "Emacs 24.4, Ada mode 5.0")
78
79 (defcustom ada-indent-label
80 (if ada-label-indent
81 (progn
82 (message "WARNING: setting `ada-indent-label' to obsolete `ada-label-indent'")
83 ada-label-indent)
84 -3)
85 ;; Ada mode 4.01 and earlier default this to -4. But that is
86 ;; incompatible with the default gnat indentation style check, which
87 ;; wants all indentations to be a multiple of 3 (with some
88 ;; exceptions). So we default this to -3.
89 "Indentation for a loop, block, or statement label, relative to the item it labels.
90
91 Example :
92 Label_1 :
93 <<<<declare
94
95 <<Label_2>>
96 <<<<Foo := 0;"
97 :type 'integer
98 :group 'ada-indentation
99 :safe 'integerp)
100 (make-variable-buffer-local 'ada-indent-label)
101
102 (defcustom ada-indent-record-rel-type 3
103 "Indentation for 'record' relative to 'type' or 'use'.
104
105 An example is:
106 type A is
107 >>>record"
108 :type 'integer
109 :group 'ada-indent
110 :safe 'integerp)
111 (make-variable-buffer-local 'ada-indent-record-rel-type)
112
113 (defcustom ada-indent-renames 2
114 "Indentation for 'renames' relative to the matching subprogram keyword.
115
116 For 'renames' of non-subprograms the indentation is
117 `ada-indent-broken' relative to the line containing the matching
118 keyword.
119
120 If the subprogram has parameters then if `ada-indent-renames' is
121 zero or less the indentation is abs `ada-indent-renames' relative
122 to the open parenthesis; if `ada-indent-renames' is one or more
123 the indentation is relative to the line containing the keyword.
124
125 If the subprogram has no parameters then `ada-indent-broken' the
126 indentation is relative to the indentation of the line containing
127 the keyword.
128
129 Examples:
130 ada-indent-renames = 2
131 generic function A (B : Integer) return C
132 >>renames Foo;
133
134 ada-indent-renames = -1
135 function A (B : Integer)
136 return C
137 >>>>>>>>>>>renames Foo;"
138 :type 'integer
139 :group 'ada-indent
140 :safe 'integerp)
141 (make-variable-buffer-local 'ada-indent-renames)
142
143 (defcustom ada-indent-return 0
144 "Indentation for 'return' relative to the matching 'function' keyword.
145
146 If the function has parameters, then if `ada-indent-return' is
147 zero or less the indentation is abs `ada-indent-return' relative
148 to the open parenthesis; if `ada-indent-return' is one or more,
149 indentation is relative to line containing 'function'.
150
151 If the function has no parameters, `ada-indent-broken' is used
152 relative to line containing 'function'.
153
154 An example is:
155 function A (B : Integer)
156 >>>>>>>>>>>return C;"
157 :type 'integer
158 :group 'ada-indent
159 :safe 'integerp)
160 (make-variable-buffer-local 'ada-indent-return)
161
162 (defvar ada-use-indent nil)
163 (make-obsolete-variable
164 'ada-use-indent
165 'ada-indent-use
166 "Emacs 24.4, Ada mode 5.0")
167
168 (defcustom ada-indent-use
169 (if ada-use-indent
170 (progn
171 (message "WARNING: setting `ada-indent-use' to obsolete `ada-use-indent'")
172 ada-use-indent)
173 ada-indent-broken)
174 "Indentation for the lines in a 'use' statement.
175
176 An example is:
177 use Ada.Text_IO,
178 >>Ada.Numerics;"
179 :type 'integer
180 :group 'ada
181 :safe 'integerp)
182 (make-variable-buffer-local 'ada-indent-use)
183
184 (defvar ada-when-indent nil)
185 (make-obsolete-variable
186 'ada-when-indent
187 'ada-indent-when
188 "Emacs 24.4, Ada mode 5.0")
189
190 (defcustom ada-indent-when
191 (if ada-when-indent
192 (progn
193 (message "WARNING: setting `ada-indent-when' to obsolete `ada-when-indent'")
194 ada-when-indent)
195 3)
196 "Indentation for 'when' relative to 'exception', 'case', 'or' in select.
197
198 An example is:
199 case A is
200 >>>when B =>"
201 :type 'integer
202 :group 'ada-indent
203 :safe 'integerp)
204 (make-variable-buffer-local 'ada-indent-when)
205
206 (defvar ada-with-indent nil)
207 (make-obsolete-variable
208 'ada-with-indent
209 'ada-indent-with
210 "Emacs 24.4, Ada mode 5.0")
211
212 (defcustom ada-indent-with
213 (if ada-with-indent
214 (progn
215 (message "WARNING: setting `ada-indent-with' to obsolete `ada-with-indent'")
216 ada-with-indent)
217 ada-indent-broken)
218 "Indentation for the lines in a 'with' context clause.
219
220 An example is:
221 with Ada.Text_IO,
222 >>Ada.Numerics;"
223 :type 'integer
224 :group 'ada
225 :safe 'integerp)
226 (make-variable-buffer-local 'ada-indent-with)
227
228 (provide 'ada-indent-user-options)
229
230 ;; end file