diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-08-21 13:43:31 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-08-21 13:43:31 -0400 |
commit | 23a8a5ab697f3389ea6478cdfefe4e67fff28051 (patch) | |
tree | 0d2c5d9a9a7fc45c3c3baec32dc8f726ed824b24 /lisp/emacs-lisp | |
parent | 1e91d50696f9d458228039f5d1e346fd4dae41e6 (diff) | |
download | emacs-23a8a5ab697f3389ea6478cdfefe4e67fff28051.tar.gz emacs-23a8a5ab697f3389ea6478cdfefe4e67fff28051.tar.bz2 emacs-23a8a5ab697f3389ea6478cdfefe4e67fff28051.zip |
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.
Fixes: debbugs:6664
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/find-func.el | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index f84de0308bf..57d25c9e169 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -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) diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 0194af2e3a8..2c7208db8a3 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -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)))) |