aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLute Kamstra2005-06-23 08:20:33 +0000
committerLute Kamstra2005-06-23 08:20:33 +0000
commitce5ce46defdab48c325d228dfd0368931a1b45a1 (patch)
tree946bfe1196dd823e5953610e479279dc2d3ebfff
parent1d1c7e755a99050996bdb6c2097c935637705a8d (diff)
downloademacs-ce5ce46defdab48c325d228dfd0368931a1b45a1.tar.gz
emacs-ce5ce46defdab48c325d228dfd0368931a1b45a1.zip
(debugger-special-form-p): New defun.
(debug-on-entry): Use it. New interactive declaration that uses function-called-at-point.
-rw-r--r--lisp/emacs-lisp/debug.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 0ee67355bf4..e543932d8b4 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -653,6 +653,12 @@ functions to break on entry."
653 nil 653 nil
654 (funcall debugger 'debug))) 654 (funcall debugger 'debug)))
655 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
656;;;###autoload 662;;;###autoload
657(defun debug-on-entry (function) 663(defun debug-on-entry (function)
658 "Request FUNCTION to invoke debugger each time it is called. 664 "Request FUNCTION to invoke debugger each time it is called.
@@ -668,9 +674,21 @@ primitive functions only works when that function is called from Lisp.
668 674
669Use \\[cancel-debug-on-entry] to cancel the effect of this command. 675Use \\[cancel-debug-on-entry] to cancel the effect of this command.
670Redefining FUNCTION also cancels it." 676Redefining FUNCTION also cancels it."
671 (interactive "aDebug on entry (to function): ") 677 (interactive
672 (when (and (subrp (symbol-function function)) 678 (let ((fn (function-called-at-point)) val)
673 (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) 679 (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)
674 (error "Function %s is a special form" function)) 692 (error "Function %s is a special form" function))
675 (if (or (symbolp (symbol-function function)) 693 (if (or (symbolp (symbol-function function))
676 (subrp (symbol-function function))) 694 (subrp (symbol-function function)))