[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: |
Fri, 15 Oct 2021 13:26:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
> The code deals with character codepoints, not with their multibyte
> representation. So UTF-8 or not doesn't seem relevant here.
Sorry; I mean "Unicode code points", not utf-8.
Eli Zaretskii <eliz@gnu.org> writes:
>> > > always (and (characterp ch)
>> > > (let ((ch2 (logand ch (lognot ?\M-\^@))))
>> > > (and (>= ch2 0) (<= ch2 127))))))
[...]
> Actually, I have to disagree with the conclusion that this is a
> complicated way of saying
>
> (<= 0 ch 127)
>
> That's because 'ch' can include modifier bits set, and the above code
> resets them before comparing against 127.
But `characterp' just checks that ch is smaller than 0x3FFFFF, and
(dotimes (ch #x3FFFFF)
(unless (equal
(and (characterp ch)
(let ((ch2 (logand ch (lognot ?\M-\^@))))
(and (>= ch2 0) (<= ch2 127))))
(<= 0 ch 127))
(error "%s" ch)))
shows no difference between the two tests in that range. So perhaps the
logic it's trying to get at just doesn't work, or we have other problems
here.
And note:
(characterp ?\M-\^@)
=> nil
It's hard to say, but I think the code wants to allow returning "\M-s"
as a string, but it doesn't:
(edmacro-parse-keys "M-s")
=> [134217843]
So the code today is equivalent to (<= 0 ch 127), but that's probably
because it's buggy -- perhaps always has been, but perhaps it's because
we've changed how characters are represented.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: Moving kbd to subr.el, (continued)
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/15
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/15
- Re: Moving kbd to subr.el, Andreas Schwab, 2021/10/15
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/15
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/15
- Re: Moving kbd to subr.el, Stefan Monnier, 2021/10/15
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/15
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/15
- Re: Moving kbd to subr.el, Stefan Monnier, 2021/10/15
- Re: Moving kbd to subr.el, T.V Raman, 2021/10/15
- Re: Moving kbd to subr.el,
Lars Ingebrigtsen <=
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/16
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/16
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/16
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/17
- Re: Moving kbd to subr.el, Gregory Heytings, 2021/10/17
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/17
- Re: Moving kbd to subr.el, Gregory Heytings, 2021/10/17
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/17
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/18
- Re: Moving kbd to subr.el, Gregory Heytings, 2021/10/18