From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <87h82u5rce.fsf@mail.linkov.net> References: <8ea0a3fa-5169-4493-bd54-3ebe47836a35@default> <87y4chjdop.fsf@gnus.org> <87o8ys3131.fsf@gnus.org> <875zjx6hs6.fsf@mail.linkov.net> <87sgmy3x22.fsf@gnus.org> <871rugbqmy.fsf@mail.linkov.net> <87d0dxyh7z.fsf@gnus.org> <53c55db5-d623-4946-af2e-d141e7bc7acd@default> <87sgmrpir5.fsf@web.de> <87mucya2a7.fsf@web.de> <87mucy4cb2.fsf@web.de> <621b98dc-0fe9-4eef-9e11-7580fb446e97@default> <87k1822ocn.fsf@web.de> <87lfsfmtk0.fsf@mail.linkov.net> <874kz3gibu.fsf@gnus.org> <87bltaw3xz.fsf@mail.linkov.net> <87r224x54p.fsf@mail.linkov.net> <87v9rgnv0o.fsf@gnus.org> <878sobqxb4.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="137770"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Michael Heerdegen , 17272@debbugs.gnu.org, 19064@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 23 23:25:26 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iYdqH-000Zfe-Ak for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 23:25:25 +0100 Original-Received: from localhost ([::1]:32992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYdqG-0000gO-3r for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 17:25:24 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60964) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYdq8-0000gH-T1 for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:25:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYdq7-0005Sn-6f for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:25:16 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49108) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iYdq7-0005Sh-1x for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:25:15 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iYdpu-0006Gq-2M for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:25:11 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Nov 2019 22:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17272 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 17272-submit@debbugs.gnu.org id=B17272.157454786124039 (code B ref 17272); Sat, 23 Nov 2019 22:25:02 +0000 Original-Received: (at 17272) by debbugs.gnu.org; 23 Nov 2019 22:24:21 +0000 Original-Received: from localhost ([127.0.0.1]:57925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYdpB-0006Fb-Lt for submit@debbugs.gnu.org; Sat, 23 Nov 2019 17:24:20 -0500 Original-Received: from eastern.birch.relay.mailchannels.net ([23.83.209.55]:1151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYdp6-0006FG-Ez; Sat, 23 Nov 2019 17:24:13 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 097336A1AB3; Sat, 23 Nov 2019 22:24:11 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (100-96-86-105.trex.outbound.svc.cluster.local [100.96.86.105]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9280D6A1995; Sat, 23 Nov 2019 22:24:10 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Sat, 23 Nov 2019 22:24:10 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Hysterical-Desert: 35e301f3130aebe7_1574547850841_1299729679 X-MC-Loop-Signature: 1574547850841:3696309583 X-MC-Ingress-Time: 1574547850841 Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTP id 5630984069; Sat, 23 Nov 2019 14:24:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=n/OJ35Fct7wihxkieSrLMiywGRI=; b= xtz8Ntek1PHKjayHarp4GD5L2uEOc1OJbmS4WO1gbkMgLG4Zxu1jQ1dGGNtYWroW ysFa5GTFoAKiKkA7E+xLwJVIWVvz8WsxYx/kvHzteNoLpu4//wa7nvvnT0O/JO+Q lZif4tO0LNw20f1QAgbFCUWH6ubu+7yqUl8wc37gEe8= Original-Received: from mail.jurta.org (m91-129-105-73.cust.tele2.ee [91.129.105.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTPSA id 74B4484068; Sat, 23 Nov 2019 14:24:03 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a34 In-Reply-To: <878sobqxb4.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 20 Nov 2019 00:28:15 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172347 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>> The variable name is =E2=80=98message-in-echo-area=E2=80=99. 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): --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=message-in-echo-area.patch 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); --=-=-=--