all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: f.j.wright@live.co.uk,
	Francis Wright <francis.j.wright@gmail.com>,
	30529@debbugs.gnu.org
Subject: bug#30529: 26.0.91; minibuffer errors change standard-output
Date: Thu, 12 Aug 2021 16:34:20 +0200	[thread overview]
Message-ID: <878s16k9zn.fsf@gnus.org> (raw)
In-Reply-To: <87360sdvwg.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 29 Nov 2020 15:29:03 +0000")

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

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

Found the culprit!  cmd_error sets standard_output to t!

The following patch fixes the reported issue (and doesn't lead to any
regressions in the test suite), but this code has been like this
forever, so I'm a bit leery about applying it.

And perhaps the 

  old_level = Vprint_level;
  old_length = Vprint_length;

stuff should also be changed to specbinding?  Or do we want to avoid
specbind here totally for some reason?  The commit for those lines just
says:

    (cmd_error): Bind Vprint_level and Vprint_length.

I mean, we had specbind before 1995, I think?

So...  any comments/insights here?

diff --git a/src/keyboard.c b/src/keyboard.c
index 820229cf8f..f44a2b9164 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -923,6 +923,7 @@ restore_kboard_configuration (int was_locked)
 static Lisp_Object
 cmd_error (Lisp_Object data)
 {
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object old_level, old_length;
   Lisp_Object conditions;
   char macroerror[sizeof "After..kbd macro iterations: "
@@ -951,8 +952,8 @@ cmd_error (Lisp_Object data)
       executing_kbd_macro = Qnil;
     }
 
-  Vstandard_output = Qt;
-  Vstandard_input = Qt;
+  specbind (Qstandard_output, Qt);
+  specbind (Qstandard_input, Qt);
   kset_prefix_arg (current_kboard, Qnil);
   kset_last_prefix_arg (current_kboard, Qnil);
   cancel_echoing ();
@@ -969,6 +970,7 @@ cmd_error (Lisp_Object data)
   Vquit_flag = Qnil;
   Vinhibit_quit = Qnil;
 
+  unbind_to (count, Qnil);
   return make_fixnum (0);
 }
 


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





  parent reply	other threads:[~2021-08-12 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 16:04 bug#30529: 26.0.91; minibuffer errors change standard-output Francis Wright
2020-11-26 13:52 ` Lars Ingebrigtsen
2020-11-29 15:29   ` Basil L. Contovounesios
2020-11-30  9:41     ` Lars Ingebrigtsen
2021-08-12 14:34     ` Lars Ingebrigtsen [this message]
2021-08-12 15:04       ` Andreas Schwab
2021-08-13 11:22         ` Lars Ingebrigtsen
2021-08-12 15:58       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s16k9zn.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=30529@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=f.j.wright@live.co.uk \
    --cc=francis.j.wright@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.