# HG changeset patch # User Lute Kamstra # Date 1119514833 0 # Node ID 9f00cb6e413eb2c159c80268a9825fda9ba3e9e1 # Parent 8166221bcd71c035c712ce2e517cee492eabffed (debugger-special-form-p): New defun. (debug-on-entry): Use it. New interactive declaration that uses function-called-at-point. diff -r 8166221bcd71 -r 9f00cb6e413e lisp/emacs-lisp/debug.el --- a/lisp/emacs-lisp/debug.el Thu Jun 23 07:54:12 2005 +0000 +++ b/lisp/emacs-lisp/debug.el Thu Jun 23 08:20:33 2005 +0000 @@ -653,6 +653,12 @@ 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 @@ 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)))