Function: edebug-form
edebug-form is a byte-compiled function defined in edebug.el.gz.
Signature
(edebug-form CURSOR)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/edebug.el.gz
(defun edebug-form (cursor)
;; Return the instrumented form for the following form.
;; Add the point offsets to the edebug-offset-list for the form.
(let* ((form (edebug-top-element-required cursor "Expected form"))
(offset (edebug-top-offset cursor)))
(prog1
(cond
((consp form)
;; The first offset for a list form is for the list form itself.
(if (eq 'quote (car form))
;; This makes sure we don't instrument 'foo
;; which would cause the debugger to single-step
;; the trivial evaluation of a constant.
form
(let* ((head (car form))
(spec (and (symbolp head) (edebug-get-spec head)))
(new-cursor (edebug-new-cursor form offset)))
;; Find out if this is a defining form from first symbol.
;; An indirect spec would not work here, yet.
(if (and (consp spec) (eq '&define (car spec)))
(edebug-defining-form
new-cursor
(car offset);; before the form
(edebug-after-offset cursor)
(cons (symbol-name head) (cdr spec)))
;; Wrap a regular form.
(edebug-make-before-and-after-form
(edebug-inc-offset (car offset))
(edebug-list-form new-cursor)
;; After processing the list form, the new-cursor is left
;; with the offset after the form.
(edebug-inc-offset (edebug-cursor-offsets new-cursor))))
)))
((symbolp form)
(cond
;; Check for constant symbols that don't get wrapped.
((or (memq form '(t nil))
(keywordp form))
form)
(t ;; just a variable
(edebug-make-after-form form (edebug-inc-offset (cdr offset))))))
;; Anything else is self-evaluating.
(t form))
(edebug-move-cursor cursor))))