arguments. @xref{Defining Macros}, for more explanation of
the @code{declare} form.
+@c See eg http://debbugs.gnu.org/10577
+@c FIXME Maybe there should be an Edebug option to get it to
+@c automatically load the entire source file containing the function
+@c being instrumented. That would avoid this.
+ Take care to ensure that the specifications are known to Edebug when
+you instrument code. If you are instrumenting a function from a file
+that uses @code{eval-when-compile} to require another file containing
+macro definitions, you may need to explicitly load that file.
+
You can also define an edebug specification for a macro separately
from the macro definition with @code{def-edebug-spec}. Adding
@code{debug} declarations is preferred, and more convenient, for macro
of them match, nothing is matched, but the @code{¬} specification
succeeds.
+@c FIXME &key?
+
@item &define
@c @kindex &define @r{(Edebug)}
Indicates that the specification is for a defining form. The defining
optional expression. In the specification below, notice the @code{gate}
inside of the sublist to prevent backtracking once a sublist is found.
-@c FIXME? The actual definition in edebug.el does not have a gate.
+@ignore
+@c FIXME? The actual definition in edebug.el looks like this (and always
+@c has AFAICS). In fact, nothing in edebug.el uses gate. So maybe
+@c this is just an example for illustration?
+(def-edebug-spec let
+ ((&rest
+ &or (symbolp &optional form) symbolp)
+ body))
+@end ignore
@example
(def-edebug-spec let
((&rest
@xref{Edebug Execution Modes}.
@end defopt
-@c FIXME edebug-unwrap-results
+@defopt edebug-unwrap-results
+If non-@code{nil}, Edebug tries to remove any of its own
+instrumentation when showing the results of expressions. This is
+relevant when debugging macros where the results of expressions are
+themselves instrumented expressions. As a very artificial example,
+suppose that the example function @code{fac} has been instrumented,
+and consider a macro of the form:
+
+@c FIXME find a less silly example.
+@smallexample
+(defmacro test () "Edebug example."
+ (if (symbol-function 'fac)
+ @dots{}))
+@end smallexample
+
+If you instrument the @code{test} macro and step through it, then by
+default the result of the @code{symbol-function} call has numerous
+@code{edebug-after} and @code{edebug-before} forms, which can make it
+difficult to see the ``actual'' result. If
+@code{edebug-unwrap-results} is non-@code{nil}, Edebug tries to remove
+these forms from the result.
+@end defopt
@defopt edebug-on-error
Edebug binds @code{debug-on-error} to this value, if
;;; edebug.el --- a source-level debugger for Emacs Lisp
-;; Copyright (C) 1988-1995, 1997, 1999-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1988-1995, 1997, 1999-2012 Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <liberte@holonexus.org>
;; Maintainer: FSF
(defcustom edebug-unwrap-results nil
"Non-nil if Edebug should unwrap results of expressions.
+That is, Edebug will try to remove its own instrumentation from the result.
This is useful when debugging macros where the results of expressions
are instrumented expressions. But don't do this when results might be
circular or an infinite loop will result."
(def-edebug-spec apply (function-form &rest form))
(def-edebug-spec funcall (function-form &rest form))
-;; FIXME? The manual has a gate here.
+;; FIXME? The manual uses this form (maybe that's just for illustration?):
+;; (def-edebug-spec let
+;; ((&rest &or symbolp (gate symbolp &optional form))
+;; body))
(def-edebug-spec let
((&rest &or (symbolp &optional form) symbolp)
body))
;;; Frequency count and coverage
;; FIXME should this use overlays instead?
+;; Definitely, IMO. The current business with undo in
+;; edebug-temp-display-freq-count is horrid.
(defun edebug-display-freq-count ()
"Display the frequency count data for each line of the current definition.
The frequency counts are inserted as comment lines after each line,
(insert "\n")
(setq i first-index)))))
+;; FIXME this does not work very well. Eg if you press an arrow key,
+;; or make a mouse-click, it fails with "Non-character input-event".
(defun edebug-temp-display-freq-count ()
"Temporarily display the frequency count data for the current definition.
It is removed when you hit any char."
(undo-boundary)
(edebug-display-freq-count)
(setq unread-command-char (read-char))
+ ;; Yuck! This doesn't seem to work at all for me.
(undo)))
\f