Subject: Re: bug#43830: keyboard layout handling incompatible with rest of the OS

From: Paul Pogonyshev <[email-masked]>
Date: Sun, 1 Nov 2020 19:56:09 +0100

> read-event will figure out by itself whether it should return the
> ASCII character or a non-ASCII character, and return that.

I'm not sure that is possible, because it doesn't really know how it
is going to be processed. But you must be much more familiar with
Emacs internals.

Paul

On Sun, 1 Nov 2020 at 18:25, Eli Zaretskii <[email-masked]> wrote:

> > From: Paul Pogonyshev <[email-masked]>
> > Date: Sun, 1 Nov 2020 17:51:00 +0100
> > Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> >
> > > > What about functions like `read-event'? It returns integers if I
> press
> > > > M-[letter] or C-[letter].
> > >
> > > read-event is also implemented in C.  But maybe I don't understand
> > > your question.
> >
> > I mean, what about the cases where it is called from Elisp?  It is
> > implemented in C, but also is publicly available.
> >
> > I have come up with two ideas:
> >
> > 1. `read-event' and its internal C implementation grow an optional
> > parameter that says whether to return character as if being typed (as
> > now) or for keybinding use (i.e. from physical keys).
> >
> > 2. Alternatively, if this cannot be determined in advance (i.e. before
> > calling `read-event' etc.), these functions could set variable named sth.
> > like `last-keybinding-keycode'. Then the caller would use either the
> > return value (as now) or, if it wants, the value of the variable instead.
>
> What I had in mind was
>
>  0. read-event will figure out by itself whether it should return the
>  ASCII character or a non-ASCII character, and return that.
>