From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#33749: 26.1; input-decode-map to empty vector should preserve echo area Date: Tue, 25 Dec 2018 14:35:13 -0500 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1545766451 20378 195.159.176.226 (25 Dec 2018 19:34:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Dec 2018 19:34:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 33749@debbugs.gnu.org To: Yuri Khan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 25 20:34:07 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gbsSs-0005DK-N9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Dec 2018 20:34:06 +0100 Original-Received: from localhost ([127.0.0.1]:42642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbsUz-0006rM-DD for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Dec 2018 14:36:17 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbsUq-0006pJ-GQ for bug-gnu-emacs@gnu.org; Tue, 25 Dec 2018 14:36:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbsUk-0001p1-Vn for bug-gnu-emacs@gnu.org; Tue, 25 Dec 2018 14:36:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36888) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbsUk-0001ol-Sh for bug-gnu-emacs@gnu.org; Tue, 25 Dec 2018 14:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gbsUk-0000gE-HN for bug-gnu-emacs@gnu.org; Tue, 25 Dec 2018 14:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Dec 2018 19:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33749-submit@debbugs.gnu.org id=B33749.15457665182553 (code B ref 33749); Tue, 25 Dec 2018 19:36:02 +0000 Original-Received: (at 33749) by debbugs.gnu.org; 25 Dec 2018 19:35:18 +0000 Original-Received: from localhost ([127.0.0.1]:36443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gbsU2-0000f7-E6 for submit@debbugs.gnu.org; Tue, 25 Dec 2018 14:35:18 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:45410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gbsTz-0000ey-Li for 33749@debbugs.gnu.org; Tue, 25 Dec 2018 14:35:16 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id wBPJZD5W005385; Tue, 25 Dec 2018 14:35:14 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id B5FD9AE1EF; Tue, 25 Dec 2018 14:35:13 -0500 (EST) In-Reply-To: (Yuri Khan's message of "Sat, 22 Dec 2018 01:36:55 +0700") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6446=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6446> : inlines <6990> : streams <1808178> : uri <2769924> 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: 208.118.235.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:153836 Archived-At: > Also, I cannot easily add a new condition at this particular point. > It happens when Emacs reads each character of the sequence that will > eventually turn out to map to an empty one, but I do not know that > will be the case until the end. I think The Right Thing to do is likely to move this code to read_key_sequence, more specifically, move it to the point where we *know* we really do have an event. IOW, I think the patch below might be a better option (where we test `indec.start > 0` to make sure some *decoded* event was read). >> >> Also, who/where do you intend to set input-decode-preserve-echo? >> Ah, so you're planning to set it once and for all globally? > Terminal-locally, if it=E2=80=99s any better. Only marginally. Stefan diff --git a/src/keyboard.c b/src/keyboard.c index baf2f51440..92ef79b09f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2928,22 +2928,6 @@ read_char (int commandflag, Lisp_Object map, Vinput_method_previous_message =3D previous_echo_area_message; } =20 - /* Now wipe the echo area, except for help events which do their - own stuff with the echo area. */ - if (!CONSP (c) - || (!(EQ (Qhelp_echo, XCAR (c))) - && !(EQ (Qswitch_frame, XCAR (c))) - /* Don't wipe echo area for select window events: These might - get delayed via `mouse-autoselect-window' (Bug#11304). */ - && !(EQ (Qselect_window, XCAR (c))))) - { - if (!NILP (echo_area_buffer[0])) - { - safe_run_hooks (Qecho_area_clear_hook); - clear_message (1, 0); - } - } - reread_for_input_method: from_macro: /* Pass this to the input method, if appropriate. */ @@ -9070,6 +9054,23 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object = prompt, /* If not, we should actually read a character. */ else { + /* Now wipe the echo area, except for help events which do their + own stuff with the echo area. */ + /* FIXME: This used to happen at the end of read_char (i.e. after + we read the first event of a key sequence), but we now do it = just + before reading the second event, and only when we know that t= he + first event is a "real" one, rather than some internal event = that + might be dropped altogether (e.g. help-event, switch-frame, or + some key that we remap to the empty sequence (bug#33749)). + Maybe we should even make sure that `fkey.star > 0` or maybe + even `keytran.start > 0`!? */ + if (indec.start > 0 + && !NILP (echo_area_buffer[0])) + { + safe_run_hooks (Qecho_area_clear_hook); + clear_message (1, 0); + } + { KBOARD *interrupted_kboard =3D current_kboard; struct frame *interrupted_frame =3D SELECTED_FRAME ();