[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: debug-on-entry question
From: |
Lute Kamstra |
Subject: |
Re: debug-on-entry question |
Date: |
Mon, 20 Jun 2005 19:41:09 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Juri Linkov <address@hidden> writes:
> A better way to do this is to change the interactive specification of
> `debug-on-entry' to call `function-called-at-point'.
How about this?
Lute.
Index: lisp/emacs-lisp/debug.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/debug.el,v
retrieving revision 1.87
diff -c -r1.87 debug.el
*** lisp/emacs-lisp/debug.el 14 Jun 2005 12:00:50 -0000 1.87
--- lisp/emacs-lisp/debug.el 20 Jun 2005 17:40:29 -0000
***************
*** 653,658 ****
--- 653,664 ----
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,676 ****
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))
(error "Function %s is a special form" function))
(if (or (symbolp (symbol-function function))
(subrp (symbol-function function)))
--- 674,694 ----
Use \\[cancel-debug-on-entry] to cancel the effect of this command.
Redefining FUNCTION also cancels it."
! (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)))