diff options
| author | Chong Yidong | 2011-08-21 13:43:31 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-08-21 13:43:31 -0400 |
| commit | 23a8a5ab697f3389ea6478cdfefe4e67fff28051 (patch) | |
| tree | 0d2c5d9a9a7fc45c3c3baec32dc8f726ed824b24 /lisp | |
| parent | 1e91d50696f9d458228039f5d1e346fd4dae41e6 (diff) | |
| download | emacs-23a8a5ab697f3389ea6478cdfefe4e67fff28051.tar.gz 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')
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/edebug.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/find-func.el | 8 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e383f86971f..6de159536a1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2011-08-21 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * emacs-lisp/find-func.el (find-function-noselect): New arg | ||
| 4 | lisp-only. | ||
| 5 | |||
| 6 | * emacs-lisp/edebug.el (edebug-instrument-function): Use it to | ||
| 7 | signal an error for built-in functions (Bug#6664). | ||
| 8 | |||
| 1 | 2011-08-21 Lars Magne Ingebrigtsen <larsi@gnus.org> | 9 | 2011-08-21 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 10 | ||
| 3 | * mail/smtpmail.el (smtpmail-smtp-user): New variable. | 11 | * mail/smtpmail.el (smtpmail-smtp-user): New variable. |
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." | |||
| 3408 | (message "%s is already instrumented." func) | 3408 | (message "%s is already instrumented." func) |
| 3409 | func) | 3409 | func) |
| 3410 | (t | 3410 | (t |
| 3411 | (let ((loc (find-function-noselect func))) | 3411 | (let ((loc (find-function-noselect func t))) |
| 3412 | (unless (cdr loc) | 3412 | (unless (cdr loc) |
| 3413 | (error "Could not find the definition in its file")) | 3413 | (error "Could not find the definition in its file")) |
| 3414 | (with-current-buffer (car loc) | 3414 | (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." | |||
| 312 | (cons (current-buffer) nil)))))))) | 312 | (cons (current-buffer) nil)))))))) |
| 313 | 313 | ||
| 314 | ;;;###autoload | 314 | ;;;###autoload |
| 315 | (defun find-function-noselect (function) | 315 | (defun find-function-noselect (function &optional lisp-only) |
| 316 | "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION. | 316 | "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION. |
| 317 | 317 | ||
| 318 | Finds the source file containing the definition of FUNCTION | 318 | 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 | |||
| 320 | not selected. If the function definition can't be found in | 320 | not selected. If the function definition can't be found in |
| 321 | the buffer, returns (BUFFER). | 321 | the buffer, returns (BUFFER). |
| 322 | 322 | ||
| 323 | If FUNCTION is a built-in function, this function normally | ||
| 324 | attempts to find it in the Emacs C sources; however, if LISP-ONLY | ||
| 325 | is non-nil, signal an error instead. | ||
| 326 | |||
| 323 | If the file where FUNCTION is defined is not known, then it is | 327 | If the file where FUNCTION is defined is not known, then it is |
| 324 | searched for in `find-function-source-path' if non-nil, otherwise | 328 | searched for in `find-function-source-path' if non-nil, otherwise |
| 325 | in `load-path'." | 329 | in `load-path'." |
| @@ -345,6 +349,8 @@ in `load-path'." | |||
| 345 | (cond ((eq (car-safe def) 'autoload) | 349 | (cond ((eq (car-safe def) 'autoload) |
| 346 | (nth 1 def)) | 350 | (nth 1 def)) |
| 347 | ((subrp def) | 351 | ((subrp def) |
| 352 | (if lisp-only | ||
| 353 | (error "%s is a built-in function" function)) | ||
| 348 | (help-C-file-name def 'subr)) | 354 | (help-C-file-name def 'subr)) |
| 349 | ((symbol-file function 'defun))))) | 355 | ((symbol-file function 'defun))))) |
| 350 | (find-function-search-for-symbol function nil library)))) | 356 | (find-function-search-for-symbol function nil library)))) |