From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
17272@debbugs.gnu.org, 19064@debbugs.gnu.org
Subject: bug#17272: bug#19064: bug#17272: bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it
Date: Sat, 23 Nov 2019 23:54:01 +0200 [thread overview]
Message-ID: <87h82u5rce.fsf@mail.linkov.net> (raw)
In-Reply-To: <878sobqxb4.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 20 Nov 2019 00:28:15 +0200")
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
>>> 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.
After more testing, at least all noticed problems are fixed
with this patch (it also reverts previous commits that
added minibuffer-message and that is not needed anymore):
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message-in-echo-area.patch --]
[-- Type: text/x-diff, Size: 7455 bytes --]
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 079750a3f6..9275513c8d 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -815,8 +815,7 @@ auto-revert-handler
(when revert
(when (and auto-revert-verbose
(not (eq revert 'fast)))
- (with-current-buffer (window-buffer (old-selected-window))
- (minibuffer-message "Reverting buffer `%s'." (buffer-name))))
+ (message "Reverting buffer `%s'." (buffer-name)))
;; If point (or a window point) is at the end of the buffer, we
;; want to keep it at the end after reverting. This allows one
;; to tail a file.
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.
diff --git a/lisp/man.el b/lisp/man.el
index ce01fdc805..beec2e616f 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1474,7 +1474,7 @@ Man-bgproc-sentinel
(kill-buffer Man-buffer)))
(when message
- (minibuffer-message "%s" message)))))
+ (message "%s" message)))))
(defun Man-page-from-arguments (args)
;; Skip arguments and only print the page name.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ee3d0095a9..7c87a18273 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -712,16 +712,16 @@ minibuffer-message
(progn
(if args
(apply #'message message args)
- (message "%s" message))
+ (message-in-echo-area "%s" message))
(prog1 (sit-for (or minibuffer-message-timeout 1000000))
- (message nil)))
+ (message-in-echo-area nil)))
;; Record message in the *Messages* buffer
(let ((inhibit-message t))
(if args
(apply #'message message args)
- (message "%s" message)))
+ (message-in-echo-area "%s" message)))
;; Clear out any old echo-area message to make way for our new thing.
- (message nil)
+ (message-in-echo-area nil)
(setq message (if (and (null args)
(string-match-p "\\` *\\[.+\\]\\'" message))
;; Make sure we can put-text-property.
@@ -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)))
diff --git a/lisp/subr.el b/lisp/subr.el
index 20daed623f..fae06399ef 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4620,9 +4620,10 @@ do-after-load-evaluation
byte-compile-current-file
byte-compile-root-dir)))
(byte-compile-warn "%s" msg))
- (run-with-idle-timer 0 nil
+ (run-with-timer 0 nil
(lambda (msg)
- (minibuffer-message "%s" msg))
+ (discard-input)
+ (message "%s" msg))
msg)))))
;; Finally, run any other hook.
diff --git a/src/editfns.c b/src/editfns.c
index 8fc866d391..650dc6d4ca 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2875,8 +2875,57 @@ accent (\\=`) and apostrophe (\\=') are special in the format; see
any existing message; this lets the minibuffer contents show. See
also `current-message'.
+When the variable `message-in-echo-area' is non-nil, use the function
+`message-in-echo-area' to display the message in the echo area.
+Otherwise, when the minibuffer is active, use `minibuffer-message'
+to temporarily display the message at the end of the minibuffer.
+
usage: (message FORMAT-STRING &rest ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
+{
+ if (NILP (Vmessage_in_echo_area)
+ && !inhibit_message
+ && !(NILP (args[0]) || (STRINGP (args[0]) && SBYTES (args[0]) == 0))
+ && WINDOW_LIVE_P (Fold_selected_window ())
+ && BUFFERP (Fwindow_buffer (Fold_selected_window ()))
+ && !NILP (Fminibufferp (Fwindow_buffer (Fold_selected_window ()))))
+ {
+ ptrdiff_t count = SPECPDL_INDEX ();
+
+ /* Avoid possible recursion. */
+ specbind (Qmessage_in_echo_area, Qt);
+
+ record_unwind_current_buffer ();
+ Fset_buffer (Fwindow_buffer (Fold_selected_window ()));
+
+ return unbind_to (count, CALLN (Fapply, intern ("minibuffer-message"),
+ Flist (nargs, args)));
+ }
+ else
+ return Fmessage_in_echo_area (nargs, args);
+}
+
+DEFUN ("message-in-echo-area", Fmessage_in_echo_area, Smessage_in_echo_area, 1, MANY, 0,
+ doc: /* Display a message at the bottom of the screen.
+The message also goes into the `*Messages*' buffer, if `message-log-max'
+is non-nil. (In keyboard macros, that's all it does.)
+Return the message.
+
+In batch mode, the message is printed to the standard error stream,
+followed by a newline.
+
+The first argument is a format control string, and the rest are data
+to be formatted under control of the string. Percent sign (%), grave
+accent (\\=`) and apostrophe (\\=') are special in the format; see
+`format-message' for details. To display STRING without special
+treatment, use (message-in-echo-area "%s" STRING).
+
+If the first argument is nil or the empty string, the function clears
+any existing message; this lets the minibuffer contents show. See
+also `current-message'.
+
+usage: (message-in-echo-area FORMAT-STRING &rest ARGS) */)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
if (NILP (args[0])
|| (STRINGP (args[0])
@@ -4520,6 +4569,11 @@ syms_of_editfns (void)
it to be non-nil. */);
binary_as_unsigned = false;
+ DEFVAR_LISP ("message-in-echo-area", Vmessage_in_echo_area,
+ doc: /* Non-nil means overwrite the minibuffer with a message in the echo area. */);
+ Vmessage_in_echo_area = Qnil;
+ DEFSYM (Qmessage_in_echo_area, "message-in-echo-area");
+
defsubr (&Spropertize);
defsubr (&Schar_equal);
defsubr (&Sgoto_char);
@@ -4594,6 +4648,7 @@ syms_of_editfns (void)
defsubr (&Semacs_pid);
defsubr (&Ssystem_name);
defsubr (&Smessage);
+ defsubr (&Smessage_in_echo_area);
defsubr (&Smessage_box);
defsubr (&Smessage_or_box);
defsubr (&Scurrent_message);
next prev parent reply other threads:[~2019-11-23 21:54 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 18:38 bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it Drew Adams
2015-12-26 16:30 ` Lars Ingebrigtsen
2015-12-26 17:19 ` Drew Adams
2015-12-26 17:45 ` Michael Heerdegen
2015-12-26 17:57 ` Lars Ingebrigtsen
2019-10-07 17:41 ` bug#17272: " Lars Ingebrigtsen
2019-10-08 9:15 ` Michael Heerdegen
2019-10-08 15:44 ` bug#17272: " Lars Ingebrigtsen
2019-11-05 23:10 ` bug#19064: " Juri Linkov
2019-11-08 20:58 ` Lars Ingebrigtsen
2019-11-08 21:19 ` bug#19064: " Drew Adams
2019-11-09 23:01 ` Juri Linkov
2019-11-12 2:13 ` bug#17272: " Lars Ingebrigtsen
2019-11-12 15:34 ` Drew Adams
2019-11-12 22:20 ` Juri Linkov
2019-11-12 23:23 ` bug#17272: " Drew Adams
2019-11-13 21:29 ` Michael Heerdegen
2019-11-13 21:53 ` Juri Linkov
2019-11-13 23:24 ` bug#17272: " Drew Adams
2019-11-14 15:46 ` Michael Heerdegen
2019-11-14 16:28 ` bug#17272: " Drew Adams
2019-11-14 17:06 ` Michael Heerdegen
2019-11-14 17:17 ` Drew Adams
2019-11-14 20:29 ` Michael Heerdegen
2019-11-16 20:53 ` Juri Linkov
2019-11-16 22:37 ` Michael Heerdegen
2019-11-17 1:42 ` bug#19064: bug#17272: " Drew Adams
2019-11-17 21:58 ` Juri Linkov
2019-11-17 23:54 ` bug#19064: " Drew Adams
2019-11-17 5:52 ` Lars Ingebrigtsen
2019-11-17 5:52 ` Lars Ingebrigtsen
2019-11-17 21:59 ` bug#17272: " Juri Linkov
2019-11-18 21:10 ` Juri Linkov
2019-11-19 8:13 ` Lars Ingebrigtsen
2019-11-19 11:11 ` bug#19064: " João Távora
2019-11-19 22:39 ` bug#17272: " Juri Linkov
2019-11-19 23:38 ` João Távora
2019-11-20 22:10 ` Juri Linkov
2019-11-20 23:44 ` João Távora
2019-11-21 21:39 ` Juri Linkov
2019-11-22 7:48 ` Eli Zaretskii
2019-11-23 19:02 ` Juri Linkov
2019-11-23 19:14 ` Eli Zaretskii
2019-11-26 23:18 ` bug#19064: " Juri Linkov
2019-11-27 0:46 ` Drew Adams
2019-11-21 8:22 ` martin rudalics
2019-11-21 21:44 ` Juri Linkov
2019-11-22 8:08 ` martin rudalics
2019-11-23 18:56 ` Juri Linkov
2019-11-23 19:16 ` Eli Zaretskii
2019-11-19 22:28 ` Juri Linkov
2019-11-20 10:55 ` Lars Ingebrigtsen
2019-11-20 22:18 ` Juri Linkov
2019-11-21 21:54 ` Juri Linkov
2019-11-21 23:07 ` bug#19064: " Lars Ingebrigtsen
2019-11-23 21:54 ` Juri Linkov [this message]
2019-11-26 23:44 ` Juri Linkov
2019-11-27 11:55 ` bug#19064: " Lars Ingebrigtsen
2019-11-28 22:45 ` Juri Linkov
2019-11-06 22:18 ` Juri Linkov
2019-11-09 22:57 ` Juri Linkov
2019-11-10 9:46 ` martin rudalics
2019-11-10 20:45 ` bug#38164: quit-restore-window doesn't restore point in man Juri Linkov
2019-11-11 9:33 ` martin rudalics
2019-11-12 20:50 ` Juri Linkov
2019-11-13 8:04 ` martin rudalics
2019-11-13 21:29 ` Juri Linkov
2019-11-14 9:20 ` martin rudalics
2019-11-14 23:13 ` Juri Linkov
2019-11-15 8:13 ` martin rudalics
2019-11-18 21:21 ` Juri Linkov
2019-11-19 3:28 ` Eli Zaretskii
2019-11-19 7:56 ` martin rudalics
2019-11-19 16:06 ` Eli Zaretskii
2019-11-19 16:53 ` martin rudalics
2019-11-19 17:36 ` Eli Zaretskii
2019-11-19 18:15 ` martin rudalics
2019-11-19 23:03 ` Juri Linkov
2019-11-20 7:59 ` martin rudalics
2019-11-20 22:35 ` Juri Linkov
2019-11-20 16:02 ` Eli Zaretskii
2020-09-21 13:08 ` Lars Ingebrigtsen
2021-04-04 18:13 ` Basil L. Contovounesios
2021-04-04 18:28 ` Eli Zaretskii
2021-04-04 19:19 ` Lars Ingebrigtsen
2021-04-04 19:36 ` Eli Zaretskii
2021-04-04 19:40 ` Lars Ingebrigtsen
2021-04-04 19:38 ` Lars Ingebrigtsen
2015-12-26 17:53 ` bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it Lars Ingebrigtsen
2015-12-26 18:10 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h82u5rce.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=17272@debbugs.gnu.org \
--cc=19064@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=michael_heerdegen@web.de \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).