emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105520: Improve Edebug error for att


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105520: Improve Edebug error for attempting to instrument built-in functions.
Date: Sun, 21 Aug 2011 13:43:31 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105520
fixes bug(s): http://debbugs.gnu.org/6664
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2011-08-21 13:43:31 -0400
message:
  Improve Edebug error for attempting to instrument built-in functions.
  
  * 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.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/edebug.el
  lisp/emacs-lisp/find-func.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-21 04:11:59 +0000
+++ b/lisp/ChangeLog    2011-08-21 17:43:31 +0000
@@ -1,3 +1,11 @@
+2011-08-21  Chong Yidong  <address@hidden>
+
+       * 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  <address@hidden>
 
        * mail/smtpmail.el (smtpmail-smtp-user): New variable.

=== modified file 'lisp/emacs-lisp/edebug.el'
--- a/lisp/emacs-lisp/edebug.el 2011-04-01 15:16:50 +0000
+++ b/lisp/emacs-lisp/edebug.el 2011-08-21 17:43:31 +0000
@@ -3408,7 +3408,7 @@
       (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)

=== modified file 'lisp/emacs-lisp/find-func.el'
--- a/lisp/emacs-lisp/find-func.el      2011-07-01 03:15:02 +0000
+++ b/lisp/emacs-lisp/find-func.el      2011-08-21 17:43:31 +0000
@@ -312,7 +312,7 @@
              (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 @@
 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 @@
           (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))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]