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: Mon, 18 Nov 2019 23:10:30 +0200 Organization: LINKOV.NET Message-ID: <87r224x54p.fsf@mail.linkov.net> References: <8ea0a3fa-5169-4493-bd54-3ebe47836a35@default> <87r3i9nped.fsf@gnus.org> <87wps1m7co.fsf@web.de> <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> 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="81121"; 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 Mon Nov 18 22:52:18 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 1iWowU-000KzH-AW for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 22:52:18 +0100 Original-Received: from localhost ([::1]:39870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWowT-0004M1-0b for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 16:52:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40069) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWowJ-0004Gn-Bv for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:52:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWowH-0007v1-VS for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:52:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37543) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWowH-0007uV-Qw for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:52:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWowH-0005GD-Os for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:52:05 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2019 21:52: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.157411390620152 (code B ref 17272); Mon, 18 Nov 2019 21:52:02 +0000 Original-Received: (at 17272) by debbugs.gnu.org; 18 Nov 2019 21:51:46 +0000 Original-Received: from localhost ([127.0.0.1]:46355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWovx-0005Ex-Mp for submit@debbugs.gnu.org; Mon, 18 Nov 2019 16:51:46 -0500 Original-Received: from chocolate.birch.relay.mailchannels.net ([23.83.209.35]:38073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWovu-0005El-Vp; Mon, 18 Nov 2019 16:51:44 -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 8578E3C035E; Mon, 18 Nov 2019 21:51:41 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (100-96-196-51.trex.outbound.svc.cluster.local [100.96.196.51]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id EC6A93C0172; Mon, 18 Nov 2019 21:51:40 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a6.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); Mon, 18 Nov 2019 21:51:41 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Language-Society: 62bd5ac44c3f81fb_1574113901275_2416894597 X-MC-Loop-Signature: 1574113901275:139463986 X-MC-Ingress-Time: 1574113901274 Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTP id 2B1EBA7011; Mon, 18 Nov 2019 13:51:38 -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=45WSH53PNh3bzdPF7JdsHaK+91c=; b= p4lohBMJ9yZmNwXQ48vO49Gevdj1Obwa4F1oyHRCuc0jB8K2JR8ShhbVKtSORj/P 3Kc8XEvO7DFMDHQMQixIzFyDSZV5lZLFx97yw6/ioJw+UabM4v8dphifMD3KC/Mk WMTJ6xvsqlw7pEz08RnsFotrIUSEkgDMtO3CN1ebxys= Original-Received: from mail.jurta.org (m91-129-102-1.cust.tele2.ee [91.129.102.1]) (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-a6.g.dreamhost.com (Postfix) with ESMTPSA id 33048A7004; Mon, 18 Nov 2019 13:51:34 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a6 In-Reply-To: <87bltaw3xz.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 17 Nov 2019 23:59:50 +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:171941 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>> 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 :-( >> >> Yeah, it's a problem all over the place. >> >>> 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= : >> >> Drew doesn't have veto powers. I say go ahead and make the change in >> `message' (with a variable that can be used to force `message' to not >> behave like `minibuffer-message'). > > Yes, I believe a new variable would make Drew happy. The variable name is =E2=80=98message-in-echo-area=E2=80=99. After a lit= tle testing, it seems to handle all such cases well: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=message-in-echo-area.patch diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 6e72eb73f9..7e74fa1ffb 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. diff --git a/src/editfns.c b/src/editfns.c index 8fc866d391..a1e3fb1fa5 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2877,6 +2877,49 @@ Fmessage usage: (message FORMAT-STRING &rest ARGS) */) (ptrdiff_t nargs, Lisp_Object *args) +{ + if (NILP (Vmessage_in_echo_area) + && !(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 +4563,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 +4642,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); --=-=-=--