]> code.delx.au - gnu-emacs-elpa/blob - packages/ada-mode/ada-indent-user-options.el
Merge commit '078f88ecb797b6cf2cd597417402274dd82402ce' from diff-hl
[gnu-emacs-elpa] / packages / ada-mode / ada-indent-user-options.el
1 ;;; user options shared by Ada mode indentation engines -*- lexical-binding:t -*-
2 ;;
3 ;; Copyright (C) 2012, 2013, 2015 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 :safe #'integerp)
40 (make-variable-buffer-local 'ada-indent)
41
42 (defvar ada-broken-indent nil)
43 (make-obsolete-variable
44 'ada-broken-indent
45 'ada-indent-broken
46 "Emacs 24.4, Ada mode 5.0")
47
48 (defcustom ada-indent-broken
49 (if ada-broken-indent
50 (progn
51 (message "WARNING: setting `ada-indent-broken' to obsolete `ada-broken-indent'")
52 ada-broken-indent)
53 2)
54 "Indentation for the continuation of a broken line.
55
56 Example :
57 My_Var : My_Type :=
58 >>(Field1 => Value);"
59 :type 'integer
60 :safe #'integerp)
61 (make-variable-buffer-local 'ada-indent-broken)
62
63 (defcustom ada-indent-comment-col-0 nil
64 "If non-nil, comments currently starting in column 0 are left in column 0.
65 Otherwise, they are indented with previous comments or code."
66 :type 'boolean
67 :safe #'booleanp)
68 (make-variable-buffer-local 'ada-indent-comment-col-0)
69
70 (defvar ada-label-indent nil)
71 (make-obsolete-variable
72 'ada-label-indent
73 'ada-indent-label
74 "Emacs 24.4, Ada mode 5.0")
75
76 (defcustom ada-indent-label
77 (if ada-label-indent
78 (progn
79 (message "WARNING: setting `ada-indent-label' to obsolete `ada-label-indent'")
80 ada-label-indent)
81 -3)
82 ;; Ada mode 4.01 and earlier default this to -4. But that is
83 ;; incompatible with the default gnat indentation style check, which
84 ;; wants all indentations to be a multiple of 3 (with some
85 ;; exceptions). So we default this to -3.
86 "Indentation for a loop, block, or statement label, relative to the item it labels.
87
88 Example :
89 Label_1 :
90 <<<<declare
91
92 <<Label_2>>
93 <<<<Foo := 0;"
94 :type 'integer
95 :safe #'integerp)
96 (make-variable-buffer-local 'ada-indent-label)
97
98 (defcustom ada-indent-record-rel-type 3
99 "Indentation for 'record' relative to 'type' or 'use'.
100
101 An example is:
102 type A is
103 >>>record"
104 :type 'integer
105 :safe #'integerp)
106 (make-variable-buffer-local 'ada-indent-record-rel-type)
107
108 (defcustom ada-indent-renames 2
109 "Indentation for 'renames' relative to the matching subprogram keyword.
110
111 For 'renames' of non-subprograms the indentation is
112 `ada-indent-broken' relative to the line containing the matching
113 keyword.
114
115 If the subprogram has parameters then if `ada-indent-renames' is
116 zero or less the indentation is abs `ada-indent-renames' relative
117 to the open parenthesis; if `ada-indent-renames' is one or more
118 the indentation is relative to the line containing the keyword.
119
120 If the subprogram has no parameters then `ada-indent-broken' the
121 indentation is relative to the indentation of the line containing
122 the keyword.
123
124 Examples:
125 ada-indent-renames = 2
126 generic function A (B : Integer) return C
127 >>renames Foo;
128
129 ada-indent-renames = -1
130 function A (B : Integer)
131 return C
132 >>>>>>>>>>>renames Foo;"
133 :type 'integer
134 :safe #'integerp)
135 (make-variable-buffer-local 'ada-indent-renames)
136
137 (defcustom ada-indent-return 0
138 "Indentation for 'return' relative to the matching 'function' keyword.
139
140 If the function has parameters, then if `ada-indent-return' is
141 zero or less the indentation is abs `ada-indent-return' relative
142 to the open parenthesis; if `ada-indent-return' is one or more,
143 indentation is relative to line containing 'function'.
144
145 If the function has no parameters, `ada-indent-broken' is used
146 relative to line containing 'function'.
147
148 An example is:
149 function A (B : Integer)
150 >>>>>>>>>>>return C;"
151 :type 'integer
152 :safe #'integerp)
153 (make-variable-buffer-local 'ada-indent-return)
154
155 (defvar ada-use-indent nil)
156 (make-obsolete-variable
157 'ada-use-indent
158 'ada-indent-use
159 "Emacs 24.4, Ada mode 5.0")
160
161 (defcustom ada-indent-use
162 (if ada-use-indent
163 (progn
164 (message "WARNING: setting `ada-indent-use' to obsolete `ada-use-indent'")
165 ada-use-indent)
166 ada-indent-broken)
167 "Indentation for the lines in a 'use' statement.
168
169 An example is:
170 use Ada.Text_IO,
171 >>Ada.Numerics;"
172 :type 'integer
173 :safe #'integerp)
174 (make-variable-buffer-local 'ada-indent-use)
175
176 (defvar ada-when-indent nil)
177 (make-obsolete-variable
178 'ada-when-indent
179 'ada-indent-when
180 "Emacs 24.4, Ada mode 5.0")
181
182 (defcustom ada-indent-when
183 (if ada-when-indent
184 (progn
185 (message "WARNING: setting `ada-indent-when' to obsolete `ada-when-indent'")
186 ada-when-indent)
187 3)
188 "Indentation for 'when' relative to 'exception', 'case', 'or' in select.
189
190 An example is:
191 case A is
192 >>>when B =>"
193 :type 'integer
194 :safe #'integerp)
195 (make-variable-buffer-local 'ada-indent-when)
196
197 (defvar ada-with-indent nil)
198 (make-obsolete-variable
199 'ada-with-indent
200 'ada-indent-with
201 "Emacs 24.4, Ada mode 5.0")
202
203 (defcustom ada-indent-with
204 (if ada-with-indent
205 (progn
206 (message "WARNING: setting `ada-indent-with' to obsolete `ada-with-indent'")
207 ada-with-indent)
208 ada-indent-broken)
209 "Indentation for the lines in a 'with' context clause.
210
211 An example is:
212 with Ada.Text_IO,
213 >>Ada.Numerics;"
214 :type 'integer
215 :safe #'integerp)
216 (make-variable-buffer-local 'ada-indent-with)
217
218 (provide 'ada-indent-user-options)
219
220 ;; end file