emacs-devel
[Top][All Lists]
Advanced

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

Re: Moving kbd to subr.el


From: Lars Ingebrigtsen
Subject: Re: Moving kbd to subr.el
Date: Mon, 18 Oct 2021 08:02:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Gregory Heytings <gregory@heytings.org> writes:

> If the point is to introduce a strict syntax, I think it's up to you
> to decide which key and event names are okay from the point of view of
> Emacs.

I imagined that the OS was feeding us the event names somehow (from xkb
in X, for instance), but that's perhaps not true?

In keyboard.c, we have lispy_accent_keys, lispy_multimedia_keys and
lispy_function_keys (etc) that perhaps lists (exhaustively) all the keys
we can handle?

Let's see...  make_lispy_event uses all those...  and then

      /* Handle system-specific or unknown keysyms.
         We need to use an alist rather than a vector as the cache
         since we can't make a vector long enough.  */
      if (NILP (KVAR (current_kboard, system_key_syms)))
        kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
      return modify_event_symbol (event->code,
                                  event->modifiers,
                                  Qfunction_key,
                                  KVAR (current_kboard, Vsystem_key_alist),
                                  0, &KVAR (current_kboard, system_key_syms),
                                  PTRDIFF_MAX);

Which...  Uhm, actually, I'm not sure what this returns, since
NAME_ALIST_OR_STEM isn't a stem here.

Anyway, it seems like we (more or less) have a complete list of all
symbols that are possible, but there's no way to ask Emacs "is this a
valid lispy event name?"  And it depends on the OS -- so we can't really
create a function based on the lispy_ C arrays either, because it'd be
annoying to get errors (or warnings) on different systems.

But it does seem true that none of our events start with a number, or a
dash, or an underscore.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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