From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.bugs Subject: bug#33749: 26.1; input-decode-map to empty vector should preserve echo area Date: Sat, 15 Dec 2018 03:48:00 +0700 Message-ID: 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 1544826248 20991 195.159.176.226 (14 Dec 2018 22:24:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Dec 2018 22:24:08 +0000 (UTC) To: 33749@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 14 23:24:04 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 1gXvsJ-0005Ld-7x for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Dec 2018 23:24:03 +0100 Original-Received: from localhost ([::1]:35777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXvuQ-0007OS-21 for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Dec 2018 17:26:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXvuG-0007OK-L9 for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 17:26:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXvuF-0000DR-16 for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 17:26:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44375) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXvuE-0000DJ-T6 for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 17:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gXvuE-0003k1-Lp for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 17:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuri Khan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Dec 2018 22:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154482634514357 (code B ref -1); Fri, 14 Dec 2018 22:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Dec 2018 22:25:45 +0000 Original-Received: from localhost ([127.0.0.1]:48633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXvtv-0003jS-9I for submit@debbugs.gnu.org; Fri, 14 Dec 2018 17:25:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXuNo-0001Rq-3C for submit@debbugs.gnu.org; Fri, 14 Dec 2018 15:48:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXuNh-0006x5-5M for submit@debbugs.gnu.org; Fri, 14 Dec 2018 15:48:22 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:55668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXuNe-0006vJ-PC for submit@debbugs.gnu.org; Fri, 14 Dec 2018 15:48:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXuNd-00017y-8S for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 15:48:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXuNb-0006ng-Hv for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 15:48:17 -0500 Original-Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:44558) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXuNb-0006bt-9V for bug-gnu-emacs@gnu.org; Fri, 14 Dec 2018 15:48:15 -0500 Original-Received: by mail-ot1-x341.google.com with SMTP id f18so6657203otl.11 for ; Fri, 14 Dec 2018 12:48:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=DYqX8HlmR3BOQ1p9sP0yNIsMMOwqdE3luEiAODKJlp8=; b=WQFGxcjR248WM4WBUHmZcRCNWjvPZUlRZdNuFchMvEPoFJZ2wzjTx2w8h7qWJQ9EBH MRMRo7aeItwvOLMd5MgNmbd63JacSLbLxZoWnTBWJx7l0CGqKaV19GoBdvab8lpAweIC 4gC/x0VJbT6k5tuZqHKD6Uw8wLTsFNLPE5vdJzL2nW2i8OLBLsKZ9eyxZH3cza6WaxZE 2Mcb39moOmhA+1DUHyB7MgfqfZFJwjNftTlBRAn+60TZG4b5NjbaNZCOK11l36bJ/VbM 4rJ9dWRbXEPm5RqqQPH1XZrofOWGsiM4llpfS3jpqLXz2Islm5u2DbZkzd+h7ECT/fGq yUTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=DYqX8HlmR3BOQ1p9sP0yNIsMMOwqdE3luEiAODKJlp8=; b=A7fyHgDnl5O/4cdM0FA8rfvjvDjhhxHAkjiR654sdGtA6EaigLwX1+6Nh+dJIhVcfB 2zgIuMX5+T3dg9wGtmpb/7J2o3S8T6dxbQfJycNfdomUM4BNrnpFeU4uXnT8S1cylYZj etSgoQ56GkPuwfgye5ZunrEy2CGttEaQanis1ZaNKBwtmTgxW/OosxUZYsUJUjzHMTOq CDfypWsbadnaUdCx9IDVghs/C/HakVF/BNJEUJH03waJhJPvtEhNxYjaGpzE4SGuZgvB iZC27ehjiHkani2LOQ+aJQjNocNUN5cJcvfE5OJ7GNSPSXN9rqf94gMmqlLGlwC2DyId DqDw== X-Gm-Message-State: AA+aEWYJ80iABLdeHa/CY3OF1p5LhqWMnD0DPnm4gPs78mVOko4eJnXw ZZCAIgIDeXhITKP4zK1rtQwtStKtEix1X1VzPSXoLmLV X-Google-Smtp-Source: AFSGD/Vab8WmnhpGcE5MVgWNSELo6AaIOBJeVUnMlVdpOcgfoyJjqvgbzUFwN4TN3So9tOF1B49GMiWiKO7W2Svjp6A= X-Received: by 2002:a9d:6419:: with SMTP id h25mr3373502otl.34.1544820492729; Fri, 14 Dec 2018 12:48:12 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Fri, 14 Dec 2018 17:25:42 -0500 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:153464 Archived-At: See wider context here: http://lists.gnu.org/archive/html/emacs-devel/2018-12/msg00254.html The Kitty terminal emulator in full keyboard mode sends sequences for every keyboard event. This includes key release events and modifier key press events. I would like to ignore these, and it seems to be the most appropriate method to map them to an empty vector via =E2=80=98input-decode-map=E2=80=99. Currently, this works, but every time s= uch a sequence is received from the terminal, the echo area is cleared, rendering invisible any prompt displayed by the previous key press. Here=E2=80=99s a playground recipe with no external dependencies: $ emacs -Q (define-key input-decode-map (kbd " ") []) C-s The intuitive expectation is that pressing is a no-op. The I-search prompt should continue to be displayed, and no other action should be taken. The actual behavior depends on the timing: * Pressing the first time clears the echo area immediately. * If is pressed again within =E2=80=98echo-keystrokes=E2=80=99 seconds= , the echo area stays blank and the prompt invisible until the next key (other than ) is pressed. * If =E2=80=98echo-keystrokes=E2=80=99 seconds elapse before the next key i= s pressed, then the echo area displays the current key sequence prefix and a dash: =E2=80=98f5-=E2=80=99. * In that case, pressing again changes the echo area to =E2=80=98f5 f5= -=E2=80=99, as if it=E2=80=99s waiting for more. And it is; since is replaced= by an empty vector, it is now a prefix of every possible binding. The call sequence that causes the echo to be cleared looks like this: command_loop_1 (in keyboard.c) read_key_sequence read_char redisplay and much of the read_char and read_key_sequence mechanics maintain echoing of the current prefix sequence. My suggestion is to add two changes: * If =E2=80=98read_key_sequence=E2=80=99 detects that the whole key sequenc= e has been rewritten to an empty sequence, return -1. This is the same code as a canceled menu selection, upon receiving which clients call =E2=80=98read_key_sequence=E2=80=99 again. * In =E2=80=98command_loop_1=E2=80=99, save the echo area contents before c= alling =E2=80=98read_key_sequence=E2=80=99, and restore it if the return value is = -1. A proposed patch will follow. In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-29 built on lcy01-amd64-029 Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 18.04.1 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. [] Quit Configured using: 'configure --build=3Dx86_64-linux-gnu --prefix=3D/usr '--includedir=3D${prefix}/include' '--mandir=3D${prefix}/share/man' '--infodir=3D${prefix}/share/info' --sysconfdir=3D/etc --localstatedir=3D/= var --disable-silent-rules '--libdir=3D${prefix}/lib/x86_64-linux-gnu' '--libexecdir=3D${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=3D/usr --sharedstatedir=3D/var/lib --program-suffix=3D26 --with-modules --with-file-notification=3Dinotify --with-mailutils --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-xwidgets --with-lcms2 'CFLAGS=3D-g -O2 -fdebug-prefix-map=3D/build/emacs26-pCvJBp/emacs26-26.1~1.git07f8f9b=3D. -fstack-protector-strong -Wformat -Werror=3Dformat-security -no-pie' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2' 'LDFLAGS=3D-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2 Important settings: value of $LC_MONETARY: en_RU.UTF-8 value of $LC_NUMERIC: en_RU.UTF-8 value of $LC_TIME: en_RU.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils misearch multi-isearch edmacro kmacro cl-loaddefs cl-lib elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting xwidget-internal move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 96766 11934) (symbols 48 20584 1) (miscs 40 46 179) (strings 32 28973 1221) (string-bytes 1 760346) (vectors 16 14880) (vector-slots 8 498940 11302) (floats 8 50 266) (intervals 56 264 14) (buffers 992 11))