diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-06-13 04:34:18 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-06-13 04:34:18 +0000 |
commit | a440f81d29363c298141f434df4f471e12f37813 (patch) | |
tree | 419e43591756426c746e2c7dc1821daaa55ce69f /lisp/emacs-lisp | |
parent | 63987c84b15fac7137724a4f765b65f1de1304a2 (diff) | |
download | emacs-a440f81d29363c298141f434df4f471e12f37813.tar.gz emacs-a440f81d29363c298141f434df4f471e12f37813.tar.bz2 emacs-a440f81d29363c298141f434df4f471e12f37813.zip |
(elisp-eval-region): Accept new arg read-function; also handle
load-read-function.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/eval-reg.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/eval-reg.el b/lisp/emacs-lisp/eval-reg.el index a38acade8be..8d7824146ba 100644 --- a/lisp/emacs-lisp/eval-reg.el +++ b/lisp/emacs-lisp/eval-reg.el @@ -122,7 +122,8 @@ its value will not be lost." (funcall elisp-code))))) -(defun elisp-eval-region (elisp-start elisp-end &optional elisp-output) +(defun elisp-eval-region (elisp-start elisp-end &optional elisp-output + elisp-read-function) "Execute the region as Lisp code. When called from programs, expects two arguments, giving starting and ending indices in the current buffer @@ -130,6 +131,10 @@ of the text to be executed. Programs can pass third argument PRINTFLAG which controls printing of output: nil means discard it; anything else is stream for print. +Also the fourth argument READ-FUNCTION, if non-nil, is used +instead of `read' to read each expression. It gets one argument +which is the input stream for reading characters. + This version, from `eval-reg.el', allows Lisp customization of read, eval, and the printer." @@ -149,7 +154,13 @@ eval, and the printer." (goto-char elisp-start) (elisp-skip-whitespace) (while (< (point) elisp-end-marker) - (setq elisp-form (read elisp-buf)) + (setq elisp-form + (cond (elisp-read-function + (funcall elisp-read-function elisp-buf)) + (load-read-function + (funcall load-read-function elisp-buf)) + (t + (read elisp-buf)))) (let ((elisp-current-buffer (current-buffer))) ;; Restore the inside current-buffer. |