Subject: Re: bug#19064: bug#17272: bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it

From: Juri Linkov <[email-masked]>
Date: Sat, 16 Nov 2019 22:53:51 +0200

>> That's easy to do.  But the statement wasn't just
>> about the minibuffer when echo area was meant, or
>> vice versa.  The claim was that _user input_ (not
>> a prompt) became permanently hidden.
>
> I don't know if that was also a mistake or really meant like that.

This is not a mistake.  Permanently hidden user input
is a serious problem and security threat.

Today I started compilation, then in a Dired buffer
requested files deletion that displayed the prompt:

  Delete D [54 files] (y or n)

But before I had a chance to answer the prompt, compilation finished
and obscured the prompt with this message permanently:

  Compilation finished

So I forgot about what was in the prompt :-(

Since Drew doesn't want to improve safety to cover all such cases,
we need to address these issues one by one, so here is the next patch:

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 5a3386f227..101e294557 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2265,7 +2265,8 @@ compilation-handle-exit
                  (msg (format "%s %s" mode-name
                               (replace-regexp-in-string "\n?$" ""
                                                         (car status)))))
-             (message "%s" msg)
+             (with-current-buffer (window-buffer (old-selected-window))
+               (minibuffer-message "%s" msg))
              (propertize out-string
                          'help-echo msg
                          'face (if (> exit-status 0)