help-gnu-emacs
[Top][All Lists]
Advanced

[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:48:44 -0400

On Fri, Jul 12, 2024 at 8:53 AM Robert Pluim <rpluim@gmail.com> wrote:

> >>>>> On Fri, 12 Jul 2024 08:14:52 -0400, Pierre Rouleau <
> prouleau001@gmail.com> said:
>
>     Pierre>  Hi all,
>     Pierre> Does Emacs already have a predicate function that can be used
> to check if
>     Pierre> the specified key sequence is valid for Emacs running in
> terminal mode?
>
> Not that I know of, but Emacs always has functionality I donʼt know of
> :-)
>
>     Pierre> For example, "C-;" is not accessible on Emacs running in
> terminal mode
>     Pierre> because this is not an ASCII control character. It's available
> for Emacs
>     Pierre> running in graphical environment, but not in terminal mode.
>
>     Pierre> Is there something similar already available or one would
> simply wrap
>     Pierre> describe-key and catch the error to check?
>
> Iʼm in a terminal frame:
>
>     (describe-key (kbd "C-;")) =>
>     #("C-; is undefined" 0 3 (face help-key-binding font-lock-face
> help-key-binding))
>
> which is exactly what you get in a GUI frame.
>
> I think the best you can do is bind the key. If itʼs available, it will
> work.
>
>
Yes, but I want to be able to distinguish in elisp code.
In a situation where several packages globally bind the same
key sequence to different commands I have code that detect the instance
and report by warning.
I want to prevent the warning in Emacs running in terminal mode
if that key sequence cannot even be used under Emacs in terminal mode
when running in the specific terminal.


-- 
/Pierre


reply via email to

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