Subject: bug#30529: 26.0.91; minibuffer errors change standard-output

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 26 Nov 2020 14:52:21 +0100

Francis Wright <[email-masked]> writes:

> A user-error in the minibuffer can change the value of standard-output
> (to t) within the environment that invoked the minibuffer, whereas I
> think the minibuffer should rebind standard-output locally and not
> change its global value. Here is a simple way to illustrate this
> problem. Evaluate the following:
>
> (defun STANDARD-LISP ()
>   "Run Standard LISP with input via the minibuffer and output via a buffer."
>   (interactive)
>   (switch-to-buffer (get-buffer-create "*Standard LISP*"))
>   (let (value
> 		(standard-output (current-buffer)))
> 	(while t
> 	  (terpri)
> 	  (princ "Eval: ")
> 	  (setq value (read))
> 	  ;; (read) errors change standard-output to *Messages* buffer,
> 	  ;; so...
> 	  ;; (setq standard-output (current-buffer))
> 	  (prin1 value) (terpri)
> 	  (setq value (eval value))
> 	  (terpri)
> 	  (princ "====> ") (princ value) (terpri))))

(This bug report unfortunately got no response at the time.)

This problem is still present in Emacs 28.  I tried following the code
logic for a couple of minutes to see just what it is that's (re)setting
`standard-output' here, but was unable to locate the location.

Anybody know?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no