Subject: bug#19064: bug#17272: 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: Wed, 20 Nov 2019 00:28:15 +0200

>> The variable name is ‘message-in-echo-area’.  After a little testing,
>> it seems to handle all such cases well:
>
> I have not tested the patch, but it looks good to me.

Actually this patch needs more testing.  I found already
two cases that might be annoying.  Better to anticipate
a possible angry reaction and fix these cases in advance.

The first case is when doing completion, the message
"Making completion list..." is displayed in the minibuffer
for 2 seconds. I don't understand why this message is needed at all,
but at least this patch restores its previous behavior
that displays that message in the echo area and doesn't wait.

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 6e72eb73f9..b3fc3b8ab0 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1838,7 +1838,7 @@ completion--done
 (defun minibuffer-completion-help (&optional start end)
   "Display a list of possible completions of the current minibuffer contents."
   (interactive)
-  (message "Making completion list...")
+  (message-in-echo-area "Making completion list...")
   (let* ((start (or start (minibuffer-prompt-end)))
          (end (or end (point-max)))
          (string (buffer-substring start end))
@@ -1849,7 +1849,7 @@ minibuffer-completion-help
                        minibuffer-completion-predicate
                        (- (point) start)
                        md)))
-    (message nil)
+    (message-in-echo-area nil)
     (if (or (null completions)
             (and (not (consp (cdr completions)))
                  (equal (car completions) string)))

Another case when using isearch in minibuffer, the failed search
message is displayed at the end of the minibuffer instead of
in the search prompt in the echo area.  This patch restores
the previous behavior:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 4f3342782d..1705b050b5 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2011,7 +2011,7 @@ isearch-message-properties
 (defun isearch--momentary-message (string)
   "Print STRING at the end of the isearch prompt for 1 second."
   (let ((message-log-max nil))
-    (message "%s%s%s"
+    (message-in-echo-area "%s%s%s"
              (isearch-message-prefix nil isearch-nonincremental)
              isearch-message
              (apply #'propertize (format " [%s]" string)
@@ -3168,7 +3170,7 @@ isearch-message
 	     (isearch-message-prefix ellipsis isearch-nonincremental)
 	     m
 	     (isearch-message-suffix c-q-hack)))
-    (if c-q-hack m (let ((message-log-max nil)) (message "%s" m)))))
+    (if c-q-hack m (let ((message-log-max nil)) (message-in-echo-area "%s" m)))))
 
 (defun isearch--describe-regexp-mode (regexp-function &optional space-before)
   "Make a string for describing REGEXP-FUNCTION.