From: Lute Kamstra Date: Thu, 23 Jun 2005 08:20:33 +0000 (+0000) Subject: (debugger-special-form-p): New defun. X-Git-Tag: emacs-pretest-22.0.90~8714 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ce5ce46defdab48c325d228dfd0368931a1b45a1;p=emacs.git (debugger-special-form-p): New defun. (debug-on-entry): Use it. New interactive declaration that uses function-called-at-point. --- 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." nil (funcall debugger 'debug))) +(defun debugger-special-form-p (symbol) + "Return whether SYMBOL is a special form." + (and (fboundp symbol) + (subrp (symbol-function symbol)) + (eq (cdr (subr-arity (symbol-function symbol))) 'unevalled))) + ;;;###autoload (defun debug-on-entry (function) "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. Use \\[cancel-debug-on-entry] to cancel the effect of this command. Redefining FUNCTION also cancels it." - (interactive "aDebug on entry (to function): ") - (when (and (subrp (symbol-function function)) - (eq (cdr (subr-arity (symbol-function function))) 'unevalled)) + (interactive + (let ((fn (function-called-at-point)) val) + (when (debugger-special-form-p fn) + (setq fn nil)) + (setq val (completing-read + (if fn + (format "Debug on entry to function (default %s): " fn) + "Debug on entry to function: ") + obarray + #'(lambda (symbol) + (and (fboundp symbol) + (not (debugger-special-form-p symbol)))) + t nil nil (symbol-name fn))) + (list (if (equal val "") fn (intern val))))) + (when (debugger-special-form-p function) (error "Function %s is a special form" function)) (if (or (symbolp (symbol-function function)) (subrp (symbol-function function)))