annotate man/ada-mode.texi @ 79209:e36d222d322f

Mention desktop locking.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 24 Oct 2007 10:18:52 +0000
parents 88224dc74061
children 02b9a9aa5b0c e6fdae9180d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 \input texinfo @c -*-texinfo-*-
25913
2552233fdd74 Set file name to ../info/ada-mode
Gerd Moellmann <gerd@gnu.org>
parents: 25906
diff changeset
2 @setfilename ../info/ada-mode
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3 @settitle Ada Mode
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
5 @copying
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
6 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74004
diff changeset
7 2005, 2006, 2007 Free Software Foundation, Inc.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
9 @quotation
37403
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
10 Permission is granted to copy, distribute and/or modify this document
65555
69b3598a61c5 Update all manuals to specify GFDL version 1.2.
Romain Francoise <romain@orebokech.com>
parents: 64890
diff changeset
11 under the terms of the GNU Free Documentation License, Version 1.2 or
37403
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
12 any later version published by the Free Software Foundation; with the
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
13 Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
14 ``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
15 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
16 license is included in the section entitled ``GNU Free Documentation
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
17 License'' in the Emacs manual.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18
37403
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
19 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
20 this GNU Manual, like GNU software. Copies published by the Free
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
21 Software Foundation raise funds for GNU development.''
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
37403
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
23 This document is part of a collection distributed under the GNU Free
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
24 Documentation License. If you want to distribute this document
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
25 separately from the collection, you can do so by adding a copy of the
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
26 license to the document, as described in section 6 of the license.
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
27 @end quotation
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
28 @end copying
37403
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
29
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
30 @dircategory Emacs
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
31 @direntry
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
32 * Ada mode: (ada-mode). Emacs mode for editing and compiling Ada code.
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
33 @end direntry
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 @titlepage
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 @sp 10
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 @title{Ada Mode}
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 @sp 2
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
39 @subtitle An Emacs major mode for programming in Ada
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
40 @subtitle Ada Mode Version 3.7
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 @sp 2
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 @page
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 @vskip 0pt plus 1filll
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 46918
diff changeset
44 @insertcopying
37403
aa94142b7f02 Add copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents: 36509
diff changeset
45 @end titlepage
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
47 @c fixme; title page doesn't show up in ada-mode.info; why bother with
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
48 @c it?
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 @node Top, Overview, (dir), (dir)
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 @menu
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 * Overview::
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
54 * Installation:: Installing Ada mode on your system
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
55 * Customization:: Setting up Ada mode to your taste
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
56 * Compiling Executing:: Working with your application within Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
57 * Project files:: Describing the organization of your project
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
58 * Compiling Examples:: A small tutorial
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
59 * Moving Through Ada Code:: Moving easily through Ada sources
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
60 * Identifier completion:: Finishing words automatically
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
61 * Automatic Smart Indentation:: Indenting your code automatically as you type
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
62 * Formatting Parameter Lists:: Formatting subprograms' parameter lists
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 automatically
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
64 * Automatic Casing:: Adjusting the case of words automatically
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
65 * Statement Templates:: Inserting code templates
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
66 * Comment Handling:: Reformatting comments easily
77235
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
67 * GNU Free Documentation License:: The license for this documentation.
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
68 * Index::
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 @end menu
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 @node Overview, Installation, Top, Top
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 @chapter Overview
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
74
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
75 The Emacs mode for programming in Ada helps the user in understanding
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
76 existing code and facilitates writing new code.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
77
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
78 When the Gnu Ada compiler GNAT is used, the cross-reference
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
79 information output by the compiler is used to provide powerful code
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
80 navigation (jump to definition, find all uses, etc).
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
81
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
82 When you open a file with a file extension of @file{.ads} or
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
83 @file{.adb}, Emacs will automatically load and activate Ada mode.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
85 Ada mode works without any customization, if you are using the GNAT
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
86 compiler (@url{https://libre2.adacore.com/}) and the GNAT default
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
87 naming convention.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
89 You must customize a few things if you are using a different compiler
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
90 or file naming convention; @xref{Other compiler}, @xref{Non-standard
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
91 file names}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
92
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
93 In addition, you may want to customize the indentation,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
94 capitalization, and other things; @xref{Other customization}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
96 Finally, for large Ada projects, you will want to set up an Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
97 Ada mode project file for each project; @xref{Project files}. Note
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
98 that these are different from the GNAT project files used by gnatmake
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
99 and other GNAT commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
100
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
101 See the Emacs info manual, section 'Running Debuggers Under Emacs',
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
102 for general information on debugging.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
103
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
104 @node Installation, Customization, Overview, Top
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
105 @chapter Installation
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
107 Ada mode is part of the standard Emacs distribution; if you use that,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
108 no files need to be installed.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
109
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
110 Ada mode is also available as a separate distribution, from the Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
111 Ada mode website
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
112 @uref{http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html}. The
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
113 separate distribution may be more recent.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
114
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
115 For installing the separate distribution, see the @file{README} file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
116 in the distribution.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
117
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
118 To see what version of Ada mode you have installed, do @key{M-x
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
119 ada-mode-version}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
120
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
121 The following files are provided with the Ada mode distribution:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 @itemize @bullet
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
124
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
125 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
126 @file{ada-mode.el}: The main file for Ada mode, providing indentation,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
127 formatting of parameter lists, moving through code, comment handling
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
128 and automatic casing.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
129
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
130 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
131 @file{ada-prj.el}: GUI editing of Ada mode project files, using Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
132 widgets.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
133
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
134 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
135 @file{ada-stmt.el}: Ada statement templates.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
136
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
137 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
138 @file{ada-xref.el}: GNAT cross-references, completion of identifiers,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
139 and compilation. Also provides project files (which are not
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
140 GNAT-specific).
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
141
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 @end itemize
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
144 @node Customization, Compiling Executing, Installation, Top
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
145 @chapter Customizing Ada mode
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
147 Here we assume you are familiar with setting variables in Emacs,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
148 either thru 'customize' or in elisp (in your @file{.emacs} file). For
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
149 a basic introduction to customize, elisp, and Emacs in general, see
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
150 the tutorial in
42326
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
151 @iftex
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
152 @cite{The GNU Emacs Manual}.
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
153 @end iftex
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
154 @ifhtml
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
155 @cite{The GNU Emacs Manual}.
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
156 @end ifhtml
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
157 @ifinfo
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
158 @ref{Top, , The GNU Emacs Manual, emacs, The GNU Emacs Manual}.
939fbbfd59d8 Fix typo in cross-reference for `Using non-standard file names'
Robert J. Chassell <bob@rattlesnake.com>
parents: 40705
diff changeset
159 @end ifinfo
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
161 These global Emacs settings are strongly recommended (put them in your
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
162 .emacs):
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
163
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
164 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
165 (global-font-lock-mode t)
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
166 (transient-mark-mode t)
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
167 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
169 @samp{(global-font-lock-mode t)} turns on syntax
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
170 highlighting for all buffers (it is off by default because it may be
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
171 too slow for some machines).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
173 @samp{(transient-mark-mode t)} highlights selected text.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
175 See the Emacs help for each of these variables for more information.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
177 @menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
178 * Non-standard file names::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
179 * Other compiler::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
180 * Other customization::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
181 @end menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
182
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
183 @node Non-standard file names, Other compiler, Customization, Customization
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
184 @section Non-standard file names
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
186 By default, Ada mode is configured to use the GNAT file naming
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
187 convention, where file names are a simple modification of the Ada
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
188 names, and the extension for specs and bodies are
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
189 @samp{.ads} and @samp{.adb}, respectively.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
191 Ada mode uses the file extentions to allow moving from a package body
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
192 to the corresponding spec and back.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
193
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
194 Ada mode supports a list of alternative file extensions for specs and bodies.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
195
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
196 For instance, if your spec and bodies files are called
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
197 @file{@var{unit}_s.ada} and @file{@var{unit}_b.ada}, respectively, you
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
198 can add the following to your @file{.emacs} file:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
200 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
201 (ada-add-extensions "_s.ada" "_b.ada")
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
202 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
204 You can define additional extensions:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
206 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
207 (ada-add-extensions ".ads" "_b.ada")
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
208 (ada-add-extensions ".ads" ".body")
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
209 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
211 This means that whenever Ada mode looks for the body for a file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
212 whose extension is @file{.ads}, it will take the first available file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
213 that ends with either @file{.adb}, @file{_b.ada} or
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
214 @file{.body}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
216 Simililarly, if Ada mode is looking for a spec, it will look for
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
217 @file{.ads} or @file{_s.ada}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
219 If the filename is not derived from the Ada name following the GNAT
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
220 convention, things are a little more complicated. You then need to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
221 rewrite the function @code{ada-make-filename-from-adaname}. Doing that
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
222 is beyond the scope of this manual; see the current definitions in
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
223 @file{ada-mode.el} and @file{ada-xref.el} for examples.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
224
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
225 @node Other compiler, Other customization, Non-standard file names, Customization
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
226 @section Other compiler
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
227
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
228 By default, Ada mode is configured to use the Gnu Ada compiler GNAT.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
230 To use a different Ada compiler, you must specify the command lines
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
231 used to run that compiler, either in lisp variables or in Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
232 Ada mode project files. See @ref{Project file variables} for the list
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
233 of project variables, and the corresponding lisp variables.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
235 @node Other customization, , Other compiler, Customization
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
236 @section Other customization
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
237
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
238 All user-settable Ada mode variables can be set via the menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
239 @samp{Ada | Customize}. Click on the @samp{Help} button there for help
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
240 on using customize.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 To modify a specific variable, you can directly call the function
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
243 @code{customize-variable}; just type @kbd{M-x customize-variable
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
244 @key{RET} @var{variable-name} @key{RET}}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
246 Alternately, you can specify variable settings in the Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
247 configuration file, @file{.emacs}. This file is coded in Emacs lisp,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
248 and the syntax to set a variable is the following:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 @example
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 (setq variable-name value)
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251 @end example
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
253 @node Compiling Executing, Project files, Customization, Top
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
254 @chapter Compiling Executing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
255
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
256 Ada projects can be compiled, linked, and executed using commands on
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
257 the Ada menu. All of these commands can be customized via a project
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
258 file (@pxref{Project files}), but the defaults are sufficient for using
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
259 the GNAT compiler for simple projects (single files, or several files
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
260 in a single directory).
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
261
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
262 Even when no project file is used, the GUI project editor (menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
263 @key{Ada | Project | Edit}) shows the settings of the various project
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
264 file variables referenced here.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
265
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
266 @menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
267 * Compile commands::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
268 * Compiler errors::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
269 @end menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
270
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
271 @node Compile commands, Compiler errors, Compiling Executing, Compiling Executing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
272 @section Compile commands
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
273
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
274 Here are the commands for building and using an Ada project, as
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
275 listed in the Ada menu.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
276
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
277 In multi-file projects, there must be one file that is the main
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
278 program. That is given by the @code{main_unit} project file variable;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
279 it defaults to the current file if not yet set, but is also set by the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
280 ``set main and build'' command.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
281
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
282 @table @code
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
283
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
284 @item Check file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
285 Compiles the current file in syntax check mode, by running
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
286 @code{check_cmd} defined in the current project file. This typically
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
287 runs faster than full compile mode, speeding up finding and fixing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
288 compilation errors.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
289
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
290 This sets @code{main_unit} only if it has not been set yet.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
292 @item Compile file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
293 Compiles the current file, by running @code{comp_cmd} from the current
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
294 project file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
295
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
296 This does not set @code{main_unit}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
297
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
298 @item Set main and Build
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
299 Sets @code{main_unit} to the current file, then executes the Build
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
300 command.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
301
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
302 @item Show main
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
303 Display @code{main_unit} in the message buffer.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
304
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
305 @item Build
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
306 Compiles all obsolete units of the current @code{main_unit}, and links
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
307 @code{main_unit}, by running @code{make_cmd} from the current project.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
308
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
309 This sets @code{main_unit} only if it has not been set yet.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
311 @item Run
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
312 Executes the main program in a shell, displayed in a separate Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
313 buffer. This runs @code{run_cmd} from the current project. The
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
314 execution buffer allows for interactive input/output.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
315
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
316 To modify the run command, in particular to provide or change the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
317 command line arguments, type @key{C-u} before invoking the command.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
318
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
319 This command is not available for a cross-compilation toolchain.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
321 @end table
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
322 It is important when using these commands to understand how
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
323 @code{main_unit} is used and changed.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
324
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
325 Build runs 'gnatmake' on the main unit. During a typical edit/compile
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
326 session, this is the only command you need to invoke, which is why it
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
327 is bound to @key{C-c C-c}. It will compile all files needed by the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
328 main unit, and display compilation errors in any of them.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
329
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
330 Note that Build can be invoked from any Ada buffer; typically you will
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
331 be fixing errors in files other than the main, but you don't have to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
332 switch back to the main to invoke the compiler again.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
334 Novices and students typically work on single-file Ada projects. In
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
335 this case, @key{C-c C-m} will normally be the only command needed; it
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
336 will build the current file, rather than the last-built main.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
337
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
338 There are three ways to change @code{main_unit}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
339
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
340 @enumerate
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
341 @item
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
342 Invoke @key{Ada | Set main and Build}, which sets @code{main_unit} to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
343 the current file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
344
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
345 @item
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
346 Invoke @key{Ada | Project | Edit}, edit @code{main_unit} and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
347 @code{main}, and click @key{[save]}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
348
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
349 @item
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
350 Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main_unit}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
351
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
352 @end enumerate
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
354 @node Compiler errors, , Compile commands, Compiling Executing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
355 @section Compiler errors
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
356
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
357 The @code{Check file}, @code{Compile file}, and @code{Build} commands
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
358 all place compilation errors in a separate buffer named
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
359 @code{*compilation*}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
360
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
361 Each line in this buffer will become active: you can simply click on
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
362 it with the middle button of the mouse, or move point to it and press
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
363 @key{RET}. Emacs will then display the relevant source file and put
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
364 point on the line and column where the error was found.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
365
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
366 You can also press the @kbd{C-x `} key (@code{next-error}), and Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
367 will jump to the first error. If you press that key again, it will
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
368 move you to the second error, and so on.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
369
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
370 Some error messages might also include references to other files. These
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
371 references are also clickable in the same way, or put point after the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
372 line number and press @key{RET}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
373
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
374 @node Project files, Compiling Examples, Compiling Executing, Top
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
375 @chapter Project files
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
377 An Emacs Ada mode project file specifies what directories hold sources
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
378 for your project, and allows you to customize the compilation commands
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
379 and other things on a per-project basis.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
380
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
381 Note that Ada mode project files @samp{*.adp} are different than GNAT
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
382 compiler project files @samp{*.gpr}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
383
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
384 @menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
385 * Project File Overview::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
386 * GUI Editor::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
387 * Project file variables::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
388 @end menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
389
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
390 @node Project File Overview, GUI Editor, Project files, Project files
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
391 @section Project File Overview
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
393 Project files have a simple syntax; they may be edited directly. Each
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
394 line specifies a project variable name and its value, separated by ``='':
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
395 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
396 src_dir=/Projects/my_project/src_1
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
397 src_dir=/Projects/my_project/src_2
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
398 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
399
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
400 Some variables (like @code{src_dir}) are lists; multiple occurances
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
401 are concatenated.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
402
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
403 There must be no space between the variable name and ``='', and no
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
404 trailing spaces.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
406 Alternately, a GUI editor for project files is available (@pxref{GUI
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
407 Editor}). It uses Emacs widgets, similar to Emacs customize.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
408
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
409 The GUI editor also provides a convenient way to view current project
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
410 settings, if they have been modified using menu commands rather than
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
411 by editing the project file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
412
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
413 After the first Ada mode build command is invoked, there is always a
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
414 current project file, given by the lisp variable
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
415 @code{ada-prj-default-project-file}. Currently, the only way to show
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
416 the current project file is to invoke the GUI editor.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
417
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
418 To find the project file the first time, Ada mode uses the following
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
419 search algorithm:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 @itemize @bullet
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
422 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
423 If @code{ada-prj-default-project-file} is set, use that.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
424
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
425 @item
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
426 Otherwise, search for a file in the current directory with
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
427 the same base name as the Ada file, but extension given by
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
428 @code{ada-prj-file-extension} (default @code{".adp"}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
430 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
431 If not found, search for @file{*.adp} in the current directory; if
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
432 several are found, prompt the user to select one.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
433
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
434 @item
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
435 If none are found, use @file{default.adp} in the current directory (even
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
436 if it does not exist).
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
437
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 @end itemize
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
440 This algorithm always sets @code{ada-prj-default-project-file}, even
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
441 when the file does not actually exist.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
443 To change the project file before or after the first one is found,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
444 invoke @key{Ada | Project | Load ...}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
445
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
446 Or, in lisp, evaluate @code{ada-set-default-project-file "/path/file.adp"}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
447 This sets @code{ada-prj-default-project-file}, and reads the project file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
448
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
449 @node GUI Editor, Project file variables, Project File Overview, Project files
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
450 @section GUI Editor
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
451
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
452 The project file editor is invoked with the menu @samp{Ada | Projects
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
453 | Edit}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
454
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
455 Once in the buffer for editing the project file, you can save your
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
456 modification using the @samp{[save]} button at the bottom of the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
457 buffer, or the @kbd{C-x C-s} binding. To cancel your modifications,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
458 kill the buffer or click on the @samp{[cancel]} button.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
459
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
460 @node Project file variables, , GUI Editor, Project files
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
461 @section Project file variables
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
462
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
463 The following variables can be defined in a project file; some can
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
464 also be defined in lisp variables.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
465
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
466 To set a project variable that is a list, specify each element of the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
467 list on a separate line in the project file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
468
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
469 Any project variable can be referenced in other project variables,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
470 using a shell-like notation. For instance, if the variable
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
471 @code{comp_cmd} contains @code{$@{comp_opt@}}, the value of the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
472 @code{comp_opt} variable will be substituted when @code{comp_cmd} is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
473 used.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
474
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
475 Most project variables have defaults that can be changed by setting
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
476 lisp variables; the table below identifies the lisp variable for each
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
477 project variable. Lisp variables corresponding to project variables
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
478 that are lists are lisp lists.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
479
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
480 Here is the list of variables. In the default values, the current
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
481 directory @code{"."} is the project file directory.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
482
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
483 @c defined in ada-xref-set-default-prj-values; same order here
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
484 @table @asis
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
485 @item @code{build_dir} [default: @code{"."}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
486 The compile commands will be issued in this directory.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
487
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
488 @item @code{src_dir} [default: @code{"."}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
489 A list of directories to search for source files, both for compile
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
490 commands and source navigation.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
491
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
492 @item @code{obj_dir} [default: @code{"."}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
493 A list of directories to search for library files. Ada mode searches
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
494 this list for the @samp{.ali} files generated by GNAT that contain
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
495 cross-reference information.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
496
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
497 The compiler commands must place the @samp{.ali} files in one of these
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
498 directories; the default commands do that.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
499
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
500 @item @code{casing} [default: @code{("~/.emacs_case_exceptions")}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
501 List of files containing casing exceptions. See the help on
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
502 @code{ada-case-exception-file} for more info.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
503 @c FIXME: section on case exceptions
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
504
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
505 Lisp variable: @code{ada-case-exception-file}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
506
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
507 @item @code{comp_opt} [default: @code{"-gnatq -gnatQ"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
508 Holds user compiler options; used in the default compile commands. The
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
509 default value tells gnatmake to generate library files for
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
510 cross-referencing even when there are errors.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
511
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
512 If source code for the project is in multiple directories, the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
513 appropriate compiler options must be added here. @ref{Set source
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
514 search path} for examples of this. Alternately, GNAT project files may
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
515 be used; @ref{Use GNAT project file}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
516
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
517 Lisp variable: @code{ada-prj-default-comp-opt}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
518
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
519 @item @code{bind_opt} [default: @code{""}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
520 Holds user binder options; used in the default build commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
521
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
522 Lisp variable: @code{ada-prj-default-bind-opt}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
523
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
524 @item @code{link_opt} [default: @code{""}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
525 Holds user linker options; used in the default build commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
526
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
527 Lisp variable: @code{ada-prj-default-link-opt}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
528
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
529 @item @code{gnatmake_opt} [default: @code{"-g"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
530 Holds user gnatmake options; used in the default build commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
531
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
532 If a GNAT project file is used (for example @file{project.gpr}), this
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
533 option should be set to @code{-Pproject.gpr}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
534
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
535 Lisp variable: @code{ada-prj-default-gnatmake-opt}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
537 @item @code{gnatfind_opt} [default: @code{"-rf"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
538 Holds user gnatfind options; used in the default find commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
539
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
540 Lisp variable: @code{ada-prj-gnatfind-switches}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
541
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
542 @item @code{main} [default: current file]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
543 Specifies the name of the executable file for the project; used in the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
544 default build commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
545
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
546 @item @code{main_unit} [default: current Ada unit]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
547 Specifies the name of the main Ada unit for the project; used in the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
548 default build commands.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
549
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
550 @item @code{cross_prefix} [default: @code{""}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
551 Name of target machine in a cross-compilation environment. Used in
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
552 default compile and build commands.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
553
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
554 @item @code{remote_machine} [default: @code{""}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
555 Name of the machine to log into before issuing the compile and build
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
556 commands. If this variable is empty, the command will be run on the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
557 local machine.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
558
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
559 @item @code{comp_cmd} [default: @code{"$@{cross_prefix@}gnatmake -u -c $@{gnatmake_opt@} $@{full_current@} -cargs $@{comp_opt@}"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
560 Command used to compile a single file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
561 The name of the file is substituted for @code{full_current}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
562
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
563 Lisp variable: @code{ada-prj-default-comp-cmd}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
564
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
565 @item @code{check_cmd} [default: @code{"$@{cross_prefix@}gnatmake -u -c -gnatc $@{gnatmake_opt@} $@{full_current@} -cargs $@{comp_opt@}"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
566 Command used to syntax check a single file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
567 The name of the file is substituted for @code{full_current}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
569 Lisp variable: @code{ada-prj-default-check-cmd}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
570
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
571 @item @code{make_cmd} [default: @code{"$@{cross_prefix@}gnatmake -o $@{main@} $@{main_unit@} $@{gnatmake_opt@} -cargs $@{comp_opt@} -bargs $@{bind_opt@} -largs $@{link_opt@}"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
572 Command used to build the application.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
573
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
574 Lisp variable: @code{ada-prj-default-make-cmd}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
575
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
576 @item @code{run_cmd} [default: @code{"./$@{main@}"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
577 Command used to run the application.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
578
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
579 @item @code{debug_pre_cmd} [default: @code{"cd $@{build_dir@}"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
580 Command executed before @code{debug_cmd}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
581
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
582 @item @code{debug_cmd} [default: @code{"$@{cross_prefix@}gdb $@{main@}"}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
583 Command used to debug the application
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
584
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
585 Lisp variable: @code{ada-prj-default-debugger}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
586
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
587 @item @code{debug_post_cmd} [default: @code{""}]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
588 Command executed after @code{debug_cmd}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
589
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
590 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
591
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
592 @node Compiling Examples, Moving Through Ada Code, Project files, Top
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
593 @chapter Compiling Examples
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
594
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
595 We present several small projects, and walk thru the process of
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
596 compiling, linking, and running them.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
597
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
598 The first example illustrates more Ada mode features than the others;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
599 you should work thru that example before doing the others.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
600
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
601 All of these examples assume you are using GNAT.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
602
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
603 The source for these examples is available on the Emacs Ada mode
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
604 website mentioned in @xref{Installation}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
605
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
606 @menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
607 * No project files:: Just menus
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
608 * Set compiler options:: A basic Ada mode project file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
609 * Set source search path:: Source in multiple directories
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
610 * Use GNAT project file::
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
611 @end menu
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
612
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
613 @node No project files, Set compiler options, Compiling Examples, Compiling Examples
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
614 @section No project files
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
615 This example uses no project files.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
616
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
617 First, create a directory @file{Example_1}, containing:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
618
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
619 @file{hello.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
620
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
621 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
622 with Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
623 procedure Hello
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
624 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
625 Put_Line("Hello from hello.adb");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
626 end Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
627 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
628
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
629 Yes, this is missing ``use Ada.Text_IO;'' - we want to demonstrate
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
630 compiler error handling.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
631
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
632 @file{hello_2.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
633
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
634 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
635 with Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
636 procedure Hello_2
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
637 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
638 Hello_Pkg.Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
639 end Hello_2;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
640 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
641
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
642 @file{hello_pkg.ads}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
643
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
644 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
645 package Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
646 procedure Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
647 end Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
648 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
649
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
650 @file{hello_pkg.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
651
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
652 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
653 with Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
654 package Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
655 procedure Say_Hello
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
656 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
657 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
658 end Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
659 end Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
660 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
661
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
662 Yes, this is missing the keyword @code{body}; another compiler error
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
663 example.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
664
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
665 In buffer @file{hello.adb}, invoke @key{Ada | Check file}. You should
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
666 get a @code{*compilation*} buffer containing something like (the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
667 directory paths will be different):
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
668
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
669 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
670 cd c:/Examples/Example_1/
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
671 gnatmake -u -c -gnatc -g c:/Examples/Example_1/hello.adb -cargs -gnatq -gnatQ
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
672 gcc -c -Ic:/Examples/Example_1/ -gnatc -g -gnatq -gnatQ -I- c:/Examples/Example_1/hello.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
673 hello.adb:4:04: "Put_Line" is not visible
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
674 hello.adb:4:04: non-visible declaration at a-textio.ads:264
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
675 hello.adb:4:04: non-visible declaration at a-textio.ads:260
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
676 gnatmake: "c:/Examples/Example_1/hello.adb" compilation error
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
677 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
678
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
679 If you have enabled font-lock, the lines with actual errors (starting
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
680 with @file{hello.adb}) are highlighted, with the file name in red.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
681
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
682 Now type @key{C-x `} (on a PC keyboard, @key{`} is next to @key{1}).
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
683 Or you can click the middle mouse button on the first error line. The
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
684 compilation buffer scrolls to put the first error on the top line, and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
685 point is put at the place of the error in the @file{hello.adb} buffer.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
686
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
687 To fix the error, change the line to be
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
688
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
689 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
690 Ada.Text_IO.Put_Line ("hello from hello.adb"):
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
691 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
692
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
693 Now invoke @key{Ada | Show main}; this displays @file{Ada mode main_unit: hello}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
694
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
695 Now (in buffer @file{hello.adb}), invoke @key{Ada | Build}. You are
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
696 prompted to save the file (if you haven't already). Then the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
697 compilation buffer is displayed again, containing:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
698
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
699 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
700 cd c:/Examples/Example_1/
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
701 gnatmake -o hello hello -g -cargs -gnatq -gnatQ -bargs -largs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
702 gcc -c -g -gnatq -gnatQ hello.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
703 gnatbind -x hello.ali
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
704 gnatlink hello.ali -o hello.exe -g
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
705 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
706
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
707 The compilation has succeeded without errors; @file{hello.exe} now
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
708 exists in the same directory as @file{hello.adb}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
709
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
710 Now invoke @key{Ada | Run}. A @file{*run*} buffer is displayed,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
711 containing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
712
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
713 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
714 Hello from hello.adb
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
715
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
716 Process run finished
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
717 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
718
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
719 That completes the first part of this example.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
720
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
721 Now we will compile a multi-file project. Open the file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
722 @file{hello_2.adb}, and invoke @key{Ada | Set main and Build}. This
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
723 finds an error in @file{hello_pkg.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
724
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
725 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
726 cd c:/Examples/Example_1/
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
727 gnatmake -o hello_2 hello_2 -g -cargs -gnatq -gnatQ -bargs -largs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
728 gcc -c -g -gnatq -gnatQ hello_pkg.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
729 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
730 gnatmake: "hello_pkg.adb" compilation error
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
731 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
732
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
733 This demonstrates that gnatmake finds the files needed by the main
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
734 program. However, it cannot find files in a different directory,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
735 unless you use an Emacs Ada mode project file to specify the other directories;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
736 @xref{Set source search path}, or a GNAT project file; @ref{Use GNAT
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
737 project file}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
738
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
739 Invoke @key{Ada | Show main}; this displays @file{Ada mode main_unit: hello_2}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
740
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
741 Move to the error with @key{C-x `}, and fix the error by adding @code{body}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
742
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
743 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
744 package body Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
745 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
746
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
747 Now, while still in @file{hello_pkg.adb}, invoke @key{Ada | Build}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
748 gnatmake successfully builds @file{hello_2}. This demonstrates that
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
749 Emacs has remembered the main file, in the project variable
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
750 @code{main_unit}, and used it for the Build command.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
751
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
752 Finally, again while in @file{hello_pkg.adb}, invoke @key{Ada | Run}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
753 The @code{*run*} buffer displays @code{Hello from hello_pkg.adb}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
754
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
755 One final point. If you switch back to buffer @file{hello.adb}, and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
756 invoke @key{Ada | Run}, @file{hello_2.exe} will be run. That is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
757 because @code{main_unit} is still set to @code{hello_2}, as you can
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
758 see when you invoke @key{Ada | Project | Edit}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
759
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
760 There are three ways to change @code{main_unit}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
761
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
762 @enumerate
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
763 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
764 Invoke @key{Ada | Set main and Build}, which sets @code{main_unit} to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
765 the current file.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
766
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
767 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
768 Invoke @key{Ada | Project | Edit}, edit @code{main_unit} and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
769 @code{main}, and click @key{[save]}
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
770
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
771 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
772 Invoke @key{Ada | Project | Load}, and load a project file that specifies @code{main_unit}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
773
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
774 @end enumerate
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
775
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
776 @node Set compiler options, Set source search path, No project files, Compiling Examples
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
777 @section Set compiler options
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
778
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
779 This example illustrates using an Emacs Ada mode project file to set a
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
780 compiler option.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
781
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
782 If you have files from @file{Example_1} open in Emacs, you should
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
783 close them so you don't get confused. Use menu @key{File | Close
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
784 (current buffer)}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
785
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
786 In directory @file{Example_2}, create these files:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
787
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
788 @file{hello.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
789
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
790 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
791 with Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
792 procedure Hello
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
793 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
794 Put_Line("Hello from hello.adb");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
795 end Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
796 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
797
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
798 This is the same as @file{hello.adb} from @file{Example_1}. It has two
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
799 errors; missing ``use Ada.Text_IO;'', and no space between
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
800 @code{Put_Line} and its argument list.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
801
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
802 @file{hello.adp}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
803
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
804 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
805 comp_opt=-gnatyt
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
806 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
807
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
808 This tells the GNAT compiler to check for token spacing; in
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
809 particular, there must be a space preceding a parenthesis.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
810
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
811 In buffer @file{hello.adb}, invoke @key{Ada | Project | Load...}, and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
812 select @file{Example_2/hello.adp}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
813
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
814 Then, again in buffer @file{hello.adb}, invoke @key{Ada | Set main and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
815 Build}. You should get a @code{*compilation*} buffer containing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
816 something like (the directory paths will be different):
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
817
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
818 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
819 cd c:/Examples/Example_2/
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
820 gnatmake -o hello hello -g -cargs -gnatyt -bargs -largs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
821 gcc -c -g -gnatyt hello.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
822 hello.adb:4:04: "Put_Line" is not visible
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
823 hello.adb:4:04: non-visible declaration at a-textio.ads:264
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
824 hello.adb:4:04: non-visible declaration at a-textio.ads:260
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
825 hello.adb:4:12: (style) space required
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
826 gnatmake: "hello.adb" compilation error
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
827 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
828
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
829 Compare this to the compiler output in @ref{No project files}; the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
830 gnatmake option @code{-cargs -gnatq -gnatQ} has been replaced by
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
831 @code{-cargs -gnaty}, and an additional error is reported in
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
832 @file{hello.adb} on line 4. This shows that @file{hello.adp} is being
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
833 used to set the compiler options.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
834
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
835 Fixing the error, linking and running the code proceed as in @ref{No
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
836 project files}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
837
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
838 @node Set source search path, Use GNAT project file, Set compiler options, Compiling Examples
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
839 @section Set source search path
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
840
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
841 In this example, we show how to deal with files in more than one
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
842 directory. We start with the same code as in @ref{No project files}; create those
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
843 files (with the errors present)
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
844
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
845 Create the directory @file{Example_3}, containing:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
846
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
847 @file{hello_pkg.ads}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
848
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
849 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
850 package Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
851 procedure Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
852 end Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
853 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
854
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
855 @file{hello_pkg.adb}:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
856
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
857 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
858 with Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
859 package Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
860 procedure Say_Hello
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
861 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
862 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
863 end Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
864 end Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
865 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
866
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
867 These are the same files from example 1; @file{hello_pkg.adb} has an
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
868 error on line 2.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
869
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
870 In addition, create a directory @file{Example_3/Other}, containing these files:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
871
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
872 @file{Other/hello_3.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
873
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
874 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
875 with Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
876 with Ada.Text_IO; use Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
877 procedure Hello_3
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
878 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
879 Hello_Pkg.Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
880 Put_Line ("From hello_3");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
881 end Hello_3;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
882 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
883
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
884 There are no errors in this file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
885
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
886 @file{Other/other.adp}:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
887
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
888 @example
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
889 src_dir=..
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
890 comp_opt=-I..
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
891 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
892
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
893 Note that there must be no trailing spaces.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
894
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
895 In buffer @file{hello_3.adb}, invoke @key{Ada | Project | Load...}, and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
896 select @file{Example_3/Other/other.adp}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
897
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
898 Then, again in @file{hello_3.adb}, invoke @key{Ada | Set main and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
899 Build}. You should get a @code{*compilation*} buffer containing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
900 something like (the directory paths will be different):
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
901
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
902 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
903 cd c:/Examples/Example_3/Other/
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
904 gnatmake -o hello_3 hello_3 -g -cargs -I.. -bargs -largs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
905 gcc -c -g -I.. hello_3.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
906 gcc -c -I./ -g -I.. -I- C:\Examples\Example_3\hello_pkg.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
907 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
908 gnatmake: "C:\Examples\Example_3\hello_pkg.adb" compilation error
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
909 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
910
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
911 Compare the @code{-cargs} option to the compiler output in @ref{Set
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
912 compiler options}; this shows that @file{other.adp} is being used to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
913 set the compiler options.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
914
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
915 Move to the error with @key{C-x `}. Ada mode searches the list of
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
916 directories given by @code{src_dir} for the file mentioned in the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
917 compiler error message.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
918
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
919 Fixing the error, linking and running the code proceed as in @ref{No
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
920 project files}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
921
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
922 @node Use GNAT project file, , Set source search path, Compiling Examples
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
923 @section Use GNAT project file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
924
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
925 In this example, we show how to use a GNAT project file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
926
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
927 Create the directory @file{Example_4}, containing:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
928
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
929 @file{hello_pkg.ads}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
930
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
931 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
932 package Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
933 procedure Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
934 end Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
935 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
936
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
937 @file{hello_pkg.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
938
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
939 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
940 with Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
941 package Hello_Pkg is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
942 procedure Say_Hello
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
943 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
944 Ada.Text_IO.Put_Line ("Hello from hello_pkg.adb");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
945 end Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
946 end Hello_Pkg;
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
947 @end example
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
948
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
949 These are the same files from example 1; @file{hello_pkg.adb} has an
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
950 error on line 2.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
951
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
952 In addition, create a directory @file{Example_4/Gnat_Project},
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
953 containing these files:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
954
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
955 @file{Other/hello_4.adb}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
956
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
957 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
958 with Hello_Pkg;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
959 with Ada.Text_IO; use Ada.Text_IO;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
960 procedure Hello_4
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
961 is begin
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
962 Hello_Pkg.Say_Hello;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
963 Put_Line ("From hello_4");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
964 end Hello_4;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
965 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
966
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
967 There are no errors in this file.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
968
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
969 @file{Gnat_Project/hello_4.adp}:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
970
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
971 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
972 src_dir=..
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
973 gnatmake_opt=-Phello_4.gpr
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
974 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
975
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
976 @file{Gnat_Project/hello_4.gpr}:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
977
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
978 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
979 Project Hello_4 is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
980 for Source_Dirs use (".", "..");
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
981 end Hello_4;
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
982 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
983
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
984 In buffer @file{hello_4.adb}, invoke @key{Ada | Project | Load...}, and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
985 select @file{Example_4/Gnat_Project/hello_4.adp}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
986
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
987 Then, again in @file{hello_4.adb}, invoke @key{Ada | Set main and
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
988 Build}. You should get a @code{*compilation*} buffer containing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
989 something like (the directory paths will be different):
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
990
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
991 @example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
992 cd c:/Examples/Example_4/Gnat_Project/
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
993 gnatmake -o hello_4 hello_4 -Phello_4.gpr -cargs -gnatq -gnatQ -bargs -largs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
994 gcc -c -g -gnatyt -gnatq -gnatQ -I- -gnatA c:\Examples\Example_4\Gnat_Project\hello_4.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
995 gcc -c -g -gnatyt -gnatq -gnatQ -I- -gnatA c:\Examples\Example_4\hello_pkg.adb
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
996 hello_pkg.adb:2:08: keyword "body" expected here [see file name]
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
997 gnatmake: "c:\examples\example_4\hello_pkg.adb" compilation error
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
998 @end example
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
999
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1000 Compare the @code{gcc} options to the compiler output in @ref{Set
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1001 compiler options}; this shows that @file{hello_4.gpr} is being used to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1002 set the compiler options.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1003
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1004 Fixing the error, linking and running the code proceed as in @ref{No
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1005 project files}.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1006
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1007 @node Moving Through Ada Code, Identifier completion, Compiling Examples, Top
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1008 @chapter Moving Through Ada Code
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1009 @c -----------------------------------------------------------------------
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1010
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1011 There are several easy to use commands to navigate through Ada code. All
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1012 these functions are available through the Ada menu, and you can also
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1013 use the following key bindings or the command names. Some of these
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1014 menu entries are available only if the GNAT compiler is used, since
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1015 the implementation relies on the GNAT cross-referencing information.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1016
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1017 @table @kbd
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1018 @item M-C-e
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1019 @findex ada-next-procedure
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1020 Move to the next function/procedure/task, which ever comes next
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1021 (@code{ada-next-procedure}).
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1022 @item M-C-a
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1023 @findex ada-previous-procedure
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1024 Move to previous function/procedure/task
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1025 (@code{ada-previous-procedure}).
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1026 @item M-x ada-next-package
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1027 @findex ada-next-package
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1028 Move to next package.
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1029 @item M-x ada-previous-package
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1030 @findex ada-previous-package
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1031 Move to previous package.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1032 @item C-c C-a
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1033 @findex ada-move-to-start
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1034 Move to matching start of @code{end} (@code{ada-move-to-start}). If
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1035 point is at the end of a subprogram, this command jumps to the
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1036 corresponding @code{begin} if the user option
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1037 @code{ada-move-to-declaration} is @code{nil} (default), otherwise it jumps to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1038 the subprogram declaration.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1039 @item C-c C-e
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1040 @findex ada-move-to-end
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1041 Move point to end of current block (@code{ada-move-to-end}).
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1042 @item C-c o
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1043 Switch between corresponding spec and body file
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1044 (@code{ff-find-other-file}). If point is in a subprogram, position
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1045 point on the corresponding declaration or body in the other file.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1046 @item C-c c-d
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1047 @findex ada-goto-declaration
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1048 Move from any reference to its declaration, for from a declaration to
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1049 its body (for procedures, tasks, private and incomplete types).
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1050 @item C-c C-r
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1051 @findex ada-find-references
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1052 Runs the @file{gnatfind} command to search for all references to the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1053 identifier surrounding point (@code{ada-find-references}). Use
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1054 @kbd{C-x `} (@code{next-error}) to visit each reference (as for
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1055 compilation errors).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1056 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1057
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1058 If the @code{ada-xref-create-ali} variable is non-@code{nil}, Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1059 will try to run GNAT for you whenever cross-reference information is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1060 needed, and is older than the current source file.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1061
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1062 @node Identifier completion, Automatic Smart Indentation, Moving Through Ada Code, Top
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1063 @chapter Identifier completion
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1064
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1065 Emacs and Ada mode provide two general ways for the completion of
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1066 identifiers. This is an easy way to type faster: you just have to type
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1067 the first few letters of an identifiers, and then loop through all the
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1068 possible completions.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1069
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1070 The first method is general for Emacs. It works by parsing all open
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1071 files for possible completions.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1072
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1073 For instance, if the words @samp{my_identifier}, @samp{my_subprogram}
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1074 are the only words starting with @samp{my} in any of the opened files,
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1075 then you will have this scenario:
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1076
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1077 @example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1078 You type: my@key{M-/}
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1079 Emacs inserts: @samp{my_identifier}
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1080 If you press @key{M-/} once again, Emacs replaces @samp{my_identifier} with
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1081 @samp{my_subprogram}.
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1082 Pressing @key{M-/} once more will bring you back to @samp{my_identifier}.
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1083 @end example
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1084
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1085 This is a very fast way to do completion, and the casing of words will
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1086 also be respected.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1087
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1088 The second method (@key{C-TAB}) is specific to Ada mode and the GNAT
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1089 compiler. Emacs will search the cross-information for possible
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1090 completions.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1091
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1092 The main advantage is that this completion is more accurate: only
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1093 existing identifier will be suggested.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1094
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1095 On the other hand, this completion is a little bit slower and requires
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1096 that you have compiled your file at least once since you created that
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1097 identifier.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1098
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1099 @table @kbd
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1100 @item C-@key{TAB}
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1101 @findex ada-complete-identifier
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1102 Complete current identifier using cross-reference information.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1103 @item M-/
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1104 Complete identifier using buffer information (not Ada-specific).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1105 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1106
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1107 @node Automatic Smart Indentation, Formatting Parameter Lists, Identifier completion, Top
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1108 @chapter Automatic Smart Indentation
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1109
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1110 Ada mode comes with a full set of rules for automatic indentation. You
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1111 can also configure the indentation, via the following variables:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1112
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1113 @table @asis
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1114 @item @code{ada-broken-indent} (default value: 2)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1115 Number of columns to indent the continuation of a broken line.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1116
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1117 @item @code{ada-indent} (default value: 3)
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1118 Number of columns for default indentation.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1119
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1120 @item @code{ada-indent-record-rel-type} (default value: 3)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1121 Indentation for @code{record} relative to @code{type} or @code{use}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1122
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1123 @item @code{ada-indent-return} (default value: 0)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1124 Indentation for @code{return} relative to @code{function} (if
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1125 @code{ada-indent-return} is greater than 0), or the open parenthesis
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1126 (if @code{ada-indent-return} is negative or 0). Note that in the second
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1127 case, when there is no open parenthesis, the indentation is done
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1128 relative to @code{function} with the value of @code{ada-broken-indent}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1129
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1130 @item @code{ada-label-indent} (default value: -4)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1131 Number of columns to indent a label.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1132
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1133 @item @code{ada-stmt-end-indent} (default value: 0)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1134 Number of columns to indent a statement @code{end} keyword on a separate line.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1135
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1136 @item @code{ada-when-indent} (default value: 3)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1137 Indentation for @code{when} relative to @code{exception} or @code{case}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1138
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1139 @item @code{ada-indent-is-separate} (default value: t)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1140 Non-@code{nil} means indent @code{is separate} or @code{is abstract} if on a single line.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1141
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1142 @item @code{ada-indent-to-open-paren} (default value: t)
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1143 Non-@code{nil} means indent according to the innermost open parenthesis.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1144
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1145 @item @code{ada-indent-after-return} (default value: t)
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1146 Non-@code{nil} means that the current line will also be re-indented
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1147 before inserting a newline, when you press @key{RET}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1148 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1149
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1150 Most of the time, the indentation will be automatic, i.e when you
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1151 press @key{RET}, the cursor will move to the correct column on the
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1152 next line.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1153
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1154 You can also indent single lines, or the current region, with @key{TAB}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1155
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1156 Another mode of indentation exists that helps you to set up your
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1157 indentation scheme. If you press @kbd{C-c @key{TAB}}, Ada mode will do
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1158 the following:
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1159
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1160 @itemize @bullet
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1161 @item
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1162 Reindent the current line, as @key{TAB} would do.
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1163 @item
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1164 Temporarily move the cursor to a reference line, i.e., the line that
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1165 was used to calculate the current indentation.
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1166 @item
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1167 Display in the message window the name of the variable that provided
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1168 the offset for the indentation.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1169 @end itemize
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1170
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1171 The exact indentation of the current line is the same as the one for the
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1172 reference line, plus an offset given by the variable.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1173
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1174 @table @kbd
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1175 @item @key{TAB}
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1176 Indent the current line or the current region.
40705
421e0a91a1d1 Replace M-C- with C-M-
Eli Zaretskii <eliz@gnu.org>
parents: 39367
diff changeset
1177 @item C-M-\
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1178 Indent lines in the current region.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1179 @item C-c @key{TAB}
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1180 Indent the current line and display the name of the variable used for
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1181 indentation.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1182 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1183
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1184 @node Formatting Parameter Lists, Automatic Casing, Automatic Smart Indentation, Top
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1185 @chapter Formatting Parameter Lists
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1186
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1187 @table @kbd
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1188 @item C-c C-f
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1189 @findex ada-format-paramlist
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1190 Format the parameter list (@code{ada-format-paramlist}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1191 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1192
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1193 This aligns the declarations on the colon (@samp{:}) separating
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1194 argument names and argument types, and aligns the @code{in},
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1195 @code{out} and @code{in out} keywords.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1196
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1197 @node Automatic Casing, Statement Templates, Formatting Parameter Lists, Top
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1198 @chapter Automatic Casing
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1199
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1200 Casing of identifiers, attributes and keywords is automatically
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1201 performed while typing when the variable @code{ada-auto-case} is set.
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1202 Every time you press a word separator, the previous word is
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1203 automatically cased.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1204
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1205 You can customize the automatic casing differently for keywords,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1206 attributes and identifiers. The relevant variables are the following:
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1207 @code{ada-case-keyword}, @code{ada-case-attribute} and
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1208 @code{ada-case-identifier}.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1209
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1210 All these variables can have one of the following values:
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1211
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1212 @table @code
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1213 @item downcase-word
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1214 The word will be lowercase. For instance @code{My_vARIable} is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1215 converted to @code{my_variable}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1216
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1217 @item upcase-word
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1218 The word will be uppercase. For instance @code{My_vARIable} is
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1219 converted to @code{MY_VARIABLE}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1220
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1221 @item ada-capitalize-word
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1222 The first letter and each letter following an underscore (@samp{_})
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1223 are uppercase, others are lowercase. For instance @code{My_vARIable}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1224 is converted to @code{My_Variable}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1225
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1226 @item ada-loose-case-word
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1227 Characters after an underscore @samp{_} character are uppercase,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1228 others are not modified. For instance @code{My_vARIable} is converted
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1229 to @code{My_VARIable}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1230 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1231
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1232 Ada mode allows you to define exceptions to these rules, in a file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1233 specified by the variable variable @code{ada-case-exception-file}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1234 (default @file{~/.emacs_case_exceptions}). Each line in this file
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1235 specifies the casing of one word or word fragment. Comments may be
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1236 included, separated from the word by a space.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1237
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1238 If the word starts with an asterisk (@key{*}), it defines the casing
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1239 af a word fragemnt (or ``substring''); part of a word between two
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1240 underscores or word boundary.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1241
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1242 For example:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1243
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1244 @example
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1245 DOD Department of Defense
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1246 *IO
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1247 GNAT The GNAT compiler from Ada Core Technologies
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1248 @end example
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1249
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1250 The word fragment @code{*IO} applies to any word containing ``_io'';
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1251 @code{Text_IO}, @code{Hardware_IO}, etc.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1252
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1253 @findex ada-create-case-exception
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1254 There are two ways to add new items to this file: you can simply edit
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1255 it as you would edit any text file. Or you can position point on the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1256 word you want to add, and select menu @samp{Ada | Edit | Create Case
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1257 Exception}, or press @kbd{C-c C-y} (@code{ada-create-case-exception}).
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1258 The word will automatically be added to the current list of exceptions
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1259 and to the file.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1260
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1261 To define a word fragment case exception, select the word fragment,
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1262 then select menu @samp{Ada | Edit | Create Case Exception Substring}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1263
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1264 It is sometimes useful to have multiple exception files around (for
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1265 instance, one could be the standard Ada acronyms, the second some
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1266 company specific exceptions, and the last one some project specific
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1267 exceptions). If you set up the variable @code{ada-case-exception-file}
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1268 as a list of files, each of them will be parsed and used in your emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1269 session. However, when you save a new exception through the menu, as
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1270 described above, the new exception will be added to the first file in
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1271 the list.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1272
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1273 @table @kbd
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1274 @item C-c C-b
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1275 @findex ada-adjust-case-buffer
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1276 Adjust case in the whole buffer (@code{ada-adjust-case-buffer}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1277 @item C-c C-y
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1278 Create a new entry in the exception dictionary, with the word under
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1279 the cursor (@code{ada-create-case-exception})
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1280 @item C-c C-t
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1281 @findex ada-case-read-exceptions
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1282 Rereads the exception dictionary from the file
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1283 @code{ada-case-exception-file} (@code{ada-case-read-exceptions}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1284 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1285
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1286 @node Statement Templates, Comment Handling, Automatic Casing, Top
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1287 @chapter Statement Templates
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1288
74004
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1289 Templates are defined for most Ada statements, using the Emacs
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1290 ``skeleton'' package. They can be inserted in the buffer using the
ad6a503ca867 Total rewrite.
Juanma Barranquero <lekktu@gmail.com>
parents: 73494
diff changeset
1291 following commands:
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1292
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1293 @table @kbd
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1294 @item C-c t b
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1295 @findex ada-exception-block
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1296 exception Block (@code{ada-exception-block}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1297 @item C-c t c
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1298 @findex ada-case
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1299 case (@code{ada-case}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1300 @item C-c t d
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1301 @findex ada-declare-block
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1302 declare Block (@code{ada-declare-block}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1303 @item C-c t e
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1304 @findex ada-else
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1305 else (@code{ada-else}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1306 @item C-c t f
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1307 @findex ada-for-loop
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1308 for Loop (@code{ada-for-loop}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1309 @item C-c t h
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1310 @findex ada-header
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1311 Header (@code{ada-header}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1312 @item C-c t i
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1313 @findex ada-if
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1314 if (@code{ada-if}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1315 @item C-c t k
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1316 @findex ada-package-body
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1317 package Body (@code{ada-package-body}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1318 @item C-c t l
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1319 @findex ada-loop
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1320 loop (@code{ada-loop}).
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1321 @item C-c p
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1322 @findex ada-subprogram-body
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1323 subprogram body (@code{ada-subprogram-body}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1324 @item C-c t t
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1325 @findex ada-task-body
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1326 task Body (@code{ada-task-body}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1327 @item C-c t w
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1328 @findex ada-while
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1329 while Loop (@code{ada-while}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1330 @item C-c t u
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1331 @findex ada-use
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1332 use (@code{ada-use}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1333 @item C-c t x
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1334 @findex ada-exit
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1335 exit (@code{ada-exit}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1336 @item C-c t C-a
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1337 @findex ada-array
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1338 array (@code{ada-array}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1339 @item C-c t C-e
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1340 @findex ada-elsif
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1341 elsif (@code{ada-elsif}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1342 @item C-c t C-f
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1343 @findex ada-function-spec
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1344 function Spec (@code{ada-function-spec}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1345 @item C-c t C-k
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1346 @findex ada-package-spec
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1347 package Spec (@code{ada-package-spec}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1348 @item C-c t C-p
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1349 @findex ada-procedure-spec
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1350 procedure Spec (@code{ada-package-spec}.
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1351 @item C-c t C-r
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1352 @findex ada-record
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1353 record (@code{ada-record}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1354 @item C-c t C-s
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1355 @findex ada-subtype
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1356 subtype (@code{ada-subtype}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1357 @item C-c t C-t
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1358 @findex ada-task-spec
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1359 task Spec (@code{ada-task-spec}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1360 @item C-c t C-u
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1361 @findex ada-with
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1362 with (@code{ada-with}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1363 @item C-c t C-v
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1364 @findex ada-private
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1365 private (@code{ada-private}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1366 @item C-c t C-w
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1367 @findex ada-when
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1368 when (@code{ada-when}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1369 @item C-c t C-x
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1370 @findex ada-exception
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1371 exception (@code{ada-exception}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1372 @item C-c t C-y
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1373 @findex ada-type
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1374 type (@code{ada-type}).
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1375 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1376
77235
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
1377 @node Comment Handling, GNU Free Documentation License, Statement Templates, Top
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1378 @chapter Comment Handling
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1379
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1380 By default, comment lines get indented like Ada code. There are a few
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1381 additional functions to handle comments:
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1382
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1383 @table @kbd
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1384 @item M-;
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1385 Start a comment in default column.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1386 @item M-j
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1387 Continue comment on next line.
38864
c656fc177008 Many corrections in Texinfo usage and English usage.
Richard M. Stallman <rms@gnu.org>
parents: 37403
diff changeset
1388 @item C-c ;
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1389 Comment the selected region (add -- at the beginning of lines).
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1390 @item C-c :
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1391 Uncomment the selected region
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1392 @item M-q
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1393 autofill the current comment.
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1394 @end table
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1395
77235
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
1396 @node GNU Free Documentation License, Index, Comment Handling, Top
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
1397 @appendix GNU Free Documentation License
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
1398 @include doclicense.texi
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
1399
88224dc74061 Include GFDL.
Chong Yidong <cyd@stupidchicken.com>
parents: 75348
diff changeset
1400 @node Index, , GNU Free Documentation License, Top
39367
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1401 @unnumbered Index
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1402
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1403 @printindex fn
88b1d99e92ad Add an Index and index all commands. This is so C-h C-f works.
Eli Zaretskii <eliz@gnu.org>
parents: 38881
diff changeset
1404
25906
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1405 @contents
3a06267f733d New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1406 @bye
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1407
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1408 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1409 arch-tag: 68cf0d8a-55cc-4190-a28d-4984fa56ed1e
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1410 @end ignore