]> code.delx.au - gnu-emacs-elpa/blob - packages/ada-mode/ada-mode.info
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / ada-mode / ada-mode.info
1 This is ada-mode.info, produced by makeinfo version 6.0 from
2 ada-mode.texi.
3
4 Copyright (C) 1999 - 2015 Free Software Foundation, Inc.
5
6 Permission is granted to copy, distribute and/or modify this
7 document under the terms of the GNU Free Documentation License,
8 Version 1.3 or any later version published by the Free Software
9 Foundation; with no Invariant Sections, with the Front-Cover texts
10 being "A GNU Manual", and with the Back-Cover Texts as in (a)
11 below. A copy of the license is included in the section entitled
12 "GNU Free Documentation License".
13
14 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
15 modify this GNU manual. Buying copies from the FSF supports it in
16 developing GNU and promoting software freedom."
17 INFO-DIR-SECTION Emacs editing modes
18 START-INFO-DIR-ENTRY
19 * Ada mode: (ada-mode). Emacs mode for editing and navigating Ada code.
20 END-INFO-DIR-ENTRY
21
22 \1f
23 File: ada-mode.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
24
25 Ada Mode Version 5.1.9
26
27 Copyright (C) 1999 - 2015 Free Software Foundation, Inc.
28
29 Permission is granted to copy, distribute and/or modify this
30 document under the terms of the GNU Free Documentation License,
31 Version 1.3 or any later version published by the Free Software
32 Foundation; with no Invariant Sections, with the Front-Cover texts
33 being "A GNU Manual", and with the Back-Cover Texts as in (a)
34 below. A copy of the license is included in the section entitled
35 "GNU Free Documentation License".
36
37 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
38 modify this GNU manual. Buying copies from the FSF supports it in
39 developing GNU and promoting software freedom."
40
41 * Menu:
42
43 * Overview::
44 * Installation:: Installing Ada mode on your system
45 * Customization:: Setting up Ada mode to your taste
46 * Compiling Executing:: Working with your application within Emacs
47 * Project files:: Describing the organization of your project
48 * Moving Through Ada Code:: Moving easily through Ada sources
49 * Identifier completion:: Finishing words automatically
50 * Indentation:: Indenting your code automatically as you type
51 * Statement skeletons:: Some code is written for you
52 * Aligning code:: Making it pretty
53 * Automatic casing:: Adjusting the case of words automatically
54 * Comment Handling:: Reformatting comments easily
55 * Key summary::
56 * Developer overview::
57 * GNU Free Documentation License::
58 * Index::
59
60 \1f
61 File: ada-mode.info, Node: Overview, Next: Installation, Prev: Top, Up: Top
62
63 1 Overview
64 **********
65
66 The Emacs mode for programming in Ada helps the user in reading existing
67 code and facilitates developing new code.
68
69 Cross-reference information output by the compiler is used to provide
70 powerful code navigation (jump to definition, find all uses, etc).
71
72 When you open a file with a file extension of '.ads' or '.adb', Emacs
73 will automatically load and activate Ada mode.
74
75 Ada mode works without any customization, if you are using the GNAT
76 compiler (<https://libre2.adacore.com/>) and the GNAT default naming
77 convention.
78
79 You must customize a few things if you are using a different file
80 naming convention or compiler; *Note Non-standard file names::, *Note
81 Other compiler::.
82
83 In addition, you may want to customize the indentation,
84 capitalization, and other things; *Note Other customization::.
85
86 Finally, for large Ada projects, you will want to set up an Emacs Ada
87 mode project file for each project; *Note Project files::. Note that
88 these are different from the GNAT project files used by the GNAT tools.
89
90 *Note Debuggers: (emacs)Debuggers, for general information on
91 debugging.
92
93 \1f
94 File: ada-mode.info, Node: Installation, Next: Customization, Prev: Overview, Up: Top
95
96 2 Installation
97 **************
98
99 Ada mode requires Emacs 24.2 or greater.
100
101 Ada mode is distributed in the Gnu ELPA package archive; it can be
102 installed via 'M-x list-packages' (*note (emacs)Packages::). You must
103 first enable packages in your '~/.emacs', _after_ customizing
104 'Info-default-directory-list' (if you do that):
105
106 (package-initialize)
107
108 Ada mode is also available as a separate distribution, from the Emacs
109 Ada mode website
110 <http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html>.
111
112 For installing the separate distribution, see the 'README' file in
113 the distribution.
114
115 To see what version of Ada mode you have installed, invoke 'M-x
116 ada-mode-version'.
117
118 You may also want to install additional utilities:
119
120 * Menu:
121
122 * Ada Reference Manual::
123 * gpr_query::
124 * Upgrading::
125
126 \1f
127 File: ada-mode.info, Node: Ada Reference Manual, Next: gpr_query, Prev: Installation, Up: Installation
128
129 2.1 Ada Reference Manual
130 ========================
131
132 The ELPA package ada-ref-man includes the Ada Reference Manual and
133 Annotated Ada Reference Manual in info format.
134
135 \1f
136 File: ada-mode.info, Node: gpr_query, Next: Upgrading, Prev: Ada Reference Manual, Up: Installation
137
138 2.2 gpr_query
139 =============
140
141 Ada mode has support for an external cross reference tool 'gpr_query',
142 which supports Ada, C, C++, and any other language for which AdaCore gcc
143 provides the '-fdump-xref' ('-fdump-xref' is an AdaCore extension).
144
145 'gpr_query' requires the 'gnatcoll' library provided by AdaCore,
146 distributed with GNAT GPL 2014.
147
148 To build 'gpr_query', assuming GNAT GPL 2014 is installed in
149 '/usr/gnat-gpl-2014', and '/usr/gnat-gpl-2014/bin' is in PATH (if you
150 are running Windows, use Cygwin bash to run these commands, with GNAT
151 GPL bin first in PATH) (note that gnatcoll-gpl-2014-src.tar.gz unzips to
152 gnatcoll-1.7w-src):
153
154 tar xf ~/Downloads/gnatcoll-gpl-2014-src.tar.gz
155 cd gnatcoll-1.7w-src
156 ./configure --prefix=/usr/gnat-gpl-2014
157 make
158 sudo make install
159 cd ~/.emacs.d/elpa/ada-mode-5.xx/build
160 make install
161
162 To build an sqlite3 executable that is compatible with the database
163 created by 'gpr_query':
164
165 cd gnatcoll-1.7w-src/src/sqlite/amalgamation/
166 gcc -O2 -o sqlite3 shell.c sqlite3.c -ldl -lpthread
167
168 \1f
169 File: ada-mode.info, Node: Upgrading, Prev: gpr_query, Up: Installation
170
171 2.3 Upgrading from previous versions
172 ====================================
173
174 See the file NEWS for more details; here we summarize only important
175 user interface changes.
176
177 'from 5.0.1'
178 Nothing to do.
179
180 'from 4.01'
181 There are many user interface and API changes between 4.01 and
182 5.0.1; we only document those that may be hard to diagnose here.
183
184 'prog-mode-hook' is no longer run by 'ada-mode'; 'ada-mode' is no
185 longer derived from 'prog-mode'. Use 'ada-mode-hook' instead.
186
187 \1f
188 File: ada-mode.info, Node: Customization, Next: Compiling Executing, Prev: Installation, Up: Top
189
190 3 Customizing Ada mode
191 **********************
192
193 Here we assume you are familiar with setting variables in Emacs, either
194 thru 'customize' or in elisp (in your '.emacs' file). For a basic
195 introduction to customize, elisp, and Emacs in general, see the tutorial
196 ('C-h t').
197
198 * Menu:
199
200 * Non-standard file names::
201 * Other compiler::
202 * Other cross-reference::
203 * Other customization::
204
205 \1f
206 File: ada-mode.info, Node: Non-standard file names, Next: Other compiler, Prev: Customization, Up: Customization
207
208 3.1 Non-standard file names
209 ===========================
210
211 By default, Ada mode is configured to use the GNAT file naming
212 convention, where file names are a simple modification of the Ada names,
213 and the extension for specs and bodies are '.ads' and '.adb',
214 respectively.
215
216 Emacs uses the file extension to enable Ada mode; Ada mode uses the
217 file extentions to allow moving from a package body to the corresponding
218 spec and back.
219
220 Emacs and Ada mode support ways to use alternative file extensions
221 for specs and bodies. Note that you must also tell the compiler about
222 these extensions; doing that is beyond the scope of this manual.
223
224 For instance, if your spec and bodies files are called 'UNIT_s.ada'
225 and 'UNIT_b.ada', respectively, you can add the following to your
226 '.emacs' file:
227
228 ;; Tell Ada mode about spec and body extensions
229 (ada-add-extensions "_s.ada" "_b.ada")
230
231 ;; Tell Emacs to use Ada mode for those extensions
232 (add-to-list 'auto-mode-alist '("\\.ada\\'" . ada-mode))
233
234 You can define additional extensions:
235
236 (ada-add-extensions ".ads" "_b.ada")
237 (ada-add-extensions ".ads" ".body")
238
239 This means that whenever Ada mode looks for the body for a file whose
240 extension is '.ads', it will take the first available file that ends
241 with either '.adb', '_b.ada' or '.body'.
242
243 Simililarly, if Ada mode is looking for a spec, it will look for
244 '.ads' or '_s.ada'.
245
246 If the filename excluding the extension is not derived from the Ada
247 name following the GNAT convention, you need to provide an alternate
248 function for 'ada-file-name-from-ada-name'. Doing that is beyond the
249 scope of this manual; see the current definitions in 'ada-mode.el' and
250 'ada-gnat-xref.el' for examples.
251
252 \1f
253 File: ada-mode.info, Node: Other compiler, Next: Other cross-reference, Prev: Non-standard file names, Up: Customization
254
255 3.2 Other compiler
256 ==================
257
258 The project variable 'ada_compiler' (default elisp variable
259 'ada-compiler') is used to index several variables that point to the
260 compiler-specific functions for corresponding Ada mode operations.
261
262 To use a compiler other than GNAT, you must write Emacs lisp code
263 that provides the interface to the compiler, and set 'ada-compiler' and
264 the indirection variables.
265
266 See 'ada-gnat-compile.el' for an example.
267
268 \1f
269 File: ada-mode.info, Node: Other cross-reference, Next: Other customization, Prev: Other compiler, Up: Customization
270
271 3.3 Other cross-reference
272 =========================
273
274 The project variable 'ada_xref' (default elisp variable 'ada-xref-tool')
275 is used to index several variables that point to the
276 cross-reference-tool-specific functions for corresponding Ada mode
277 operations.
278
279 The default cross-reference tool is 'gnatxref', provided by the file
280 'ada-gnat-xref.el'. One other tool is supported: 'gpr_query'. To use
281 it, add the following to '~/.emacs':
282
283 (require 'gpr-query)
284
285 To use 'gpr_query', the Ada code 'gpr_query.adb' must be compiled;
286 see *note Installation::. In addition, non-Ada code must be compiled
287 with the AdaCore gcc extension '-fdump-xref'.
288
289 To use a cross reference tool other than the above, you must write
290 Emacs lisp code that provides the interface to the compiler, and set
291 'ada-xref-tool' and the indirection variables.
292
293 See 'ada-gnat-xref.el' and 'gpr-query.el' for examples.
294
295 \1f
296 File: ada-mode.info, Node: Other customization, Prev: Other cross-reference, Up: Customization
297
298 3.4 Other customization
299 =======================
300
301 All user-settable Ada mode variables can be set via the menu 'Ada |
302 Customize'. Click on the 'Help' button there for help on using
303 customize.
304
305 To modify a specific variable, you can directly call the function
306 'customize-variable'; just type 'M-x customize-variable <RET>
307 VARIABLE-NAME <RET>').
308
309 Alternately, you can specify variable settings in the Emacs
310 configuration file, '~/.emacs'. This file is coded in Emacs lisp, and
311 the syntax to set a variable is the following:
312 (setq variable-name value)
313
314 Some general Emacs settings that are useful for Ada files:
315 'delete-trailing-whitespace'
316 Deletes space, tab at end of line and blank lines at end of buffer.
317 'untabify'
318 Deletes tab characters that have crept into the file.
319 'indent-tabs-mode'
320 Don't insert tab characters when indenting.
321 'copyright-update'
322 Updates the copyright date in the file header comment, to the
323 current year.
324 'electric-pair-mode'
325 Insert a matching right paren when you type a left paren.
326 'hippie-expand'
327 Bind 'hippie-expand' to a key; it expands the word before point,
328 using words from current buffer, other buffers, file names, etc;
329 see 'hippie-expand-try-functions-list'. You can also add
330 'ada-skel-hippie-try' to that list. Note that 'ada-expand', which
331 defaults to 'ada-skel-expand', is bound to <C-c C-e> (*note
332 Statement skeletons::).
333 'imenu'
334 Navigate to subprograms and types by name, from a minibuffer menu.
335 'speedbar'
336 Navigate to subprograms and types by name, from a list in a
337 dedicated window.
338 'which-func'
339 'jit-lock-defer-time'
340 In large files, parsing is slow, so it gets in the way of
341 interactive typing due to immediate font-lock triggering a parse.
342 Delay the font-lock by setting an Emacs file-local variable in an
343 Ada comment:
344
345 -- Local Variables:
346 -- jit-lock-defer-time: 0.5
347 -- End:
348
349 The above can all be set by the following code in your '~/.emacs'.
350 Note that some are functions are added to 'before-save-hook'; they run
351 just before a buffer is written to disk. Also, the order is important;
352 ada-mode does not set up the Ada-specific features of imenu and speedbar
353 unless imenu is loaded first.
354
355 (setq-default indent-tabs-mode nil)
356 (electric-pair-mode 1)
357 (require 'imenu) ;; also enables speedbar
358 (require 'ada-mode)
359 (add-to-list 'hippie-expand-try-functions-list 'ada-skel-hippie-try)
360 (define-key ada-mode-map "\C-e" 'hippie-expand)
361 (add-hook 'ada-mode-hook
362 (lambda ()
363 (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
364 (add-hook 'before-save-hook 'copyright-update nil t)
365 (add-hook 'before-save-hook
366 (lambda () (untabify (point-min) (point-max)))
367 nil t)))
368
369 \1f
370 File: ada-mode.info, Node: Compiling Executing, Next: Project files, Prev: Customization, Up: Top
371
372 4 Compiling Executing
373 *********************
374
375 Ada projects can be compiled, linked, and executed using commands on the
376 Ada menu. All of these commands can be customized via a project file
377 (*note Project files::), but the defaults are sufficient for using the
378 GNAT compiler for simple projects (single files, or several files in a
379 single directory).
380
381 For complex projects, you will want to use 'make' or some other build
382 tool; in that case, you will need an Emacs Ada mode project file to tell
383 Emacs about the project directory tree and other settings.
384
385 * Menu:
386
387 * Compile commands::
388 * Compiling Examples::
389 * Compiler errors::
390
391 \1f
392 File: ada-mode.info, Node: Compile commands, Next: Compiling Examples, Prev: Compiling Executing, Up: Compiling Executing
393
394 4.1 Compile commands
395 ====================
396
397 Here are the commands for building an Ada project and running the main
398 program.
399
400 In multi-file projects, there must be one file that is the main
401 program. That is given by the 'main' project file variable; it defaults
402 to the current file if not yet set, but is also set by the "set main and
403 build" command.
404
405 'Check file'
406 Compiles the current file in syntax check mode, by running
407 'check_cmd' defined in the current project file. This typically
408 runs faster than full compile mode, speeding up finding and fixing
409 compilation errors.
410
411 This sets 'main' only if it has not been set yet.
412
413 'Compile file'
414 Compiles the current file, by running 'comp_cmd' from the current
415 project file.
416
417 This does not set 'main'.
418
419 'Set main and Build'
420 Sets 'main' to the current file, then executes the Build command.
421
422 'Show main'
423 Display 'main' in the message buffer.
424
425 'Build'
426 Compiles all obsolete units of the current 'main', and links
427 'main', by running 'make_cmd' from the current project.
428
429 This sets 'main' only if it has not been set yet.
430
431 'Run'
432 Executes the main program in a shell, displayed in a separate Emacs
433 buffer. This runs 'run_cmd' from the current project. The
434 execution buffer allows for interactive input/output.
435
436 To modify the run command, in particular to provide or change the
437 command line arguments, type 'C-u' before invoking the command.
438
439 This command is not available for a cross-compilation toolchain.
440
441 It is important when using these commands to understand how 'main' is
442 used and changed.
443
444 Build runs 'gnatmake' on the main unit. During a typical
445 edit/compile session, this is the only command you need to invoke, which
446 is why it is bound to 'C-c C-c'. It will compile all files needed by
447 the main unit, and display compilation errors in any of them.
448
449 Note that Build can be invoked from any Ada buffer; typically you
450 will be fixing errors in files other than the main, but you don't have
451 to switch back to the main to invoke the compiler again.
452
453 Novices and students typically work on single-file Ada projects. In
454 this case, 'C-c C-m' will normally be the only command needed; it will
455 build the current file, rather than the last-built main.
456
457 There are three ways to change 'main':
458
459 1. Invoke 'Ada | Set main and Build', which sets 'main' to the current
460 file.
461
462 2. Invoke 'Ada | Project | Edit', edit 'main' and 'main', and click
463 '[save]'
464
465 3. Invoke 'Ada | Project | Load', and load a project file that
466 specifies 'main'
467
468 \1f
469 File: ada-mode.info, Node: Compiling Examples, Next: Compiler errors, Prev: Compile commands, Up: Compiling Executing
470
471 4.2 Compiling Examples
472 ======================
473
474 We present several small projects, and walk thru the process of
475 compiling, linking, and running them.
476
477 The first example illustrates more Ada mode features than the others;
478 you should work thru that example before doing the others.
479
480 All of these examples assume you are using GNAT.
481
482 The source for these examples is available on the Emacs Ada mode
483 website mentioned in *Note Installation::.
484
485 * Menu:
486
487 * No project files:: Just menus
488 * Set compiler options:: A basic Ada mode project file
489 * Set source search path:: Source in multiple directories
490 * Use GNAT project file::
491 * Use multiple GNAT project files::
492 * Use a Makefile::
493
494 \1f
495 File: ada-mode.info, Node: No project files, Next: Set compiler options, Prev: Compiling Examples, Up: Compiling Examples
496
497 4.2.1 No project files
498 ----------------------
499
500 This example uses no project files.
501
502 First, create a directory 'Example_1', containing:
503
504 'hello.adb':
505
506 with Ada.Text_IO;
507 procedure Hello
508 is begin
509 Put_Line("Hello from hello.adb");
510 end Hello;
511
512 Yes, this is missing "use Ada.Text_IO;" - we want to demonstrate
513 compiler error handling.
514
515 'hello_2.adb' has no errors:
516
517 with Hello_Pkg;
518 procedure Hello_2
519 is begin
520 Hello_Pkg.Say_Hello;
521 end Hello_2;
522
523 'hello_pkg.ads' has no errors:
524
525 package Hello_Pkg is
526 procedure Say_Hello;
527 end Hello_Pkg;
528
529 'hello_pkg.adb':
530
531 with Ada.Text_IO;
532 package Hello_Pkg is
533 procedure Say_Hello
534 is begin
535 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
536 end Say_Hello;
537 end Hello_Pkg;
538
539 Yes, this is missing the keyword 'body'; another compiler error
540 example. However, note that the indentation engine parser accepts this
541 code with no errors, making it easier to indent slightly illegal Ada
542 code.
543
544 In buffer 'hello.adb', invoke the menu entry 'Ada | Build | Check
545 syntax'. You should get a '*compilation*' buffer containing something
546 like (the directory paths will be different):
547
548 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/" -*-
549 Compilation started at Fri Oct 18 04:23:54
550
551 gnatmake -u -c -gnatc c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/hello.adb -cargs
552 gcc -c -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/ -gnatc -I- c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/hello.adb
553 hello.adb:4:04: "Put_Line" is not visible
554 hello.adb:4:04: non-visible declaration at a-textio.ads:263
555 hello.adb:4:04: non-visible declaration at a-textio.ads:259
556 gnatmake: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/hello.adb" compilation error
557
558 Compilation exited abnormally with code 4 at Fri Oct 18 04:23:54
559
560 The lines with actual errors (starting with 'hello.adb') are
561 highlighted, with the file name in red.
562
563 Now invoke 'Ada | Build | Next compilation error'. Or you can click
564 the middle mouse button on the first error line, or use the key binding
565 shown on the menu. The compilation buffer scrolls to put the first
566 error on the top line, and point is put at the place of the error in the
567 'hello.adb' buffer.
568
569 To fix the error, invoke 'Ada | Build | Fix compilation error'; this
570 adds "Ada.Text_Io." to the line:
571
572 Ada.Text_Io.Put_Line ("hello from hello.adb");
573
574 Now invoke 'Ada | Build | Show main'; this displays 'Ada mode main:
575 hello'.
576
577 Now (in buffer 'hello.adb'), invoke 'Ada | Build | Build'. You are
578 prompted to save the file (if you haven't already). Then the
579 compilation buffer is displayed again, containing:
580
581 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/" -*-
582 Compilation started at Fri Oct 18 20:39:33
583
584 gnatmake -o hello hello -cargs -bargs -largs
585 gcc -c hello.adb
586 gnatbind -x hello.ali
587 gnatlink hello.ali -o hello.exe
588
589 Compilation finished at Fri Oct 18 20:39:34
590
591 The compilation has succeeded without errors; 'hello.exe' now exists
592 in the same directory as 'hello.adb'.
593
594 Now invoke 'Ada | Build | Run'. The '*compilation*' buffer is
595 displayed, containing
596
597 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_1/" -*-
598 Compilation started at Fri Oct 18 20:41:53
599
600 ./hello
601 Hello from hello.adb
602
603 Compilation finished at Fri Oct 18 20:41:53
604
605 That completes the first part of this example.
606
607 Now we will compile a multi-file project. Open the file
608 'hello_2.adb', invoke 'Ada | Build | Set main and Build'. This finds an
609 error in 'hello_pkg.adb':
610
611 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
612
613 This demonstrates that gnatmake finds the files needed by the main
614 program. However, it cannot find files in a different directory, unless
615 you use an Emacs Ada mode project file or a GNAT project file to specify
616 the other directories; *Note Set source search path::, *note Use GNAT
617 project file::.
618
619 Invoke 'Ada | Build | Show main'; this displays 'Ada mode main:
620 hello_2'.
621
622 Move to the error with 'C-x `', and fix the error by adding 'body':
623
624 package body Hello_Pkg is
625
626 Now, while still in 'hello_pkg.adb', invoke 'Ada | Build | Build'.
627 gnatmake successfully builds 'hello_2'. This demonstrates that Emacs
628 has remembered the main file, in the project variable 'main', and used
629 it for the Build command.
630
631 Finally, again while in 'hello_pkg.adb', invoke 'Ada | Build | Run'.
632 The '*compilation*' buffer displays 'Hello from hello_pkg.adb'.
633
634 One final point. If you switch back to buffer 'hello.adb', and
635 invoke 'Ada | Build | Run', 'hello_2.exe' will be run. That is because
636 'main' is still set to 'hello_2', as you can see when you invoke 'Ada |
637 Build | Show main'.
638
639 There are two ways to change 'main':
640
641 1. Invoke 'Ada | Build | Set main and Build', which sets 'main' to the
642 current file.
643
644 2. Invoke 'Ada | Build | Set Project ...', and select a project file
645 that specifies 'main'.
646
647 \1f
648 File: ada-mode.info, Node: Set compiler options, Next: Set source search path, Prev: No project files, Up: Compiling Examples
649
650 4.2.2 Set compiler options
651 --------------------------
652
653 This example illustrates using an Emacs Ada mode project file to set a
654 compiler option.
655
656 If you have files from 'Example_1' open in Emacs, you should close
657 them so you don't get confused. Use menu 'File | Close (current
658 buffer)'.
659
660 In directory 'Example_2', create these files:
661
662 'hello.adb':
663
664 with Ada.Text_IO;
665 procedure Hello
666 is begin
667 Put_Line("Hello from hello.adb");
668 end Hello;
669
670 This is the same as 'hello.adb' from 'Example_1'. It has two errors;
671 missing "use Ada.Text_IO;", and no space between 'Put_Line' and its
672 argument list.
673
674 'hello.adp':
675
676 comp_opt=-gnatyt
677
678 This tells the GNAT compiler to check for token spacing; in
679 particular, there must be a space preceding a parenthesis.
680
681 In buffer 'hello.adb', invoke 'Ada | Build | Set main and Build'.
682 This finds the project file 'hello.adp', uses it to set the compiler
683 options, and builds the project. You should get a '*compilation*'
684 buffer containing something like (the directory paths will be
685 different):
686
687 cd c:/Examples/Example_2/
688 gnatmake -o hello hello -g -cargs -gnatyt -bargs -largs
689 gcc -c -g -gnatyt hello.adb
690 hello.adb:4:04: "Put_Line" is not visible
691 hello.adb:4:04: non-visible declaration at a-textio.ads:264
692 hello.adb:4:04: non-visible declaration at a-textio.ads:260
693 hello.adb:4:12: (style) space required
694 gnatmake: "hello.adb" compilation error
695
696 Compare this to the compiler output in *note No project files::; the
697 gnatmake option '-cargs' has been replaced by '-cargs -gnaty', and an
698 additional error is reported in 'hello.adb' on line 4. This shows that
699 'hello.adp' is being used to set the compiler options.
700
701 Fixing the error, linking and running the code proceed as in *note No
702 project files::.
703
704 \1f
705 File: ada-mode.info, Node: Set source search path, Next: Use GNAT project file, Prev: Set compiler options, Up: Compiling Examples
706
707 4.2.3 Set source search path
708 ----------------------------
709
710 In this example, we show how to deal with files in more than one
711 directory, using an Emacs Ada mode project file to set the search path.
712
713 Create the directory 'Example_3', containing:
714
715 'hello_pkg.ads':
716
717 package Hello_Pkg is
718 procedure Say_Hello;
719 end Hello_Pkg;
720
721 'hello_pkg.adb':
722
723 with Ada.Text_IO;
724 package Hello_Pkg is
725 procedure Say_Hello
726 is begin
727 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
728 end Say_Hello;
729 end Hello_Pkg;
730
731 These are the same files from example 1; 'hello_pkg.adb' has an error
732 on line 2.
733
734 In addition, create a directory 'Example_3/Other', containing these
735 files:
736
737 'Other/hello_3.adb':
738
739 with Hello_Pkg;
740 with Ada.Text_IO; use Ada.Text_IO;
741 procedure Hello_3
742 is begin
743 Hello_Pkg.Say_Hello;
744 Put_Line ("From hello_3");
745 end Hello_3;
746
747 There are no errors in this file.
748
749 'Other/other.adp':
750
751 src_dir=..
752
753 Note that there must be no trailing spaces.
754
755 In buffer 'hello_3.adb', invoke 'Ada | Project files | Find and set
756 project...', and select 'Example_3/Other/other.adp'. This tells Emacs
757 Ada mode to stop using the project file from 'Example_2', and use the
758 one for 'Example_3'. Also note that since this project file is not
759 named 'hello_3.adp', it would not be found by default.
760
761 Then, again in 'hello_3.adb', invoke 'Ada | Set main and Build'. You
762 should get a '*compilation*' buffer containing something like (the
763 directory paths will be different):
764
765 cd c:/Examples/Example_3/Other/
766 gnatmake -o hello_3 hello_3 -g -cargs -I.. -bargs -largs
767 gcc -c -g -I.. hello_3.adb
768 gcc -c -I./ -g -I.. -I- C:\Examples\Example_3\hello_pkg.adb
769 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
770 gnatmake: "C:\Examples\Example_3\hello_pkg.adb" compilation error
771
772 Compare the '-cargs' option to the compiler output in *note Set
773 compiler options::; this shows that 'other.adp' is being used to set the
774 compiler options.
775
776 Move to the error with 'C-x `'. Ada mode searches the list of
777 directories given by 'src_dir' for the file mentioned in the compiler
778 error message.
779
780 Fixing the error, linking and running the code proceed as in *note No
781 project files::.
782
783 \1f
784 File: ada-mode.info, Node: Use GNAT project file, Next: Use multiple GNAT project files, Prev: Set source search path, Up: Compiling Examples
785
786 4.2.4 Use GNAT project file
787 ---------------------------
788
789 In this example, we show how to use a GNAT project file, with no Ada
790 mode project file.
791
792 Create the directory 'Example_4', containing:
793
794 'hello_pkg.ads':
795
796 package Hello_Pkg is
797 procedure Say_Hello;
798 end Hello_Pkg;
799
800 'hello_pkg.adb':
801
802 with Ada.Text_IO;
803 package Hello_Pkg is
804 procedure Say_Hello
805 is begin
806 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
807 end Say_Hello;
808 end Hello_Pkg;
809
810 These are the same files from example 1; 'hello_pkg.adb' has an error
811 on line 2.
812
813 In addition, create a directory 'Example_4/Gnat_Project', containing
814 these files:
815
816 'Gnat_Project/hello_4.adb':
817
818 with Hello_Pkg;
819 with Ada.Text_IO; use Ada.Text_IO;
820 procedure Hello_4
821 is begin
822 Hello_Pkg.Say_Hello;
823 Put_Line ("From hello_4");
824 end Hello_4;
825
826 There are no errors in this file.
827
828 'Gnat_Project/hello_4.gpr':
829
830 project Hello_4 is
831 for Source_Dirs use (".", "..");
832 end Hello_4;
833
834 In buffer 'hello_4.adb', invoke 'Ada | Project | Load...', and select
835 'Example_4/Gnat_Project/hello_4.gpr'.
836
837 Then, again in 'hello_4.adb', invoke 'Ada | Set main and Build'. You
838 should get a '*compilation*' buffer containing something like (the
839 directory paths will be different):
840
841 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project/" -*-
842 Compilation started at Mon Oct 21 11:28:31
843
844 gnatmake -Pc:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project/hello_4.gpr -o hello_4 hello_4 -cargs -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -bargs -largs
845 gcc -c -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -I- -gnatA C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb
846 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
847 gnatmake: "C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb" compilation error
848
849 Compilation exited abnormally with code 4 at Mon Oct 21 11:28:31
850
851 Compare the 'gcc' options to the compiler output in *note Set
852 compiler options::; this shows that 'hello_4.gpr' is being used to set
853 the compiler options.
854
855 Fixing the error, linking and running the code proceed as in *note No
856 project files::.
857
858 \1f
859 File: ada-mode.info, Node: Use multiple GNAT project files, Next: Use a Makefile, Prev: Use GNAT project file, Up: Compiling Examples
860
861 4.2.5 Use multiple GNAT project files
862 -------------------------------------
863
864 In this example, we show how to use multiple GNAT project files,
865 specifying the GNAT project search path in an Ada mode project file.
866
867 Create the directory 'Example_4' as specified in *note Use GNAT
868 project file::.
869
870 Create the directory 'Example_5', containing:
871
872 'hello_5.adb':
873
874 with Hello_Pkg;
875 with Ada.Text_IO; use Ada.Text_IO;
876 procedure Hello_5
877 is begin
878 Hello_Pkg.Say_Hello;
879 Put_Line ("From hello_5");
880 end Hello_5;
881
882 There are no errors in this file.
883
884 'hello_5.adp':
885
886 ada_project_path=../Example_4/Gnat_Project
887 gpr_file=hello_5.gpr
888
889 'hello_5.gpr':
890
891 with "hello_4";
892 project Hello_5 is
893 for Source_Dirs use (".");
894 package Compiler is
895 for Default_Switches ("Ada") use ("-g", "-gnatyt");
896 end Compiler;
897 end Hello_5;
898
899 In buffer 'hello_5.adb', invoke 'Ada | Project | Find and select
900 project...', and select 'Example_5/hello_5.adp'. This would also be
901 found by default if no previous project file had been selected.
902
903 Then, again in 'hello_5.adb', invoke 'Ada | Build | Set main and
904 Build'. You should get a '*compilation*' buffer containing something
905 like (the directory paths will be different):
906
907 -*- mode: compilation; default-directory: "c:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5/" -*-
908 Compilation started at Mon Oct 21 11:32:05
909
910 gnatmake -Pc:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5/hello_5.gpr -o hello_5 hello_5 -cargs -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5 -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -bargs -largs
911 gcc -c -I. -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_5 -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4/Gnat_Project -Ic:/Projects/org.emacs.ada-mode.stephe-1/test/Example_4 -Ic:/Apps/GNAT-7.1.2/lib/gcc/i686-pc-mingw32/4.7.3/adainclude -I- -gnatA C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb
912 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
913 gnatmake: "C:\Projects\org.emacs.ada-mode.stephe-1\test\Example_4\hello_pkg.adb" compilation error
914
915 Compilation exited abnormally with code 4 at Mon Oct 21 11:32:05
916
917 Now type 'C-x `'. 'Example_4/hello_pkg.adb' is shown, demonstrating
918 that 'hello_5.gpr' and 'hello_4.gpr' are being used to set the
919 compilation search path.
920
921 \1f
922 File: ada-mode.info, Node: Use a Makefile, Prev: Use multiple GNAT project files, Up: Compiling Examples
923
924 4.2.6 Use a Makefile
925 --------------------
926
927 In this example, we show how to use a Makefile to build an Ada project
928 with GNAT, run the result, and clean the build directories.
929
930 Create the directories 'Example_4, Example_5' as specified in *note
931 Use GNAT project file::, *note Use multiple GNAT project files::.
932
933 In 'Example_5', add the file:
934
935 'Makefile':
936
937 # build and run hello_5 project
938
939 all : build run
940
941 .PHONY : force
942
943 build : force
944 gprbuild -Phello_5.gpr hello_5
945
946 run :
947 ./hello_5
948
949 clean :
950 gnatclean -r -Phello_5
951
952 export GPR_PROJECT_PATH = ../Example_4/Gnat_Project
953
954 # Local Variables:
955 # eval:(ada-parse-prj-file "hello_5.adp")
956 # eval:(ada-select-prj-file "hello_5.adp")
957 # End:
958
959 Close and re-open 'Makefile'; the 'Local Variables' section sets the
960 project file to 'hello_5.adp' when the 'Makefile' is opened. You can
961 also use <C-x C-e> to execute the select line after the 'Makefile' is
962 opened, to change the project file back to 'hello_5.adp'.
963
964 In 'Makefile', invoke 'Tools | Compile...', and accept the default
965 make command. This runs the 'all' target, which builds 'hello_5' and
966 runs it.
967
968 \1f
969 File: ada-mode.info, Node: Compiler errors, Prev: Compiling Examples, Up: Compiling Executing
970
971 4.3 Compiler errors
972 ===================
973
974 The 'Check syntax' and 'Build' commands, or running 'make', place
975 compilation errors in a separate buffer named '*compilation*'.
976
977 Each line in this buffer will become active: you can simply click on
978 it with the middle button of the mouse, or move point to it and press
979 <RET>. Emacs will then display the relevant source file and put point
980 on the line and column where the error was found.
981
982 You can also press the 'C-x `' key ('next-error'), and Emacs will
983 jump to the first error. If you press that key again, it will move you
984 to the second error, and so on.
985
986 Some error messages also include references to other files. These
987 references are accessed via 'C-c `'.
988
989 \1f
990 File: ada-mode.info, Node: Project files, Next: Moving Through Ada Code, Prev: Compiling Executing, Up: Top
991
992 5 Project files
993 ***************
994
995 An Emacs Ada mode project file specifies what directories hold sources
996 for your project, and allows you to customize the compilation commands
997 and other things on a per-project basis.
998
999 The default file extension for Ada mode project files is '*.adp' or
1000 '*.prj'. You can use a different extension by adding it to
1001 'ada-prj-file-extensions', and a different syntax by adding a parser
1002 function to 'ada-prj-parser-alist'.
1003
1004 Note that Ada mode project files '*.adp' are different than GNAT
1005 compiler project files '*.gpr'. However, Emacs Ada mode can use a GNAT
1006 project file to specify the project directories. If no other
1007 customization is needed, a GNAT project file can be used without an
1008 Emacs Ada mode project file.
1009
1010 If no Emacs Ada mode project file is specified, some Ada mode
1011 functions are not available.
1012
1013 * Menu:
1014
1015 * Project file overview::
1016 * Project file variables::
1017
1018 \1f
1019 File: ada-mode.info, Node: Project file overview, Next: Project file variables, Prev: Project files, Up: Project files
1020
1021 5.1 Project file overview
1022 =========================
1023
1024 Project files have a simple syntax; they may be edited directly. Each
1025 line specifies a project variable name and its value, separated by "="
1026 (spaces not allowed):
1027 src_dir=/Projects/my_project/src_1
1028 src_dir=/Projects/my_project/src_2
1029
1030 Any line that does not have an "=" is a comment.
1031
1032 Some variables (like 'src_dir') are lists; multiple occurrences are
1033 concatenated.
1034
1035 There must be no space between the variable name and "=", and no
1036 trailing spaces after the value.
1037
1038 The current project file is given by the lisp variable
1039 'ada-prj-default-project-file', and shown by the menu command <Ada |
1040 Project Files | Show project>.
1041
1042 To set the project file, use the menu command 'Ada | Set Project
1043 ...', or the elisp functions 'ada-parse-prj-file, ada-select-prj-file'.
1044 The latter can be added to a Makefile:
1045
1046 # Local Variables:
1047 # eval: (ada-parse-prj-file "ada-mode.prj")
1048 # eval: (ada-select-prj-file ada-mode.prj")
1049 # End:
1050
1051 You specify either a GNAT project file or an Emacs Ada mode project
1052 file; if the file extension is '.gpr', the file is treated as a GNAT
1053 project file. Extensions given by 'ada-prj-file-extensions' (default
1054 '.adp, .prj') are treated as an Emacs Ada mode project file.
1055
1056 After a project file is parsed, you can make it current again with
1057 just 'ada-select-prj-file', or by selecting it from the menu.
1058
1059 \1f
1060 File: ada-mode.info, Node: Project file variables, Prev: Project file overview, Up: Project files
1061
1062 5.2 Project file variables
1063 ==========================
1064
1065 To set a project variable that is a list, specify each element of the
1066 list on a separate line in the project file. The value on the last line
1067 is the last element in the list.
1068
1069 A variable name that starts with '$' is set as a process environment
1070 variable, for processes launched from Emacs for the project.
1071
1072 In variable values, process environment variables can be referenced
1073 using the normal '$var' syntax.
1074
1075 Most project variables have defaults that can be changed by setting
1076 elisp variables; the table below identifies the elisp variable for each
1077 project variable. Elisp variables corresponding to project variables
1078 that are lists are elisp lists.
1079
1080 In general, project variables are evaluated when referenced in Emacs
1081 Ada mode commands. Relative file paths are expanded relative to the
1082 directory containing the project file.
1083
1084 Ada mode defines some project variables; others are defined by the
1085 compiler.
1086
1087 Here is the list of variables valid for all compilers. In the
1088 default values, the current directory '"."' is the directory containing
1089 the project file.
1090
1091 'ada_compiler' [default: 'ada-compiler, gnat']
1092 Ada compiler for this project. It must occur in the project file
1093 before any compiler-specific project variable.
1094
1095 'auto_case' [default: 'ada-auto-case, t']
1096 Non-nil means automatically change case of preceding word while
1097 typing.
1098
1099 'case_identifier' [default: 'ada-case-identifier, ada-mixed-case']
1100 Function to call to adjust the case of an Ada identifier.
1101
1102 'case_keyword' [default: 'ada-case-keyword, downcase-word']
1103 Function to call to adjust the case of an Ada keyword.
1104
1105 'case_strict' [default: 'ada-case-strict, t']
1106 If non-nil, 'ada-mixed-case' forces 'Mixed_Case' for identifiers.
1107 Otherwise, 'ada-mixed-case' allows 'UPPERCASE' for identifiers.
1108
1109 'casing' [default: 'ada-case-exception-file, nil']
1110 List of files containing casing exceptions. *Note Automatic
1111 casing::.
1112
1113 'el_file' [default: ]
1114 The value is a file name, which is loaded as an elisp file when the
1115 project file is parsed or selected. This allows setting Ada mode
1116 indentation variables, and any arbitrary elisp code used to
1117 customize the project.
1118
1119 'path_sep' [default: 'path-separator']
1120 Separator character used in compiler search paths.
1121
1122 'src_dir' [default: '"."']
1123 A list of directories to search for source files.
1124
1125 'xref_tool' [default: 'ada-xref-tool, gnat-xref']
1126 Cross reference tool for this project.
1127
1128 The following variables are valid with the GNAT compiler:
1129
1130 'ada_project_path' [default: '""']
1131 A list of directories to search for GNAT project files.
1132
1133 If set, the 'GPR_PROJECT_PATH' process environment variable is set
1134 to this value in the child process that runs GNAT tools. If not
1135 set, 'GPR_PROJECT_PATH' in the child process is inherited from the
1136 Emacs process.
1137
1138 If you have the 'GPR_PROJECT_PATH' or 'ADA_PROJECT_PATH'
1139 environment variable set in the Emacs process correctly for all of
1140 your projects, you do not need to set this project variable.
1141
1142 The project search path can also be set in GNAT aggregate projects.
1143 However, the gnat tools do not make that path available to Emacs,
1144 so you must duplicate it in an Emacs Ada project file.
1145
1146 'gpr_file' [default: '""']
1147 The GNAT project file.
1148
1149 If set, the source and project directories specified in the GNAT
1150 project file are appended to 'src_dir' and 'ada_project_path'.
1151 This allows specifying Ada source directories with a GNAT project
1152 file, and other source directories with the Emacs project file.
1153
1154 'gpr_project_path' [default: '""']
1155 Same as 'ada_project_path'.
1156
1157 \1f
1158 File: ada-mode.info, Node: Moving Through Ada Code, Next: Identifier completion, Prev: Project files, Up: Top
1159
1160 6 Moving Through Ada Code
1161 *************************
1162
1163 There are several commands to navigate through Ada code. All these
1164 functions are available through the Ada menu and keybindings.
1165
1166 Some of these commands rely on cross reference facilities provided by
1167 the compiler; the standard Emacs Ada mode only supports the GNAT
1168 compiler, but others can be added (*note Other cross-reference::).
1169
1170 'C-c C-d'
1171 Move from any use of an identifier to its declaration, for from a
1172 declaration to its body (if there is one).
1173
1174 'C-c M-d'
1175 Move from a child type declaration to the parent type declaration;
1176 display a list of references if there is more than one parent.
1177
1178 'C-c C-n'
1179 Move to the next keyword in the current statement.
1180
1181 For example, if point is on 'if', move to 'then'.
1182
1183 'C-c C-p'
1184 Move to the previous keyword in the current statement.
1185
1186 For example, if point is on 'then', move to 'if'.
1187
1188 'C-c C-o'
1189 Switch between corresponding spec and body. There are several
1190 special cases:
1191
1192 * If the region is active, it is assumed to contain an Ada
1193 package name; position point on the corresponding package
1194 declaration.
1195
1196 * If point is in the start line of a top level child package
1197 declaration (but not package body), or a child subprogram spec
1198 or body, position point on the corresponding parent package
1199 declaration.
1200
1201 * If point is in the start line of a top level separate body,
1202 position point on the corresponding separate stub declaration.
1203
1204 * If point is in a subprogram declaration or body, position
1205 point on the corresponding body or declaration in the other
1206 file.
1207
1208 * If point is on a 'with' clause, position point on the
1209 corresponding declaration.
1210
1211 'C-c C-r'
1212 Show all references to the identifier surrounding point. Use 'C-x
1213 `' ('next-error') to visit each reference (as for compilation
1214 errors).
1215
1216 'C-c C-x'
1217 Show all declarations that override the primitive procedure at
1218 point. Use 'C-x `' ('next-error') to visit each reference (as for
1219 compilation errors).
1220
1221 'C-c M-x'
1222 Show the declaration that the declaration at point overrides.
1223
1224 'C-u SPACE'
1225 Jump back to the previous location.
1226
1227 'Ada | Misc | Refresh cross reference cache'
1228 Cross reference information is loaded from the compiler output when
1229 the first cross reference command is issued. If the code is
1230 recompiled after that, the cross reference information is reloaded
1231 by invoking this menu command.
1232
1233 \1f
1234 File: ada-mode.info, Node: Identifier completion, Next: Indentation, Prev: Moving Through Ada Code, Up: Top
1235
1236 7 Identifier completion
1237 ***********************
1238
1239 Emacs provides a general way of completing identifiers: 'M-/' (bound to
1240 'dabbrev-expand'). This is an easy way to type faster: you just have to
1241 type the first few letters of an identifier, and then loop through all
1242 the possible completions.
1243
1244 'M-/' works by parsing all open Ada files for possible completions.
1245
1246 For instance, if the words 'my_identifier' and 'my_subprogram' are
1247 the only words starting with 'my' in any of the open Ada files, then you
1248 will have this scenario:
1249
1250 You type: myM-/
1251 Emacs inserts: 'my_identifier'
1252 If you press M-/ once again, Emacs replaces 'my_identifier' with
1253 'my_subprogram'.
1254 Pressing M-/ once more will bring you back to 'my_identifier'.
1255
1256 This is a very fast way to do completion, and the casing of words
1257 will also be respected.
1258
1259 \1f
1260 File: ada-mode.info, Node: Indentation, Next: Statement skeletons, Prev: Identifier completion, Up: Top
1261
1262 8 Indentation
1263 *************
1264
1265 Ada mode comes with a full set of rules for automatic indentation. You
1266 can also configure the indentation, via the following variables:
1267
1268 'ada-indent' (default value: 3)
1269 Number of columns for default indentation.
1270
1271 'ada-indent-broken' (default value: 2)
1272 Number of columns to indent the continuation of a broken line.
1273
1274 'ada-indent-comment-col-0' (default value: nil)
1275 If non-nil, comments currently starting in column 0 are left in
1276 column 0. Otherwise, they are indented with previous comments or
1277 code.
1278
1279 'ada-indent-comment-gnat' (default value: nil)
1280 If non-nil, comments are indented to meet the GNAT style check; one
1281 of:
1282 * multiple of 'ada-indent'
1283 * next non-blank line
1284 * previous non-blank line
1285
1286 Otherwise, they are indented with previous comments or code.
1287
1288 'ada-indent-label' (default value: -3)
1289 Number of columns to indent a label.
1290
1291 'ada-indent-record-rel-type' (default value: 3)
1292 Indentation for 'record' relative to 'type' or 'use'.
1293
1294 'ada-indent-renames' (default value: 2)
1295 Indentation for 'renames' relative to the matching subprogram
1296 keyword.
1297
1298 If the subprogram has parameters then if 'ada-indent-renames' is
1299 zero or less the indentation is abs 'ada-indent-renames' relative
1300 to the open parenthesis; if 'ada-indent-renames' is one or more the
1301 indentation is relative to the line containing the keyword.
1302
1303 If the subprogram has no parameters then 'ada-indent-broken' the
1304 indentation is relative to the indentation of the line containing
1305 the keyword.
1306
1307 'ada-indent-return' (default value: 0)
1308 Indentation for 'return' relative to the matching 'function'.
1309
1310 If the function has parameters, then if 'ada-indent-return' is zero
1311 or less the indentation is abs 'ada-indent-return' relative to the
1312 open parenthesis; if 'ada-indent-return' is one or more,
1313 indentation is relative to line containing 'function'.
1314
1315 If the function has no parameters, 'ada-indent-broken' is used
1316 relative to line containing 'function'.
1317
1318 'ada-indent-use' (default value: ada-indent-broken)
1319 Indentation for the lines in a 'use' statement.
1320
1321 'ada-indent-when' (default value: 3)
1322 Indentation for 'when' relative to 'exception', 'case', or 'or' in
1323 'select'.
1324
1325 'ada-indent-with' (default value: ada-indent-broken)
1326 Indentation for the lines in a 'with' context clause.
1327
1328 The indentation variables are buffer local; the global value may be
1329 overridden in an elisp file invoked by an 'el_file' Emacs Ada mode
1330 project file statement, or in a file local variable section.
1331
1332 The following keys indent portions of the text:
1333
1334 'RET'
1335 Insert and indent a new line.
1336
1337 'TAB'
1338 Indent the current line, or the current region.
1339
1340 'C-c TAB'
1341 Indent the current statement or declaration.
1342
1343 The indentation algorithm relies on a grammar parser to identify the
1344 syntactic role for keywords and other words in the code. If the code is
1345 accepted by the parser, the indentation is done according to the rules
1346 in the indentation engine.
1347
1348 If the code is not accepted (because it is partially complete during
1349 editing), the indentation engine falls back to the trivial algorithm of
1350 indenting each new line the same as the previous line. Once enough new
1351 text has been entered to make the code acceptable to the parser, the
1352 statement or declaration is properly indented.
1353
1354 For example, if you are entering this code:
1355
1356 if A then
1357 B;
1358 end if;
1359
1360 when you type 'RET B', 'B' is indented to the same column as 'if',
1361 because the parser does not find 'end if;'. Then when you type the
1362 final ';' followed by <TAB>, all three lines are indented, putting 'B'
1363 where it belongs.
1364
1365 To be more user friendly, the parser accepts a superset of the Ada
1366 grammer. For example, the parser accepts this code for an 'if'
1367 statement:
1368
1369 if then
1370 end if;
1371
1372 In general, any sequence of statements, and many expressions, may be
1373 omitted.
1374
1375 One way to easily insert empty statements like this is using *note
1376 Statement skeletons::.
1377
1378 In rare cases, the parser gets confused; it can be reset by invoking
1379 menu <Ada | Misc | Reset parser>. Please report such cases as a bug.
1380
1381 \1f
1382 File: ada-mode.info, Node: Statement skeletons, Next: Aligning code, Prev: Indentation, Up: Top
1383
1384 9 Statement skeletons
1385 *********************
1386
1387 'C-c C-e' expands the previous one or two words into a statment
1388 skeleton. For example, 'i f C-c C-e' expands to:
1389
1390 if then
1391 elsif then
1392 else
1393 end if;
1394
1395 All skeleton expansions are accepted by the indentation parser, so
1396 this is a convenient way to insert statements with correct indentation.
1397
1398 For named statements (packages, loops, etc), the name is taken from
1399 the word before point, and the name of the statement from the word
1400 before that.
1401
1402 Some expansions prompt for more information, such as whether a spec
1403 or body is desired. For example, 'package A_Package C-c C-e' first
1404 prompts for "body" or "spec". If "spec" is selected, the following code
1405 is inserted:
1406
1407 package A_Package is
1408 private
1409 end A_Package;
1410
1411 Named blocks work similarly: 'declare A_Block C-c C-e' expands
1412 (without prompting) to:
1413
1414 A_Block:
1415 declare
1416 begin
1417 exception
1418 end A_Block;
1419
1420 Note that the order of the keyword 'declare' and the name 'A_Block'
1421 are reversed in the expansion; this may take some getting used to.
1422 Alternately, if no name is present in the buffer, you are prompted for a
1423 name: 'declare C-c C-e' first prompts for a name, then expands to the
1424 above.
1425
1426 The variable 'ada-skel-initial-string' defines what to insert in a
1427 newly created empty buffer. It defaults to '{header}', which is a
1428 placeholder defined by 'ada-skel-header', which inserts a typical header
1429 with a copyright license (choice of GPL or restricted). Users will
1430 typically want to override the definition of 'ada-skel-initial-string'
1431 and/or 'ada-skel-header', or provide more choices of copyright license.
1432
1433 \1f
1434 File: ada-mode.info, Node: Aligning code, Next: Automatic casing, Prev: Statement skeletons, Up: Top
1435
1436 10 Aligning code
1437 ****************
1438
1439 Aligning code adds space in each line so that similar parts of
1440 successive lines are aligned vertically. For example, a sequence of
1441 declarations:
1442
1443 A : Integer;
1444 Another : Float := 1.0;
1445 More : Integer := 2;
1446
1447 changes to this when aligned:
1448
1449 A : Integer;
1450 Another : Float := 1.0;
1451 More : Integer := 2;
1452
1453 Alignment is invoked by 'C-c C-a', which aligns the sequence of
1454 statements surrounding point, or within the selected region.
1455
1456 Parameter lists are also aligned:
1457
1458 procedure Foo
1459 (A : in Integer;
1460 Another : out Float := 1.0;
1461 More : in out Integer := 2);
1462
1463 is aligned to:
1464
1465 procedure Foo
1466 (A : in Integer;
1467 Another : out Float := 1.0;
1468 More : in out Integer := 2);
1469
1470 \1f
1471 File: ada-mode.info, Node: Automatic casing, Next: Comment Handling, Prev: Aligning code, Up: Top
1472
1473 11 Automatic casing
1474 *******************
1475
1476 Casing of identifiers, attributes and keywords is automatically
1477 performed while typing when the variable 'ada-auto-case' is non-nil (the
1478 default). Every time you type a word separator, the previous word is
1479 automatically cased.
1480
1481 You can customize the automatic casing with the following variables:
1482
1483 'ada-case-keyword'
1484 Value must be one of:
1485 'downcase-word'
1486 Ada keywords will be lowercase.
1487
1488 'upcase-word'
1489 Ada keywords will be uppercase.
1490
1491 'ada-case-strict'
1492 If non-nil, all identifiers are forced to 'Mixed_Case'; first
1493 letter, and letter following "_" are uppercase; rest are lowercase.
1494
1495 If nil, the mixed case characters in identifiers are forced to
1496 upper case, but the other characters are not modified. That allows
1497 typing all uppercase identifiers without defining a casing
1498 exception.
1499
1500 You can define exceptions to these rules, in files specified by the
1501 variable 'ada-case-exception-file'. Each line in a case exception file
1502 specifies the casing of one word or word fragment. If an exception is
1503 defined in multiple files, the first occurrence is used.
1504
1505 If the word starts with an asterisk ('*'), it defines the casing of a
1506 word fragment (or "substring"); part of a word between two underscores
1507 or word boundary.
1508
1509 For example:
1510
1511 DOD
1512 *IO
1513 GNAT
1514
1515 The word fragment '*IO' applies to any word containing "_io";
1516 'Text_IO', 'Hardware_IO', etc.
1517
1518 There are two ways to add new items to this file: you can simply edit
1519 it as you would edit any text file. Or you can position point on the
1520 word you want to add, and select menu 'Ada | Casing | Create full
1521 exception' or 'Ada | Casing | Create partial exception'. The word will
1522 be added to the current list of exceptions and to the file.
1523
1524 It is sometimes useful to have multiple exception files. For
1525 example, one could be the standard Ada acronyms, the second some company
1526 specific exceptions, and the last one some project specific exceptions.
1527 If you set up the variable 'ada-case-exception-file' as a list of files,
1528 each of them will be parsed and used in your emacs session. When you
1529 create a new exception, you are prompted for the file to save it in.
1530
1531 Other keys and menu entries are defined:
1532
1533 'C-c C-w'
1534 Adjust case of the word at point. With prefix arg, adjust case
1535 even if in comment. Normally, comments are not affected by case
1536 adjust.
1537
1538 'Ada | Casing | Adjust case region'
1539 Adjust case in the active region.
1540
1541 'Ada | Casing | Adjust case buffer'
1542 Adjust case in the active buffer.
1543
1544 \1f
1545 File: ada-mode.info, Node: Comment Handling, Next: Key summary, Prev: Automatic casing, Up: Top
1546
1547 12 Comment Handling
1548 *******************
1549
1550 By default, comment lines get indented like Ada code. There are a few
1551 additional functions to handle comments:
1552
1553 'M-;'
1554 If the region is active, comment or uncomment it.
1555
1556 If the current line is empty, start a comment.
1557
1558 Otherwise, add a comment at the end of the line, in a column given
1559 by 'comment-column'.
1560
1561 'M-q'
1562 Fill the current comment paragraph.
1563
1564 \1f
1565 File: ada-mode.info, Node: Key summary, Next: Developer overview, Prev: Comment Handling, Up: Top
1566
1567 13 Key summary
1568 **************
1569
1570 This table summarizes the keys described in this manual. Other keys are
1571 bound by Ada mode; see <C-h b> for a complete list. The Ada menu also
1572 displays keys bound to menu operations.
1573
1574 'M-/'
1575 *Note Identifier completion::. Complete the word before point;
1576 repeat to cycle thru possible completions.
1577
1578 'M-;'
1579 *Note Comment Handling::. If the region is active, comment or
1580 uncomment it.
1581
1582 'M-q'
1583 *Note Comment Handling::. Fill the current comment paragraph.
1584
1585 'RET'
1586 *Note Indentation::. Insert and indent a new line.
1587
1588 'TAB'
1589 *Note Indentation::. Indent the current line, or the current
1590 region.
1591
1592 'C-c TAB'
1593 *Note Indentation::. Indent the current statement or declaration.
1594
1595 'C-c `'
1596 *Note Compiler errors::. Move to the location of the secondary
1597 reference in the current compilation error.
1598
1599 'C-c C-a'
1600 *Note Aligning code::. Align code.
1601
1602 'C-c C-c'
1603 *Note Compile commands::. Build the current main program.
1604
1605 'C-c C-d'
1606 *Note Moving Through Ada Code::. Move from any use of an
1607 identifier to its declaration, for from a declaration to its body.
1608
1609 'C-c M-d'
1610 *Note Moving Through Ada Code::. Move from a child type
1611 declaration to the parent type declaration.
1612
1613 'C-c C-e'
1614 *Note Statement skeletons::. Expand previous one or two words into
1615 a statement or declaration skeleton.
1616
1617 'C-c C-c'
1618 *Note Compile commands::. Build the current file.
1619
1620 'C-c C-n'
1621 *Note Moving Through Ada Code::. Move to the next keyword in the
1622 current statement.
1623
1624 'C-c C-o'
1625 *Note Moving Through Ada Code::. Switch between corresponding spec
1626 and body, or find other spec.
1627
1628 'C-c C-p'
1629 *Note Moving Through Ada Code::. Move to the previous keyword in
1630 the current statement.
1631
1632 'C-c C-r'
1633 *Note Moving Through Ada Code::. Show all references to the
1634 identifier surrounding point.
1635
1636 'C-c C-w'
1637 *Note Automatic casing::. Adjust case of the word at point. With
1638 prefix arg, adjust case even if in comment.
1639
1640 'C-c C-x'
1641 *Note Moving Through Ada Code::. Show all declarations that
1642 override the primitive procedure at point.
1643
1644 'C-c C-y'
1645 *Note Automatic casing::. Create case exception.
1646
1647 'C-c `'
1648 *Note Compiler errors::. Move to the location of the next
1649 secondary compilation error.
1650
1651 'C-x `'
1652 *Note Compiler errors::. Move to the location of the next
1653 compilation error or show result.
1654
1655 'M-q'
1656 *Note Comment Handling::. Fill the current comment paragraph.
1657
1658 \1f
1659 File: ada-mode.info, Node: Developer overview, Next: GNU Free Documentation License, Prev: Key summary, Up: Top
1660
1661 14 Developer overview
1662 *********************
1663
1664 If you'd like to contribute to Ada mode, or just understand the sources,
1665 here's an overview.
1666
1667 * Menu:
1668
1669 * Directory structure::
1670 * Package organization::
1671 * OpenToken::
1672 * ELPA::
1673
1674 \1f
1675 File: ada-mode.info, Node: Directory structure, Next: Package organization, Prev: Developer overview, Up: Developer overview
1676
1677 14.1 Directory structure
1678 ========================
1679
1680 'org.emacs.ada-mode'
1681 Main source.
1682
1683 File extensions:
1684 '*.el'
1685 Elisp files; main code.
1686
1687 '*.elc'
1688 Byte-compiled elisp files, not in the distribution. Generated
1689 by the Makefile target 'byte-compile', or by the Emacs package
1690 installer.
1691
1692 Compiling the parse tables ('*-wy.el') speeds up loading them
1693 significantly. Compiling other files speeds up parsing, but
1694 not noticeably.
1695
1696 One reason to byte-compile files is to find errors; the byte
1697 compiler reports undefined variables, wrong argument counts,
1698 etc.
1699
1700 '*-wy.el'
1701 Parse tables, generated from the corresponding grammar '*.wy'
1702 by the OpenToken tool 'wisi-generate.exe'. These are in the
1703 tarball distribution and the monotone repository so users and
1704 Elisp developers don't have to install OpenToken.
1705
1706 '*-wy.output'
1707 Diagnostic output from 'wisi-generate.exe', useful for tracing
1708 parses while debugging a grammar issue. Not in the tarball
1709 distribution or the monotone repository.
1710
1711 '*.wy'
1712 Grammar files, specifying the language to be parsed. The
1713 syntax for these grammar files is similar to that for bison
1714 and wisent, but not the same; see the OpenToken documentation
1715 for more info.
1716
1717 The wisi parser (in 'wisi-parse.el') is a generalized LALR
1718 parser, so it tolerates some conflicts and ambiguities. This
1719 makes the grammars easier to write, and in particular makes it
1720 possible to let the Ada grammar closely match Annex P of the
1721 Ada Language Reference Manual (the syntax summary).
1722
1723 '*.texi'
1724 Texinfo source for the user guides.
1725
1726 '*.html'
1727 Generated user guide in HTML format.
1728
1729 '*.info'
1730 Generated user guide in Emacs info format.
1731
1732 'build'
1733 Makefile for building the user guides, publishing to the web page
1734 or Gnu ELPA. Test drivers.
1735
1736 'build/wisi'
1737 Makefile for building and testing with the wisi-based parser.
1738 Separate from 'build', because there used to be a SMIE-based
1739 parser, and there might be another parser someday.
1740
1741 The emacs used to byte-compile and run tests is given by the 'make'
1742 variable EMACS_EXE, which defaults to 'emacs'; it can be overridden
1743 on the make command line or by an environment variable.
1744
1745 'test'
1746 All tests for Ada mode, gpr mode, parser.
1747
1748 Each test is run in a separate invocation of Emacs, so it is
1749 completely independent of all other tests.
1750
1751 The tests are driven by the elisp code in 'build/*.el'.
1752
1753 In general, the Ada mode tests open the file, execute test actions,
1754 re-indent, and re-captialize the entire file. The result is diffed
1755 with the original, and must match.
1756
1757 The test actions are defined by comments with the prefix
1758 '--EMACSCMD:'; they are elisp forms that invoke Ada mode functions.
1759 This is used to test navigation features and other parser effects.
1760
1761 'test/Example_*'
1762 Starting files for examples in user guide.
1763
1764 'test/gpr'
1765 Tests for gpr mode.
1766
1767 'test/subdir'
1768 More tests; allows testing path search features.
1769
1770 'test/wisi'
1771 Tests of the elisp wisi grammar compiler and parser.
1772
1773 \1f
1774 File: ada-mode.info, Node: Package organization, Next: OpenToken, Prev: Directory structure, Up: Developer overview
1775
1776 14.2 Package organization
1777 =========================
1778
1779 * Menu:
1780
1781 * Ada mode::
1782 * gpr mode::
1783 * GNAT core::
1784 * Wisi::
1785
1786 \1f
1787 File: ada-mode.info, Node: Ada mode, Next: gpr mode, Prev: Package organization, Up: Package organization
1788
1789 14.2.1 Ada mode
1790 ---------------
1791
1792 Ada mode consists of all files with 'ada-' prefix in the file name.
1793
1794 'ada-mode.el'
1795 The main file, implementing the keymap, menu, and top level
1796 functionality.
1797
1798 It allows for different backend implementations for compiling,
1799 cross-referencing, and indenting. The functions for each of these
1800 backends dispatch thru global variables that are set by Emacs Ada
1801 mode project files. They default to the GNAT compiler, the
1802 gnatxref cross reference tool, and the ada-wisi indentation engine.
1803
1804 'ada-build.el'
1805 Provides functions for compiling Ada files without a Makefile (or
1806 similar tool).
1807
1808 'ada-fix-error.el'
1809 Provides an interface to utilities for automatically fixing errors
1810 reported by the compiler. It dispatches to a compiler-specific
1811 backend.
1812
1813 'ada-gnat-compile.el'
1814 Implements the Ada mode compiler functions for the GNAT compiler.
1815
1816 'ada-gnat-xref.el'
1817 Implements the Ada mode cross reference functions for the GNAT
1818 compiler.
1819
1820 'ada-grammar.*'
1821 The Ada language grammar, and files generated from it by the
1822 OpenToken tool 'wisi-generate.exe'.
1823
1824 'ada-indent-user-options.el'
1825 All user-settable options for the Ada indentation engine.
1826
1827 'ada-mode-compat-23.4.el'
1828 Defines functions used by Ada mode that are not in Emacs 23.4.
1829
1830 Emacs Ada mode is written for Emacs 24.3. Emacs version 23.4 is
1831 partially supported. Earlier versions of Emacs are not supported.
1832
1833 'ada-mode.texi'
1834 The Ada mode user guide source and compiled versions.
1835
1836 'ada-skel.el'
1837 Skeletons for expansion of Ada syntax (*note Statement
1838 skeletons::). Extends the Emacs skeleton functions with "tokens",
1839 inspired by the lamented Else package (which was inspired by DEC
1840 LSE).
1841
1842 'ada-wisi-opentoken.el'
1843 Indentation functions useful when editing OpenToken code; an
1844 example of extending the Ada mode indentation engine for special
1845 circumstances.
1846
1847 'ada-wisi.el'
1848 Implements the Ada mode indentation functions for the wisi
1849 indentation engine backend.
1850
1851 \1f
1852 File: ada-mode.info, Node: gpr mode, Next: GNAT core, Prev: Ada mode, Up: Package organization
1853
1854 14.2.2 gpr mode
1855 ---------------
1856
1857 gpr mode consists of all files with 'gpr-' prefix in the file name. The
1858 functions in each file are similar to the similarly-named Ada mode
1859 files.
1860
1861 \1f
1862 File: ada-mode.info, Node: GNAT core, Next: Wisi, Prev: gpr mode, Up: Package organization
1863
1864 14.2.3 GNAT core
1865 ----------------
1866
1867 'gnat-core.el'
1868 GNAT is actually a multi-language tool; it builds on top of the
1869 multi-language gcc.
1870
1871 'gnat-core.el' is a start at a language-agnostic interface to the
1872 GNAT tools. It was first factored out from 'ada-gnat.el' and
1873 'ada-mode.el' to support the multi-language 'gpr_query.el'.
1874
1875 More code currently in 'ada-mode.el' could be migrated to
1876 'gnat-core.el', in particular the project file support.
1877
1878 'gpr-query.el'
1879 Provides an interface to the external multi-language
1880 cross-reference tool 'gpr_query'.
1881
1882 Implements the Ada mode cross-reference functions for the
1883 'gpr_query' backend, and a minor mode providing similar functions
1884 for C++.
1885
1886 \1f
1887 File: ada-mode.info, Node: Wisi, Prev: GNAT core, Up: Package organization
1888
1889 14.2.4 Wisi
1890 -----------
1891
1892 The "wisi" parser. "wisi" used to be an acronym, but now it's just a
1893 name.
1894
1895 'wisi.el'
1896 Implements the lexer, the main parser driver, parser actions that
1897 cache parser information in text properties, utilities for
1898 indenting and navigating using the cached information, and general
1899 setup.
1900
1901 'wisi-compile.el'
1902 Implements the parse table compiler. 'wisi-generate.exe' processes
1903 the grammar source '*.wy' into an elisp source representation of a
1904 parse table '*-wy.el'. That is compiled into an internal structure
1905 containing the state transitions and executable actions. The
1906 actions can be any elisp form; the intent is that they be calls to
1907 the action functions provided by 'wisi.el'. 'wisi-compile.el' uses
1908 some features provided by 'semantic'.
1909
1910 'wisi-parse.el'
1911 Implements the generalized LALR parser.
1912
1913 \1f
1914 File: ada-mode.info, Node: OpenToken, Next: ELPA, Prev: Package organization, Up: Developer overview
1915
1916 14.3 OpenToken
1917 ==============
1918
1919 Ada mode uses the OpenToken tool 'wisi-generate.exe' to process the
1920 grammar sources into elisp parse tables. See
1921 <http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html> for current
1922 information about which version of OpenToken is required, and how to get
1923 it.
1924
1925 The Makefile variable 'WISI_OPENTOKEN' gives the path to the build
1926 directory for OpenToken; you probably need to override it with an
1927 external environment variable or on the 'make' command line.
1928
1929 \1f
1930 File: ada-mode.info, Node: ELPA, Prev: OpenToken, Up: Developer overview
1931
1932 14.4 ELPA
1933 =========
1934
1935 Ada mode is published via the Gnu ELPA archive. To test a new version
1936 of Ada mode, we use a local Gnu ELPA archive. That requires fetching
1937 Gnu ELPA via git:
1938
1939 cd /Projects
1940 git clone git://git.savannah.gnu.org/emacs/elpa.git
1941
1942 If you have an Emacs Savannah developer account, you can use:
1943
1944 cd /Projects
1945 git clone <login>@git.savannah.gnu.org/emacs/elpa.git
1946
1947 'build/Makefile' contains targets for copying Ada mode source to the
1948 elpa workspace, and for building the elpa archive there.
1949
1950 \1f
1951 File: ada-mode.info, Node: GNU Free Documentation License, Next: Index, Prev: Developer overview, Up: Top
1952
1953 Appendix A GNU Free Documentation License
1954 *****************************************
1955
1956 Version 1.3, 3 November 2008
1957
1958 Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
1959 <http://fsf.org/>
1960
1961 Everyone is permitted to copy and distribute verbatim copies
1962 of this license document, but changing it is not allowed.
1963
1964 0. PREAMBLE
1965
1966 The purpose of this License is to make a manual, textbook, or other
1967 functional and useful document "free" in the sense of freedom: to
1968 assure everyone the effective freedom to copy and redistribute it,
1969 with or without modifying it, either commercially or
1970 noncommercially. Secondarily, this License preserves for the
1971 author and publisher a way to get credit for their work, while not
1972 being considered responsible for modifications made by others.
1973
1974 This License is a kind of "copyleft", which means that derivative
1975 works of the document must themselves be free in the same sense.
1976 It complements the GNU General Public License, which is a copyleft
1977 license designed for free software.
1978
1979 We have designed this License in order to use it for manuals for
1980 free software, because free software needs free documentation: a
1981 free program should come with manuals providing the same freedoms
1982 that the software does. But this License is not limited to
1983 software manuals; it can be used for any textual work, regardless
1984 of subject matter or whether it is published as a printed book. We
1985 recommend this License principally for works whose purpose is
1986 instruction or reference.
1987
1988 1. APPLICABILITY AND DEFINITIONS
1989
1990 This License applies to any manual or other work, in any medium,
1991 that contains a notice placed by the copyright holder saying it can
1992 be distributed under the terms of this License. Such a notice
1993 grants a world-wide, royalty-free license, unlimited in duration,
1994 to use that work under the conditions stated herein. The
1995 "Document", below, refers to any such manual or work. Any member
1996 of the public is a licensee, and is addressed as "you". You accept
1997 the license if you copy, modify or distribute the work in a way
1998 requiring permission under copyright law.
1999
2000 A "Modified Version" of the Document means any work containing the
2001 Document or a portion of it, either copied verbatim, or with
2002 modifications and/or translated into another language.
2003
2004 A "Secondary Section" is a named appendix or a front-matter section
2005 of the Document that deals exclusively with the relationship of the
2006 publishers or authors of the Document to the Document's overall
2007 subject (or to related matters) and contains nothing that could
2008 fall directly within that overall subject. (Thus, if the Document
2009 is in part a textbook of mathematics, a Secondary Section may not
2010 explain any mathematics.) The relationship could be a matter of
2011 historical connection with the subject or with related matters, or
2012 of legal, commercial, philosophical, ethical or political position
2013 regarding them.
2014
2015 The "Invariant Sections" are certain Secondary Sections whose
2016 titles are designated, as being those of Invariant Sections, in the
2017 notice that says that the Document is released under this License.
2018 If a section does not fit the above definition of Secondary then it
2019 is not allowed to be designated as Invariant. The Document may
2020 contain zero Invariant Sections. If the Document does not identify
2021 any Invariant Sections then there are none.
2022
2023 The "Cover Texts" are certain short passages of text that are
2024 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
2025 that says that the Document is released under this License. A
2026 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
2027 be at most 25 words.
2028
2029 A "Transparent" copy of the Document means a machine-readable copy,
2030 represented in a format whose specification is available to the
2031 general public, that is suitable for revising the document
2032 straightforwardly with generic text editors or (for images composed
2033 of pixels) generic paint programs or (for drawings) some widely
2034 available drawing editor, and that is suitable for input to text
2035 formatters or for automatic translation to a variety of formats
2036 suitable for input to text formatters. A copy made in an otherwise
2037 Transparent file format whose markup, or absence of markup, has
2038 been arranged to thwart or discourage subsequent modification by
2039 readers is not Transparent. An image format is not Transparent if
2040 used for any substantial amount of text. A copy that is not
2041 "Transparent" is called "Opaque".
2042
2043 Examples of suitable formats for Transparent copies include plain
2044 ASCII without markup, Texinfo input format, LaTeX input format,
2045 SGML or XML using a publicly available DTD, and standard-conforming
2046 simple HTML, PostScript or PDF designed for human modification.
2047 Examples of transparent image formats include PNG, XCF and JPG.
2048 Opaque formats include proprietary formats that can be read and
2049 edited only by proprietary word processors, SGML or XML for which
2050 the DTD and/or processing tools are not generally available, and
2051 the machine-generated HTML, PostScript or PDF produced by some word
2052 processors for output purposes only.
2053
2054 The "Title Page" means, for a printed book, the title page itself,
2055 plus such following pages as are needed to hold, legibly, the
2056 material this License requires to appear in the title page. For
2057 works in formats which do not have any title page as such, "Title
2058 Page" means the text near the most prominent appearance of the
2059 work's title, preceding the beginning of the body of the text.
2060
2061 The "publisher" means any person or entity that distributes copies
2062 of the Document to the public.
2063
2064 A section "Entitled XYZ" means a named subunit of the Document
2065 whose title either is precisely XYZ or contains XYZ in parentheses
2066 following text that translates XYZ in another language. (Here XYZ
2067 stands for a specific section name mentioned below, such as
2068 "Acknowledgements", "Dedications", "Endorsements", or "History".)
2069 To "Preserve the Title" of such a section when you modify the
2070 Document means that it remains a section "Entitled XYZ" according
2071 to this definition.
2072
2073 The Document may include Warranty Disclaimers next to the notice
2074 which states that this License applies to the Document. These
2075 Warranty Disclaimers are considered to be included by reference in
2076 this License, but only as regards disclaiming warranties: any other
2077 implication that these Warranty Disclaimers may have is void and
2078 has no effect on the meaning of this License.
2079
2080 2. VERBATIM COPYING
2081
2082 You may copy and distribute the Document in any medium, either
2083 commercially or noncommercially, provided that this License, the
2084 copyright notices, and the license notice saying this License
2085 applies to the Document are reproduced in all copies, and that you
2086 add no other conditions whatsoever to those of this License. You
2087 may not use technical measures to obstruct or control the reading
2088 or further copying of the copies you make or distribute. However,
2089 you may accept compensation in exchange for copies. If you
2090 distribute a large enough number of copies you must also follow the
2091 conditions in section 3.
2092
2093 You may also lend copies, under the same conditions stated above,
2094 and you may publicly display copies.
2095
2096 3. COPYING IN QUANTITY
2097
2098 If you publish printed copies (or copies in media that commonly
2099 have printed covers) of the Document, numbering more than 100, and
2100 the Document's license notice requires Cover Texts, you must
2101 enclose the copies in covers that carry, clearly and legibly, all
2102 these Cover Texts: Front-Cover Texts on the front cover, and
2103 Back-Cover Texts on the back cover. Both covers must also clearly
2104 and legibly identify you as the publisher of these copies. The
2105 front cover must present the full title with all words of the title
2106 equally prominent and visible. You may add other material on the
2107 covers in addition. Copying with changes limited to the covers, as
2108 long as they preserve the title of the Document and satisfy these
2109 conditions, can be treated as verbatim copying in other respects.
2110
2111 If the required texts for either cover are too voluminous to fit
2112 legibly, you should put the first ones listed (as many as fit
2113 reasonably) on the actual cover, and continue the rest onto
2114 adjacent pages.
2115
2116 If you publish or distribute Opaque copies of the Document
2117 numbering more than 100, you must either include a machine-readable
2118 Transparent copy along with each Opaque copy, or state in or with
2119 each Opaque copy a computer-network location from which the general
2120 network-using public has access to download using public-standard
2121 network protocols a complete Transparent copy of the Document, free
2122 of added material. If you use the latter option, you must take
2123 reasonably prudent steps, when you begin distribution of Opaque
2124 copies in quantity, to ensure that this Transparent copy will
2125 remain thus accessible at the stated location until at least one
2126 year after the last time you distribute an Opaque copy (directly or
2127 through your agents or retailers) of that edition to the public.
2128
2129 It is requested, but not required, that you contact the authors of
2130 the Document well before redistributing any large number of copies,
2131 to give them a chance to provide you with an updated version of the
2132 Document.
2133
2134 4. MODIFICATIONS
2135
2136 You may copy and distribute a Modified Version of the Document
2137 under the conditions of sections 2 and 3 above, provided that you
2138 release the Modified Version under precisely this License, with the
2139 Modified Version filling the role of the Document, thus licensing
2140 distribution and modification of the Modified Version to whoever
2141 possesses a copy of it. In addition, you must do these things in
2142 the Modified Version:
2143
2144 A. Use in the Title Page (and on the covers, if any) a title
2145 distinct from that of the Document, and from those of previous
2146 versions (which should, if there were any, be listed in the
2147 History section of the Document). You may use the same title
2148 as a previous version if the original publisher of that
2149 version gives permission.
2150
2151 B. List on the Title Page, as authors, one or more persons or
2152 entities responsible for authorship of the modifications in
2153 the Modified Version, together with at least five of the
2154 principal authors of the Document (all of its principal
2155 authors, if it has fewer than five), unless they release you
2156 from this requirement.
2157
2158 C. State on the Title page the name of the publisher of the
2159 Modified Version, as the publisher.
2160
2161 D. Preserve all the copyright notices of the Document.
2162
2163 E. Add an appropriate copyright notice for your modifications
2164 adjacent to the other copyright notices.
2165
2166 F. Include, immediately after the copyright notices, a license
2167 notice giving the public permission to use the Modified
2168 Version under the terms of this License, in the form shown in
2169 the Addendum below.
2170
2171 G. Preserve in that license notice the full lists of Invariant
2172 Sections and required Cover Texts given in the Document's
2173 license notice.
2174
2175 H. Include an unaltered copy of this License.
2176
2177 I. Preserve the section Entitled "History", Preserve its Title,
2178 and add to it an item stating at least the title, year, new
2179 authors, and publisher of the Modified Version as given on the
2180 Title Page. If there is no section Entitled "History" in the
2181 Document, create one stating the title, year, authors, and
2182 publisher of the Document as given on its Title Page, then add
2183 an item describing the Modified Version as stated in the
2184 previous sentence.
2185
2186 J. Preserve the network location, if any, given in the Document
2187 for public access to a Transparent copy of the Document, and
2188 likewise the network locations given in the Document for
2189 previous versions it was based on. These may be placed in the
2190 "History" section. You may omit a network location for a work
2191 that was published at least four years before the Document
2192 itself, or if the original publisher of the version it refers
2193 to gives permission.
2194
2195 K. For any section Entitled "Acknowledgements" or "Dedications",
2196 Preserve the Title of the section, and preserve in the section
2197 all the substance and tone of each of the contributor
2198 acknowledgements and/or dedications given therein.
2199
2200 L. Preserve all the Invariant Sections of the Document, unaltered
2201 in their text and in their titles. Section numbers or the
2202 equivalent are not considered part of the section titles.
2203
2204 M. Delete any section Entitled "Endorsements". Such a section
2205 may not be included in the Modified Version.
2206
2207 N. Do not retitle any existing section to be Entitled
2208 "Endorsements" or to conflict in title with any Invariant
2209 Section.
2210
2211 O. Preserve any Warranty Disclaimers.
2212
2213 If the Modified Version includes new front-matter sections or
2214 appendices that qualify as Secondary Sections and contain no
2215 material copied from the Document, you may at your option designate
2216 some or all of these sections as invariant. To do this, add their
2217 titles to the list of Invariant Sections in the Modified Version's
2218 license notice. These titles must be distinct from any other
2219 section titles.
2220
2221 You may add a section Entitled "Endorsements", provided it contains
2222 nothing but endorsements of your Modified Version by various
2223 parties--for example, statements of peer review or that the text
2224 has been approved by an organization as the authoritative
2225 definition of a standard.
2226
2227 You may add a passage of up to five words as a Front-Cover Text,
2228 and a passage of up to 25 words as a Back-Cover Text, to the end of
2229 the list of Cover Texts in the Modified Version. Only one passage
2230 of Front-Cover Text and one of Back-Cover Text may be added by (or
2231 through arrangements made by) any one entity. If the Document
2232 already includes a cover text for the same cover, previously added
2233 by you or by arrangement made by the same entity you are acting on
2234 behalf of, you may not add another; but you may replace the old
2235 one, on explicit permission from the previous publisher that added
2236 the old one.
2237
2238 The author(s) and publisher(s) of the Document do not by this
2239 License give permission to use their names for publicity for or to
2240 assert or imply endorsement of any Modified Version.
2241
2242 5. COMBINING DOCUMENTS
2243
2244 You may combine the Document with other documents released under
2245 this License, under the terms defined in section 4 above for
2246 modified versions, provided that you include in the combination all
2247 of the Invariant Sections of all of the original documents,
2248 unmodified, and list them all as Invariant Sections of your
2249 combined work in its license notice, and that you preserve all
2250 their Warranty Disclaimers.
2251
2252 The combined work need only contain one copy of this License, and
2253 multiple identical Invariant Sections may be replaced with a single
2254 copy. If there are multiple Invariant Sections with the same name
2255 but different contents, make the title of each such section unique
2256 by adding at the end of it, in parentheses, the name of the
2257 original author or publisher of that section if known, or else a
2258 unique number. Make the same adjustment to the section titles in
2259 the list of Invariant Sections in the license notice of the
2260 combined work.
2261
2262 In the combination, you must combine any sections Entitled
2263 "History" in the various original documents, forming one section
2264 Entitled "History"; likewise combine any sections Entitled
2265 "Acknowledgements", and any sections Entitled "Dedications". You
2266 must delete all sections Entitled "Endorsements."
2267
2268 6. COLLECTIONS OF DOCUMENTS
2269
2270 You may make a collection consisting of the Document and other
2271 documents released under this License, and replace the individual
2272 copies of this License in the various documents with a single copy
2273 that is included in the collection, provided that you follow the
2274 rules of this License for verbatim copying of each of the documents
2275 in all other respects.
2276
2277 You may extract a single document from such a collection, and
2278 distribute it individually under this License, provided you insert
2279 a copy of this License into the extracted document, and follow this
2280 License in all other respects regarding verbatim copying of that
2281 document.
2282
2283 7. AGGREGATION WITH INDEPENDENT WORKS
2284
2285 A compilation of the Document or its derivatives with other
2286 separate and independent documents or works, in or on a volume of a
2287 storage or distribution medium, is called an "aggregate" if the
2288 copyright resulting from the compilation is not used to limit the
2289 legal rights of the compilation's users beyond what the individual
2290 works permit. When the Document is included in an aggregate, this
2291 License does not apply to the other works in the aggregate which
2292 are not themselves derivative works of the Document.
2293
2294 If the Cover Text requirement of section 3 is applicable to these
2295 copies of the Document, then if the Document is less than one half
2296 of the entire aggregate, the Document's Cover Texts may be placed
2297 on covers that bracket the Document within the aggregate, or the
2298 electronic equivalent of covers if the Document is in electronic
2299 form. Otherwise they must appear on printed covers that bracket
2300 the whole aggregate.
2301
2302 8. TRANSLATION
2303
2304 Translation is considered a kind of modification, so you may
2305 distribute translations of the Document under the terms of section
2306 4. Replacing Invariant Sections with translations requires special
2307 permission from their copyright holders, but you may include
2308 translations of some or all Invariant Sections in addition to the
2309 original versions of these Invariant Sections. You may include a
2310 translation of this License, and all the license notices in the
2311 Document, and any Warranty Disclaimers, provided that you also
2312 include the original English version of this License and the
2313 original versions of those notices and disclaimers. In case of a
2314 disagreement between the translation and the original version of
2315 this License or a notice or disclaimer, the original version will
2316 prevail.
2317
2318 If a section in the Document is Entitled "Acknowledgements",
2319 "Dedications", or "History", the requirement (section 4) to
2320 Preserve its Title (section 1) will typically require changing the
2321 actual title.
2322
2323 9. TERMINATION
2324
2325 You may not copy, modify, sublicense, or distribute the Document
2326 except as expressly provided under this License. Any attempt
2327 otherwise to copy, modify, sublicense, or distribute it is void,
2328 and will automatically terminate your rights under this License.
2329
2330 However, if you cease all violation of this License, then your
2331 license from a particular copyright holder is reinstated (a)
2332 provisionally, unless and until the copyright holder explicitly and
2333 finally terminates your license, and (b) permanently, if the
2334 copyright holder fails to notify you of the violation by some
2335 reasonable means prior to 60 days after the cessation.
2336
2337 Moreover, your license from a particular copyright holder is
2338 reinstated permanently if the copyright holder notifies you of the
2339 violation by some reasonable means, this is the first time you have
2340 received notice of violation of this License (for any work) from
2341 that copyright holder, and you cure the violation prior to 30 days
2342 after your receipt of the notice.
2343
2344 Termination of your rights under this section does not terminate
2345 the licenses of parties who have received copies or rights from you
2346 under this License. If your rights have been terminated and not
2347 permanently reinstated, receipt of a copy of some or all of the
2348 same material does not give you any rights to use it.
2349
2350 10. FUTURE REVISIONS OF THIS LICENSE
2351
2352 The Free Software Foundation may publish new, revised versions of
2353 the GNU Free Documentation License from time to time. Such new
2354 versions will be similar in spirit to the present version, but may
2355 differ in detail to address new problems or concerns. See
2356 <http://www.gnu.org/copyleft/>.
2357
2358 Each version of the License is given a distinguishing version
2359 number. If the Document specifies that a particular numbered
2360 version of this License "or any later version" applies to it, you
2361 have the option of following the terms and conditions either of
2362 that specified version or of any later version that has been
2363 published (not as a draft) by the Free Software Foundation. If the
2364 Document does not specify a version number of this License, you may
2365 choose any version ever published (not as a draft) by the Free
2366 Software Foundation. If the Document specifies that a proxy can
2367 decide which future versions of this License can be used, that
2368 proxy's public statement of acceptance of a version permanently
2369 authorizes you to choose that version for the Document.
2370
2371 11. RELICENSING
2372
2373 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
2374 World Wide Web server that publishes copyrightable works and also
2375 provides prominent facilities for anybody to edit those works. A
2376 public wiki that anybody can edit is an example of such a server.
2377 A "Massive Multiauthor Collaboration" (or "MMC") contained in the
2378 site means any set of copyrightable works thus published on the MMC
2379 site.
2380
2381 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
2382 license published by Creative Commons Corporation, a not-for-profit
2383 corporation with a principal place of business in San Francisco,
2384 California, as well as future copyleft versions of that license
2385 published by that same organization.
2386
2387 "Incorporate" means to publish or republish a Document, in whole or
2388 in part, as part of another Document.
2389
2390 An MMC is "eligible for relicensing" if it is licensed under this
2391 License, and if all works that were first published under this
2392 License somewhere other than this MMC, and subsequently
2393 incorporated in whole or in part into the MMC, (1) had no cover
2394 texts or invariant sections, and (2) were thus incorporated prior
2395 to November 1, 2008.
2396
2397 The operator of an MMC Site may republish an MMC contained in the
2398 site under CC-BY-SA on the same site at any time before August 1,
2399 2009, provided the MMC is eligible for relicensing.
2400
2401 ADDENDUM: How to use this License for your documents
2402 ====================================================
2403
2404 To use this License in a document you have written, include a copy of
2405 the License in the document and put the following copyright and license
2406 notices just after the title page:
2407
2408 Copyright (C) YEAR YOUR NAME.
2409 Permission is granted to copy, distribute and/or modify this document
2410 under the terms of the GNU Free Documentation License, Version 1.3
2411 or any later version published by the Free Software Foundation;
2412 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2413 Texts. A copy of the license is included in the section entitled ``GNU
2414 Free Documentation License''.
2415
2416 If you have Invariant Sections, Front-Cover Texts and Back-Cover
2417 Texts, replace the "with...Texts." line with this:
2418
2419 with the Invariant Sections being LIST THEIR TITLES, with
2420 the Front-Cover Texts being LIST, and with the Back-Cover Texts
2421 being LIST.
2422
2423 If you have Invariant Sections without Cover Texts, or some other
2424 combination of the three, merge those two alternatives to suit the
2425 situation.
2426
2427 If your document contains nontrivial examples of program code, we
2428 recommend releasing these examples in parallel under your choice of free
2429 software license, such as the GNU General Public License, to permit
2430 their use in free software.
2431
2432 \1f
2433 File: ada-mode.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
2434
2435 Index
2436 *****
2437
2438