# HG changeset patch # User Richard M. Stallman # Date 897712458 0 # Node ID fc8109f5d8f5ce6115154ec6b3f7ba1c0879758a # Parent fd555029931d8689a9caefb18773999226c4c2da (elisp-eval-region): Accept new arg read-function; also handle load-read-function. diff -r fd555029931d -r fc8109f5d8f5 lisp/emacs-lisp/eval-reg.el --- a/lisp/emacs-lisp/eval-reg.el Sat Jun 13 04:33:31 1998 +0000 +++ b/lisp/emacs-lisp/eval-reg.el Sat Jun 13 04:34:18 1998 +0000 @@ -122,7 +122,8 @@ (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 @@ 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 @@ (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.