all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#33749: 26.1; input-decode-map to empty vector should preserve echo area
@ 2018-12-14 20:48 Yuri Khan
  2018-12-15  6:57 ` Eli Zaretskii
  2018-12-19 18:05 ` bug#33749: 26.1; input-decode-map to empty vector should preserve echo area Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Yuri Khan @ 2018-12-14 20:48 UTC (permalink / raw)
  To: 33749

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
‘input-decode-map’. Currently, this works, but every time such a
sequence is received from the terminal, the echo area is cleared,
rendering invisible any prompt displayed by the previous key press.


Here’s a playground recipe with no external dependencies:

$ emacs -Q

(define-key input-decode-map (kbd "<f5> <f5>") [])

C-s <f5> <f5>


The intuitive expectation is that pressing <f5> <f5> 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 <f5> the first time clears the echo area immediately.

* If <f5> is pressed again within ‘echo-keystrokes’ seconds, the echo
area stays blank and the prompt invisible until the next key (other
than <f5>) is pressed.

* If ‘echo-keystrokes’ seconds elapse before the next key is pressed,
then the echo area displays the current key sequence prefix and a
dash: ‘f5-’.

* In that case, pressing <f5> again changes the echo area to ‘f5 f5-’,
as if it’s waiting for more. And it is; since <f5> <f5> 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 ‘read_key_sequence’ detects that the whole key sequence has been
rewritten to an empty sequence, return -1. This is the same code as a
canceled menu selection, upon receiving which clients call
‘read_key_sequence’ again.

* In ‘command_loop_1’, save the echo area contents before calling
‘read_key_sequence’, 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=x86_64-linux-gnu --prefix=/usr
 '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
 '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
 --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu'
 '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
 --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
 --program-suffix=26 --with-modules --with-file-notification=inotify
 --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets
 --with-lcms2 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs26-pCvJBp/emacs26-26.1~1.git07f8f9b=.
-fstack-protector-strong
 -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' 'LDFLAGS=-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))





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-01-01 16:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-14 20:48 bug#33749: 26.1; input-decode-map to empty vector should preserve echo area Yuri Khan
2018-12-15  6:57 ` Eli Zaretskii
2018-12-15  8:07   ` Yuri Khan
2018-12-15  9:09     ` Eli Zaretskii
2018-12-16  8:29     ` bug#33749: [PATCH] Preserve echo area contents when decoding an empty key sequence (Bug#33749) Yuri Khan
2018-12-19 18:05 ` bug#33749: 26.1; input-decode-map to empty vector should preserve echo area Stefan Monnier
2018-12-20 17:33   ` Yuri Khan
2018-12-20 18:56     ` Stefan Monnier
2018-12-21 18:36       ` Yuri Khan
2018-12-25 19:35         ` Stefan Monnier
2018-12-25 19:44           ` Eli Zaretskii
2018-12-25 20:07             ` Stefan Monnier
2018-12-26  3:32               ` Eli Zaretskii
2019-01-01 16:09               ` Yuri Khan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.