Function: edebug-default-enter

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

Signature

(edebug-default-enter FUNCTION ARGS BODY)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/edebug.el.gz
(defun edebug-default-enter (function args body)
  ;; Entering FUNC.  The arguments are ARGS, and the body is BODY.
  ;; Setup edebug variables and evaluate BODY.  This function is called
  ;; when a function evaluated with edebug-eval-top-level-form is entered.
  ;; Return the result of BODY.

  ;; Is this the first time we are entering edebug since
  ;; lower-level recursive-edit command?
  ;; More precisely, this tests whether Edebug is currently active.
  (let ((edebug-function function))
    (if (not edebug-entered)
        (let ((edebug-entered t)
              ;; Binding max-lisp-eval-depth here is OK,
              ;; but not inside an unwind-protect.
              ;; Doing it here also keeps it from growing too large.
              (max-lisp-eval-depth (+ 100 max-lisp-eval-depth)) ; too much??
              (max-specpdl-size (+ 200 max-specpdl-size))

              (debugger edebug-debugger) ; only while edebug is active.
              (edebug-outside-debug-on-error debug-on-error)
              (edebug-outside-debug-on-quit debug-on-quit)
              (outside-frame (selected-frame))
              ;; Binding these may not be the right thing to do.
              ;; We want to allow the global values to be changed.
              (debug-on-error (or debug-on-error edebug-on-error))
              (debug-on-quit edebug-on-quit))
          (unwind-protect
              (let ((signal-hook-function #'edebug-signal))
                (setq edebug-execution-mode (or edebug-next-execution-mode
                                                edebug-initial-mode
                                                edebug-execution-mode)
                      edebug-next-execution-mode nil)
                (edebug-default-enter function args body))
            (if (and (frame-live-p outside-frame)
                     (not (memq (framep outside-frame) '(nil t pc))))
                (x-focus-frame outside-frame))))

      (let* ((edebug-data (get function 'edebug))
             (edebug-def-mark (car edebug-data)) ; mark at def start
             (edebug-freq-count (get function 'edebug-freq-count))
             (edebug-coverage (get function 'edebug-coverage))
             (edebug-buffer (marker-buffer edebug-def-mark))

             (edebug-stack (cons function edebug-stack))
             (edebug-offset-indices (cons 0 edebug-offset-indices))
             )
        (if (get function 'edebug-on-entry)
            (progn
              (setq edebug-execution-mode 'step)
              (if (eq (get function 'edebug-on-entry) 'temp)
                  (put function 'edebug-on-entry nil))))
        (if edebug-trace
            (edebug--enter-trace function args body)
          (funcall body))
        ))))