Next: , Previous: , Up: Edebug   [Index]


K.3.11 Insert a Direct Call to Edebug

(defmacro stop-here (fn)
       "Call edebug here. FN is assumed to be a symbol of the function you are in."
       `(if (consp (get ,fn 'edebug))
           (edebug)))

(defun clear-edebug (fn-sym)
  "Remove 'edebug property from FN-SYM, a function symbol."
  (put fn-sym 'edebug nil))
 ;; An example of use:
(defun fact (n)
  (cond ((= n 0) )
        ((= n 1) 1)
        ((>  n 1) (progn (stop-here 'fact) (* n (fact (1- n)))))
        (t nil)))

If you eval the above and then edebug-defun while the point is on ‘fact’, you’ll first stop at ‘fact’ but then when you enter ‘g’ for ‘go’ it will next stop after the (* n… ) which is what I want.

And note you could also put a condition around ‘stop-here‘ for example:

((>  n 1) (progn (if (= n 3) (stop-here 'fact)) (* n (fact (1- n)))))