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