The previous chapter discusses the Emacs commands that are useful for
making changes in programs. This chapter deals with commands that assist
-in the larger process of developing and maintaining programs.
+in the larger process of compiling and testing programs.
@menu
* Compilation:: Compiling programs in languages other
subprocesses; to work around this lack, @kbd{M-x compile} runs the
compilation command synchronously on MS-DOS. As a consequence, you must
wait until the command finishes before you can do anything else in
-Emacs. @xref{MS-DOS}.
+Emacs. @xref{MS-DOS,,,emacs-xtra,Specialized Emacs Features}.
@node Grep Searching
@section Searching with Grep under Emacs
@table @kbd
@item M-x grep
+@item M-x lgrep
Run @code{grep} asynchronously under Emacs, with matching lines
listed in the buffer named @samp{*grep*}.
@item M-x grep-find
@itemx M-x find-grep
+@itemx M-x rgrep
Run @code{grep} via @code{find}, with user-specified arguments, and
collect output in the buffer named @samp{*grep*}.
@item M-x kill-grep
@code{grep}, so as to search every file in a directory tree. See also
the @code{find-grep-dired} command, in @ref{Dired and Find}.
+@findex lgrep
+@findex rgrep
+ The commands @kbd{M-x lgrep} (local grep) and @kbd{M-x rgrep}
+(recursive grep) are more user-friendly versions of @code{grep} and
+@code{grep-find}, which prompt separately for the regular expression
+to match, the files to search, and the base directory for the search
+(rgrep only). Case sensitivitivy of the search is controlled by the
+current value of @code{case-fold-search}.
+
+These commands build the shell commands based on the variables
+@code{grep-template} (for @code{lgrep}) and @code{grep-find-template}
+(for @code{rgrep}).
+
+The files to search can use aliases defined in the variable
+@code{grep-files-aliases}.
+
+Subdirectories listed in the variable
+@code{grep-find-ignored-directories} such as those typically used by
+various version control systems, like CVS and arch, are automatically
+skipped by @code{rgrep}.
+
@node Flymake
@section Finding Syntax Errors On The Fly
@cindex checking syntax
@kindex C-c C-f @r{(GUD)}
@itemx C-x C-a C-f
@findex gud-finish
-Run the program until the selected stack frame returns or
+Run the program until the selected stack frame returns or
stops for some other reason (@code{gud-finish}).
@item C-x C-a C-j
The name of the current source file. If the current buffer is the GUD
buffer, then the ``current source file'' is the file that the program
stopped in.
-@c This said, ``the name of the file the program counter was in at the last breakpoint.''
-@c But I suspect it is really the last stop file.
@item %l
The number of the current source line. If the current buffer is the GUD
stopped in.
@item %e
-The text of the C lvalue or function-call expression at or adjacent to point.
+In transient-mark-mode the text in the region, if it is active.
+Otherwise the text of the C lvalue or function-call expression at or
+adjacent to point.
@item %a
The text of the hexadecimal address at or adjacent to point.
If you don't use @samp{%p} in the command string, the command you define
ignores any numeric argument.
+
+@item %d
+The name of the directory of the current source file.
+
+@item %c
+Fully qualified class name derived from the expression surrounding point
+(jdb only).
@end table
@node GDB Graphical Interface
@example
+--------------------------------+--------------------------------+
| | |
-| GUD buffer (I/O of GDB) | Locals buffer |
+| GUD buffer (I/O of GDB) | Locals buffer |
| | |
|--------------------------------+--------------------------------+
| | |
-| Source buffer | I/O buffer (of inferior) |
+| Source buffer | I/O buffer for debugged pgm |
| | |
|--------------------------------+--------------------------------+
| | |
-| Stack buffer | Breakpoints buffer |
+| Stack buffer | Breakpoints buffer |
| | |
+--------------------------------+--------------------------------+
@end example
- However, if @code{gdb-use-inferior-io-buffer} is @code{nil}, the I/O
+ However, if @code{gdb-use-separate-io-buffer} is @code{nil}, the I/O
buffer does not appear and the source buffer occupies the full width
of the frame.
@cindex Watching expressions in GDB
@findex gud-watch
+@kindex C-x C-a C-w @r{(GUD)}
If you want to see how a variable changes each time your program
stops, move point into the variable name and click on the watch icon
-in the tool bar (@code{gud-watch}).
+in the tool bar (@code{gud-watch}) or type @kbd{C-x C-a C-w}. If you
+specify a prefix argument, you can enter the variable name in the
+minibuffer.
Each watch expression is displayed in the speedbar. Complex data
types, such as arrays, structures and unions are represented in a tree
format. Leaves and simple data types show the name of the expression
-and its value, and display the type as a tooltip. Higher levels show
-the name, type and address value for pointers and just the name and
-type otherwise.
+and its value and, when the speedbar frame is selected, display the
+type as a tooltip. Higher levels show the name, type and address
+value for pointers and just the name and type otherwise. Root expressions
+also display the frame address as a tooltip to help identify the frame
+in which they were defined.
To expand or contract a complex data type, click @kbd{Mouse-2}
on the tag to the left of the expression.
+@kindex D @r{(GDB speedbar)}
@findex gdb-var-delete
To delete a complex watch expression, move point to the root
expression in the speedbar and type @kbd{D} (@code{gdb-var-delete}).
If you set the variable @code{gdb-show-changed-values} to
non-@code{nil} (the default value), Emacs uses
@code{font-lock-warning-face} to highlight values that have recently
-changed.
+changed and @code{shadow} face to make variables which have gone out of
+scope less noticeable. When a variable goes out of scope you can't
+edit its value.
@vindex gdb-use-colon-colon-notation
If the variable @code{gdb-use-colon-colon-notation} is
non-@code{nil}, Emacs uses the @samp{@var{function}::@var{variable}}
-format to display variables in the speedbar. Since this does not work
-for variables defined in compound statements, the default value is
-@code{nil}.
+format. This allows the user to display watch expressions which share
+the same variable name. The default value is @code{nil}.
+
+@vindex gdb-speedbar-auto-raise
+To automatically raise the speedbar every time the display of watch
+expressions updates, set @code{gdb-speedbar-auto-raise} to
+non-@code{nil}. This can be useful if you are debugging with a full
+screen Emacs frame.
@node Other GDB User Interface Buffers
@subsubsection Other Buffers
@table @asis
@item Input/Output Buffer
-@vindex gdb-use-inferior-io-buffer
-If the variable @code{gdb-use-inferior-io-buffer} is non-@code{nil},
+@vindex gdb-use-separate-io-buffer
+If the variable @code{gdb-use-separate-io-buffer} is non-@code{nil},
the executable program that is being debugged takes its input and
displays its output here. Otherwise it uses the GUD buffer for that.
-To toggle the use of this buffer, do @kbd{M-x
-gdb-use-inferior-io-buffer}.
+To toggle whether GUD mode uses this buffer, do @kbd{M-x
+gdb-use-separate-io-buffer}. That takes effect when you next
+restart the program you are debugging.
-Some of the commands from shell mode are available here. @xref{Shell
-Mode}.
+The history and replay commands from Shell mode are available here,
+as are the commands to send signals to the program you are debugging.
+@xref{Shell Mode}.
@item Locals Buffer
The locals buffer displays the values of local variables of the
Arrays and structures display their type only. With GDB 6.4 or later,
move point to their name and press @key{RET}, or alternatively click
@kbd{Mouse-2} there, to examine their values. With earlier versions
-of GDB, move point to their type description ([struct/union] or
-[array]). @xref{Watch Expressions}.
+of GDB, use @kbd{Mouse-2} or @key{RET} on the type description
+(@samp{[struct/union]} or @samp{[array]}). @xref{Watch Expressions}.
@item Registers Buffer
@findex toggle-gdb-all-registers
is to use Inferior Emacs-Lisp mode, which provides an interface rather
like Shell mode (@pxref{Shell Mode}) for evaluating Emacs Lisp
expressions. Type @kbd{M-x ielm} to create an @samp{*ielm*} buffer
-which uses this mode.
+which uses this mode. For more information see that command's
+documentation.
@node External Lisp
@section Running an External Lisp