aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-02-07 23:47:53 +0000
committerRichard M. Stallman2006-02-07 23:47:53 +0000
commit41f633c104c06c8a0f73b396f2e22af3f9290d75 (patch)
treec5c2fb2bd9b413dd296d3fa8cf15897213e1624b
parentbbf0fec6a021d43955320016714a2f4db5f9fb78 (diff)
downloademacs-41f633c104c06c8a0f73b396f2e22af3f9290d75.tar.gz
emacs-41f633c104c06c8a0f73b396f2e22af3f9290d75.zip
(Compilation): Move and split kill-compilation para.
Add para about multiple compilers. (Compilation Mode): Commands also available in grep mode and others. Mention C-u C-x ` more tutorially. Clarify C-x `. (Compilation Shell): Clarify. Put Bash example first. (Grep Searching): Minor cleanups; add @w. (Debuggers): Minor cleanups. (Starting GUD): Make GDB xgraphical mode issue clearer. (Debugger Operation): Lots of clarifications including GDB tooltip side-effect issue. (Commands of GUD): Clarify. (GUD Customization): Add bashdb-mode-hook. (GDB Graphical Interface): Rewrite for clarity. (GDB User Interface Layout): Rewrite for clarity. (Stack Buffer, Watch Expressions): Likewise. (Other GDB User Interface Buffers): Cleanups. (Lisp Libraries, External Lisp): Cleanup.
-rw-r--r--man/building.texi533
1 files changed, 281 insertions, 252 deletions
diff --git a/man/building.texi b/man/building.texi
index bc7ab649407..e3e3b5ac5a2 100644
--- a/man/building.texi
+++ b/man/building.texi
@@ -90,23 +90,12 @@ above point, which remains at the end. If point is not at the end of
90the buffer, it remains fixed while more compilation output is added at 90the buffer, it remains fixed while more compilation output is added at
91the end of the buffer. 91the end of the buffer.
92 92
93@cindex compilation buffer, keeping current position at the end 93@cindex compilation buffer, keeping point at end
94@vindex compilation-scroll-output 94@vindex compilation-scroll-output
95 If you set the variable @code{compilation-scroll-output} to a 95 If you set the variable @code{compilation-scroll-output} to a
96non-@code{nil} value, then the compilation buffer always scrolls to 96non-@code{nil} value, then the compilation buffer always scrolls to
97follow output as it comes in. 97follow output as it comes in.
98 98
99@findex kill-compilation
100 When the compiler process terminates, for whatever reason, the mode
101line of the @samp{*compilation*} buffer changes to say @samp{exit}
102(followed by the exit code, @samp{[0]} for a normal exit), or
103@samp{signal} (if a signal terminated the process), instead of
104@samp{run}. Starting a new compilation also kills any running
105compilation, as only one can exist at any time. However, @kbd{M-x
106compile} asks for confirmation before actually killing a compilation
107that is running. You can also kill the compilation process with
108@kbd{M-x kill-compilation}.
109
110@findex recompile 99@findex recompile
111 To rerun the last compilation with the same command, type @kbd{M-x 100 To rerun the last compilation with the same command, type @kbd{M-x
112recompile}. This automatically reuses the compilation command from 101recompile}. This automatically reuses the compilation command from
@@ -115,6 +104,25 @@ the last invocation of @kbd{M-x compile}. It also reuses the
115directory, which is the directory in which the previous compilation 104directory, which is the directory in which the previous compilation
116was started. 105was started.
117 106
107 When the compiler process terminates, for whatever reason, the mode
108line of the @samp{*compilation*} buffer changes to say @samp{exit}
109(followed by the exit code, @samp{[0]} for a normal exit), or
110@samp{signal} (if a signal terminated the process), instead of
111@samp{run}.
112
113@findex kill-compilation
114 Starting a new compilation also kills any compilation
115running in @samp{*compilation*}, as the buffer can only handle one
116compilation at any time. However, @kbd{M-x compile} asks for
117confirmation before actually killing a compilation that is running.
118You can also kill the compilation process with @kbd{M-x
119kill-compilation}.
120
121 If you want to run two compilations at once, you should start the
122first one, then rename the @samp{*compilation*} buffer (perhaps using
123@code{rename-uniquely}; @pxref{Misc Buffer}), and start the other
124compilation. That will create a new @samp{*compilation*} buffer.
125
118 Emacs does not expect a compiler process to launch asynchronous 126 Emacs does not expect a compiler process to launch asynchronous
119subprocesses; if it does, and they keep running after the main 127subprocesses; if it does, and they keep running after the main
120compiler process has terminated, Emacs may kill them or their output 128compiler process has terminated, Emacs may kill them or their output
@@ -146,21 +154,23 @@ variable settings override the usual ones.
146@node Compilation Mode 154@node Compilation Mode
147@section Compilation Mode 155@section Compilation Mode
148 156
149@findex compile-goto-error
150@cindex Compilation mode 157@cindex Compilation mode
151@cindex mode, Compilation 158@cindex mode, Compilation
152 The @samp{*compilation*} buffer uses a special major mode, Compilation 159 The @samp{*compilation*} buffer uses a special major mode,
153mode, whose main feature is to provide a convenient way to look at the 160Compilation mode, whose main feature is to provide a convenient way to
154source line where the error happened. 161visit the source line corresponding to an error message. These
162commands are also available in other special buffers that list
163locations in files, including those made by @kbd{M-x grep} and
164@kbd{M-x occur}.
155 165
156@table @kbd 166@table @kbd
157@item M-g M-n 167@item M-g M-n
158@itemx M-g n 168@itemx M-g n
159@itemx C-x ` 169@itemx C-x `
160Visit the locus of the next compiler error message or @code{grep} match. 170Visit the locus of the next error message or match.
161@item M-g M-p 171@item M-g M-p
162@itemx M-g p 172@itemx M-g p
163Visit the locus of the previous compiler error message or @code{grep} match. 173Visit the locus of the previous error message or match.
164@item @key{RET} 174@item @key{RET}
165Visit the locus of the error message that point is on. 175Visit the locus of the error message that point is on.
166This command is used in the compilation buffer. 176This command is used in the compilation buffer.
@@ -183,16 +193,17 @@ Toggle Next Error Follow minor mode, which makes cursor motion in the
183compilation buffer produce automatic source display. 193compilation buffer produce automatic source display.
184@end table 194@end table
185 195
186@kindex M-g M-n 196@findex compile-goto-error
187@kindex M-g n
188@kindex C-x `
189@findex next-error
190 You can visit the source for any particular error message by moving 197 You can visit the source for any particular error message by moving
191point in the @samp{*compilation*} buffer to that error message and 198point in the @samp{*compilation*} buffer to that error message and
192typing @key{RET} (@code{compile-goto-error}). Alternatively, you can 199typing @key{RET} (@code{compile-goto-error}). Alternatively, you can
193click @kbd{Mouse-2} on the error message; you need not switch to the 200click @kbd{Mouse-2} on the error message; you need not switch to the
194@samp{*compilation*} buffer first. 201@samp{*compilation*} buffer first.
195 202
203@kindex M-g M-n
204@kindex M-g n
205@kindex C-x `
206@findex next-error
196@vindex next-error-highlight 207@vindex next-error-highlight
197 To parse the compiler error messages sequentially, type @kbd{C-x `} 208 To parse the compiler error messages sequentially, type @kbd{C-x `}
198(@code{next-error}). The character following the @kbd{C-x} is the 209(@code{next-error}). The character following the @kbd{C-x} is the
@@ -203,27 +214,30 @@ location of the error in another window. It also momentarily
203highlights the relevant source line. You can change the behavior of 214highlights the relevant source line. You can change the behavior of
204this highlighting with the variable @code{next-error-highlight}. 215this highlighting with the variable @code{next-error-highlight}.
205 216
206 The first time @kbd{C-x `} is used after the start of a compilation, 217 The first time @w{@kbd{C-x `}} is used after the start of a compilation,
207it moves to the first error's location. Subsequent uses of @kbd{C-x `} 218it moves to the first error's location. Subsequent uses of @kbd{C-x
208advance down to subsequent errors. If you visit a specific error 219`} advance down to subsequent errors. If you visit a specific error
209message with @key{RET} or @kbd{Mouse-2}, subsequent @kbd{C-x `} 220message with @key{RET} or @kbd{Mouse-2}, subsequent @w{@kbd{C-x `}}
210commands advance from there. When @kbd{C-x `} gets to the end of the 221commands advance from there. When @w{@kbd{C-x `}} gets to the end of the
211buffer and finds no more error messages to visit, it fails and signals 222buffer and finds no more error messages to visit, it fails and signals
212an Emacs error. 223an Emacs error. @w{@kbd{C-u C-x `}} starts scanning from the beginning of
224the compilation buffer, and goes to the first error's location.
213 225
214@vindex compilation-skip-threshold 226@vindex compilation-skip-threshold
215 By default, @kbd{C-x `} skips less important messages. The variable 227 By default, @w{@kbd{C-x `}} skips less important messages. The variable
216@code{compilation-skip-threshold} controls this. If its value is 2, 228@code{compilation-skip-threshold} controls this. If its value is 2,
217@kbd{C-x `} skips anything less than error, 1 skips anything less 229@w{@kbd{C-x `}} skips anything less than error, 1 skips anything less
218than warning, and 0 doesn't skip any messages. 230than warning, and 0 doesn't skip any messages. The default is 1.
219 231
220When the left fringe is displayed, an arrow points to the 232 When the window has a left fringe, an arrow in the fringe points to
221current message in the compilation buffer. The variable 233the current message in the compilation buffer. The variable
222@code{compilation-context-lines} controls the number of lines of 234@code{compilation-context-lines} controls the number of lines of
223leading context in the window before the current message. If it is 235leading context to display before the current message. Going to an
224@code{nil} and the left fringe is displayed, the window doesn't 236error message location scrolls the @samp{*compilation*} buffer to put
225scroll. If there is no left fringe, no arrow is displayed and a value 237the message that far down from the top. The value @code{nil} is
226of @code{nil} means display the message at the top of the window. 238special: if there's a left fringe, the window doesn't scroll at all
239if the message is already visible. If there is no left fringe,
240@code{nil} means display the message at the top of the window.
227 241
228 If you're not in the compilation buffer when you run 242 If you're not in the compilation buffer when you run
229@code{next-error}, Emacs will look for a buffer that contains error 243@code{next-error}, Emacs will look for a buffer that contains error
@@ -233,9 +247,6 @@ then at the current buffer. Finally, Emacs looks at all the remaining
233buffers. @code{next-error} signals an error if it can't find any such 247buffers. @code{next-error} signals an error if it can't find any such
234buffer. 248buffer.
235 249
236 @kbd{C-u C-x `} starts scanning from the beginning of the compilation
237buffer. This is one way to process the same set of errors again.
238
239@vindex compilation-error-regexp-alist 250@vindex compilation-error-regexp-alist
240@vindex grep-regexp-alist 251@vindex grep-regexp-alist
241 To parse messages from the compiler, Compilation mode uses the 252 To parse messages from the compiler, Compilation mode uses the
@@ -280,28 +291,28 @@ files by FTP (@pxref{File Names}).
280@node Compilation Shell 291@node Compilation Shell
281@section Subshells for Compilation 292@section Subshells for Compilation
282 293
283 Emacs uses a shell to run the compilation command, but specifies 294 Emacs uses a shell to run the compilation command, but specifies the
284the option for a noninteractive shell. This means, in particular, that 295option for a noninteractive shell. This means, in particular, that
285the shell should start with no prompt. If you find your usual shell 296the shell should start with no prompt. If you find your usual shell
286prompt making an unsightly appearance in the @samp{*compilation*} 297prompt making an unsightly appearance in the @samp{*compilation*}
287buffer, it means you have made a mistake in your shell's init file by 298buffer, it means you have made a mistake in your shell's init file by
288setting the prompt unconditionally. (This init file's name may be 299setting the prompt unconditionally. (This init file's name may be
289@file{.bashrc}, @file{.profile}, @file{.cshrc}, @file{.shrc}, or various 300@file{.bashrc}, @file{.profile}, @file{.cshrc}, @file{.shrc}, or
290other things, depending on the shell you use.) The shell init file 301various other things, depending on the shell you use.) The shell init
291should set the prompt only if there already is a prompt. In csh, here 302file should set the prompt only if there already is a prompt. Here's
292is how to do it: 303how to do it in bash:
293 304
294@example 305@example
295if ($?prompt) set prompt = @dots{} 306if [ "$@{PS1+set@}" = set ]
307then PS1=@dots{}
308fi
296@end example 309@end example
297 310
298@noindent 311@noindent
299And here's how to do it in bash: 312And here's how to do it in csh:
300 313
301@example 314@example
302if [ "$@{PS1+set@}" = set ] 315if ($?prompt) set prompt = @dots{}
303then PS1=@dots{}
304fi
305@end example 316@end example
306 317
307 There may well be other things that your shell's init file 318 There may well be other things that your shell's init file
@@ -335,18 +346,18 @@ Kill the running @code{grep} subprocess.
335@end table 346@end table
336 347
337@findex grep 348@findex grep
338 To run @code{grep}, type @kbd{M-x grep}, then enter a command line that 349 To run @code{grep}, type @kbd{M-x grep}, then enter a command line
339specifies how to run @code{grep}. Use the same arguments you would give 350that specifies how to run @code{grep}. Use the same arguments you
340@code{grep} when running it normally: a @code{grep}-style regexp 351would give @code{grep} when running it normally: a @code{grep}-style
341(usually in single-quotes to quote the shell's special characters) 352regexp (usually in single-quotes to quote the shell's special
342followed by file names, which may use wildcards. If you specify a 353characters) followed by file names, which may use wildcards. If you
343prefix argument for @kbd{M-x grep}, it figures out the tag 354specify a prefix argument for @kbd{M-x grep}, it detects the tag
344(@pxref{Tags}) around point, and puts that into the default 355(@pxref{Tags}) around point, and puts that into the default
345@code{grep} command. 356@code{grep} command.
346 357
347 The output from @code{grep} goes in the @samp{*grep*} buffer. You 358 The output from @code{grep} goes in the @samp{*grep*} buffer. You
348can find the corresponding lines in the original files using @kbd{C-x 359can find the corresponding lines in the original files using @w{@kbd{C-x
349`}, @key{RET}, and so forth, just like compilation errors. 360`}}, @key{RET}, and so forth, just like compilation errors.
350 361
351 Some grep programs accept a @samp{--color} option to output special 362 Some grep programs accept a @samp{--color} option to output special
352markers around matches for the purpose of highlighting. You can make 363markers around matches for the purpose of highlighting. You can make
@@ -403,12 +414,11 @@ Flymake, flymake, The Flymake Manual}.
403@c Do you believe in GUD? 414@c Do you believe in GUD?
404The GUD (Grand Unified Debugger) library provides an interface to 415The GUD (Grand Unified Debugger) library provides an interface to
405various symbolic debuggers from within Emacs. We recommend the 416various symbolic debuggers from within Emacs. We recommend the
406debugger GDB, which is free software, but you can also run DBX, SDB or 417debugger GDB, which is free software, but GUD can also run DBX, SDB or
407XDB if you have them. GUD can also serve as an interface to Perl's 418XDB. GUD can also serve as an interface to Perl's debugging mode, the
408debugging mode, the Python debugger PDB, the bash debugger, and to 419Python debugger PDB, the Bash debugger, and to JDB, the Java Debugger.
409JDB, the Java Debugger. @xref{Debugging,, The Lisp Debugger, elisp, 420@xref{Debugging,, The Lisp Debugger, elisp, the Emacs Lisp Reference
410the Emacs Lisp Reference Manual}, for information on debugging Emacs 421Manual}, for information on debugging Emacs Lisp programs.
411Lisp programs.
412 422
413@menu 423@menu
414* Starting GUD:: How to start a debugger subprocess. 424* Starting GUD:: How to start a debugger subprocess.
@@ -429,24 +439,27 @@ to a particular debugger program.
429@table @kbd 439@table @kbd
430@item M-x gdb @key{RET} @var{file} @key{RET} 440@item M-x gdb @key{RET} @var{file} @key{RET}
431@findex gdb 441@findex gdb
432Run GDB as a subprocess of Emacs. By default, this operates in 442Run GDB as a subprocess of Emacs. By default, this uses an IDE-like
433graphical mode; @xref{GDB Graphical Interface}. Graphical mode 443graphical interface; see @ref{GDB Graphical Interface}. Only GDB
434does not support any other debuggers. 444works with the graphical interface.
435 445
436@item M-x dbx @key{RET} @var{file} @key{RET} 446@item M-x dbx @key{RET} @var{file} @key{RET}
437@findex dbx 447@findex dbx
438Similar, but run DBX instead of GDB. 448Run DBX as a subprocess of Emacs. Since Emacs does not implement a
449graphical interface for DBX, communication with DBX works by typing
450commands in the GUD interaction buffer. The same is true for all
451the other supported debuggers.
439 452
440@item M-x xdb @key{RET} @var{file} @key{RET} 453@item M-x xdb @key{RET} @var{file} @key{RET}
441@findex xdb 454@findex xdb
442@vindex gud-xdb-directories 455@vindex gud-xdb-directories
443Similar, but run XDB instead of GDB. Use the variable 456Similar, but run XDB. Use the variable
444@code{gud-xdb-directories} to specify directories to search for source 457@code{gud-xdb-directories} to specify directories to search for source
445files. 458files.
446 459
447@item M-x sdb @key{RET} @var{file} @key{RET} 460@item M-x sdb @key{RET} @var{file} @key{RET}
448@findex sdb 461@findex sdb
449Similar, but run SDB instead of GDB. 462Similar, but run SDB.
450 463
451 Some versions of SDB do not mention source file names in their 464 Some versions of SDB do not mention source file names in their
452messages. When you use them, you need to have a valid tags table 465messages. When you use them, you need to have a valid tags table
@@ -484,27 +497,25 @@ allowed. GUD assumes that the first argument not starting with a
484@subsection Debugger Operation 497@subsection Debugger Operation
485 498
486@cindex fringes, and current execution line in GUD 499@cindex fringes, and current execution line in GUD
487 When you run a debugger with GUD, the debugger uses an Emacs buffer 500 When you run a debugger with GUD using the textual interface, the
488for its ordinary input and output. This is called the GUD buffer. The 501debugger uses an Emacs buffer for its ordinary input and output. This
489debugger displays the source files of the program by visiting them in 502is called the GUD buffer. Input and output from the program you are
490Emacs buffers. An arrow (@samp{=>}) in one of these buffers indicates 503debugging also use this buffer.
491the current execution line.@footnote{Under a window system, the arrow 504
492appears in the left fringe of the Emacs window.} Moving point in this 505 The debugger displays the source files of the program by visiting
493buffer does not move the arrow. 506them in Emacs buffers. An arrow in the left fringe indicates the
507current execution line.@footnote{On a text-only terminal, the arrow
508appears as @samp{=>} and overlays the first two text columns.} Moving
509point in this buffer does not move the arrow. The arrow is not part
510of the file's text; it appears only on the screen.
494 511
495 You can start editing these source files at any time in the buffers 512 You can start editing these source files at any time in the buffers
496that display them. The arrow is not part of the file's 513that display them. If you do modify a source file, keep in mind that
497text; it appears only on the screen. If you do modify a source file, 514inserting or deleting lines will throw off the arrow's positioning;
498keep in mind that inserting or deleting lines will throw off the arrow's 515GUD has no way of figuring out which line corresponded before your
499positioning; GUD has no way of figuring out which line corresponded 516changes to the line number in a debugger message. Also, you'll
500before your changes to the line number in a debugger message. Also, 517typically have to recompile and restart the program for your changes
501you'll typically have to recompile and restart the program for your 518to be reflected in the debugger's tables.
502changes to be reflected in the debugger's tables.
503
504 If you wish, you can control your debugger process entirely through the
505debugger buffer, which uses a variant of Shell mode. All the usual
506commands for your debugger are available, and you can use the Shell mode
507history commands to repeat them. @xref{Shell Mode}.
508 519
509@cindex tooltips with GUD 520@cindex tooltips with GUD
510@vindex tooltip-gud-modes 521@vindex tooltip-gud-modes
@@ -521,23 +532,30 @@ the list @code{gud-tooltip-modes}. If the variable
521@code{gud-tooltip-echo-area} is non-@code{nil} then the variable's 532@code{gud-tooltip-echo-area} is non-@code{nil} then the variable's
522value is displayed in the echo area. 533value is displayed in the echo area.
523 534
524With GDB in text command mode (@pxref{GDB Graphical Interface}), 535 GUD tooltips are disabled when you use GDB in text command mode
525it is possible that use of GUD tooltips can cause a function to be 536(@pxref{GDB Graphical Interface}), because displaying an expression's
526called with harmful side-effects. In this case, Emacs disables 537value in GDB can sometimes expand a macro and result in a side effect
527them. 538that interferes with the program's operation. The GDB graphical
539interface supports GUD tooltips and assures they will not cause side
540effects.
528 541
529@node Commands of GUD 542@node Commands of GUD
530@subsection Commands of GUD 543@subsection Commands of GUD
531 544
532 The GUD interaction buffer uses a variant of Shell mode, so the 545 The GUD interaction buffer uses a variant of Shell mode, so the
533commands of Shell mode are available (@pxref{Shell Mode}). GUD mode 546Emacs commands of Shell mode are available (@pxref{Shell Mode}). All
534also provides commands for setting and clearing breakpoints, for 547the usual commands for your debugger are available, and you can use
535selecting stack frames, and for stepping through the program. These 548the Shell mode history commands to repeat them. If you wish, you can
536commands are available both in the GUD buffer and globally, but with 549control your debugger process entirely through this buffer.
537different key bindings. It also has its own tool bar from which you 550
538can invoke the more common commands by clicking on the appropriate 551 GUD mode also provides commands for setting and clearing
539icon. This is particularly useful for repetitive commands like 552breakpoints, for selecting stack frames, and for stepping through the
540gud-next and gud-step and allows the user to hide the GUD buffer. 553program. These commands are available both in the GUD buffer and
554globally, but with different key bindings. It also has its own tool
555bar from which you can invoke the more common commands by clicking on
556the appropriate icon. This is particularly useful for repetitive
557commands like @code{gud-next} and @code{gud-step}, and allows you to
558keep the GUD buffer hidden.
541 559
542 The breakpoint commands are normally used in source file buffers, 560 The breakpoint commands are normally used in source file buffers,
543because that is the easiest way to specify where to set or clear the 561because that is the easiest way to specify where to set or clear the
@@ -550,7 +568,7 @@ Set a breakpoint on the source line that point is on.
550@end table 568@end table
551 569
552@kindex C-x C-a @r{(GUD)} 570@kindex C-x C-a @r{(GUD)}
553 Here are the other special commands provided by GUD. The keys 571 Here are the other special commands provided by GUD@. The keys
554starting with @kbd{C-c} are available only in the GUD interaction 572starting with @kbd{C-c} are available only in the GUD interaction
555buffer. The key bindings that start with @kbd{C-x C-a} are available in 573buffer. The key bindings that start with @kbd{C-x C-a} are available in
556the GUD interaction buffer and also in source files. 574the GUD interaction buffer and also in source files.
@@ -606,9 +624,9 @@ buffer, it applies to the line where the program last stopped.
606@kindex C-c C-t @r{(GUD)} 624@kindex C-c C-t @r{(GUD)}
607@itemx C-x C-a C-t 625@itemx C-x C-a C-t
608@findex gud-tbreak 626@findex gud-tbreak
609Set a temporary breakpoint on the current source line, if any. 627Set a temporary breakpoint on the current source line, if any
610If you use this command in the GUD interaction buffer, 628(@code{gud-tbreak}). If you use this command in the GUD interaction
611it applies to the line where the program last stopped. 629buffer, it applies to the line where the program last stopped.
612@end table 630@end table
613 631
614 The above commands are common to all supported debuggers. If you are 632 The above commands are common to all supported debuggers. If you are
@@ -620,14 +638,14 @@ using GDB or (some versions of) DBX, these additional commands are available:
620@itemx C-x C-a < 638@itemx C-x C-a <
621@findex gud-up 639@findex gud-up
622Select the next enclosing stack frame (@code{gud-up}). This is 640Select the next enclosing stack frame (@code{gud-up}). This is
623equivalent to the @samp{up} command. 641equivalent to the GDB command @samp{up}.
624 642
625@item C-c > 643@item C-c >
626@kindex C-c > @r{(GUD)} 644@kindex C-c > @r{(GUD)}
627@itemx C-x C-a > 645@itemx C-x C-a >
628@findex gud-down 646@findex gud-down
629Select the next inner stack frame (@code{gud-down}). This is 647Select the next inner stack frame (@code{gud-down}). This is
630equivalent to the @samp{down} command. 648equivalent to the GDB command @samp{down}.
631@end table 649@end table
632 650
633 If you are using GDB, these additional key bindings are available: 651 If you are using GDB, these additional key bindings are available:
@@ -643,29 +661,28 @@ Start execution of the program (@code{gud-run}).
643@kindex C-c C-u @r{(GUD)} 661@kindex C-c C-u @r{(GUD)}
644@itemx C-x C-a C-u 662@itemx C-x C-a C-u
645@findex gud-until 663@findex gud-until
646Continue execution to the current line. The program will run until 664Continue execution to the current line (@code{gud-until}). The
647it hits a breakpoint, terminates, gets a signal that the debugger is 665program will run until it hits a breakpoint, terminates, gets a signal
648checking for, or reaches the line on which the cursor currently sits 666that the debugger is checking for, or reaches the line on which the
649(@code{gud-until}). 667cursor currently sits.
650 668
651@item @key{TAB} 669@item @key{TAB}
652@kindex TAB @r{(GUD)} 670@kindex TAB @r{(GUD)}
653@findex gud-gdb-complete-command 671@findex gud-gdb-complete-command
654With GDB, complete a symbol name (@code{gud-gdb-complete-command}). 672With GDB, complete a symbol name (@code{gud-gdb-complete-command}).
655This key is available only in the GUD interaction buffer, and requires 673This key is available only in the GUD interaction buffer.
656GDB versions 4.13 and later.
657 674
658@item C-c C-f 675@item C-c C-f
659@kindex C-c C-f @r{(GUD)} 676@kindex C-c C-f @r{(GUD)}
660@itemx C-x C-a C-f 677@itemx C-x C-a C-f
661@findex gud-finish 678@findex gud-finish
662Run the program until the selected stack frame returns (or until it 679Run the program until the selected stack frame returns or
663stops for some other reason). 680stops for some other reason (@code{gud-finish}).
664 681
665@item C-x C-a C-j 682@item C-x C-a C-j
666@kindex C-x C-a C-j @r{(GUD)} 683@kindex C-x C-a C-j @r{(GUD)}
667@findex gud-jump 684@findex gud-jump
668Only useful in a source buffer, (@code{gud-jump}) transfers the 685Only useful in a source buffer, @code{gud-jump} transfers the
669program's execution point to the current line. In other words, the 686program's execution point to the current line. In other words, the
670next line that the program executes will be the one where you gave the 687next line that the program executes will be the one where you gave the
671command. If the new execution line is in a different function from 688command. If the new execution line is in a different function from
@@ -691,11 +708,13 @@ Instead, type @kbd{C-q @key{TAB}} to enter a tab.
691@vindex perldb-mode-hook 708@vindex perldb-mode-hook
692@vindex pdb-mode-hook 709@vindex pdb-mode-hook
693@vindex jdb-mode-hook 710@vindex jdb-mode-hook
711@vindex bashdb-mode-hook
694 On startup, GUD runs one of the following hooks: @code{gdb-mode-hook}, 712 On startup, GUD runs one of the following hooks: @code{gdb-mode-hook},
695if you are using GDB; @code{dbx-mode-hook}, if you are using DBX; 713if you are using GDB; @code{dbx-mode-hook}, if you are using DBX;
696@code{sdb-mode-hook}, if you are using SDB; @code{xdb-mode-hook}, if you 714@code{sdb-mode-hook}, if you are using SDB; @code{xdb-mode-hook}, if you
697are using XDB; @code{perldb-mode-hook}, for Perl debugging mode; 715are using XDB; @code{perldb-mode-hook}, for Perl debugging mode;
698@code{pdb-mode-hook}, for PDB; @code{jdb-mode-hook}, for JDB. You can 716@code{pdb-mode-hook}, for PDB; @code{jdb-mode-hook}, for JDB;
717@code{bashdb-mode-hook}, for the Bash debugger. You can
699use these hooks to define custom key bindings for the debugger 718use these hooks to define custom key bindings for the debugger
700interaction buffer. @xref{Hooks}. 719interaction buffer. @xref{Hooks}.
701 720
@@ -750,37 +769,37 @@ ignores any numeric argument.
750@node GDB Graphical Interface 769@node GDB Graphical Interface
751@subsection GDB Graphical Interface 770@subsection GDB Graphical Interface
752 771
753@findex gdb-mouse-set-clear-breakpoint
754@findex gdb-mouse-toggle-breakpoint
755 By default, the command @code{gdb} starts GDB using a graphical 772 By default, the command @code{gdb} starts GDB using a graphical
756interface where you view and control the program's data using Emacs 773interface, using Emacs windows for display program state information.
757windows. You can still interact with GDB through the GUD buffer, but 774In effect, this makes Emacs into an IDE (interactive development
758the point of this mode is that you can do it through menus and clicks, 775environment). With it, you do not need to use textual GDB commands;
759without needing to know GDB commands. For example, you can click 776you can control the debugging session with the mouse.
760@kbd{Mouse-1} in the fringe or display margin of a source buffer to 777
761set a breakpoint there and, on a graphical display, a red bullet will 778@c @findex gdb-mouse-set-clear-breakpoint
762appear. If a breakpoint already exists on that line, this action will 779@c @findex gdb-mouse-toggle-breakpoint
763remove it. You can also enable or disable a breakpoint by clicking 780 For example, you can click @kbd{Mouse-1} in the fringe or display
764@kbd{Mouse-3} on the bullet. If you drag the debugger arrow in the 781margin of a source buffer to set a breakpoint there and, on a
765fringe with @kbd{Mouse-1}, execution will continue to the line where 782graphical display, a red bullet will appear on that line. If a
766you release the button, provided it is still in the same frame 783breakpoint already exists on that line, the same click will remove it.
767(@code{gdb-mouse-until}). Alternatively, you can click @kbd{Mouse-2} 784You can also enable or disable a breakpoint by clicking @kbd{Mouse-3}
768at some point in the fringe of this buffer and execution will advance 785on the bullet. If you drag the debugger arrow in the fringe with
769to there. 786@kbd{Mouse-1} (@code{gdb-mouse-until}), execution will continue to the
770 787line where you release the button, provided it is still in the same
771This mode requires that GDB think that the screen size is unlimited, 788frame. Alternatively, you can click @kbd{Mouse-2} at some point in
772and sets the height and width accordingly. For correct operation it 789the fringe of this buffer and execution will advance to there.
773is important that you don't change these values during the session. 790
791 This mode requires telling GDB that its ``screen size'' is
792unlimited, so it sets the height and width accordingly. For correct
793operation you must not change these values during the GDB session.
774 794
775@vindex gud-gdb-command-name 795@vindex gud-gdb-command-name
776@findex gdba 796@findex gdba
777 You can also run GDB in text command mode, which creates a buffer 797 You can also run GDB in text command mode, like other debuggers. To
778for input and output to GDB. To do this, set 798do this, set @code{gud-gdb-command-name} to @code{"gdb --fullname"} or
779@code{gud-gdb-command-name} to @code{"gdb --fullname"} or edit the 799edit the startup command in the minibuffer to say that. You need to
780startup command in the minibuffer to say that. You need to do use 800do use text command mode to run multiple debugging sessions within one
781text command mode to run multiple debugging sessions within one Emacs 801Emacs session. If you have customized @code{gud-gdb-command-name} in
782session. If you have customized @code{gud-gdb-command-name} in that 802that way, you can use @kbd{M-x gdba} to invoke GDB in graphical mode.
783way, then you can use @kbd{M-x gdba} to invoke GDB in graphical mode.
784 803
785@menu 804@menu
786* GDB User Interface Layout:: Control the number of displayed buffers. 805* GDB User Interface Layout:: Control the number of displayed buffers.
@@ -795,19 +814,16 @@ way, then you can use @kbd{M-x gdba} to invoke GDB in graphical mode.
795@subsubsection GDB User Interface Layout 814@subsubsection GDB User Interface Layout
796@cindex GDB User Interface layout 815@cindex GDB User Interface layout
797 816
798@findex gdb-many-windows
799@vindex gdb-many-windows 817@vindex gdb-many-windows
818 If the variable @code{gdb-many-windows} is @code{nil} (the default
819value) then @kbd{M-x gdb} normally displays only the GUD buffer.
820However, if the variable @code{gdb-show-main} is also non-@code{nil},
821it starts with two windows: one displaying the GUD buffer, and the
822other showing the source for the @code{main} function of the program
823you are debugging.
800 824
801If the variable @code{gdb-many-windows} is @code{nil} (the default 825 If @code{gdb-many-windows} is non-@code{nil}, then @kbd{M-x gdb}
802value) then gdb just pops up the GUD buffer unless the variable 826displays the following frame layout:
803@code{gdb-show-main} is non-@code{nil}. In this case it starts with
804two windows: one displaying the GUD buffer and the other with the
805source file with the main routine of the inferior.
806
807If @code{gdb-many-windows} is non-@code{nil}, regardless of the value of
808@code{gdb-show-main}, the layout below will appear unless
809@code{gdb-use-inferior-io-buffer} is @code{nil}. In this case the
810source buffer occupies the full width of the frame.
811 827
812@example 828@example
813+--------------------------------+--------------------------------+ 829+--------------------------------+--------------------------------+
@@ -825,121 +841,131 @@ source buffer occupies the full width of the frame.
825+--------------------------------+--------------------------------+ 841+--------------------------------+--------------------------------+
826@end example 842@end example
827 843
828To toggle this layout, do @kbd{M-x gdb-many-windows}. 844 However, if @code{gdb-use-inferior-io-buffer} is @code{nil}, the I/O
845buffer does not appear and the source buffer occupies the full width
846of the frame.
829 847
830@findex gdb-restore-windows 848@findex gdb-restore-windows
831If you change the window layout, for example, while editing and 849 If you change the window layout, for example, while editing and
832re-compiling your program, then you can restore it with the command 850re-compiling your program, then you can restore this standard window
833@code{gdb-restore-windows}. 851layout with the command @code{gdb-restore-windows}.
834 852
835You may also choose which additional buffers you want to display, 853@findex gdb-many-windows
836either in the same frame or a different one. Select them from 854 To switch between this standard layout and a simple layout
837@samp{GUD->GDB-windows} or @samp{GUD->GDB-Frames} sub-menu 855containing just the GUD buffer and a source file, type @kbd{M-x
838respectively. If the menu-bar is unavailable, type @code{M-x 856gdb-many-windows}.
857
858 You may also specify additional GUD-related buffers to display,
859either in the same frame or a different one. Select the buffers you
860want with the @samp{GUD->GDB-windows} and @samp{GUD->GDB-Frames}
861sub-menus. If the menu-bar is unavailable, type @code{M-x
839gdb-display-@var{buffertype}-buffer} or @code{M-x 862gdb-display-@var{buffertype}-buffer} or @code{M-x
840gdb-frame-@var{buffertype}-buffer} respectively, where 863gdb-frame-@var{buffertype}-buffer} respectively, where
841@var{buffertype} is the relevant buffer type e.g breakpoints. 864@var{buffertype} is the relevant buffer type, such as
842Most of these buffers are read-only and be killed by simply 865@samp{breakpoints}. Most of these buffers are read-only, and typing
843pressing @kbd{q} in them. 866@kbd{q} in them kills them.
844 867
845When you finish debugging then kill the GUD buffer with @kbd{C-x k}, 868 When you finish debugging, kill the GUD buffer with @kbd{C-x k},
846which will also kill all the buffers associated with the session. 869which will also kill all the buffers associated with the session.
847However you need not do this if, after editing and re-compiling your 870However you need not do this if, after editing and re-compiling your
848source code within Emacs, you wish continue debugging. When you 871source code within Emacs, you wish continue debugging. When you
849restart execution, GDB will automatically find your new executable. 872restart execution, GDB will automatically find your new executable.
850Keeping the GUD buffer has the advantage of keeping the shell history 873Keeping the GUD buffer has the advantage of keeping the shell history
851as well as GDB's breakpoints. You need to check, however, that the 874as well as GDB's breakpoints. You do need to check that the
852breakpoints in the recently edited code are still where you want them. 875breakpoints in recently edited source files are still in the right
876places.
853 877
854@node Breakpoints Buffer 878@node Breakpoints Buffer
855@subsubsection Breakpoints Buffer 879@subsubsection Breakpoints Buffer
856 880
857The breakpoints buffer shows the existing breakpoints and watchpoints 881 The breakpoints buffer shows the existing breakpoints and
858(@pxref{Breakpoints,,, gdb, The GNU debugger}). It has three special 882watchpoints (@pxref{Breakpoints,,, gdb, The GNU debugger}). It has
859commands: 883these special commands, which mostly apply to the @dfn{current
884breakpoint}, the breakpoint which point is on.
860 885
861@table @kbd 886@table @kbd
862@item @key{SPC} 887@item @key{SPC}
863@kindex SPC @r{(GDB breakpoints buffer)} 888@kindex SPC @r{(GDB breakpoints buffer)}
864@findex gdb-toggle-breakpoint 889@findex gdb-toggle-breakpoint
865Enable/disable the breakpoint at the current line 890Enable/disable the current breakpoint (@code{gdb-toggle-breakpoint}).
866(@code{gdb-toggle-breakpoint}). On a graphical display, this changes 891On a graphical display, this changes the color of a bullet in the
867the color of a bullet in the margin of the source buffer at the 892margin of the source buffer at the relevant line. This is red when
868relevant line. This is red when the breakpoint is enabled and grey 893the breakpoint is enabled and grey when it is disabled. Text-only
869when it is disabled. Text-only terminals correspondingly display 894terminals correspondingly display a @samp{B} or @samp{b}.
870a @samp{B} or @samp{b}.
871 895
872@item D 896@item D
873@kindex D @r{(GDB breakpoints buffer)} 897@kindex D @r{(GDB breakpoints buffer)}
874@findex gdb-delete-breakpoint 898@findex gdb-delete-breakpoint
875Delete the breakpoint at the current line (@code{gdb-delete-breakpoint}). 899Delete the current breakpoint (@code{gdb-delete-breakpoint}).
876 900
877@item @key{RET} 901@item @key{RET}
878@kindex RET @r{(GDB breakpoints buffer)} 902@kindex RET @r{(GDB breakpoints buffer)}
879@findex gdb-goto-breakpoint 903@findex gdb-goto-breakpoint
880Display the file in the source buffer at the breakpoint specified at 904Visit the source line for the current breakpoint
881the current line (@code{gdb-goto-breakpoint}). Alternatively, click 905(@code{gdb-goto-breakpoint}).
882@kbd{Mouse-2} on the breakpoint that you wish to visit. 906
907@item Mouse-2
908@kindex Mouse-2 @r{(GDB breakpoints buffer)}
909Visit the source line for the breakpoint you click on.
883@end table 910@end table
884 911
885@node Stack Buffer 912@node Stack Buffer
886@subsubsection Stack Buffer 913@subsubsection Stack Buffer
887 914
888The stack buffer displays a @dfn{call stack}, with one line for each 915 The stack buffer displays a @dfn{call stack}, with one line for each
889of the nested subroutine calls (@dfn{stack frames}) now active in the 916of the nested subroutine calls (@dfn{stack frames}) now active in the
890program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}. 917program. @xref{Backtrace,, Backtraces, gdb, The GNU debugger}.
891 918
892@findex gdb-frames-select 919@findex gdb-frames-select
893The selected frame number is displayed in reverse contrast. Move 920 The selected frame number is displayed in reverse contrast. To
894point to any frame in the stack and type @key{RET} to select it 921select a frame in GDB, move point in the stack buffer to that stack
895(@code{gdb-frames-select}) and display the associated source in the 922frame and type @key{RET} (@code{gdb-frames-select}), or click
896source buffer. Alternatively, click @kbd{Mouse-2} on a frame to 923@kbd{Mouse-2} on a stack frame. If the locals buffer is visible,
897select it. If the locals buffer is displayed then its contents update 924selecting a stack frame updates it to display the local variables of
898to display the variables that are local to the new frame. 925the new frame.
899 926
900@node Watch Expressions 927@node Watch Expressions
901@subsubsection Watch Expressions 928@subsubsection Watch Expressions
902@cindex Watching expressions in GDB 929@cindex Watching expressions in GDB
903 930
904@findex gud-watch 931@findex gud-watch
905If you want to see how a variable changes each time your program stops 932 If you want to see how a variable changes each time your program
906then place the cursor over the variable name and click on the watch 933stops, move point into the variable name and click on the watch icon
907icon in the tool bar (@code{gud-watch}). 934in the tool bar (@code{gud-watch}).
908 935
909Each watch expression is displayed in the speedbar. Complex data 936 Each watch expression is displayed in the speedbar. Complex data
910types, such as arrays, structures and unions are represented in a tree 937types, such as arrays, structures and unions are represented in a tree
911format. Leaves and simple data types show the name of the expression 938format. Leaves and simple data types show the name of the expression
912and its value, and display the type as a tooltip. Higher levels show 939and its value, and display the type as a tooltip. Higher levels show
913the name, type and address value for pointers and just the name and 940the name, type and address value for pointers and just the name and
914type otherwise. 941type otherwise.
915 942
916To expand or contract a complex data type, click @kbd{Mouse-2} 943 To expand or contract a complex data type, click @kbd{Mouse-2}
917on the tag to the left of the expression. 944on the tag to the left of the expression.
918 945
919@findex gdb-var-delete 946@findex gdb-var-delete
920With the cursor over the root expression of a complex data type, type 947 To delete a complex watch expression, move point to the root
921@kbd{D} to delete it from the speedbar 948expression in the speedbar and type @kbd{D} (@code{gdb-var-delete}).
922(@code{gdb-var-delete}).
923 949
924@kindex RET @r{(GDB speedbar)} 950@kindex RET @r{(GDB speedbar)}
925@findex gdb-edit-value 951@findex gdb-edit-value
926With the cursor over a simple data type or an element of a complex 952 To edit a variable with a simple data type, or a simple element of a
927data type which holds a value, type @key{RET} or click @kbd{Mouse-2} to edit 953complex data type, move point there in the speedbar and type @key{RET}
928its value. A prompt for a new value appears in the mini-buffer 954(@code{gdb-edit-value}). Or you can click @kbd{Mouse-2} on a value to
929(@code{gdb-edit-value}). 955edit it. Either way, this reads the new value using the minibuffer.
930 956
931@vindex gdb-show-changed-values 957@vindex gdb-show-changed-values
932If you set the variable @code{gdb-show-changed-values} to 958 If you set the variable @code{gdb-show-changed-values} to
933non-@code{nil} (the default value), Emacs will use 959non-@code{nil} (the default value), Emacs uses
934font-lock-warning-face to display values that have recently changed in 960@code{font-lock-warning-face} to highlight values that have recently
935the speedbar. 961changed.
936 962
937@vindex gdb-use-colon-colon-notation 963@vindex gdb-use-colon-colon-notation
938If you set the variable @code{gdb-use-colon-colon-notation} to a 964 If the variable @code{gdb-use-colon-colon-notation} is
939non-@code{nil} value then, in C, Emacs will use the 965non-@code{nil}, Emacs uses the @samp{@var{function}::@var{variable}}
940@var{function}::@var{variable} format to display variables in the 966format to display variables in the speedbar. Since this does not work
941speedbar. Since this does not work for variables defined in compound 967for variables defined in compound statements, the default value is
942statements, the default value is @code{nil}. 968@code{nil}.
943 969
944@node Other GDB User Interface Buffers 970@node Other GDB User Interface Buffers
945@subsubsection Other Buffers 971@subsubsection Other Buffers
@@ -949,8 +975,9 @@ statements, the default value is @code{nil}.
949@vindex gdb-use-inferior-io-buffer 975@vindex gdb-use-inferior-io-buffer
950If the variable @code{gdb-use-inferior-io-buffer} is non-@code{nil}, 976If the variable @code{gdb-use-inferior-io-buffer} is non-@code{nil},
951the executable program that is being debugged takes its input and 977the executable program that is being debugged takes its input and
952displays its output here, otherwise it uses the GUD buffer. To toggle 978displays its output here. Otherwise it uses the GUD buffer for that.
953the use of this buffer, do @kbd{M-x gdb-use-inferior-io-buffer}. 979To toggle the use of this buffer, do @kbd{M-x
980gdb-use-inferior-io-buffer}.
954 981
955Some of the commands from shell mode are available here. @xref{Shell 982Some of the commands from shell mode are available here. @xref{Shell
956Mode}. 983Mode}.
@@ -972,15 +999,15 @@ The registers buffer displays the values held by the registers
972(@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or 999(@pxref{Registers,,, gdb, The GNU debugger}). Press @key{RET} or
973click @kbd{Mouse-2} on a register if you want to change its value. 1000click @kbd{Mouse-2} on a register if you want to change its value.
974With GDB 6.4 or later, recently changed register values display with 1001With GDB 6.4 or later, recently changed register values display with
975font-lock-warning-face. With earlier versions of GDB, you can press 1002@code{font-lock-warning-face}. With earlier versions of GDB, you can
976@key{SPC} to toggle the display of floating point registers 1003press @key{SPC} to toggle the display of floating point registers
977(@code{toggle-gdb-all-registers}). 1004(@code{toggle-gdb-all-registers}).
978 1005
979@item Assembler Buffer 1006@item Assembler Buffer
980The assembler buffer displays the current frame as machine code. An 1007The assembler buffer displays the current frame as machine code. An
981overlay arrow points to the current instruction and you can set and 1008arrow points to the current instruction, and you can set and remove
982remove breakpoints as with the source buffer. Breakpoint icons also 1009breakpoints as in a source buffer. Breakpoint icons also appear in
983appear in the fringe or margin. 1010the fringe or margin.
984 1011
985@item Threads Buffer 1012@item Threads Buffer
986@findex gdb-threads-select 1013@findex gdb-threads-select
@@ -990,15 +1017,15 @@ threads, gdb, The GNU debugger}). Move point to any thread in the
990list and press @key{RET} to select it (@code{gdb-threads-select}) and 1017list and press @key{RET} to select it (@code{gdb-threads-select}) and
991display the associated source in the source buffer. Alternatively, 1018display the associated source in the source buffer. Alternatively,
992click @kbd{Mouse-2} on a thread to select it. If the locals buffer is 1019click @kbd{Mouse-2} on a thread to select it. If the locals buffer is
993displayed then its contents update to display the variables that are 1020visible, its contents update to display the variables that are local
994local to the new thread. 1021in the new thread.
995 1022
996@item Memory Buffer 1023@item Memory Buffer
997The memory buffer allows the user to examine sections of program 1024The memory buffer lets you examine sections of program memory
998memory (@pxref{Memory, Memory, Examining memory, gdb, The GNU 1025(@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}).
999debugger}). Click @kbd{Mouse-1} on the appropriate part of the header 1026Click @kbd{Mouse-1} on the appropriate part of the header line to
1000line to change the starting address or number of data items that the 1027change the starting address or number of data items that the buffer
1001buffer displays. Click @kbd{Mouse-3} on the header line to select the 1028displays. Click @kbd{Mouse-3} on the header line to select the
1002display format or unit size for these data items. 1029display format or unit size for these data items.
1003 1030
1004@end table 1031@end table
@@ -1045,6 +1072,14 @@ available globally. @xref{Programs}.
1045conventionally end in @file{.el}. This ending tells Emacs to edit them in 1072conventionally end in @file{.el}. This ending tells Emacs to edit them in
1046Emacs-Lisp mode (@pxref{Executing Lisp}). 1073Emacs-Lisp mode (@pxref{Executing Lisp}).
1047 1074
1075@cindex byte code
1076 Emacs Lisp code can be compiled into byte-code, which loads faster,
1077takes up less space, and executes faster. @xref{Byte Compilation,,
1078Byte Compilation, elisp, the Emacs Lisp Reference Manual}. By
1079convention, the compiled code for a library goes in a separate file
1080whose name ends in @samp{.elc}. Thus, the compiled code for
1081@file{foo.el} goes in @file{foo.elc}.
1082
1048@findex load-file 1083@findex load-file
1049 To execute a file of Emacs Lisp code, use @kbd{M-x load-file}. This 1084 To execute a file of Emacs Lisp code, use @kbd{M-x load-file}. This
1050command reads a file name using the minibuffer and then executes the 1085command reads a file name using the minibuffer and then executes the
@@ -1055,9 +1090,9 @@ not text in an Emacs buffer.
1055@findex load 1090@findex load
1056@findex load-library 1091@findex load-library
1057 Once a file of Lisp code is installed in the Emacs Lisp library 1092 Once a file of Lisp code is installed in the Emacs Lisp library
1058directories, users can load it using @kbd{M-x load-library}. Programs can 1093directories, users can load it using @kbd{M-x load-library}. Programs
1059load it by calling @code{load-library}, or with @code{load}, a more primitive 1094can load it by calling @code{load}, a more primitive function that is
1060function that is similar but accepts some additional arguments. 1095similar but accepts some additional arguments.
1061 1096
1062 @kbd{M-x load-library} differs from @kbd{M-x load-file} in that it 1097 @kbd{M-x load-library} differs from @kbd{M-x load-file} in that it
1063searches a sequence of directories and tries three file names in each 1098searches a sequence of directories and tries three file names in each
@@ -1068,9 +1103,11 @@ the result of compiling @file{@var{lib}.el}; it is better to load the
1068compiled file, since it will load and run faster. 1103compiled file, since it will load and run faster.
1069 1104
1070 If @code{load-library} finds that @file{@var{lib}.el} is newer than 1105 If @code{load-library} finds that @file{@var{lib}.el} is newer than
1071@file{@var{lib}.elc} file, it issues a warning, because it's likely that 1106@file{@var{lib}.elc} file, it issues a warning, because it's likely
1072somebody made changes to the @file{.el} file and forgot to recompile 1107that somebody made changes to the @file{.el} file and forgot to
1073it. 1108recompile it. Nonetheless, it loads @file{@var{lib}.elc}. This is
1109because people often leave unfinished edits the source file, and don't
1110recompile it until they think it is ready to use.
1074 1111
1075 Because the argument to @code{load-library} is usually not in itself 1112 Because the argument to @code{load-library} is usually not in itself
1076a valid file name, file name completion is not available. Indeed, when 1113a valid file name, file name completion is not available. Indeed, when
@@ -1080,7 +1117,7 @@ will be used.
1080@vindex load-path 1117@vindex load-path
1081 The sequence of directories searched by @kbd{M-x load-library} is 1118 The sequence of directories searched by @kbd{M-x load-library} is
1082specified by the variable @code{load-path}, a list of strings that are 1119specified by the variable @code{load-path}, a list of strings that are
1083directory names. The default value of the list contains the directory where 1120directory names. The default value of the list contains the directories where
1084the Lisp code for Emacs itself is stored. If you have libraries of 1121the Lisp code for Emacs itself is stored. If you have libraries of
1085your own, put them in a single directory and add that directory 1122your own, put them in a single directory and add that directory
1086to @code{load-path}. @code{nil} in this list stands for the current default 1123to @code{load-path}. @code{nil} in this list stands for the current default
@@ -1096,15 +1133,6 @@ library. Trying to run any of those commands calls @code{load} to load
1096the library; this replaces the autoload definitions with the real ones 1133the library; this replaces the autoload definitions with the real ones
1097from the library. 1134from the library.
1098 1135
1099@cindex byte code
1100 Emacs Lisp code can be compiled into byte-code which loads faster,
1101takes up less space when loaded, and executes faster. @xref{Byte
1102Compilation,, Byte Compilation, elisp, the Emacs Lisp Reference Manual}.
1103By convention, the compiled code for a library goes in a separate file
1104whose name consists of the library source file with @samp{c} appended.
1105Thus, the compiled code for @file{foo.el} goes in @file{foo.elc}.
1106That's why @code{load-library} searches for @samp{.elc} files first.
1107
1108@vindex load-dangerous-libraries 1136@vindex load-dangerous-libraries
1109@cindex Lisp files byte-compiled by XEmacs 1137@cindex Lisp files byte-compiled by XEmacs
1110 By default, Emacs refuses to load compiled Lisp files which were 1138 By default, Emacs refuses to load compiled Lisp files which were
@@ -1217,7 +1245,7 @@ The customizable variables @code{eval-expression-print-level} and
1217of lists to print in the result of the evaluation commands before 1245of lists to print in the result of the evaluation commands before
1218abbreviating them. @code{eval-expression-debug-on-error} controls 1246abbreviating them. @code{eval-expression-debug-on-error} controls
1219whether evaluation errors invoke the debugger when these commands are 1247whether evaluation errors invoke the debugger when these commands are
1220used. 1248used; its default is @code{t}.
1221 1249
1222@node Lisp Interaction 1250@node Lisp Interaction
1223@section Lisp Interaction Buffers 1251@section Lisp Interaction Buffers
@@ -1279,9 +1307,9 @@ mode.
1279 1307
1280@findex lisp-mode 1308@findex lisp-mode
1281 For the source files of programs to run in external Lisps, use Lisp 1309 For the source files of programs to run in external Lisps, use Lisp
1282mode. This mode can be selected with @kbd{M-x lisp-mode}, and is used 1310mode. You can switch to this mode with @kbd{M-x lisp-mode}, and it is
1283automatically for files whose names end in @file{.l}, @file{.lsp}, or 1311used automatically for files whose names end in @file{.l},
1284@file{.lisp}, as most Lisp systems usually expect. 1312@file{.lsp}, or @file{.lisp}.
1285 1313
1286@kindex C-M-x @r{(Lisp mode)} 1314@kindex C-M-x @r{(Lisp mode)}
1287@findex lisp-eval-defun 1315@findex lisp-eval-defun
@@ -1292,12 +1320,13 @@ which finds the defun around or following point and sends it as input to
1292the Lisp process. (Emacs can send input to any inferior process regardless 1320the Lisp process. (Emacs can send input to any inferior process regardless
1293of what buffer is current.) 1321of what buffer is current.)
1294 1322
1295 Contrast the meanings of @kbd{C-M-x} in Lisp mode (for editing programs 1323 Contrast the meanings of @kbd{C-M-x} in Lisp mode (for editing
1296to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp 1324programs to be run in another Lisp system) and Emacs-Lisp mode (for
1297programs to be run in Emacs): in both modes it has the effect of installing 1325editing Lisp programs to be run in Emacs; see @pxref{Lisp Eval}): in
1298the function definition that point is in, but the way of doing so is 1326both modes it has the effect of installing the function definition
1299different according to where the relevant Lisp environment is found. 1327that point is in, but the way of doing so is different according to
1300@xref{Executing Lisp}. 1328where the relevant Lisp environment is found.
1329
1301 1330
1302@ignore 1331@ignore
1303 arch-tag: 9c3c2f71-b332-4144-8500-3ff9945a50ed 1332 arch-tag: 9c3c2f71-b332-4144-8500-3ff9945a50ed