[Top][All Lists]

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

Re: Moving kbd to subr.el

From: Stefan Monnier
Subject: Re: Moving kbd to subr.el
Date: Fri, 15 Oct 2021 09:32:05 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> commit 629d4dcd2a184da6a0b246d31f152a84327db51a
> Author:     Richard M. Stallman <rms@gnu.org>
> AuthorDate: Tue Sep 21 03:44:04 1993 +0000
>     Total rewrite by Gillespie.
> +                always (and (integerp ch)
> +                            (let ((ch2 (logand ch (lognot (lsh 1 23)))))
> +                              (and (>= ch2 0) (<= ch2 127))))))
> which works as intended (probably), and then it became

First things first: I think `kbd` should simply always return a vector.
[ This is just repeating my stance that we should deprecate the use of
  strings as sequences of events.  ]

As for what this intends to do, I think it tries to use a string even
in the case where some of the events use the `meta` modifier, and it
does this by relying on the following bit of code in `define-key`:

    int meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key))
                    ? meta_modifier : 0x80);

I.e. when a string is used to represent a sequence of events, that string
can include meta modifiers (represented as the 7th bit) but only if the
string is unibyte.

It's for those kinds of intricacies that I want to get rid of the use of
strings as sequences of events.


reply via email to

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