Mercurial > emacs
comparison man/building.texi @ 60789:e1f3e09e22da
(Starting GUD): Add bashdb.
(Building): Put Grep Searching after Compilation Shell.
(Compilation Mode): Document M-n, M-p, M-}, M-{, and C-c C-f bindings.
Document next-error-highlight.
(Grep Searching): Document grep-highlight-matches.
(Lisp Eval): Typing C-x C-e twice prints integers specially.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 21 Mar 2005 18:06:58 +0000 |
parents | 362e4cd2e9f8 |
children | 4e549a9044e1 |
comparison
equal
deleted
inserted
replaced
60788:98fb3a23b966 | 60789:e1f3e09e22da |
---|---|
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 |
1044 The command @kbd{C-x C-e} (@code{eval-last-sexp}) evaluates the Lisp | 1088 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 | 1089 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 | 1090 echo area. It is available in all major modes, not just Emacs-Lisp |
1047 mode. It does not treat @code{defvar} specially. | 1091 mode. It does not treat @code{defvar} specially. |
1048 | 1092 |
1093 When the result of an evaluation is an integer, you can type | |
1094 @kbd{C-x C-e} a second time to display the value of the integer result | |
1095 in additional formats (octal, hexadecimal, and character). | |
1096 | |
1049 If @kbd{C-M-x}, @kbd{C-x C-e}, or @kbd{M-:} is given a numeric | 1097 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 | 1098 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 | 1099 than displaying it in the echo area. The argument's value does not |
1052 matter. | 1100 matter. |
1053 | 1101 |