From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: debug-on-entry question Date: Mon, 20 Jun 2005 19:41:09 +0200 Message-ID: <87psuhncy2.fsf@xs4all.nl> References: <873breo37h.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1119291021 21405 80.91.229.2 (20 Jun 2005 18:10:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2005 18:10:21 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 20 20:10:14 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DkQih-0007lE-1L for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2005 20:10:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DkQov-0003uF-U9 for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2005 14:16:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DkQfO-0000cI-4L for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:06:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DkQfH-0000Zt-V0 for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:06:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DkQfH-0000AQ-0G for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:06:31 -0400 Original-Received: from [194.109.24.33] (helo=smtp-vbr13.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DkQJR-0005Mk-CT for emacs-devel@gnu.org; Mon, 20 Jun 2005 13:43:57 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr13.xs4all.nl (8.13.3/8.13.3) with ESMTP id j5KHfBGD029917; Mon, 20 Jun 2005 19:41:11 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DkQGk-0002bp-00; Mon, 20 Jun 2005 19:41:10 +0200 Original-To: Juri Linkov In-Reply-To: <873breo37h.fsf@jurta.org> (Juri Linkov's message of "Sun, 19 Jun 2005 17:03:38 +0300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 65 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:39195 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39195 Juri Linkov 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)))