emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Additional cleanup around xterm-mouse


From: Jared Finder
Subject: Re: Additional cleanup around xterm-mouse
Date: Sun, 27 Dec 2020 08:30:44 -0800
User-agent: Roundcube Webmail/1.3.15

On 2020-12-27 7:36 am, Stefan Monnier wrote:
-@defun read-key &optional prompt
+@defun read-key &optional prompt all-fallbacks-disabled

FWIW, I would call it "fallbacks-disabled".

I want to distinguish it from the very similar intentioned but somewhat differing behaving parameter to read-key-sequence. If I don't need to change read-key-sequence's behavior (see below), then I am 100% on board.

Hmm... now that I think about it, I wonder if we need to make changes in
`read_key_sequence` at all, because we can instead arrange for all keys
to be bound:

    diff --git a/lisp/subr.el b/lisp/subr.el
    index 725722cbee..1ca1d51d44 100644
    --- a/lisp/subr.el
    +++ b/lisp/subr.el
    @@ -2453,10 +2453,11 @@ memory-limit
     ;;;; Input and display facilities.

     (defconst read-key-empty-map (make-sparse-keymap))
    -
    +(defconst read-key-full-map
+ (let ((map (make-sparse-keymap))) (define-key map [t] 'dummy) map)) (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.

    -(defun read-key (&optional prompt)
    +(defun read-key (&optional prompt dont-fallback)
       "Read a key from the keyboard.
Contrary to `read-event' this will not return a raw event but instead will
     obey the input decoding and translations usually done by
`read-key-sequence'.
    @@ -2468,7 +2469,8 @@ read-key
;; always inherits the input method, in practice read-key does not ;; inherit the input method (at least not if it's based on quail).
       (let ((overriding-terminal-local-map nil)
    -       (overriding-local-map read-key-empty-map)
    +       (overriding-local-map
    +        (if dont-fallback read-key-full-map read-key-empty-map))
             (echo-keystrokes 0)
            (old-global-map (current-global-map))
             (timer (run-with-idle-timer

WDYT?

This needs to also avoid binding ESC as well, e.g. adding (define-key map [?\e] nil). Cursory testing locally with that as well shows this working out well.

This assumes that ESC is the only prefix key in input-decode-map. Is that an okay assumption to make? It appears true locally on my xterm.


All other suggestions integrated into my local patch.

  -- MJF



reply via email to

[Prev in Thread] Current Thread [Next in Thread]