Function: edebug

edebug is a byte-compiled function defined in edebug.el.gz.

Signature

(edebug &optional ARG-MODE &rest ARGS)

Documentation

Replacement for debug.

If we are running an edebugged function, show where we last were. Otherwise call debug normally.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/edebug.el.gz
;;; Interface with standard debugger.

;; (setq debugger 'edebug) ; to use the edebug debugger
;; (setq debugger 'debug)  ; use the standard debugger

;; Note that debug and its utilities must be byte-compiled to work,
;; since they depend on the backtrace looking a certain way.  Edebug
;; will work if not byte-compiled, but it will not be able correctly
;; remove its instrumentation from backtraces unless it is
;; byte-compiled.

(defun edebug (&optional arg-mode &rest args)
  "Replacement for `debug'.
If we are running an edebugged function, show where we last were.
Otherwise call `debug' normally."
  ;;(message "entered: %s  depth: %s  edebug-recursion-depth: %s"
  ;;  edebug-entered (recursion-depth) edebug-recursion-depth) (sit-for 1)
  (if (and edebug-entered  ; anything active?
	   (eq (recursion-depth) edebug-recursion-depth))
      (let (;; Where were we before the error occurred?
	    (offset-index (car edebug-offset-indices))
	    (value (car args))
	    ;; Bind variables required by edebug--display.
	    edebug-breakpoints
	    edebug-break-data
	    edebug-break-condition
	    edebug-global-break
	    (edebug-break (null arg-mode)) ;; If called explicitly.
	    )
	(edebug--display value offset-index arg-mode)
	(if (eq arg-mode 'error)
	    nil
	  value))

    ;; Otherwise call debug normally.
    ;; Still need to remove extraneous edebug calls from stack.
    (apply #'debug arg-mode args)
    ))