annotate doc/misc/ada-mode.texi @ 99641:833f28e62d37

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