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

From: "Basil L. Contovounesios" <[email-masked]>
Date: Sun, 29 Nov 2020 15:29:03 +0000

Lars Ingebrigtsen <[email-masked]> writes:

> 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?

Just from a quick grep, could it be recursive_edit_1?

Does error handling invoke a recursive edit e.g. for entering the
debugger?

-- 
Basil