653 |
nil |
nil |
654 |
(funcall debugger 'debug))) |
(funcall debugger 'debug))) |
655 |
|
|
656 |
|
(defun debugger-special-form-p (symbol) |
657 |
|
"Return whether SYMBOL is a special form." |
658 |
|
(and (fboundp symbol) |
659 |
|
(subrp (symbol-function symbol)) |
660 |
|
(eq (cdr (subr-arity (symbol-function symbol))) 'unevalled))) |
661 |
|
|
662 |
;;;###autoload |
;;;###autoload |
663 |
(defun debug-on-entry (function) |
(defun debug-on-entry (function) |
664 |
"Request FUNCTION to invoke debugger each time it is called. |
"Request FUNCTION to invoke debugger each time it is called. |
674 |
|
|
675 |
Use \\[cancel-debug-on-entry] to cancel the effect of this command. |
Use \\[cancel-debug-on-entry] to cancel the effect of this command. |
676 |
Redefining FUNCTION also cancels it." |
Redefining FUNCTION also cancels it." |
677 |
(interactive "aDebug on entry (to function): ") |
(interactive |
678 |
(when (and (subrp (symbol-function function)) |
(let ((fn (function-called-at-point)) val) |
679 |
(eq (cdr (subr-arity (symbol-function function))) 'unevalled)) |
(when (debugger-special-form-p fn) |
680 |
|
(setq fn nil)) |
681 |
|
(setq val (completing-read |
682 |
|
(if fn |
683 |
|
(format "Debug on entry to function (default %s): " fn) |
684 |
|
"Debug on entry to function: ") |
685 |
|
obarray |
686 |
|
#'(lambda (symbol) |
687 |
|
(and (fboundp symbol) |
688 |
|
(not (debugger-special-form-p symbol)))) |
689 |
|
t nil nil (symbol-name fn))) |
690 |
|
(list (if (equal val "") fn (intern val))))) |
691 |
|
(when (debugger-special-form-p function) |
692 |
(error "Function %s is a special form" function)) |
(error "Function %s is a special form" function)) |
693 |
(if (or (symbolp (symbol-function function)) |
(if (or (symbolp (symbol-function function)) |
694 |
(subrp (symbol-function function))) |
(subrp (symbol-function function))) |