[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does code exist to check if a key sequence is valid for Emacs runnin
From: |
Pierre Rouleau |
Subject: |
Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode? |
Date: |
Fri, 12 Jul 2024 10:57:57 -0400 |
On Fri, Jul 12, 2024 at 10:45 AM Robert Pluim <rpluim@gmail.com> wrote:
> >>>>> On Fri, 12 Jul 2024 10:35:49 -0400, Pierre Rouleau <
> prouleau001@gmail.com> said:
>
> Pierre> It would therefore like to distinguish the 3 potential cases:
> Pierre> - the key sequence is bound
> Pierre> - the key sequence is not defined.
> Pierre> Like "C-| is undefined" when tried in Emacs running in
> graphical mode.
> Pierre> - the key sequence is not defined, but reported via an error.
> Pierre> Like "C-;" when tried under Emacs running in terminal mode
> Pierre> inside a terminal that does not remap the C-; to some
> other escape
> Pierre> sequence.
>
> In every terminal Iʼm aware of the way it works is that pressing Ctrl
> and ; at the same time sends ';', so thereʼs no error case to detect
> (maybe this is different with kitty with its extensions)
>
> Plus `describe-key' happily works with key sequences that the current
> terminal cannot produce:
>
> (describe-key (kbd "A-C-H-M-s-S-;")) =>
>
> #("A-C-H-M-S-s-; is undefined" 0 13 (face help-key-binding font-lock-face
> help-key-binding))
>
>
I get the behaviour you describe under Linux normally.
But under macOS, running under their Terminal.app terminal it's different.
The Terminal.app configuration allows selecting sequences for some ANSI
code sequence
but not for the Control sequences that do not correspond to the ASCII
Control codes
(C-@ (0x00) up to C-_ (0x1f)).
I assume I could, with some logic, try to use the key sequence binary
value,
detect the terminal by looking at the TERM environment variable,
use the knowledge appropriate to the terminal and infer whether it's
supported or not.
But that seems like the wrong approach.
--
/Pierre
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, (continued)
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Pierre Rouleau, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Pierre Rouleau, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Yuri Khan, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Pierre Rouleau, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, tomas, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Pierre Rouleau, 2024/07/13
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, tomas, 2024/07/13
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Emanuel Berg, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Pierre Rouleau, 2024/07/13
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Robert Pluim, 2024/07/12
- Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?,
Pierre Rouleau <=
Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode?, Stefan Monnier, 2024/07/16