all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>
Cc: emacs-devel@gnu.org
Subject: Re: debug-on-entry question
Date: Mon, 20 Jun 2005 19:41:09 +0200	[thread overview]
Message-ID: <87psuhncy2.fsf@xs4all.nl> (raw)
In-Reply-To: <873breo37h.fsf@jurta.org> (Juri Linkov's message of "Sun, 19 Jun 2005 17:03:38 +0300")

Juri Linkov <juri@jurta.org> 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)))

  parent reply	other threads:[~2005-06-20 17:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-18 10:03 debug-on-entry question Yoni Rabkin Katzenell
2005-06-18 11:23 ` David Kastrup
2005-06-18 11:47   ` Yoni Rabkin Katzenell
2005-06-19 14:03 ` Juri Linkov
2005-06-19 17:24   ` Drew Adams
2005-06-19 17:48     ` David Kastrup
2005-06-19 18:07       ` Drew Adams
2005-06-20  4:59     ` Juri Linkov
2005-06-20 15:42       ` Drew Adams
2005-06-21  2:00       ` Richard Stallman
2005-06-20  3:50   ` Richard Stallman
2005-06-20 17:41   ` Lute Kamstra [this message]
2005-06-21 16:32     ` Juri Linkov
2005-06-22  3:40       ` Richard M. Stallman
2005-06-22  8:32         ` Lute Kamstra
2005-06-23  0:54           ` Richard M. Stallman
2005-06-22 13:12         ` Juri Linkov
2005-06-23 14:38           ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87psuhncy2.fsf@xs4all.nl \
    --to=lute.kamstra.lists@xs4all.nl \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.