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