diff options
| author | Chong Yidong | 2011-12-08 21:21:58 +0800 |
|---|---|---|
| committer | Chong Yidong | 2011-12-08 21:21:58 +0800 |
| commit | b09d01daefabb424b0a02b2ae364f29064ddfd9d (patch) | |
| tree | 9bddd1ab033c935ca282ea6ef751c82305be51cf | |
| parent | 39c9faef2f2027336f7235d5521269714cc370c8 (diff) | |
| download | emacs-b09d01daefabb424b0a02b2ae364f29064ddfd9d.tar.gz emacs-b09d01daefabb424b0a02b2ae364f29064ddfd9d.zip | |
Updates to Building chapter of Emacs manual.
* doc/emacs/building.texi (Compilation): Say what the -k flag to make does.
Move subprocess discussion to Compilation Shell.
(Compilation Mode): Add xref for grep, occur, and mouse
references. Define "locus".
(Grep Searching): Use @command.
* doc/emacs/programs.texi (Symbol Completion): M-TAB can now use Semantic.
(Semantic): Add cindex entries for Semantic.
| -rw-r--r-- | doc/emacs/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/emacs/building.texi | 420 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 2 | ||||
| -rw-r--r-- | doc/emacs/programs.texi | 16 |
4 files changed, 225 insertions, 224 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 20a6e8e84d7..2627586f1f4 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2011-12-08 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * building.texi (Compilation): Say what the -k flag to make does. | ||
| 4 | Move subprocess discussion to Compilation Shell. | ||
| 5 | (Compilation Mode): Add xref for grep, occur, and mouse | ||
| 6 | references. Define "locus". | ||
| 7 | (Grep Searching): Use @command. | ||
| 8 | |||
| 9 | * programs.texi (Symbol Completion): M-TAB can now use Semantic. | ||
| 10 | (Semantic): Add cindex entries for Semantic. | ||
| 11 | |||
| 1 | 2011-12-06 Chong Yidong <cyd@gnu.org> | 12 | 2011-12-06 Chong Yidong <cyd@gnu.org> |
| 2 | 13 | ||
| 3 | * programs.texi (Man Page): Clarify how to use Man-switches. | 14 | * programs.texi (Man Page): Clarify how to use Man-switches. |
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 9c5b2e7dcd7..34ac5887a1d 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi | |||
| @@ -8,9 +8,9 @@ | |||
| 8 | @cindex program building | 8 | @cindex program building |
| 9 | @cindex running Lisp functions | 9 | @cindex running Lisp functions |
| 10 | 10 | ||
| 11 | The previous chapter discusses the Emacs commands that are useful for | 11 | The previous chapter discusses the Emacs commands that are useful |
| 12 | making changes in programs. This chapter deals with commands that assist | 12 | for making changes in programs. This chapter deals with commands that |
| 13 | in the larger process of compiling and testing programs. | 13 | assist in the process of compiling and testing programs. |
| 14 | 14 | ||
| 15 | @menu | 15 | @menu |
| 16 | * Compilation:: Compiling programs in languages other | 16 | * Compilation:: Compiling programs in languages other |
| @@ -37,10 +37,10 @@ in the larger process of compiling and testing programs. | |||
| 37 | @cindex compilation errors | 37 | @cindex compilation errors |
| 38 | @cindex error log | 38 | @cindex error log |
| 39 | 39 | ||
| 40 | Emacs can run compilers for noninteractive languages such as C and | 40 | Emacs can run compilers for languages such as C and Fortran as |
| 41 | Fortran as inferior processes, feeding the error log into an Emacs buffer. | 41 | inferior processes, feeding the compilation log into an Emacs buffer. |
| 42 | It can also parse the error messages and show you the source lines where | 42 | It can also parse the error messages and show you where the errors |
| 43 | compilation errors occurred. | 43 | occurred. |
| 44 | 44 | ||
| 45 | @table @kbd | 45 | @table @kbd |
| 46 | @item M-x compile | 46 | @item M-x compile |
| @@ -54,65 +54,60 @@ Kill the running compilation subprocess. | |||
| 54 | @end table | 54 | @end table |
| 55 | 55 | ||
| 56 | @findex compile | 56 | @findex compile |
| 57 | To run @code{make} or another compilation command, do @kbd{M-x | 57 | To run @code{make} or another compilation command, type @kbd{M-x |
| 58 | compile}. This command reads a shell command line using the minibuffer, | 58 | compile}. This reads a shell command line using the minibuffer, and |
| 59 | and then executes the command in an inferior shell, putting output in | 59 | then executes the command in an inferior shell, putting output in the |
| 60 | the buffer named @samp{*compilation*}. The current buffer's default | 60 | buffer named @samp{*compilation*}. The current buffer's default |
| 61 | directory is used as the working directory for the execution of the | 61 | directory is used as the working directory for the execution of the |
| 62 | command; normally, therefore, the compilation happens in this | 62 | command; normally, therefore, compilation takes place in this |
| 63 | directory. | 63 | directory. |
| 64 | 64 | ||
| 65 | @vindex compile-command | 65 | @vindex compile-command |
| 66 | The default for the compilation command is normally @samp{make -k}, | 66 | The default compilation command is @samp{make -k}, which is usually |
| 67 | which is correct most of the time for nontrivial programs. | 67 | correct for programs compiled using the @command{make} utility (the |
| 68 | @xref{Top,, Make, make, GNU Make Manual}. If you have done @kbd{M-x | 68 | @samp{-k} flag tells @command{make} to continue compiling as much as |
| 69 | compile} before, the default each time is the command you used the | 69 | possible after an error). @xref{Top,, Make, make, GNU Make Manual}. |
| 70 | previous time. @code{compile} stores this command in the variable | 70 | If you have done @kbd{M-x compile} before, the command that you |
| 71 | @code{compile-command}, so setting that variable specifies the default | 71 | specified is automatically stored in the variable |
| 72 | for the next use of @kbd{M-x compile}. If a file specifies a file | 72 | @code{compile-command}; this is used as the default the next time you |
| 73 | local value for @code{compile-command}, that provides the default when | 73 | type @kbd{M-x compile}. A file can also specify a file-local value |
| 74 | you type @kbd{M-x compile} in that file's buffer. @xref{File | 74 | for @code{compile-command} (@pxref{File Variables}). |
| 75 | Variables}. | 75 | |
| 76 | 76 | Starting a compilation displays the @samp{*compilation*} buffer in | |
| 77 | Starting a compilation displays the buffer @samp{*compilation*} in | 77 | another window but does not select it. While the compilation is |
| 78 | another window but does not select it. The buffer's mode line tells | 78 | running, the word @samp{run} is shown in the major mode indicator for |
| 79 | you whether compilation is finished, with the word @samp{run}, | 79 | the @samp{*compilation*} buffer, and the word @samp{Compiling} appears |
| 80 | @samp{signal} or @samp{exit} inside the parentheses. You do not have | 80 | in all mode lines. You do not have to keep the @samp{*compilation*} |
| 81 | to keep this buffer visible; compilation continues in any case. While | 81 | buffer visible while compilation is running; it continues in any case. |
| 82 | a compilation is going on, the string @samp{Compiling} appears in the | 82 | When the compilation ends, for whatever reason, the mode line of the |
| 83 | mode lines of all windows. When this string disappears, the | 83 | @samp{*compilation*} buffer changes to say @samp{exit} (followed by |
| 84 | compilation is finished. | 84 | the exit code: @samp{[0]} for a normal exit), or @samp{signal} (if a |
| 85 | 85 | signal terminated the process). | |
| 86 | If you want to watch the compilation transcript as it appears, switch | 86 | |
| 87 | to the @samp{*compilation*} buffer and move point to the end of the | 87 | If you want to watch the compilation transcript as it appears, |
| 88 | buffer. When point is at the end, new compilation output is inserted | 88 | switch to the @samp{*compilation*} buffer and move point to the end of |
| 89 | above point, which remains at the end. If point is not at the end of | 89 | the buffer. When point is at the end, new compilation output is |
| 90 | the buffer, it remains fixed while more compilation output is added at | 90 | inserted above point, which remains at the end. Otherwise, point |
| 91 | the end of the buffer. | 91 | remains fixed while compilation output is added at the end of the |
| 92 | buffer. | ||
| 92 | 93 | ||
| 93 | @cindex compilation buffer, keeping point at end | 94 | @cindex compilation buffer, keeping point at end |
| 94 | @vindex compilation-scroll-output | 95 | @vindex compilation-scroll-output |
| 95 | If you change the variable @code{compilation-scroll-output} to a | 96 | If you change the variable @code{compilation-scroll-output} to a |
| 96 | non-@code{nil} value, the compilation buffer will scroll automatically | 97 | non-@code{nil} value, the @samp{*compilation*} buffer scrolls |
| 97 | to follow the output as it comes in. If the value is | 98 | automatically to follow the output. If the value is |
| 98 | @code{first-error}, the scrolling stops at the first error that | 99 | @code{first-error}, scrolling stops when the first error appears, |
| 99 | appears, leaving point at that error. For any other non-@code{nil} | 100 | leaving point at that error. For any other non-@code{nil} value, |
| 100 | value, the buffer continues scrolling until there is no more output. | 101 | scrolling continues until there is no more output. |
| 101 | 102 | ||
| 102 | @findex recompile | 103 | @findex recompile |
| 103 | To rerun the last compilation with the same command, type @kbd{M-x | 104 | To rerun the last compilation with the same command, type @kbd{M-x |
| 104 | recompile}. This automatically reuses the compilation command from | 105 | recompile}. This reuses the compilation command from the last |
| 105 | the last invocation of @kbd{M-x compile}. It also reuses the | 106 | invocation of @kbd{M-x compile}. It also reuses the |
| 106 | @samp{*compilation*} buffer and starts the compilation in its default | 107 | @samp{*compilation*} buffer and starts the compilation in its default |
| 107 | directory, which is the directory in which the previous compilation | 108 | directory, which is the directory in which the previous compilation |
| 108 | was started. | 109 | was started. |
| 109 | 110 | ||
| 110 | When the compiler process terminates, for whatever reason, the mode | ||
| 111 | line of the @samp{*compilation*} buffer changes to say @samp{exit} | ||
| 112 | (followed by the exit code, @samp{[0]} for a normal exit), or | ||
| 113 | @samp{signal} (if a signal terminated the process), instead of | ||
| 114 | @samp{run}. | ||
| 115 | |||
| 116 | @findex kill-compilation | 111 | @findex kill-compilation |
| 117 | Starting a new compilation also kills any compilation already | 112 | Starting a new compilation also kills any compilation already |
| 118 | running in @samp{*compilation*}, as the buffer can only handle one | 113 | running in @samp{*compilation*}, as the buffer can only handle one |
| @@ -126,27 +121,6 @@ the @samp{*compilation*} buffer (perhaps using @code{rename-uniquely}; | |||
| 126 | @pxref{Misc Buffer}), then switch buffers and start the other | 121 | @pxref{Misc Buffer}), then switch buffers and start the other |
| 127 | compilation. This will create a new @samp{*compilation*} buffer. | 122 | compilation. This will create a new @samp{*compilation*} buffer. |
| 128 | 123 | ||
| 129 | Emacs does not expect a compiler process to launch asynchronous | ||
| 130 | subprocesses; if it does, and they keep running after the main | ||
| 131 | compiler process has terminated, Emacs may kill them or their output | ||
| 132 | may not arrive in Emacs. To avoid this problem, make the main process | ||
| 133 | wait for its subprocesses to finish. In a shell script, you can do this | ||
| 134 | using @samp{$!} and @samp{wait}, like this: | ||
| 135 | |||
| 136 | @example | ||
| 137 | (sleep 10; echo 2nd)& pid=$! # @r{Record pid of subprocess} | ||
| 138 | echo first message | ||
| 139 | wait $pid # @r{Wait for subprocess} | ||
| 140 | @end example | ||
| 141 | |||
| 142 | If the background process does not output to the compilation buffer, | ||
| 143 | so you only need to prevent it from being killed when the main | ||
| 144 | compilation process terminates, this is sufficient: | ||
| 145 | |||
| 146 | @example | ||
| 147 | nohup @var{command}; sleep 1 | ||
| 148 | @end example | ||
| 149 | |||
| 150 | @vindex compilation-environment | 124 | @vindex compilation-environment |
| 151 | You can control the environment passed to the compilation command | 125 | You can control the environment passed to the compilation command |
| 152 | with the variable @code{compilation-environment}. Its value is a list | 126 | with the variable @code{compilation-environment}. Its value is a list |
| @@ -159,153 +133,154 @@ variable settings override the usual ones. | |||
| 159 | 133 | ||
| 160 | @cindex Compilation mode | 134 | @cindex Compilation mode |
| 161 | @cindex mode, Compilation | 135 | @cindex mode, Compilation |
| 162 | The @samp{*compilation*} buffer uses a special major mode, | 136 | @cindex locus |
| 163 | Compilation mode, whose main feature is to provide a convenient way to | 137 | The @samp{*compilation*} buffer uses a major mode called Compilation |
| 164 | visit the source line corresponding to an error message. These | 138 | mode. Compilation mode turns each error message in the buffer into a |
| 165 | commands are also available in other special buffers that list | 139 | hyperlink; you can move point to it and type @key{RET}, or click on it |
| 166 | locations in files, including those made by @kbd{M-x grep} and | 140 | with the mouse (@pxref{Mouse References}), to visit the @dfn{locus} of |
| 167 | @kbd{M-x occur}. | 141 | the error message in a separate window. The locus is the specific |
| 142 | position in a file where that error occurred. | ||
| 143 | |||
| 144 | @findex compile-goto-error | ||
| 145 | @vindex compilation-auto-jump-to-first-error | ||
| 146 | If you change the variable | ||
| 147 | @code{compilation-auto-jump-to-first-error} to a non-@code{nil} value, | ||
| 148 | Emacs automatically visits the locus of the first error message that | ||
| 149 | appears in the @samp{*compilation*} buffer. | ||
| 150 | |||
| 151 | Compilation mode provides the following additional commands. These | ||
| 152 | commands can also be used in @samp{*grep*} buffers, where the | ||
| 153 | hyperlinks are search matches rather than error messages (@pxref{Grep | ||
| 154 | Searching}). | ||
| 168 | 155 | ||
| 169 | @table @kbd | 156 | @table @kbd |
| 170 | @item M-g M-n | 157 | @item M-g M-n |
| 171 | @itemx M-g n | 158 | @itemx M-g n |
| 172 | @itemx C-x ` | 159 | @itemx C-x ` |
| 173 | Visit the locus of the next error message or match. | 160 | Visit the locus of the next error message or match (@code{next-error}). |
| 174 | @item M-g M-p | 161 | @item M-g M-p |
| 175 | @itemx M-g p | 162 | @itemx M-g p |
| 176 | Visit the locus of the previous error message or match. | 163 | Visit the locus of the previous error message or match |
| 177 | @item @key{RET} | 164 | (@code{previous-error}). |
| 178 | Visit the locus of the error message that point is on. | ||
| 179 | This command is used in the compilation buffer. | ||
| 180 | @item Mouse-2 | ||
| 181 | Visit the locus of the error message that you click on. | ||
| 182 | @item M-n | 165 | @item M-n |
| 183 | Find and highlight the locus of the next error message, without | 166 | Move point to the next error message or match, without visiting its |
| 184 | selecting the source buffer. | 167 | locus (@code{compilation-next-error}). |
| 185 | @item M-p | 168 | @item M-p |
| 186 | Find and highlight the locus of the previous error message, without | 169 | Move point to the previous error message or match, without visiting |
| 187 | selecting the source buffer. | 170 | its locus (@code{compilation-previous-error}). |
| 188 | @item M-@} | 171 | @item M-@} |
| 189 | Move point to the next error for a different file than the current | 172 | Move point to the next error message or match occurring in a different |
| 190 | one. | 173 | file (@code{compilation-next-file}). |
| 191 | @item M-@{ | 174 | @item M-@{ |
| 192 | Move point to the previous error for a different file than the current | 175 | Move point to the previous error message or match occurring in a |
| 193 | one. | 176 | different file (@code{compilation-previous-file}). |
| 194 | @item C-c C-f | 177 | @item C-c C-f |
| 195 | Toggle Next Error Follow minor mode, which makes cursor motion in the | 178 | Toggle Next Error Follow minor mode, which makes cursor motion in the |
| 196 | compilation buffer produce automatic source display. | 179 | compilation buffer produce automatic source display. |
| 197 | @end table | 180 | @end table |
| 198 | 181 | ||
| 199 | @findex compile-goto-error | ||
| 200 | @vindex compilation-auto-jump-to-first-error | ||
| 201 | You can visit the source for any particular error message by moving | ||
| 202 | point in the @samp{*compilation*} buffer to that error message and | ||
| 203 | typing @key{RET} (@code{compile-goto-error}). Alternatively, you can | ||
| 204 | click @kbd{Mouse-2} on the error message; you need not switch to the | ||
| 205 | @samp{*compilation*} buffer first. If you set the variable | ||
| 206 | @code{compilation-auto-jump-to-first-error} to a non-@code{nil} value, | ||
| 207 | Emacs automatically jumps to the first error, if any, as soon as it | ||
| 208 | appears in the @samp{*compilation*} buffer. | ||
| 209 | |||
| 210 | @kindex M-g M-n | 182 | @kindex M-g M-n |
| 211 | @kindex M-g n | 183 | @kindex M-g n |
| 212 | @kindex C-x ` | 184 | @kindex C-x ` |
| 213 | @findex next-error | 185 | @findex next-error |
| 214 | @vindex next-error-highlight | 186 | @vindex next-error-highlight |
| 215 | To parse the compiler error messages sequentially, type @kbd{C-x `} | 187 | To visit errors sequentially, type @w{@kbd{C-x `}} |
| 216 | (@code{next-error}). The character following the @kbd{C-x} is the | 188 | (@code{next-error}), or equivalently @kbd{M-g M-n} or @kbd{M-g n}. |
| 217 | backquote or ``grave accent,'' not the single-quote. This command is | 189 | This command can be invoked from any buffer, not just a Compilation |
| 218 | available in all buffers, not just in @samp{*compilation*}; it | 190 | mode buffer. The first time you invoke it after a compilation, it |
| 219 | displays the next error message at the top of one window and source | 191 | visits the locus of the first error message. Each subsequent |
| 220 | location of the error in another window. It also temporarily | 192 | @w{@kbd{C-x `}} visits the next error, in a similar fashion. If you |
| 221 | highlights the relevant source line, for a period controlled by the | 193 | visit a specific error with @key{RET} or a mouse click in the |
| 222 | variable @code{next-error-highlight}. | 194 | @samp{*compilation*} buffer, subsequent @w{@kbd{C-x `}} commands |
| 223 | 195 | advance from there. When @w{@kbd{C-x `}} finds no more error messages | |
| 224 | The first time @w{@kbd{C-x `}} is used after the start of a compilation, | 196 | to visit, it signals an error. @w{@kbd{C-u C-x `}} starts again from |
| 225 | it moves to the first error's location. Subsequent uses of @kbd{C-x | 197 | the beginning of the compilation buffer, and visits the first locus. |
| 226 | `} advance down to subsequent errors. If you visit a specific error | 198 | |
| 227 | message with @key{RET} or @kbd{Mouse-2}, subsequent @w{@kbd{C-x `}} | 199 | @kbd{M-g M-p} or @kbd{M-g p} (@code{previous-error}) iterates |
| 228 | commands advance from there. When @w{@kbd{C-x `}} gets to the end of the | 200 | through errors in the opposite direction. |
| 229 | buffer and finds no more error messages to visit, it fails and signals | 201 | |
| 230 | an Emacs error. @w{@kbd{C-u C-x `}} starts scanning from the beginning of | 202 | The @code{next-error} and @code{previous-error} commands don't just |
| 231 | the compilation buffer, and goes to the first error's location. | 203 | act on the errors or matches listed in @samp{*compilation*} and |
| 204 | @samp{*grep*} buffers; they also know how to iterate through error or | ||
| 205 | match lists produced by other commands, such as @kbd{M-x occur} | ||
| 206 | (@pxref{Other Repeating Search}). If you are already in a buffer | ||
| 207 | containing error messages or matches, those are the ones that are | ||
| 208 | iterated through; otherwise, Emacs looks for a buffer containing error | ||
| 209 | messages or matches amongst the windows of the selected frame, then | ||
| 210 | for one that @code{next-error} or @code{previous-error} previously | ||
| 211 | iterated through, and finally amongst all other buffers. If the | ||
| 212 | buffer chosen for iterating through is not currently displayed in a | ||
| 213 | window, it will be displayed. | ||
| 232 | 214 | ||
| 233 | @vindex compilation-skip-threshold | 215 | @vindex compilation-skip-threshold |
| 234 | By default, @w{@kbd{C-x `}} skips less important messages. The variable | 216 | By default, the @code{next-error} and @code{previous-error} commands |
| 235 | @code{compilation-skip-threshold} controls this. If its value is 2, | 217 | skip less important messages. The variable |
| 236 | @w{@kbd{C-x `}} skips anything less than error, 1 skips anything less | 218 | @code{compilation-skip-threshold} controls this. The default value, |
| 237 | than warning, and 0 doesn't skip any messages. The default is 1. | 219 | 1, means to skip anything less important than a warning. A value of 2 |
| 238 | 220 | means to skip anything less important than an error, while 0 means not | |
| 239 | When the window has a left fringe, an arrow in the fringe points to | 221 | to skip any messages. |
| 240 | the current message in the compilation buffer. The variable | 222 | |
| 241 | @code{compilation-context-lines} controls the number of lines of | 223 | When Emacs visits the locus of an error message, it momentarily |
| 242 | leading context to display before the current message. Going to an | 224 | highlights the relevant source line. The duration of this highlight |
| 243 | error message location scrolls the @samp{*compilation*} buffer to put | 225 | is determined by the variable @code{next-error-highlight}. |
| 244 | the message that far down from the top. The value @code{nil} is | 226 | |
| 245 | special: if there's a left fringe, the window doesn't scroll at all | 227 | @vindex compilation-context-lines |
| 246 | if the message is already visible. If there is no left fringe, | 228 | If the @samp{*compilation*} buffer is shown in a window with a left |
| 247 | @code{nil} means display the message at the top of the window. | 229 | fringe (@pxref{Fringes}), the locus-visiting commands put an arrow in |
| 248 | 230 | the fringe, pointing to the current error message. If the window has | |
| 249 | If you're not in the compilation buffer when you run | 231 | no left fringe, such as on a text-only terminal, these commands scroll |
| 250 | @code{next-error}, Emacs will look for a buffer that contains error | 232 | the window so that the current message is at the top of the window. |
| 251 | messages. First, it looks for one displayed in the selected frame, | 233 | If you change the variable @code{compilation-context-lines} to an |
| 252 | then for one that previously had @code{next-error} called on it, and | 234 | integer value @var{n}, these commands scroll the window so that the |
| 253 | then at the current buffer. Finally, Emacs looks at all the remaining | 235 | current error message is @var{n} lines from the top, whether or not |
| 254 | buffers. @code{next-error} signals an error if it can't find any such | 236 | there is a fringe; the default value, @code{nil}, gives the behavior |
| 255 | buffer. | 237 | described above. |
| 256 | 238 | ||
| 257 | @vindex compilation-error-regexp-alist | 239 | @vindex compilation-error-regexp-alist |
| 258 | @vindex grep-regexp-alist | 240 | @vindex grep-regexp-alist |
| 259 | To parse messages from the compiler, Compilation mode uses the | 241 | To parse messages from the compiler, Compilation mode uses the |
| 260 | variable @code{compilation-error-regexp-alist} which lists various | 242 | variable @code{compilation-error-regexp-alist} which lists various |
| 261 | formats of error messages and tells Emacs how to extract the source file | 243 | error message formats and tells Emacs how to extract the locus from |
| 262 | and the line number from the text of a message. If your compiler isn't | 244 | each. A similar variable, @code{grep-regexp-alist}, tells Emacs how |
| 263 | supported, you can tailor Compilation mode to it by adding elements to | 245 | to parse output from a @code{grep} command (@pxref{Grep Searching}). |
| 264 | that list. A similar variable @code{grep-regexp-alist} tells Emacs how | ||
| 265 | to parse output of a @code{grep} command. | ||
| 266 | 246 | ||
| 267 | @findex compilation-next-error | 247 | @findex compilation-next-error |
| 268 | @findex compilation-previous-error | 248 | @findex compilation-previous-error |
| 269 | @findex compilation-next-file | 249 | @findex compilation-next-file |
| 270 | @findex compilation-previous-file | 250 | @findex compilation-previous-file |
| 271 | Compilation mode also redefines the keys @key{SPC} and @key{DEL} to | 251 | Compilation mode also defines the keys @key{SPC} and @key{DEL} to |
| 272 | scroll by screenfuls, and @kbd{M-n} (@code{compilation-next-error}) | 252 | scroll by screenfuls; @kbd{M-n} (@code{compilation-next-error}) and |
| 273 | and @kbd{M-p} (@code{compilation-previous-error}) to move to the next | 253 | @kbd{M-p} (@code{compilation-previous-error}) to move to the next or |
| 274 | or previous error message. You can also use @kbd{M-@{} | 254 | previous error message; and @kbd{M-@{} (@code{compilation-next-file}) |
| 275 | (@code{compilation-next-file} and @kbd{M-@}} | 255 | and @kbd{M-@}} (@code{compilation-previous-file}) to move to the next |
| 276 | (@code{compilation-previous-file}) to move up or down to an error | 256 | or previous error message for a different source file. |
| 277 | message for a different source file. | ||
| 278 | 257 | ||
| 279 | @cindex Next Error Follow mode | 258 | @cindex Next Error Follow mode |
| 280 | @findex next-error-follow-minor-mode | 259 | @findex next-error-follow-minor-mode |
| 281 | You can type @kbd{C-c C-f} to toggle Next Error Follow mode. In | 260 | You can type @kbd{C-c C-f} to toggle Next Error Follow mode. In |
| 282 | this minor mode, ordinary cursor motion in the compilation buffer | 261 | this minor mode, ordinary cursor motion in the compilation buffer |
| 283 | automatically updates the source buffer. For instance, moving the | 262 | automatically updates the source buffer, i.e.@: moving the cursor over |
| 284 | cursor to the next error message causes the location of that error to | 263 | an error message causes the locus of that error to be displayed. |
| 285 | be displayed immediately. | ||
| 286 | 264 | ||
| 287 | The features of Compilation mode are also available in a minor mode | 265 | The features of Compilation mode are also available in a minor mode |
| 288 | called Compilation Minor mode. This lets you parse error messages in | 266 | called Compilation Minor mode. This lets you parse error messages in |
| 289 | any buffer, not just a normal compilation output buffer. Type @kbd{M-x | 267 | any buffer, not just a normal compilation output buffer. Type |
| 290 | compilation-minor-mode} to enable the minor mode. This defines the keys | 268 | @kbd{M-x compilation-minor-mode} to enable the minor mode. For |
| 291 | @key{RET} and @kbd{Mouse-2}, as in the Compilation major mode. | 269 | instance, in an Rlogin buffer (@pxref{Remote Host}), Compilation minor |
| 292 | 270 | mode automatically accesses remote source files by FTP (@pxref{File | |
| 293 | Compilation minor mode works in any buffer, as long as the contents | 271 | Names}). |
| 294 | are in a format that it understands. In an Rlogin buffer (@pxref{Remote | ||
| 295 | Host}), Compilation minor mode automatically accesses remote source | ||
| 296 | files by FTP (@pxref{File Names}). | ||
| 297 | 272 | ||
| 298 | @node Compilation Shell | 273 | @node Compilation Shell |
| 299 | @section Subshells for Compilation | 274 | @section Subshells for Compilation |
| 300 | 275 | ||
| 301 | Emacs uses a shell to run the compilation command, but specifies the | 276 | The @kbd{M-x compile} command uses a shell to run the compilation |
| 302 | option for a noninteractive shell. This means, in particular, that | 277 | command, but specifies the option for a noninteractive shell. This |
| 303 | the shell should start with no prompt. If you find your usual shell | 278 | means, in particular, that the shell should start with no prompt. If |
| 304 | prompt making an unsightly appearance in the @samp{*compilation*} | 279 | you find your usual shell prompt making an unsightly appearance in the |
| 305 | buffer, it means you have made a mistake in your shell's init file by | 280 | @samp{*compilation*} buffer, it means you have made a mistake in your |
| 306 | setting the prompt unconditionally. (This init file's name may be | 281 | shell's init file by setting the prompt unconditionally. (This init |
| 307 | @file{.bashrc}, @file{.profile}, @file{.cshrc}, @file{.shrc}, or | 282 | file may be named @file{.bashrc}, @file{.profile}, @file{.cshrc}, |
| 308 | various other things, depending on the shell you use.) The shell init | 283 | @file{.shrc}, etc., depending on what shell you use.) The shell init |
| 309 | file should set the prompt only if there already is a prompt. Here's | 284 | file should set the prompt only if there already is a prompt. Here's |
| 310 | how to do it in bash: | 285 | how to do it in bash: |
| 311 | 286 | ||
| @@ -322,67 +297,80 @@ And here's how to do it in csh: | |||
| 322 | if ($?prompt) set prompt = @dots{} | 297 | if ($?prompt) set prompt = @dots{} |
| 323 | @end example | 298 | @end example |
| 324 | 299 | ||
| 325 | There may well be other things that your shell's init file | 300 | Emacs does not expect a compiler process to launch asynchronous |
| 326 | ought to do only for an interactive shell. You can use the same | 301 | subprocesses; if it does, and they keep running after the main |
| 327 | method to conditionalize them. | 302 | compiler process has terminated, Emacs may kill them or their output |
| 303 | may not arrive in Emacs. To avoid this problem, make the main | ||
| 304 | compilation process wait for its subprocesses to finish. In a shell | ||
| 305 | script, you can do this using @samp{$!} and @samp{wait}, like this: | ||
| 306 | |||
| 307 | @example | ||
| 308 | (sleep 10; echo 2nd)& pid=$! # @r{Record pid of subprocess} | ||
| 309 | echo first message | ||
| 310 | wait $pid # @r{Wait for subprocess} | ||
| 311 | @end example | ||
| 312 | |||
| 313 | @noindent | ||
| 314 | If the background process does not output to the compilation buffer, | ||
| 315 | so you only need to prevent it from being killed when the main | ||
| 316 | compilation process terminates, this is sufficient: | ||
| 317 | |||
| 318 | @example | ||
| 319 | nohup @var{command}; sleep 1 | ||
| 320 | @end example | ||
| 328 | 321 | ||
| 329 | The MS-DOS ``operating system'' does not support asynchronous | ||
| 330 | subprocesses; to work around this lack, @kbd{M-x compile} runs the | ||
| 331 | compilation command synchronously on MS-DOS. As a consequence, you must | ||
| 332 | wait until the command finishes before you can do anything else in | ||
| 333 | Emacs. | ||
| 334 | @iftex | ||
| 335 | @inforef{MS-DOS,,emacs-xtra}. | ||
| 336 | @end iftex | ||
| 337 | @ifnottex | 322 | @ifnottex |
| 338 | @xref{MS-DOS}. | 323 | On the MS-DOS ``operating system'', asynchronous subprocesses are |
| 324 | not supported, so @kbd{M-x compile} runs the compilation command | ||
| 325 | synchronously (i.e.@: you must wait until the command finishes before | ||
| 326 | you can do anything else in Emacs). @xref{MS-DOS}. | ||
| 339 | @end ifnottex | 327 | @end ifnottex |
| 340 | 328 | ||
| 341 | @node Grep Searching | 329 | @node Grep Searching |
| 342 | @section Searching with Grep under Emacs | 330 | @section Searching with Grep under Emacs |
| 343 | 331 | ||
| 344 | Just as you can run a compiler from Emacs and then visit the lines | 332 | Just as you can run a compiler from Emacs and then visit the lines |
| 345 | with compilation errors, you can also run @code{grep} and then visit | 333 | with compilation errors, you can also run @command{grep} and then |
| 346 | the lines on which matches were found. This works by treating the | 334 | visit the lines on which matches were found. This works by treating |
| 347 | matches reported by @code{grep} as if they were ``errors.'' The | 335 | the matches reported by @command{grep} as if they were ``errors.'' |
| 348 | buffer of matches uses Grep mode, which is a variant of Compilation | 336 | The output buffer uses Grep mode, which is a variant of Compilation |
| 349 | mode (@pxref{Compilation Mode}). | 337 | mode (@pxref{Compilation Mode}). |
| 350 | 338 | ||
| 351 | @table @kbd | 339 | @table @kbd |
| 352 | @item M-x grep | 340 | @item M-x grep |
| 353 | @itemx M-x lgrep | 341 | @itemx M-x lgrep |
| 354 | Run @code{grep} asynchronously under Emacs, with matching lines | 342 | Run @command{grep} asynchronously under Emacs, listing matching lines in |
| 355 | listed in the buffer named @samp{*grep*}. | 343 | the buffer named @samp{*grep*}. |
| 356 | @item M-x grep-find | 344 | @item M-x grep-find |
| 357 | @itemx M-x find-grep | 345 | @itemx M-x find-grep |
| 358 | @itemx M-x rgrep | 346 | @itemx M-x rgrep |
| 359 | Run @code{grep} via @code{find}, and collect output in the buffer | 347 | Run @command{grep} via @code{find}, and collect output in the |
| 360 | named @samp{*grep*}. | 348 | @samp{*grep*} buffer. |
| 361 | @item M-x zrgrep | 349 | @item M-x zrgrep |
| 362 | Run @code{zgrep} and collect output in the buffer named @samp{*grep*}. | 350 | Run @code{zgrep} and collect output in the @samp{*grep*} buffer. |
| 363 | @item M-x kill-grep | 351 | @item M-x kill-grep |
| 364 | Kill the running @code{grep} subprocess. | 352 | Kill the running @command{grep} subprocess. |
| 365 | @end table | 353 | @end table |
| 366 | 354 | ||
| 367 | @findex grep | 355 | @findex grep |
| 368 | To run @code{grep}, type @kbd{M-x grep}, then enter a command line | 356 | To run @command{grep}, type @kbd{M-x grep}, then enter a command line |
| 369 | that specifies how to run @code{grep}. Use the same arguments you | 357 | that specifies how to run @command{grep}. Use the same arguments you |
| 370 | would give @code{grep} when running it normally: a @code{grep}-style | 358 | would give @command{grep} when running it normally: a @command{grep}-style |
| 371 | regexp (usually in single-quotes to quote the shell's special | 359 | regexp (usually in single-quotes to quote the shell's special |
| 372 | characters) followed by file names, which may use wildcards. If you | 360 | characters) followed by file names, which may use wildcards. If you |
| 373 | specify a prefix argument for @kbd{M-x grep}, it finds the tag | 361 | specify a prefix argument for @kbd{M-x grep}, it finds the tag |
| 374 | (@pxref{Tags}) in the buffer around point, and puts that into the | 362 | (@pxref{Tags}) in the buffer around point, and puts that into the |
| 375 | default @code{grep} command. | 363 | default @command{grep} command. |
| 376 | 364 | ||
| 377 | Your command need not simply run @code{grep}; you can use any shell | 365 | Your command need not simply run @command{grep}; you can use any shell |
| 378 | command that produces output in the same format. For instance, you | 366 | command that produces output in the same format. For instance, you |
| 379 | can chain @code{grep} commands, like this: | 367 | can chain @command{grep} commands, like this: |
| 380 | 368 | ||
| 381 | @example | 369 | @example |
| 382 | grep -nH -e foo *.el | grep bar | grep toto | 370 | grep -nH -e foo *.el | grep bar | grep toto |
| 383 | @end example | 371 | @end example |
| 384 | 372 | ||
| 385 | The output from @code{grep} goes in the @samp{*grep*} buffer. You | 373 | The output from @command{grep} goes in the @samp{*grep*} buffer. You |
| 386 | can find the corresponding lines in the original files using @w{@kbd{C-x | 374 | can find the corresponding lines in the original files using @w{@kbd{C-x |
| 387 | `}}, @key{RET}, and so forth, just like compilation errors. | 375 | `}}, @key{RET}, and so forth, just like compilation errors. |
| 388 | 376 | ||
| @@ -397,30 +385,31 @@ match will be highlighted, instead of the entire source line. | |||
| 397 | The command @kbd{M-x grep-find} (also available as @kbd{M-x | 385 | The command @kbd{M-x grep-find} (also available as @kbd{M-x |
| 398 | find-grep}) is similar to @kbd{M-x grep}, but it supplies a different | 386 | find-grep}) is similar to @kbd{M-x grep}, but it supplies a different |
| 399 | initial default for the command---one that runs both @code{find} and | 387 | initial default for the command---one that runs both @code{find} and |
| 400 | @code{grep}, so as to search every file in a directory tree. See also | 388 | @command{grep}, so as to search every file in a directory tree. See also |
| 401 | the @code{find-grep-dired} command, in @ref{Dired and Find}. | 389 | the @code{find-grep-dired} command, in @ref{Dired and Find}. |
| 402 | 390 | ||
| 403 | @findex lgrep | 391 | @findex lgrep |
| 404 | @findex rgrep | 392 | @findex rgrep |
| 405 | @findex zrgrep | 393 | @findex zrgrep |
| 406 | The commands @kbd{M-x lgrep} (local grep) and @kbd{M-x rgrep} | 394 | The commands @kbd{M-x lgrep} (local grep) and @kbd{M-x rgrep} |
| 407 | (recursive grep) are more user-friendly versions of @code{grep} and | 395 | (recursive grep) are more user-friendly versions of @command{grep} and |
| 408 | @code{grep-find}, which prompt separately for the regular expression | 396 | @code{grep-find}, which prompt separately for the regular expression |
| 409 | to match, the files to search, and the base directory for the search. | 397 | to match, the files to search, and the base directory for the search. |
| 410 | Case sensitivity of the search is controlled by the current value of | 398 | Case sensitivity of the search is controlled by the current value of |
| 411 | @code{case-fold-search}. The command @kbd{M-x zrgrep} is similar to | 399 | @code{case-fold-search}. The command @kbd{M-x zrgrep} is similar to |
| 412 | @code{rgrep}, but it calls @code{zgrep} instead of @code{grep} to | 400 | @kbd{M-x rgrep}, but it calls @command{zgrep} instead of |
| 413 | search the contents of gzipped files. | 401 | @command{grep} to search the contents of gzipped files. |
| 414 | 402 | ||
| 415 | These commands build the shell commands based on the variables | 403 | These commands build the shell commands based on the variables |
| 416 | @code{grep-template} (for @code{lgrep}) and @code{grep-find-template} | 404 | @code{grep-template} (for @code{lgrep}) and @code{grep-find-template} |
| 417 | (for @code{rgrep}). The files to search can use aliases defined in | 405 | (for @code{rgrep}). The files to search can use aliases defined in |
| 418 | the variable @code{grep-files-aliases}. | 406 | the variable @code{grep-files-aliases}. |
| 419 | 407 | ||
| 420 | Subdirectories listed in the variable | 408 | @vindex grep-find-ignored-directories |
| 421 | @code{grep-find-ignored-directories} such as those typically used by | 409 | Directories listed in the variable |
| 422 | various version control systems, like CVS and arch, are automatically | 410 | @code{grep-find-ignored-directories} are automatically skipped by |
| 423 | skipped by @code{rgrep}. | 411 | @kbd{M-x rgrep}. The default value includes the data directories used |
| 412 | by various version control systems. | ||
| 424 | 413 | ||
| 425 | @node Flymake | 414 | @node Flymake |
| 426 | @section Finding Syntax Errors On The Fly | 415 | @section Finding Syntax Errors On The Fly |
| @@ -444,8 +433,13 @@ flymake-goto-next-error} and @kbd{M-x flymake-goto-prev-error}. To | |||
| 444 | display any error messages associated with the current line, use | 433 | display any error messages associated with the current line, use |
| 445 | @kbd{M-x flymake-display-err-menu-for-current-line}. | 434 | @kbd{M-x flymake-display-err-menu-for-current-line}. |
| 446 | 435 | ||
| 447 | For more details about using Flymake, see @ref{Top, Flymake, | 436 | For more details about using Flymake, |
| 448 | Flymake, flymake, The Flymake Manual}. | 437 | @ifnottex |
| 438 | see @ref{Top, Flymake, Flymake, flymake, The Flymake Manual}. | ||
| 439 | @end ifnottex | ||
| 440 | @iftex | ||
| 441 | see the Flymake Info manual, which is distributed with Emacs. | ||
| 442 | @end iftex | ||
| 449 | 443 | ||
| 450 | @node Debuggers | 444 | @node Debuggers |
| 451 | @section Running Debuggers Under Emacs | 445 | @section Running Debuggers Under Emacs |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 5905c7a65b2..5336384c3b9 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -39,7 +39,7 @@ developing GNU and promoting software freedom.'' | |||
| 39 | @c in general, keep the following line commented out, unless doing a | 39 | @c in general, keep the following line commented out, unless doing a |
| 40 | @c copy of this manual that will be published. The manual should go | 40 | @c copy of this manual that will be published. The manual should go |
| 41 | @c onto the distribution in the full, 8.5 x 11" size. | 41 | @c onto the distribution in the full, 8.5 x 11" size. |
| 42 | @smallbook | 42 | @c @smallbook |
| 43 | 43 | ||
| 44 | @ifset smallbook | 44 | @ifset smallbook |
| 45 | @smallbook | 45 | @smallbook |
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 8d441f342f0..bb62ad67b2a 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi | |||
| @@ -1283,17 +1283,11 @@ for switching graphical windows, so you should type @kbd{C-M-i} or | |||
| 1283 | @kbd{@key{ESC} @key{TAB}} instead. | 1283 | @kbd{@key{ESC} @key{TAB}} instead. |
| 1284 | 1284 | ||
| 1285 | @cindex tags-based completion | 1285 | @cindex tags-based completion |
| 1286 | @cindex Info index completion | ||
| 1287 | @findex complete-symbol | ||
| 1288 | In-buffer symbol completion generates its completion list in a | 1286 | In-buffer symbol completion generates its completion list in a |
| 1289 | number of different ways. In most programming language modes, | 1287 | number of different ways. If Semantic mode is enabled, Emacs tries to |
| 1290 | completion is normally done using a tags table (@pxref{Tags}). | 1288 | use the Semantic parser data for completion (@pxref{Semantic}). If |
| 1291 | However, if you supply @kbd{C-M-i} or @kbd{M-@key{TAB}} with a numeric | 1289 | Semantic mode is not enabled or it fails at performing completion, |
| 1292 | argument, it completes using the Info file indexes for the current | 1290 | Emacs normally tries to complete using a tags table (@pxref{Tags}). |
| 1293 | language (e.g.@: the C Library Manual). Of course, Info-based | ||
| 1294 | completion works only if there is an Info file for the standard | ||
| 1295 | library functions of your language, and only if it is installed at | ||
| 1296 | your site. | ||
| 1297 | 1291 | ||
| 1298 | @cindex Lisp symbol completion | 1292 | @cindex Lisp symbol completion |
| 1299 | @cindex completion (Lisp symbols) | 1293 | @cindex completion (Lisp symbols) |
| @@ -1350,6 +1344,8 @@ have an exact understanding of programming language syntax. This | |||
| 1350 | allows Semantic to provide search, navigation, and completion commands | 1344 | allows Semantic to provide search, navigation, and completion commands |
| 1351 | that are powerful and precise. | 1345 | that are powerful and precise. |
| 1352 | 1346 | ||
| 1347 | @cindex Semantic mode | ||
| 1348 | @cindex mode, Semantic | ||
| 1353 | To begin using Semantic, type @kbd{M-x semantic-mode} or click on | 1349 | To begin using Semantic, type @kbd{M-x semantic-mode} or click on |
| 1354 | the menu item named @samp{Source Code Parsers (Semantic)} in the | 1350 | the menu item named @samp{Source Code Parsers (Semantic)} in the |
| 1355 | @samp{Tools} menu. This enables Semantic mode, a global minor mode. | 1351 | @samp{Tools} menu. This enables Semantic mode, a global minor mode. |