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