]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve Edebug error for attempting to instrument built-in functions.
authorChong Yidong <cyd@stupidchicken.com>
Sun, 21 Aug 2011 17:43:31 +0000 (13:43 -0400)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 21 Aug 2011 17:43:31 +0000 (13:43 -0400)
* lisp/emacs-lisp/edebug.el (edebug-instrument-function): Use it to
signal an error for built-in functions.

* lisp/emacs-lisp/find-func.el (find-function-noselect): New arg
lisp-only.

Fixes: debbugs:6664
lisp/ChangeLog
lisp/emacs-lisp/edebug.el
lisp/emacs-lisp/find-func.el

index e383f86971f7bca594da897b4089c2990e828346..6de159536a131b339f0d4bd7516f2d21d37f3aa1 100644 (file)
@@ -1,3 +1,11 @@
+2011-08-21  Chong Yidong  <cyd@stupidchicken.com>
+
+       * emacs-lisp/find-func.el (find-function-noselect): New arg
+       lisp-only.
+
+       * emacs-lisp/edebug.el (edebug-instrument-function): Use it to
+       signal an error for built-in functions (Bug#6664).
+
 2011-08-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * mail/smtpmail.el (smtpmail-smtp-user): New variable.
index f84de0308bfe9fa9fd0a1ad0140610d1e8208bd4..57d25c9e1692d4d2dc2b92dafe9811bf2cb319d2 100644 (file)
@@ -3408,7 +3408,7 @@ go to the end of the last sexp, or if that is the same point, then step."
       (message "%s is already instrumented." func)
       func)
      (t
-      (let ((loc (find-function-noselect func)))
+      (let ((loc (find-function-noselect func t)))
        (unless (cdr loc)
          (error "Could not find the definition in its file"))
        (with-current-buffer (car loc)
index 0194af2e3a8f969bd04e07cadf6684679ebef152..2c7208db8a30fa857dbbec76fdd354cd8e42d62a 100644 (file)
@@ -312,7 +312,7 @@ The search is done in the source for library LIBRARY."
              (cons (current-buffer) nil))))))))
 
 ;;;###autoload
-(defun find-function-noselect (function)
+(defun find-function-noselect (function &optional lisp-only)
   "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION.
 
 Finds the source file containing the definition of FUNCTION
@@ -320,6 +320,10 @@ in a buffer and the point of the definition.  The buffer is
 not selected.  If the function definition can't be found in
 the buffer, returns (BUFFER).
 
+If FUNCTION is a built-in function, this function normally
+attempts to find it in the Emacs C sources; however, if LISP-ONLY
+is non-nil, signal an error instead.
+
 If the file where FUNCTION is defined is not known, then it is
 searched for in `find-function-source-path' if non-nil, otherwise
 in `load-path'."
@@ -345,6 +349,8 @@ in `load-path'."
           (cond ((eq (car-safe def) 'autoload)
                  (nth 1 def))
                 ((subrp def)
+                 (if lisp-only
+                     (error "%s is a built-in function" function))
                  (help-C-file-name def 'subr))
                 ((symbol-file function 'defun)))))
       (find-function-search-for-symbol function nil library))))