comparison man/building.texi @ 90128:13796b0653c7

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-29 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 192-205) - Update from CVS - Use gdb-ui breakpoint faces on ttys too - Tweak gdb-ui breakpoint faces - Tweak info/.arch-inventory to identify info/.cvsignore as source - Clean up gdb-ui breakpoint faces
author Miles Bader <miles@gnu.org>
date Thu, 24 Mar 2005 18:41:26 +0000
parents 30ad2795fdab 4e549a9044e1
children 4da4a09e8b1b
comparison
equal deleted inserted replaced
90127:30ad2795fdab 90128:13796b0653c7
12 in the larger process of developing and maintaining programs. 12 in the larger process of developing and maintaining programs.
13 13
14 @menu 14 @menu
15 * Compilation:: Compiling programs in languages other 15 * Compilation:: Compiling programs in languages other
16 than Lisp (C, Pascal, etc.). 16 than Lisp (C, Pascal, etc.).
17 * Grep Searching:: Running grep as if it were a compiler.
18 * Compilation Mode:: The mode for visiting compiler errors. 17 * Compilation Mode:: The mode for visiting compiler errors.
19 * Compilation Shell:: Customizing your shell properly 18 * Compilation Shell:: Customizing your shell properly
20 for use in the compilation buffer. 19 for use in the compilation buffer.
20 * Grep Searching:: Searching with grep.
21 * Debuggers:: Running symbolic debuggers for non-Lisp programs. 21 * Debuggers:: Running symbolic debuggers for non-Lisp programs.
22 * Executing Lisp:: Various modes for editing Lisp programs, 22 * Executing Lisp:: Various modes for editing Lisp programs,
23 with different facilities for running 23 with different facilities for running
24 the Lisp programs. 24 the Lisp programs.
25 * Libraries: Lisp Libraries. Creating Lisp programs to run in Emacs. 25 * Libraries: Lisp Libraries. Creating Lisp programs to run in Emacs.
145 with the variable @code{compilation-environment}. Its value is a list 145 with the variable @code{compilation-environment}. Its value is a list
146 of environment variable settings; each element should be a string of 146 of environment variable settings; each element should be a string of
147 the form @code{"@var{envvarname}=@var{value}"}. These environment 147 the form @code{"@var{envvarname}=@var{value}"}. These environment
148 variable settings override the usual ones. 148 variable settings override the usual ones.
149 149
150 @node Grep Searching
151 @section Searching with Grep under Emacs
152
153 @findex grep
154 Just as you can run a compiler from Emacs and then visit the lines
155 where there were compilation errors, you can also run @code{grep} and
156 then visit the lines on which matches were found. This works by
157 treating the matches reported by @code{grep} as if they were ``errors.''
158
159 To do this, type @kbd{M-x grep}, then enter a command line that
160 specifies how to run @code{grep}. Use the same arguments you would give
161 @code{grep} when running it normally: a @code{grep}-style regexp
162 (usually in single-quotes to quote the shell's special characters)
163 followed by file names, which may use wildcards. The output from
164 @code{grep} goes in the @samp{*grep*} buffer. You can find the
165 corresponding lines in the original files using @kbd{C-x `} and
166 @key{RET}, as with compilation errors.
167
168 If you specify a prefix argument for @kbd{M-x grep}, it figures out
169 the tag (@pxref{Tags}) around point, and puts that into the default
170 @code{grep} command.
171
172 @findex grep-find
173 @findex find-grep
174 The command @kbd{M-x grep-find} (also available as @kbd{M-x
175 find-grep}) is similar to @kbd{M-x grep}, but it supplies a different
176 initial default for the command---one that runs both @code{find} and
177 @code{grep}, so as to search every file in a directory tree. See also
178 the @code{find-grep-dired} command, in @ref{Dired and Find}.
179
180 @node Compilation Mode 150 @node Compilation Mode
181 @section Compilation Mode 151 @section Compilation Mode
182 152
183 @findex compile-goto-error 153 @findex compile-goto-error
184 @cindex Compilation mode 154 @cindex Compilation mode
197 @item @key{RET} 167 @item @key{RET}
198 Visit the locus of the error message that point is on. 168 Visit the locus of the error message that point is on.
199 This command is used in the compilation buffer. 169 This command is used in the compilation buffer.
200 @item Mouse-2 170 @item Mouse-2
201 Visit the locus of the error message that you click on. 171 Visit the locus of the error message that you click on.
172 @item M-n
173 Find and highlight the locus of the next error message, without
174 selecting the source buffer.
175 @item M-p
176 Find and highlight the locus of the previous error message, without
177 selecting the source buffer.
178 @item M-@}
179 Move point to the next error for a different file than the current
180 one.
181 @item M-@{
182 Move point to the previous error for a different file than the current
183 one.
184 @item C-c C-f
185 Toggle Next Error Follow minor mode, which makes cursor motion in the
186 compilation buffer produce automatic source display.
202 @end table 187 @end table
203 188
204 @kindex C-x ` 189 @kindex C-x `
205 @findex next-error 190 @findex next-error
206 You can visit the source for any particular error message by moving 191 You can visit the source for any particular error message by moving
207 point in the @samp{*compilation*} buffer to that error message and 192 point in the @samp{*compilation*} buffer to that error message and
208 typing @key{RET} (@code{compile-goto-error}). Alternatively, you can 193 typing @key{RET} (@code{compile-goto-error}). Alternatively, you can
209 click @kbd{Mouse-2} on the error message; you need not switch to the 194 click @kbd{Mouse-2} on the error message; you need not switch to the
210 @samp{*compilation*} buffer first. 195 @samp{*compilation*} buffer first.
211 196
197 @vindex next-error-highlight
212 To parse the compiler error messages sequentially, type @kbd{C-x `} 198 To parse the compiler error messages sequentially, type @kbd{C-x `}
213 (@code{next-error}). The character following the @kbd{C-x} is the 199 (@code{next-error}). The character following the @kbd{C-x} is the
214 backquote or ``grave accent,'' not the single-quote. This command is 200 backquote or ``grave accent,'' not the single-quote. This command is
215 available in all buffers, not just in @samp{*compilation*}; it displays 201 available in all buffers, not just in @samp{*compilation*}; it
216 the next error message at the top of one window and source location of 202 displays the next error message at the top of one window and source
217 the error in another window. 203 location of the error in another window. It also momentarily
204 highlights the relevant source line. You can change the behavior of
205 this highlighting with the variable @code{next-error-highlight}.
218 206
219 The first time @kbd{C-x `} is used after the start of a compilation, 207 The first time @kbd{C-x `} is used after the start of a compilation,
220 it moves to the first error's location. Subsequent uses of @kbd{C-x `} 208 it moves to the first error's location. Subsequent uses of @kbd{C-x `}
221 advance down to subsequent errors. If you visit a specific error 209 advance down to subsequent errors. If you visit a specific error
222 message with @key{RET} or @kbd{Mouse-2}, subsequent @kbd{C-x `} 210 message with @key{RET} or @kbd{Mouse-2}, subsequent @kbd{C-x `}
243 and the line number from the text of a message. If your compiler isn't 231 and the line number from the text of a message. If your compiler isn't
244 supported, you can tailor Compilation mode to it by adding elements to 232 supported, you can tailor Compilation mode to it by adding elements to
245 that list. A similar variable @code{grep-regexp-alist} tells Emacs how 233 that list. A similar variable @code{grep-regexp-alist} tells Emacs how
246 to parse output of a @code{grep} command. 234 to parse output of a @code{grep} command.
247 235
236 @findex compilation-next-error
237 @findex compilation-previous-error
238 @findex compilation-next-file
239 @findex compilation-previous-file
248 Compilation mode also redefines the keys @key{SPC} and @key{DEL} to 240 Compilation mode also redefines the keys @key{SPC} and @key{DEL} to
249 scroll by screenfuls, and @kbd{M-n} and @kbd{M-p} to move to the next or 241 scroll by screenfuls, and @kbd{M-n} (@code{compilation-next-error})
250 previous error message. You can also use @kbd{M-@{} and @kbd{M-@}} to 242 and @kbd{M-p} (@code{compilation-previous-error}) to move to the next
251 move up or down to an error message for a different source file. 243 or previous error message. You can also use @kbd{M-@{}
244 (@code{compilation-next-file} and @kbd{M-@}}
245 (@code{compilation-previous-file}) to move up or down to an error
246 message for a different source file.
247
248 @cindex Next Error Follow mode
249 @findex next-error-follow-minor-mode
250 You can type @kbd{C-c C-f} to toggle Next Error Follow mode. In
251 this minor mode, ordinary cursor motion in the compilation buffer
252 automatically updates the source buffer. For instance, moving the
253 cursor to the next error message causes the location of that error to
254 be displayed immediately.
252 255
253 The features of Compilation mode are also available in a minor mode 256 The features of Compilation mode are also available in a minor mode
254 called Compilation Minor mode. This lets you parse error messages in 257 called Compilation Minor mode. This lets you parse error messages in
255 any buffer, not just a normal compilation output buffer. Type @kbd{M-x 258 any buffer, not just a normal compilation output buffer. Type @kbd{M-x
256 compilation-minor-mode} to enable the minor mode. This defines the keys 259 compilation-minor-mode} to enable the minor mode. This defines the keys
296 subprocesses; to work around this lack, @kbd{M-x compile} runs the 299 subprocesses; to work around this lack, @kbd{M-x compile} runs the
297 compilation command synchronously on MS-DOS. As a consequence, you must 300 compilation command synchronously on MS-DOS. As a consequence, you must
298 wait until the command finishes before you can do anything else in 301 wait until the command finishes before you can do anything else in
299 Emacs. @xref{MS-DOS}. 302 Emacs. @xref{MS-DOS}.
300 303
304 @node Grep Searching
305 @section Searching with Grep under Emacs
306
307 @findex grep
308 Just as you can run a compiler from Emacs and then visit the lines
309 where there were compilation errors, you can also run @code{grep} and
310 then visit the lines on which matches were found. This works by
311 treating the matches reported by @code{grep} as if they were ``errors.''
312
313 To do this, type @kbd{M-x grep}, then enter a command line that
314 specifies how to run @code{grep}. Use the same arguments you would give
315 @code{grep} when running it normally: a @code{grep}-style regexp
316 (usually in single-quotes to quote the shell's special characters)
317 followed by file names, which may use wildcards. If you specify a
318 prefix argument for @kbd{M-x grep}, it figures out the tag
319 (@pxref{Tags}) around point, and puts that into the default
320 @code{grep} command.
321
322 The output from @code{grep} goes in the @samp{*grep*} buffer. You
323 can find the corresponding lines in the original files using @kbd{C-x
324 `}, @key{RET}, and so forth, just like compilation errors.
325
326 Some grep programs accept a @samp{--color} option to output special
327 markers around matches for the purpose of highlighting. You can make
328 use of this feature by setting @code{grep-highlight-matches} to t.
329 When displaying a match in the source buffer, the exact match will be
330 highlighted, instead of the entire source line.
331
332 @findex grep-find
333 @findex find-grep
334 The command @kbd{M-x grep-find} (also available as @kbd{M-x
335 find-grep}) is similar to @kbd{M-x grep}, but it supplies a different
336 initial default for the command---one that runs both @code{find} and
337 @code{grep}, so as to search every file in a directory tree. See also
338 the @code{find-grep-dired} command, in @ref{Dired and Find}.
339
301 @node Debuggers 340 @node Debuggers
302 @section Running Debuggers Under Emacs 341 @section Running Debuggers Under Emacs
303 @cindex debuggers 342 @cindex debuggers
304 @cindex GUD library 343 @cindex GUD library
305 @cindex GDB 344 @cindex GDB
306 @cindex DBX 345 @cindex DBX
307 @cindex SDB 346 @cindex SDB
308 @cindex XDB 347 @cindex XDB
309 @cindex Perldb 348 @cindex Perldb
349 @cindex bashdb
310 @cindex JDB 350 @cindex JDB
311 @cindex PDB 351 @cindex PDB
312 352
313 @c Do you believe in GUD? 353 @c Do you believe in GUD?
314 The GUD (Grand Unified Debugger) library provides an interface to 354 The GUD (Grand Unified Debugger) library provides an interface to
363 (@pxref{Tags}) in order for GUD to find functions in the source code. 403 (@pxref{Tags}) in order for GUD to find functions in the source code.
364 If you have not visited a tags table or the tags table doesn't list one 404 If you have not visited a tags table or the tags table doesn't list one
365 of the functions, you get a message saying @samp{The sdb support 405 of the functions, you get a message saying @samp{The sdb support
366 requires a valid tags table to work}. If this happens, generate a valid 406 requires a valid tags table to work}. If this happens, generate a valid
367 tags table in the working directory and try again. 407 tags table in the working directory and try again.
408
409 @item M-x bashdb @key{RET} @var{file} @key{RET}
410 @findex bashdb
411 Run the bash debugger to debug @var{file}, a shell script.
368 412
369 @item M-x perldb @key{RET} @var{file} @key{RET} 413 @item M-x perldb @key{RET} @var{file} @key{RET}
370 @findex perldb 414 @findex perldb
371 Run the Perl interpreter in debug mode to debug @var{file}, a Perl program. 415 Run the Perl interpreter in debug mode to debug @var{file}, a Perl program.
372 416
758 802
759 @item @key{RET} 803 @item @key{RET}
760 @kindex RET @r{(GDB breakpoints buffer)} 804 @kindex RET @r{(GDB breakpoints buffer)}
761 @findex gdb-goto-breakpoint 805 @findex gdb-goto-breakpoint
762 Display the file in the source buffer at the breakpoint specified at 806 Display the file in the source buffer at the breakpoint specified at
763 the current line (@code{gdb-goto-breakpoint}). Alternatively, click @kbd{Mouse-2} on the breakpoint that you wish to visit. 807 the current line (@code{gdb-goto-breakpoint}). Alternatively, click
808 @kbd{Mouse-2} on the breakpoint that you wish to visit.
764 @end table 809 @end table
765 810
766 @node Stack Buffer 811 @node Stack Buffer
767 @subsubsection Stack Buffer 812 @subsubsection Stack Buffer
768 813
769 The stack buffer displays a @dfn{call stack}, with one line for each 814 The stack buffer displays a @dfn{call stack}, with one line for each
770 of the nested subroutine calls (@dfn{stack frames}) now active in the 815 of the nested subroutine calls (@dfn{stack frames}) now active in the
771 program. @xref{Backtrace,,info stack, gdb, The GNU debugger}. 816 program. @xref{Backtrace,,info stack, gdb, The GNU debugger}.
772 817
773 Move point to any frame in the stack and type @key{RET} to make it 818 The selected frame is displayed in reverse contrast. Move point to
774 become the current frame (@code{gdb-frames-select}) and display the 819 any frame in the stack and type @key{RET} to select it (@code{gdb-frames-select})
775 associated source in the source buffer. Alternatively, click 820 and display the associated source in the source buffer. Alternatively,
776 @kbd{Mouse-2} to make the selected frame become the current one. If the 821 click @kbd{Mouse-2} to make the selected frame become the current one.
777 locals buffer is displayed then its contents update to display the 822 If the locals buffer is displayed then its contents update to display
778 variables that are local to the new frame. 823 the variables that are local to the new frame.
779 824
780 @node Watch Expressions 825 @node Watch Expressions
781 @subsubsection Watch Expressions 826 @subsubsection Watch Expressions
782 @cindex Watching expressions in GDB 827 @cindex Watching expressions in GDB
783 828
1044 The command @kbd{C-x C-e} (@code{eval-last-sexp}) evaluates the Lisp 1089 The command @kbd{C-x C-e} (@code{eval-last-sexp}) evaluates the Lisp
1045 expression preceding point in the buffer, and displays the value in the 1090 expression preceding point in the buffer, and displays the value in the
1046 echo area. It is available in all major modes, not just Emacs-Lisp 1091 echo area. It is available in all major modes, not just Emacs-Lisp
1047 mode. It does not treat @code{defvar} specially. 1092 mode. It does not treat @code{defvar} specially.
1048 1093
1094 When the result of an evaluation is an integer, you can type
1095 @kbd{C-x C-e} a second time to display the value of the integer result
1096 in additional formats (octal, hexadecimal, and character).
1097
1049 If @kbd{C-M-x}, @kbd{C-x C-e}, or @kbd{M-:} is given a numeric 1098 If @kbd{C-M-x}, @kbd{C-x C-e}, or @kbd{M-:} is given a numeric
1050 argument, it inserts the value into the current buffer at point, rather 1099 argument, it inserts the value into the current buffer at point, rather
1051 than displaying it in the echo area. The argument's value does not 1100 than displaying it in the echo area. The argument's value does not
1052 matter. 1101 matter.
1053 1102