Mercurial > emacs
annotate man/ada-mode.texi @ 39204:8f8df4d24f48
(User-Chosen Coding Systems) <select-safe-coding-system>: Document
the new argument accept-default-p and the variable
select-safe-coding-system-accept-default-p. Tell what happens if
buffer-file-coding-system is undecided.
(Default Coding Systems): Document auto-coding-regexp-alist.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 08 Sep 2001 17:48:33 +0000 |
parents | ef5cc490984d |
children | 88b1d99e92ad |
rev | line source |
---|---|
25906 | 1 \input texinfo @c -*-texinfo-*- |
25913
2552233fdd74
Set file name to ../info/ada-mode
Gerd Moellmann <gerd@gnu.org>
parents:
25906
diff
changeset
|
2 @setfilename ../info/ada-mode |
25906 | 3 @settitle Ada Mode |
30009 | 4 @dircategory Emacs |
28823 | 5 @direntry |
6 * Ada mode: (ada-mode). The GNU Emacs mode for editing Ada. | |
7 @end direntry | |
25906 | 8 |
37403 | 9 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
10 @comment The following lines inserts the copyright notice | |
11 @comment into the Info file. | |
12 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
25906 | 13 |
37403 | 14 @ifnottex |
15 Copyright @copyright{} 1999, 2000, 2001 Free Software Foundation, Inc. | |
25906 | 16 |
37403 | 17 Permission is granted to copy, distribute and/or modify this document |
18 under the terms of the GNU Free Documentation License, Version 1.1 or | |
19 any later version published by the Free Software Foundation; with the | |
20 Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and | |
21 ``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU | |
22 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the | |
23 license is included in the section entitled ``GNU Free Documentation | |
24 License'' in the Emacs manual. | |
25906 | 25 |
37403 | 26 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify |
27 this GNU Manual, like GNU software. Copies published by the Free | |
28 Software Foundation raise funds for GNU development.'' | |
25906 | 29 |
37403 | 30 This document is part of a collection distributed under the GNU Free |
31 Documentation License. If you want to distribute this document | |
32 separately from the collection, you can do so by adding a copy of the | |
33 license to the document, as described in section 6 of the license. | |
34 @end ifnottex | |
35 | |
36 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
37 @comment TeX title page | |
38 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
25906 | 39 |
40 @titlepage | |
41 @sp 10 | |
42 @title{Ada Mode} | |
43 @sp 2 | |
44 @subtitle An Emacs major mode for programming Ada 95 with GNAT | |
45 @subtitle July 1998 for Ada Mode Version 3.0 | |
46 @sp 2 | |
47 | |
48 @page | |
49 @vskip 0pt plus 1filll | |
37403 | 50 Copyright @copyright{} 1999, 2000, 2001 Free Software Foundation, Inc. |
51 @sp 1 | |
52 Permission is granted to copy, distribute and/or modify this document | |
53 under the terms of the GNU Free Documentation License, Version 1.1 or | |
54 any later version published by the Free Software Foundation; with the | |
55 Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and | |
56 ``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU | |
57 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the | |
58 license is included in the section entitled ``GNU Free Documentation | |
59 License'' in the Emacs manual. | |
25906 | 60 |
37403 | 61 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify |
62 this GNU Manual, like GNU software. Copies published by the Free | |
63 Software Foundation raise funds for GNU development.'' | |
25906 | 64 |
37403 | 65 This document is part of a collection distributed under the GNU Free |
66 Documentation License. If you want to distribute this document | |
67 separately from the collection, you can do so by adding a copy of the | |
68 license to the document, as described in section 6 of the license. | |
69 @end titlepage | |
25906 | 70 |
71 | |
72 @node Top, Overview, (dir), (dir) | |
73 | |
74 @menu | |
75 * Overview:: | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
76 * Installation:: Installing Ada mode on your system |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
77 * Customization:: Setting up Ada mode to your taste |
25906 | 78 * Project files:: Describing the organization of your project |
79 * Syntax highlighting:: Using specific colors and fonts to highlight | |
80 the structure of your files | |
81 * Moving Through Ada Code:: Moving easily through Ada sources | |
82 * Identifier completion:: Finishing words automatically | |
83 * Index Menu of Subprograms:: A menu of all the types and subprograms | |
84 defined in your application | |
85 * File Browser:: Easy access to your files | |
86 * Automatic Smart Indentation:: Indenting your code automatically as you type | |
87 * Formatting Parameter Lists:: Formating subprograms parameter lists | |
88 automatically | |
89 * Automatic Casing:: Adjusting the case of words automatically | |
90 * Statement Templates:: Inserting code templates | |
91 * Comment Handling:: Reformatting comments easily | |
92 * Compiling Executing:: Working with your application within Emacs | |
93 * Debugging:: Debugging your application | |
94 * Using non-standard file names:: Configuring Emacs for special file names | |
95 * Working Remotely:: Working on a different machine | |
96 @end menu | |
97 | |
98 | |
99 @c ----------------------------------------------------------------------- | |
100 @node Overview, Installation, Top, Top | |
101 @chapter Overview | |
102 @c ----------------------------------------------------------------------- | |
103 | |
104 The Emacs mode for programming in Ada 95 with GNAT helps the user in | |
105 understanding existing code and facilitates writing new code. It | |
106 furthermore provides some utility functions for easier integration of | |
107 standard Emacs features when programming in Ada. | |
108 | |
109 @section General features: | |
110 | |
111 @itemize @bullet | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
112 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
113 full Integrated Development Environment: |
25906 | 114 @itemize @bullet |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
115 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
116 support of ``project files'' for the configuration (directories, |
25906 | 117 compilation options,...) |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
118 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
119 compiling and stepping through error messages. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
120 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
121 running and debugging your applications within Emacs. |
25906 | 122 @end itemize |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
123 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
124 easy to use for beginners by pull-down menus, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
125 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
126 user configurable by many user-option variables. |
25906 | 127 @end itemize |
128 | |
129 @section Ada mode features that help understanding code: | |
130 | |
131 @itemize @bullet | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
132 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
133 functions for easy and quick stepping through Ada code, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
134 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
135 getting cross reference information for identifiers (e.g. find the |
25906 | 136 defining place by a keystroke), |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
137 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
138 displaying an index menu of types and subprograms and move point to |
25906 | 139 the chosen one, |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
140 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
141 automatic color highlighting of the various entities in Ada code. |
25906 | 142 @end itemize |
143 | |
144 @section Emacs support for writing Ada code: | |
145 | |
146 @itemize @bullet | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
147 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
148 switching between spec and body files with eventually |
25906 | 149 auto-generation of body files, |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
150 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
151 automatic formating of subprograms parameter lists. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
152 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
153 automatic smart indentation according to Ada syntax, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
154 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
155 automatic completion of identifiers, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
156 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
157 automatic casing of identifiers, keywords, and attributes, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
158 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
159 insertion of statement templates, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
160 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
161 filling comment paragraphs like filling normal text, |
25906 | 162 @end itemize |
163 | |
164 @c ----------------------------------------------------------------------- | |
165 @node Installation, Customization, Overview, Top | |
166 @chapter Installation | |
167 @c ----------------------------------------------------------------------- | |
168 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
169 If you got Ada mode as a separate distribution, you should have a |
25906 | 170 look at the @file{README} file. It explains the basic steps necessary |
171 for a good installation of the emacs Ada mode. | |
172 | |
173 Installing the Ada mode is basically just a matter of copying a few | |
174 files into the Emacs library directories. Every time you open a file | |
175 with a file extension of @file{.ads} or @file{.adb}, Emacs will | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
176 automatically load and activate Ada mode. |
25906 | 177 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
178 @xref{Using non-standard file names}, if your files do |
25906 | 179 not use these extensions and if you want Emacs to automatically start the |
180 Ada mode every time you edit an Ada file. | |
181 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
182 See also the Emacs Manual (@pxref{(Top,,,emacs, The Emacs Manual)}), |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
183 for general usage variables that you might want to set. |
25906 | 184 |
185 @c --------------------------------------------------------------------- | |
186 @section Required files | |
187 @c --------------------------------------------------------------------- | |
188 | |
189 This Ada mode works best with Emacs 20.3 or higher (the easy editing | |
190 features for the project files won't work with any older version), but | |
191 most of the commands should work with older versions too. Please try to | |
192 install the most recent version of Emacs on your system before | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
193 installing Ada mode. |
25906 | 194 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
195 Although part of Ada mode is compiler-independent, the most advanced |
25906 | 196 features are specific to the Gnat compiler @url{http://www.gnat.com}. |
197 | |
198 The following files are provided with the Ada mode distribution: | |
199 | |
200 @itemize @bullet | |
201 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
202 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
203 @file{ada-mode.el}: The main file for Ada mode. |
25906 | 204 This is the only file which does not require Gnat. It contains the |
205 functions for indentation, formatting of parameter lists, stepping | |
206 through code, comment handling and automatic casing. Emacs versions | |
207 20.2 and higher already contain Ada mode version 2.27, which is an older | |
208 version of this file and should be replaced. Loading @file{ada-mode.el} | |
209 from the current distribution supersedes the standard installation. | |
210 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
211 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
212 @file{ada-stmt.el}: Contains the statement templates feature. |
25906 | 213 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
214 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
215 @file{ada-xref.el}: This file provides the main support for Gnat. |
25906 | 216 This is where the functions for cross-references, completion of |
217 identifiers, support for project files and compilation of your | |
218 application are defined. | |
219 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
220 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
221 @file{ada-prj.el}: The functions to use for easy-edition of the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
222 project files. This file is the only one which really requires Emacs |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
223 at least 20.2. It uses the new widget features from Emacs. |
25906 | 224 |
225 @end itemize | |
226 | |
227 @c -------------------------------------------------------------------- | |
228 @node Customization, Project files, Installation, Top | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
229 @chapter Customizing Ada mode |
25906 | 230 @c --------------------------------------------------------------------- |
231 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
232 Ada mode is fully customizable. Everything, from the file names to |
25906 | 233 the automatic indentation and the automatic casing can be adapted to |
234 your own needs. | |
235 | |
236 There are two different kinds of variables that control this | |
237 customization, both are easy to modify. | |
238 | |
239 The first set of variables are standard Emacs variables. Of course, some | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
240 are defined only for Ada mode, whereas others have a more general |
25906 | 241 meaning in Emacs. Please see the Emacs documentation for more |
242 information on the latest. In this documentation, we will detail all the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
243 variables that are specific to Ada mode, and a few others. The names |
25906 | 244 will be given, as in @code{ada-case-identifier}. |
245 | |
246 Emacs provides an easy way to modify them, through a special mode called | |
247 customization. To access this mode, select the menu | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
248 @samp{Ada->Customize}. This will open a new buffer with some fields that |
25906 | 249 you can edit. For instance, you will get something like: |
250 @example | |
251 Put below the compiler switches. | |
252 comp_opt= _____________________________________ | |
253 @end example | |
254 The first line gives a brief description of the variable. The second | |
255 line is the name of the variable and the field where you can give a | |
256 value for this variable. Simply type what you want in the field. | |
257 | |
258 When you are finished modifying the variables, you can simply click on | |
259 the @b{Save for future sessions} button at the top of the buffer (click | |
260 with the middle mouse button). This will save the values in your | |
261 @file{.emacs} file, so that next time you start Emacs they will have the | |
262 same values. | |
263 | |
264 To modify a specific variable, you can directly call the function | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
265 @code{customize-variable} from Emacs (just type @kbd{M-x |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
266 customize-variable @key{RET} @var{variable-name} @key{RET}}). |
25906 | 267 |
268 Some users might prefer to modify the variables directly in their | |
269 configuration file, @file{.emacs}. This file is coded in Emacs lisp, and | |
270 the syntax to set a variable is the following: | |
271 @example | |
272 (setq variable-name value) | |
273 @end example | |
274 | |
275 The second set of variables for customization are set through the use of | |
276 project files. These variables are specific to a given project, whereas | |
277 the first set was more general. For more information, please | |
278 @xref{Project files}. | |
279 | |
280 @c --------------------------------------------------------------------- | |
281 @node Project files, Syntax highlighting, Customization, Top | |
282 @chapter Project files | |
283 @c --------------------------------------------------------------------- | |
284 | |
285 @c --------------------------------------------------------------------- | |
286 @section General overview | |
287 @c --------------------------------------------------------------------- | |
288 | |
289 Emacs provides a full Integrated Development Environment for GNAT and | |
290 Ada programmers. That is to say, editing, compiling, executing and | |
291 debugging can be performed within Emacs in a convenient and natural way. | |
292 | |
293 To take full advantage of this features, it is possible to create a file | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
294 in the main directory of your application, with a @samp{.adp} extension. |
25906 | 295 This file contain all needed information dealing with the way your |
296 application is organized between directories, the commands to compile, | |
297 run and debug it etc. Creating this file is not mandatory and convenient | |
298 defaults are automatically provided for simple setups. It only becomes | |
299 necessary when those above mentioned defaults need customizing. | |
300 | |
301 A simple way to edit this file is provided for Emacs 20.2 or newer, with | |
302 the following functions, that you can access also through the Ada | |
303 menu. It is also possible to edit the project file as a regular text | |
304 file. | |
305 | |
306 Once in the buffer for editing the project file, you can save your | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
307 modification using the @samp{[OK]} button at the bottom of the buffer, or |
25906 | 308 simply use the usual @kbd{C-x C-s} binding. To cancel your |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
309 modifications, simply kill the buffer or click on the @samp{[CANCEL]} button |
25906 | 310 at the button. |
311 | |
312 Each buffer using Ada mode will be associated with one project file when | |
313 there is one available, so that Emacs can easily navigate through | |
314 related source files for instance. | |
315 | |
316 The exact algorithm to determine which project file should be used is | |
317 described in the next section, but you can force the project file you | |
318 want to use by setting one or two variables in your @file{.emacs} file. | |
319 | |
320 @itemize @bullet | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
321 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
322 To set up a default project file to use for any directory, anywhere |
25906 | 323 on your system, set the variable @code{ada-prj-default-project-file} to |
324 the name of that file. | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
325 |
25906 | 326 @example |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
327 (set 'ada-prj-default-project-file "/dir1/dir2/file") |
25906 | 328 @end example |
329 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
330 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
331 For finer control, you can set a per-directory project file. |
25906 | 332 This is done through the variable @code{ada-xref-default-prj-file}. |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
333 |
25906 | 334 @example |
335 (set 'ada-xref-default-prj-file | |
336 '(("/dir1/dir2" . "/dir3/file1") | |
337 ("/dir4/dir5" . "/dir6/file2"))) | |
338 @end example | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
339 |
25906 | 340 Note: This has a higher priority than the first variable, so the first |
341 choice is to use this variable settings, and otherwise | |
342 @code{ada-prj-default-project-file}. | |
343 @end itemize | |
344 | |
345 | |
346 @table @kbd | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
347 @item C-c u |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
348 Create or edit the project file for the current buffer (@code{ada-customize}). |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
349 @item C-c c |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
350 Change the project file associated with the current Ada buffer (@code{ada-change-prj}). |
25906 | 351 @item C-c d |
352 Change the default project file for the current directory. Every new | |
353 file opened from this directory will be associated with that file by | |
354 default. | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
355 @item ada-set-default-project-file |
25906 | 356 Set the default project file to use for *any* Ada file opened anywhere |
357 on your system. This sets this file only for the current Emacs session. | |
358 @end table | |
359 | |
360 @c --------------------------------------------------------------------- | |
361 @section Project file variables | |
362 @c --------------------------------------------------------------------- | |
363 | |
364 The following variables can be defined in a project file. They all have | |
365 a default value, so that small projects do not need to create a project | |
366 file. | |
367 | |
368 Some variables below can be referenced in other variables, using a | |
369 shell-like notation. For instance, if the variable @code{comp_cmd} | |
370 contains a sequence like @code{$@{comp_opt@}}, the value of that variable | |
371 will be substituted. | |
372 | |
373 Here is the list of variables: | |
374 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
375 @table @asis |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
376 @item @code{src_dir} [default: @code{"./"}] |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
377 This is a list of directories where Ada mode will look for source |
25906 | 378 files. These directories are used mainly in two cases, both as a switch |
379 for the compiler and for the cross-references. | |
380 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
381 @item @code{obj_dir} [default: @code{"./"}] |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
382 This is a list of directories where to look for object and library |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
383 files. The library files are the @samp{.ali} files generated by Gnat |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
384 and that contain cross-reference informations. |
25906 | 385 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
386 @item @code{comp_opt} [default: @code{""}] |
25906 | 387 Creates a variable which can be referred to subsequently by using the |
388 @code{$@{comp_opt@}} notation. This is intended to store the default | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
389 switches given to @command{gnatmake} and @command{gcc}. |
25906 | 390 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
391 @item @code{bind_opt=@var{switches}} [default: @code{""}] |
25906 | 392 Creates a variable which can be referred to subsequently by using the |
393 @code{$@{bind_opt@}} notation. This is intended to store the default | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
394 switches given to @command{gnatbind}. |
25906 | 395 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
396 @item @code{link_opt=@var{switches}} [default: @code{""}] |
25906 | 397 Creates a variable which can be referred to subsequently by using the |
398 @code{$@{link_opt@}} notation. This is intended to store the default | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
399 switches given to @command{gnatlink}. |
25906 | 400 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
401 @item @code{main=@var{executable}} [default: @code{""}] |
25906 | 402 Specifies the name of the executable for the application. This variable |
403 can be referred to in the following lines by using the @code{$@{main@}} | |
404 notation. | |
405 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
406 @item @code{cross_prefix=@var{prefix}} [default: @code{""}] |
25906 | 407 This variable should be set if you are working in a cross-compilation |
408 environment. This is the prefix used in front of the gnatmake commands. | |
409 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
410 @item @code{remote_machine=@var{machine}} [default: @code{""}] |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
411 This is the name of the machine to log into before issuing the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
412 compilation command. If this variable is empty, the command will be |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
413 run on the local machine. This will not work on Windows NT machines, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
414 since Ada mode will simply precede the compilation command with a |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
415 @command{rsh} command, unknown on Windows. |
25906 | 416 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
417 @item @code{comp_cmd=@var{command}} [default: @code{"$@{cross_prefix@}gcc -c -I$@{src_dir@} -g -gnatq"}] |
25906 | 418 Specifies the command used to compile a single file in the application. |
419 The name of the file will be added at the end of this command. | |
420 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
421 @item @code{make_cmd=@var{command}} [default: @code{"$@{cross_prefix@}gnatmake $@{main@} -aI$@{src_dir@} -aO$@{obj_dir@} -g -gnatq -cargs $@{comp_opt@} -bargs $@{bind_opt@} -largs $@{link_opt@}"]}' |
25906 | 422 Specifies the command used to recompile the whole application. |
423 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
424 @item @code{run_cmd=@var{command}} [default: @code{"$@{main@}"}] |
25906 | 425 Specifies the command used to run the application. |
426 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
427 @item @code{debug_cmd=@var{command}} [default: @code{"$@{cross_prefix@}gdb $@{main@}"}] |
25906 | 428 Specifies the command used to debug the application |
429 | |
430 @end table | |
431 | |
432 @c --------------------------------------------------------------------- | |
433 @section Detailed algorithm | |
434 @c --------------------------------------------------------------------- | |
435 | |
436 This section gives more details on the project file setup and is only of | |
437 interest for advanced users. | |
438 | |
439 Usually, an Ada file is part of a larger application, whose sources and | |
440 objects can be spread over multiple directories. The first time emacs is | |
441 asked to compile, run or debug an application, or when a cross reference | |
442 function is used (goto declaration for instance), the following steps | |
443 are taken: | |
444 | |
445 @itemize @bullet | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
446 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
447 find the appropriate project file, open and parse it. |
25906 | 448 All the fields read in the project file are then stored by emacs |
449 locally. Finding the project file requires a few steps: | |
450 | |
451 @itemize @minus | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
452 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
453 if a file from the same directory was already associated with |
25906 | 454 a project file, use the same one. This is the variable |
455 @code{ada-xref-default-prj-file} described above. | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
456 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
457 if the variable @code{ada-prj-default-project-file} is set, |
25906 | 458 use the project file specified in this variable. |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
459 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
460 if there is a project file whose name is the same as the source file |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
461 except for the suffix, use this one. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
462 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
463 if there's only one project file in the source directory, use |
25906 | 464 that one. |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
465 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
466 if there are more than one project file in the source directory, |
25906 | 467 ask the user. |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
468 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
469 if there are no project files in the source directory use standard |
25906 | 470 default values. |
471 @end itemize | |
472 | |
473 The first project file that is selected in a given directory becomes the | |
474 default project file for this directory and is used implicitly for other | |
475 sources unless specified otherwise by the user. | |
476 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
477 @item |
38881
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
478 look for the corresponding @samp{.ali} file in the @code{obj_dir} defined |
25906 | 479 in the project file. If this file can not be found, emacs proposes to |
480 compile the source using the @code{comp_cmd} defined in the project file | |
481 in order to create the ali file. | |
482 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
483 @item |
38881
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
484 when cross referencing is requested, the @samp{.ali} file is parsed to |
25906 | 485 determine the file and line of the identifier definition. It is |
38881
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
486 possible for the @samp{.ali} file to be older than the source file, |
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
487 in which case it will be recompiled if the variable |
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
488 @code{ada-xref-create-ali} is set, otherwise the reference is searched |
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
489 in the obsolete ali file with possible inaccurate results. |
25906 | 490 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
491 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
492 look for the file containing the declaration using the source |
25906 | 493 path @code{src_dir} defined in the project file. Put the cursor at the |
494 correct position and display this new cursor. | |
495 @end itemize | |
496 | |
497 @c ----------------------------------------------------------------------- | |
498 @node Syntax highlighting, Moving Through Ada Code, Project files, Top | |
499 @chapter Syntax highlighting | |
500 @c ----------------------------------------------------------------------- | |
501 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
502 Ada mode is made to help you understand the structure of your source |
25906 | 503 files. Some people like having colors or different fonts depending on |
504 the context: commands should be displayed differently than keywords, | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
505 which should also be different from strings, @dots{} |
25906 | 506 |
507 Emacs is able to display in a different way the following syntactic | |
508 entities: | |
509 | |
510 @itemize @bullet | |
511 @item keywords | |
512 @item commands | |
513 @item strings | |
514 @item gnatprep statements (preprocessor) | |
515 @item types (under certain conditions) | |
516 @item other words | |
517 @end itemize | |
518 | |
519 This is not the default behavior for Emacs. You have to explicitly | |
520 activate it. This requires that you add a new line in your @file{.emacs} | |
521 file (if this file does not exist, just create it). | |
522 | |
523 @example | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
524 (global-font-lock-mode t) |
25906 | 525 @end example |
526 | |
527 But the default colors might not be the ones you like. Fortunately, | |
528 there is a very easy way to change them. Just select the menu | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
529 @samp{Help->Customize->Specific Face...} and press @key{RET}. This |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
530 will display a buffer will all the ``faces'' (the colors) that Emacs knows |
25906 | 531 about. You can change any of them. |
532 | |
533 | |
534 @c ----------------------------------------------------------------------- | |
535 @node Moving Through Ada Code, Identifier completion, Syntax highlighting, Top | |
536 @chapter Moving Through Ada Code | |
537 @c ----------------------------------------------------------------------- | |
538 | |
539 There are several easy to use commands to stroll through Ada code. All | |
540 these functions are available through the Ada menu, and you can also use | |
541 the following key bindings or the command names: | |
542 | |
543 @table @kbd | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
544 @item M-C-e |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
545 Move to the next function/procedure/task, which ever comes next |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
546 (@code{ada-next-procedure}). |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
547 @item M-C-a |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
548 Move to previous function/procedure/task |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
549 (@code{ada-previous-procedure}). |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
550 @item M-x ada-next-package |
25906 | 551 Move to next package. |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
552 @item M-x ada-prev-package |
25906 | 553 Move to previous package. |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
554 @item C-c C-a |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
555 Move to matching start of @code{end} (@code{ada-move-to-start}). If |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
556 point is at the end of a subprogram, this command jumps to the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
557 corresponding @code{begin} if the user option |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
558 @code{ada-move-to-declaration} is @code{nil} (default), it jumps to |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
559 the subprogram declaration otherwise. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
560 @item C-c C-e |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
561 Move point to end of current block (@code{ada-move-to-end}). |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
562 @item C-c o |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
563 Switch between corresponding spec and body file |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
564 (@code{ff-find-other-file}). If the cursor is on a subprogram, switch |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
565 between declaration and body. |
25906 | 566 @item C-c c-d |
567 Move from any reference to its declaration and switch between | |
568 declaration and body (for procedures, tasks, private and incomplete | |
569 types). | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
570 @item C-c C-r |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
571 runs the @file{gnatfind} command to search for all references to the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
572 entity pointed by the cursor (@code{ada-find-references}). Use |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
573 @kbd{C-x `} (@code{next-error}) to visit each reference (as for |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
574 compilation errors). |
25906 | 575 @end table |
576 | |
577 These functions use the information in the output of the Gnat Ada | |
578 compiler. However, if your application was compiled with the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
579 @samp{-gnatx} switch, these functions will not work, since no extra |
25906 | 580 information is generated by GNAT. See GNAT documentation for further |
581 information. | |
582 | |
583 Emacs will try to run Gnat for you whenever the cross-reference | |
584 informations are older than your source file (provided the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
585 @code{ada-xref-create-ali} variable is non-@code{nil}). Gnat then produces a |
25906 | 586 file with the same name as the current Ada file but with the extension |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
587 changed to @file{.ali}. This files are normally used by the binder, but |
25906 | 588 they will also contain additional cross-referencing information. |
589 | |
590 @c ----------------------------------------------------------------------- | |
591 @node Identifier completion, Index Menu of Subprograms, Moving Through Ada Code, Top | |
592 @chapter Identifier completion | |
593 @c ----------------------------------------------------------------------- | |
594 | |
595 @c ----------------------------------------------------------------------- | |
596 @section Overview | |
597 @c ----------------------------------------------------------------------- | |
598 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
599 Emacs and Ada mode provide two general ways for the completion of |
25906 | 600 identifiers. This is an easy way to type faster: you just have to type |
601 the first few letters of an identifiers, and then loop through all the | |
602 possible completions. | |
603 | |
604 The first method is general for Emacs. It will work both with Ada | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
605 buffers, but also in C buffers, Java buffers, @enddots{} The idea is to parse |
25906 | 606 all the opened buffers for possible completions. |
607 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
608 For instance, if the words @samp{my_identifier}, @samp{my_subprogram} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
609 are the only words starting with @samp{my} in any of the opened files, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
610 then you will have this scenario: |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
611 |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
612 @quotation |
25906 | 613 You type: my@key{M-/} |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
614 Emacs inserts: @samp{my_identifier} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
615 If you press @key{M-/} once again, Emacs replaces @samp{my_identifier} with |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
616 @samp{my_subprogram}. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
617 Pressing @key{M-/} once more will bring you back to @samp{my_identifier}. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
618 @end quotation |
25906 | 619 |
620 This is a very fast way to do completion, and the casing of words will | |
621 also be respected. | |
622 | |
623 The second method is specific to Ada buffer, and even to users of the | |
38881
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
624 Gnat compiler. Emacs will search the cross-information found in the |
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
625 @samp{.ali} files generated by Gnat for possible completions. |
25906 | 626 |
627 The main advantage is that this completion is more accurate: only | |
628 existing identifier will be suggested, you don't need to have a file | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
629 opened that already contains this identifiers, @enddots{} |
25906 | 630 |
631 On the other hand, this completion is a little bit slower and requires | |
632 that you have compiled your file at least once since you created that | |
633 identifier. | |
634 | |
635 @c ----------------------------------------------------------------------- | |
636 @section Summary of commands | |
637 @c ----------------------------------------------------------------------- | |
638 | |
639 @table @kbd | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
640 @item C-@key{TAB} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
641 Complete accurately current identifier using information in @samp{.ali} file |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
642 (@code{ada-complete-identifier}). |
25906 | 643 @item M-/ |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
644 Complete identifier using buffer information (not Ada-specific). |
25906 | 645 @end table |
646 | |
647 @c ----------------------------------------------------------------------- | |
648 @node Index Menu of Subprograms, File Browser, Identifier completion, Top | |
649 @chapter Index Menu of Subprograms | |
650 @c ----------------------------------------------------------------------- | |
651 | |
652 You can display a choice menu with all procedure/function/task | |
653 declarations in the file and choose an item by mouse click to get to its | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
654 declaration. This function is accessible through the @samp{Ada} menu when |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
655 editing a Ada file, or simply through the following key binding: |
25906 | 656 |
657 @table @kbd | |
36509
45500c80145f
Fix case convention for mouse click.
Richard M. Stallman <rms@gnu.org>
parents:
30009
diff
changeset
|
658 @item C-S-Mouse-3 |
25906 | 659 display index menu |
660 @end table | |
661 | |
662 @c ----------------------------------------------------------------------- | |
663 @node File Browser, Automatic Smart Indentation, Index Menu of Subprograms, Top | |
664 @chapter File Browser | |
665 @c ----------------------------------------------------------------------- | |
666 | |
667 Emacs provides a special mode, called @code{speedbar}. When this mode is | |
668 activated, a new frame is displayed, with a file browser. The files from | |
669 the current directory are displayed, and you can click on them as you | |
670 would with any file browser. The following commands are then available. | |
671 | |
672 You can click on a directory name or file name to open it. The editor | |
673 will automatically select the best possible mode for this file, | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
674 including of course Ada mode for files written in Ada. |
25906 | 675 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
676 If you click on the @samp{[+]} symbol near a file name, all the symbols (types, |
25906 | 677 variables and subprograms) defined in that file will be displayed, and |
678 you can directly click on them to open the right file at the right | |
679 place. | |
680 | |
681 You can activate this mode by typing @key{M-x speedbar} in the editor. | |
682 This will open a new frame. A better way might be to assicate the | |
683 following key binding | |
684 | |
685 @example | |
686 (global-set-key [f7] 'speedbar-get-focus) | |
687 @end example | |
688 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
689 Every time you press @key{F7}, the mouse will automatically move to the |
25906 | 690 speedbar frame (which will be created if it does not exist). |
691 | |
692 @c ----------------------------------------------------------------------- | |
693 @node Automatic Smart Indentation, Formatting Parameter Lists, File Browser, Top | |
694 @chapter Automatic Smart Indentation | |
695 @c ----------------------------------------------------------------------- | |
696 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
697 Ada mode comes with a full set of rules for automatic indentation. |
25906 | 698 You can of course configure the indentation as you want, by setting the |
699 value of a few variables. | |
700 | |
701 As always, the preferred way to modify variables is to use the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
702 @samp{Ada->Customize} menu (don't forget to save your changes!). This |
25906 | 703 will also show you some example of code where this variable is used, and |
704 hopefully make things clearer. | |
705 | |
706 The relevant variables are the following: | |
707 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
708 @table @asis |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
709 @item @code{ada-broken-indent} (default value: 2) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
710 Number of columns to indent the continuation of a broken line. |
25906 | 711 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
712 @item @code{ada-indent} (default value: 3) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
713 Width of the default indentation. |
25906 | 714 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
715 @item @code{ada-indent-record-rel-type} (default value: 3) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
716 Indentation for @code{record} relative to @code{type} or @code{use}. |
25906 | 717 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
718 @item @code{ada-indent-return} (default value: 0) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
719 Indentation for @code{return} relative to @code{function} (if |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
720 @code{ada-indent-return} is greater than 0), or the open parenthesis |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
721 (if @code{ada-indent-return} is negative or null). Note that in the second |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
722 case, when there is no open parenthesis, the indentation is done |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
723 relative to @code{function} with the value of @code{ada-broken-indent}. |
25906 | 724 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
725 @item @code{ada-label-indent} (default value: -4) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
726 Number of columns to indent a label. |
25906 | 727 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
728 @item @code{ada-stmt-end-indent} (default value: 0) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
729 Number of columns to indent a statement @code{end} keyword on a separate line. |
25906 | 730 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
731 @item @code{ada-when-indent} (default value: 3) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
732 Indentation for @code{when} relative to @code{exception} or @code{case}. |
25906 | 733 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
734 @item @code{ada-indent-is-separate} (default value: t) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
735 Non-@code{nil} means indent @code{is separate} or @code{is abstract} if on a single line. |
25906 | 736 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
737 @item @code{ada-indent-to-open-paren} (default value: t) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
738 Non-@code{nil} means indent according to the innermost open parenthesis. |
25906 | 739 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
740 @item @code{ada-indent-after-return} (default value: t) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
741 Non-@code{nil} means that the current line will also be re-indented before |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
742 inserting a newline, when you press @key{RET}. |
25906 | 743 @end table |
744 | |
745 Most of the time, the indentation will be automatic, i.e when you will | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
746 press @key{RET}, the cursor will move to the correct column on the |
25906 | 747 next line. |
748 | |
749 However, you might want or need sometimes to re-indent the current line | |
750 or a set of lines. For this, you can simply go to that line, or select | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
751 the lines, and then press @key{TAB}. This will automatically re-indent |
25906 | 752 the lines. |
753 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
754 Another mode of indentation exists that helps you to set up your |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
755 indentation scheme. If you press @kbd{C-c @key{TAB}}, Ada mode will do |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
756 the following: |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
757 |
25906 | 758 @itemize @bullet |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
759 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
760 Reindent the current line, as @key{TAB} would do. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
761 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
762 Temporarily move the cursor to a reference line, i.e., the line that |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
763 was used to calculate the current indentation. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
764 @item |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
765 Display at the bottom of the window the name of the variable that |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
766 provided the offset for the indentation. |
25906 | 767 @end itemize |
768 | |
769 The exact indentation of the current line is the same as the one for the | |
770 reference line, plus an offset given by the variable. | |
771 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
772 Once you know the name of the variable, you can either modify it |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
773 through the usual @samp{Ada->Customize} menu, or by typing @kbd{M-x |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
774 customize-variable @key{RET}} in the Emacs window, and then give the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
775 name of the variable. |
25906 | 776 |
777 @table @kbd | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
778 @item @key{TAB} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
779 Indent the current line or the current region. |
25906 | 780 @item M-C-\ |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
781 Indent lines in the current selected block. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
782 @item C-c @key{TAB} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
783 Indent the current line and prints the name of the variable used for |
25906 | 784 indentation. |
785 @end table | |
786 | |
787 | |
788 | |
789 @c ----------------------------------------------------------------------- | |
790 @node Formatting Parameter Lists, Automatic Casing, Automatic Smart Indentation, Top | |
791 @chapter Formatting Parameter Lists | |
792 @c ----------------------------------------------------------------------- | |
793 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
794 To help you correctly align fields in a subprogram parameter list, |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
795 Emacs provides one function that will do most of the work for you. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
796 This function will align the declarations on the colon (@samp{:}) |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
797 separating argument names and argument types, plus align the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
798 @code{in}, @code{out} and @code{in out} keywords if required. |
25906 | 799 |
800 @table @kbd | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
801 @item C-c C-f |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
802 Format the parameter list (@code{ada-format-paramlist}). |
25906 | 803 @end table |
804 | |
805 @c ----------------------------------------------------------------------- | |
806 @node Automatic Casing, Statement Templates, Formatting Parameter Lists, Top | |
807 @chapter Automatic Casing | |
808 @c ----------------------------------------------------------------------- | |
809 | |
810 Casing of identifiers, attributes and keywords is automatically | |
811 performed while typing when the variable @code{ada-auto-case} is set. | |
812 Every time you press a word separator, the previous word is | |
813 automatically cased. | |
814 | |
815 You can customize the automatic casing differently for keywords, | |
816 attributes and identifiers. The relevant variables are the following: | |
817 @code{ada-case-keyword}, @code{ada-case-attribute} and | |
818 @code{ada-case-identifier}. | |
819 | |
820 All these variables can have one of the following values: | |
821 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
822 @table @code |
25906 | 823 @item downcase-word |
824 The previous word will simply be in all lower cases. For instance | |
825 @code{My_vARIable} is converted to @code{my_variable}. | |
826 | |
827 @item upcase-word | |
828 The previous word will be fully converted to upper cases. For instance | |
829 @code{My_vARIable} is converted to @code{MY_VARIABLE}. | |
830 | |
831 @item ada-capitalize-word | |
832 All letters, except the first one of the word and every letter after the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
833 @samp{_} character are lower cased. Other letters are upper cased. For |
25906 | 834 instance @code{My_vARIable} is converted to @code{My_Variable}. |
835 | |
836 @item ada-loose-case-word | |
837 No letters is modified in the previous word, except the ones after the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
838 @samp{_} character that are upper cased. For instance @code{My_vARIable} is |
25906 | 839 converted to @code{My_VARIable}. |
840 @end table | |
841 | |
842 These functions, although they will work in most cases, will not be | |
843 accurate sometimes. The Ada mode allows you to define some exceptions, | |
844 that will always be cased the same way. | |
845 | |
846 The idea is to create a dictionary of exceptions, and store it in a | |
847 file. This file should contain one identifier per line, with the casing | |
848 you want to force. The default name for this file is | |
849 @file{~/.emacs_case_exceptions}. You can of course change this name, | |
850 through the variable @code{ada-case-exception-file}. | |
851 | |
852 Note that each line in this file must start with the key word whose | |
853 casing you want to specify. The rest of the line can be used for | |
854 comments (explaining for instance what an abbreviation means, as | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
855 recommended in the Ada 95 Quality and Style, paragraph 3.1.4). Thus, a |
25906 | 856 good example for this file could be: |
857 | |
858 @example | |
859 DOD Department of Defense | |
860 Text_IO | |
861 GNAT The GNAT compiler from Ada Core Technologies | |
862 @end example | |
863 | |
864 When working on project involving multiple programmers, we recommend | |
865 that every member of the team sets this variable to the same value, | |
866 which should point to a system-wide file that each of them can | |
867 write. That way, you will ensure that the casing is consistent | |
868 throughout your application(s). | |
869 | |
870 There are two ways to add new items to this file: you can simply edit it | |
871 as you would edit any text file, and add or suppress entries in this | |
872 file. Remember that you should put one entity per line. The other, | |
873 easier way, is to position the cursor over the word you want to add, in | |
874 an Ada buffer. This word should have the casing you want. Then simply | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
875 select the menu @samp{Ada->Edit->Create Case Exception}, or the key |
25906 | 876 @kbd{C-c C-y}. The word will automatically be added to the current list |
877 of exceptions and to the file. | |
878 | |
879 It is sometimes useful to have multiple exception files around (for | |
880 instance, one could be the standard Ada acronyms, the second some | |
881 company specific exceptions, and the last one some project specific | |
882 exceptions). If you set up the variable @code{ada-case-exception-file} | |
883 as a list of files, each of them will be parsed and used in your emacs | |
884 session. | |
885 | |
886 However, when you save a new exception through the menu, as described | |
887 above, the new exception will be added to the first file in the list | |
888 only. You can not automatically add an exception to one of the other | |
889 files, although you can of course edit the files by hand at any time. | |
890 | |
891 Automatic casing can be performed on port or whole buffer using: | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
892 |
25906 | 893 @table @kbd |
894 @item C-c C-b | |
895 Adjust case in the whole buffer. | |
896 @item C-c C-y | |
897 Create a new entry in the exception dictionary, with the word under | |
898 the cursor | |
899 @item C-c C-t | |
900 Rereads the exception dictionary from the file | |
901 @code{ada-case-exception-file}. | |
902 @end table | |
903 | |
904 @c ----------------------------------------------------------------------- | |
905 @node Statement Templates, Comment Handling, Automatic Casing, Top | |
906 @chapter Statement Templates | |
907 @c ----------------------------------------------------------------------- | |
908 | |
909 NOTE: This features are not available on VMS for Emacs 19.28. The | |
910 functions used here do not exist on Emacs 19.28. | |
911 | |
912 Templates exist for most Ada statements. They can be inserted in the | |
913 buffer using the following commands: | |
914 | |
915 @table @kbd | |
916 @item C-c t b | |
917 exception Block | |
918 @item C-c t c | |
919 case. | |
920 @item C-c t d | |
921 declare Block. | |
922 @item C-c t e | |
923 else. | |
924 @item C-c t f | |
925 for Loop. | |
926 @item C-c t h | |
927 Header. | |
928 @item C-c t i | |
929 if. | |
930 @item C-c t k | |
931 package Body. | |
932 @item C-c t l | |
933 loop. | |
934 @item C-c t t | |
935 task Body. | |
936 @item C-c t w | |
937 while Loop. | |
938 @item C-c t u | |
939 use. | |
940 @item C-c t x | |
941 exit. | |
942 @item C-c t C-a | |
943 array. | |
944 @item C-c t C-e | |
945 elsif. | |
946 @item C-c t C-f | |
947 function Spec. | |
948 @item C-c t C-k | |
949 package Spec. | |
950 @item C-c t C-p | |
951 procedure Spec. | |
952 @item C-c t C-r | |
953 record. | |
954 @item C-c t C-s | |
955 subtype. | |
956 @item C-c t C-t | |
957 task Spec. | |
958 @item C-c t C-u | |
959 with. | |
960 @item C-c t C-v | |
961 private. | |
962 @item C-c t C-w | |
963 when. | |
964 @item C-c t C-x | |
965 exception. | |
966 @item C-c t C-y | |
967 type. | |
968 @end table | |
969 | |
970 @c ----------------------------------------------------------------------- | |
971 @node Comment Handling, Compiling Executing, Statement Templates, Top | |
972 @chapter Comment Handling | |
973 @c ----------------------------------------------------------------------- | |
974 | |
975 By default, comment lines get indented like Ada code. There are a few | |
976 additional functions to handle comments: | |
977 | |
978 | |
979 @table @kbd | |
980 @item M-; | |
981 Start a comment in default column. | |
982 @item M-j | |
983 Continue comment on next line. | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
984 @item C-c ; |
25906 | 985 Comment the selected region (add -- at the beginning of lines). |
986 @item C-c : | |
987 Uncomment the selected region | |
988 @item M-q | |
989 autofill the current comment. | |
990 @end table | |
991 | |
992 @c ----------------------------------------------------------------------- | |
993 @node Compiling Executing, Debugging, Comment Handling, Top | |
994 @chapter Compiling Executing | |
995 @c ----------------------------------------------------------------------- | |
996 | |
997 Ada mode provides a much complete environment for compiling, debugging | |
998 and running an application within Emacs. | |
999 | |
1000 All the commands used by Emacs to manipulate your application can be | |
1001 customized in the project file. Some default values are provided, but | |
1002 these will likely not be good enough for a big or even medium-sized | |
1003 project. See the section on the project file for an explanation on how | |
1004 to set up the commands to use. | |
1005 | |
1006 One of the variables you can set in your project file, | |
1007 @code{cross_prefix}, indicates whether you are using a cross-compilation | |
1008 environment, and if yes for which target. The default command used for | |
1009 compilation will add this @code{cross_prefix} in front of the name: | |
1010 @code{gcc} will become @code{cross_prefix}-@code{gcc}, @code{gnatmake} | |
38881
ef5cc490984d
Fix a few minor markup errors.
Eli Zaretskii <eliz@gnu.org>
parents:
38864
diff
changeset
|
1011 will become @code{cross_prefix}-@code{gnatmake}, @enddots{} |
25906 | 1012 |
1013 This will also modify the way your application is run and debugged, | |
1014 although this is not implemented at the moment. | |
1015 | |
1016 Here are the commands for building and using an Ada application | |
1017 | |
1018 @itemize @bullet | |
1019 | |
1020 @item Compiling the current source | |
1021 This command is issued when issuing the @code{compile} command from the | |
1022 Ada menu. It compiles unconditionally the current source using the | |
1023 @code{comp_cmd} variable of the project file. Compilation options can be | |
1024 customized with the variable @code{comp_opt} of the project file. | |
1025 | |
1026 Emacs will display a new buffer that contains the result of the | |
1027 compilation. Each line associated with an error will become active: you | |
1028 can simply click on it with the middle button of the mouse, or move the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1029 cursor on it and press @key{RET}. Emacs will then display the |
25906 | 1030 relevant source file and put the cursor on the line and column the error |
1031 was found at. | |
1032 | |
1033 You can also simply press the @kbd{C-x `} key and Emacs will jump to the | |
1034 first error. If you press that key again, it will move you to the second | |
1035 error, and so on. | |
1036 | |
1037 Some error messages might also include references to some files. These | |
1038 references are also clickable in the same way. | |
1039 | |
1040 | |
1041 @item (Re)building the whole application | |
1042 This command is issued when you select the @code{build} command from the | |
1043 Ada menu. It compiles all obsolete units of the current application | |
1044 using the @code{make_cmd} variable of the project file. Compilation | |
1045 options can be customized with the variable @code{comp_opt} of the | |
1046 project file, binder options with @code{bind_opt} and linker options | |
1047 with @code{link_opt}. The main unit of the application may be specified | |
1048 with @code{main}. | |
1049 | |
1050 The compilation buffer is also active in the same way it was for the above | |
1051 command. | |
1052 | |
1053 @item Running the application | |
1054 This command is issued when you select the @code{run} command from the | |
1055 Ada menu. It executes the current application in an emacs | |
1056 buffer. Arguments can be passed through before executing. The execution | |
1057 buffer allows for interactive input/output. | |
1058 | |
1059 This command is not yet available in a cross-compilation | |
1060 toolchain. Emacs would first need to log on the target before running | |
1061 the application. This will be implemented in a future release of Gnat. | |
1062 | |
1063 @end itemize | |
1064 | |
1065 @c --------------------------------------------------------------------- | |
1066 @node Debugging, Using non-standard file names, Compiling Executing, Top | |
1067 @chapter Debugging your application | |
1068 @c --------------------------------------------------------------------- | |
1069 | |
1070 You can set up in the project file a command to use to debug your | |
1071 application. Emacs is compatible with a lot of debuggers, and provide an | |
1072 easy interface to them. | |
1073 | |
1074 This selection will focus on the gdb debugger, and two of the graphical | |
1075 interfaces that exist for it. | |
1076 | |
1077 In all cases, the main window in Emacs will be split in two: in the | |
1078 upper buffer, the source code will appear, whereas the debugger | |
1079 input/output window is displayed at the bottom. You can enter the | |
1080 debugger commands as usual in the command window. Every time a new | |
1081 source file is selected by the debugger (for instance as a result of a | |
1082 @code{frame} command), the appropriate source file is displayed in the | |
1083 upper buffer. | |
1084 | |
1085 The source window is interactive: you can click on an identifier with the | |
1086 right mouse button, and print its value in the debugger window. You can | |
1087 also set a breakpoint simply by right-clicking on a line. | |
1088 | |
1089 You can easily use Emacs as the source window when you are using a | |
1090 graphical interface for the debugger. The interesting thing is that, | |
1091 whereas you still have the graphical nifties, you can also you the | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1092 cross-references features that Ada mode provides to look at the |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1093 definition for the identifiers, @enddots{} |
25906 | 1094 |
1095 Here is how you can set up gdbtk and ddd for use with Emacs (These are | |
1096 the commands you should setup in the project file): | |
1097 | |
1098 @itemize @bullet | |
1099 @item gdbtk | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1100 should be used with the switch @samp{--emacs_gdbtk}. It provides a nice |
25906 | 1101 backtrace window, as well as a tasks window. You can click interactively |
1102 on both of them, and Emacs will display the source file on the correct | |
1103 line. | |
1104 | |
1105 @item ddd (Data Display Debugger) | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1106 should be used with the switches @samp{--tty} and |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1107 @samp{--fullname}. Whenever you print a variable from Emacs, it will |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1108 be displayed graphically in the data window. |
25906 | 1109 |
1110 @end itemize | |
1111 | |
1112 | |
1113 @c --------------------------------------------------------------------- | |
1114 @node Using non-standard file names, Working Remotely, Debugging, Top | |
1115 @chapter Using non-standard file names | |
1116 @c --------------------------------------------------------------------- | |
1117 | |
1118 By default, Emacs is configured to use the GNAT style file names, where | |
1119 file names are the package names, and the extension for spec and bodies | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1120 are respectively @samp{.ads} and @samp{.adb}. |
25906 | 1121 |
1122 If you want to use other types of file names, you will need to modify | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1123 your @file{.emacs} file. |
25906 | 1124 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1125 Adding new possible extensions is easy. Since Ada mode needs to know |
25906 | 1126 how to go from the body to the spec (and back), you always have to |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1127 specify both. A function is provided with Ada mode to add new |
25906 | 1128 extensions. |
1129 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1130 For instance, if your spec and bodies files are called |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1131 @file{@var{unit}_s.ada} and @file{@var{unit}_b.ada}, respectively, you |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1132 need to add the following to your @file{.emacs} file: |
25906 | 1133 |
1134 @example | |
1135 (ada-add-extensions "_s.ada" "_b.ada") | |
1136 @end example | |
1137 | |
1138 Note that it is possible to redefine the extension, even if they already | |
1139 exist, as in: | |
1140 | |
1141 @example | |
1142 (ada-add-extensions ".ads" "_b.ada") | |
1143 (ada-add-extensions ".ads" ".body") | |
1144 @end example | |
1145 | |
1146 This simply means that whenever the ada-mode will look for the body for | |
1147 a file whose extension is @file{.ads}, it will take the first available | |
1148 file that ends with either @file{.adb} (standard), @file{_b.ada} or | |
1149 @file{.body}. | |
1150 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1151 If the filename is not the unit name, then things are a little more |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1152 complicated. You then need to rewrite the function |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1153 @code{ada-make-filename-from-adaname} (see the file @file{ada-mode.el} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1154 for an example). |
25906 | 1155 |
1156 @c --------------------------------------------------------------------- | |
1157 @node Working Remotely, ,Using non-standard file names, Top | |
1158 @chapter Working Remotely | |
1159 @c --------------------------------------------------------------------- | |
1160 | |
1161 When you work on project that involve a lot of programmers, it is | |
1162 generally the case that you will edit the files on your own machine, but | |
1163 you want to compile, run and debug your application in another buffer. | |
1164 | |
1165 Fortunately, here too Emacs provides a very convenient way to do this. | |
1166 | |
1167 @c --------------------------------------------------------------------- | |
1168 @section Remote editing | |
1169 @c --------------------------------------------------------------------- | |
1170 | |
1171 First of all, the files do not need to be on your machine. Emacs can | |
1172 edit any remote file, by doing transparent FTP sessions between your | |
1173 machine and the remote machine that stores your files. This is a special | |
1174 Emacs mode, called @code{ange-ftp}. To use it, you just have to use a | |
1175 slightly different syntax when you open a file. | |
1176 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1177 For instance, if you want to open the file @file{/work/foo.adb} on the machine |
25906 | 1178 aleph.gnu.org, where you log in as qwe, you would simply do this: |
1179 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1180 @example |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1181 C-x C-f /qwe@@aleph.gnu.org:/work/foo.adb @key{RET} |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1182 @end example |
25906 | 1183 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1184 @noindent |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1185 i.e., use your name, the name of the machine and the name of the file. |
25906 | 1186 |
1187 The first time, Emacs will ask you for a password that it will remember | |
1188 until you close the current Emacs. Even if the ftp session times out, | |
1189 you won't need to reenter your password. | |
1190 | |
1191 Every time you save the file, Emacs will upload it to the remote machine | |
1192 transparently. No file is modified on the local machine. | |
1193 | |
1194 @c --------------------------------------------------------------------- | |
1195 @section Remote compiling | |
1196 @c --------------------------------------------------------------------- | |
1197 | |
1198 If the machine you want to compile on is not the one your Emacs is | |
1199 running on, you can set the variable @code{remote_machine} in the | |
1200 project file for your application. | |
1201 | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1202 This will force Emacs to issue a @command{rsh} command for the compilation, |
25906 | 1203 instead of running it on the local machine. Unfortunately, this won't |
1204 work on Windows workstations, since this protocol is not supported. | |
1205 | |
1206 @example | |
1207 If your @code{remote_machine} is aleph.gnu.org and the standard | |
1208 compilation command is @code{cd /work/ && gnatmake foo}, then Emacs will | |
1209 actually issue the command @code{rsh aleph.gnu.org 'cd /work/ && | |
1210 gnatmake foo'}. | |
1211 @end example | |
1212 | |
1213 The advantage of using the @code{remote_machine} variable is that it is | |
1214 easier to change that machine without having to modify the compilation | |
1215 command. | |
1216 | |
1217 Note that if you need to set up some environment variables before the | |
1218 compilation, you need to insert a call to the appropriate initialization | |
1219 script in the compilation command, for instance: | |
1220 | |
1221 @example | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1222 build_cmd= initialization_script; cd /work/ && gnatmake foo |
25906 | 1223 @end example |
1224 | |
1225 @c --------------------------------------------------------------------- | |
1226 @section Remote running and debugging | |
1227 @c --------------------------------------------------------------------- | |
1228 | |
1229 This feature is not completely implemented yet. | |
1230 | |
1231 However, most of the time, you will be able to run your application | |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1232 remotely simply by replacing it with a @command{rsh} call. |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1233 For instance, if your command was @code{$@{main@}}, you could replace it with |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1234 @code{rsh aleph.gnu.org $@{main@}}. |
25906 | 1235 |
38864
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1236 However, this would not work on vxworks, for instance, where |
c656fc177008
Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents:
37403
diff
changeset
|
1237 @command{rsh} is not supported. |
25906 | 1238 |
1239 @contents | |
1240 @bye |