[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moving kbd to subr.el
From: |
Eli Zaretskii |
Subject: |
Re: Moving kbd to subr.el |
Date: |
Fri, 15 Oct 2021 14:05:36 +0300 |
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Date: Fri, 15 Oct 2021 12:28:08 +0200
>
> Stefan Kangas <stefankangas@gmail.com> writes:
>
> > OK, so looking even closer at this to develop test cases for the above,
> > in the original code we have this convoluted mess:
> >
> > (if (and (not need-vector)
> > (cl-loop for ch across res
> > always (and (characterp ch)
> > (let ((ch2 (logand ch (lognot ?\M-\^@))))
> > (and (>= ch2 0) (<= ch2 127))))))
> > (concat (cl-loop for ch across res
> > collect (if (= (logand ch ?\M-\^@) 0)
> > ch (+ ch 128))))
> > res)
>
> Yeah, my eyes glazed over when reading that code the first few times.
> :-)
>
> > But that is equivalent to:
> >
> > (<= 0 ch 127)
>
> I think... you're totally right. It looks like a very convoluted way
> to write (<= 0 ch 127).
I don't read CL-ish very well, so I cannot help you here. (Read: I
have no idea what this code does.)
> But perhaps there's historical reasons for the code being that way? In
> the olden days, Emacs didn't use utf-8 as the character representation,
> so perhaps it made sense back then?
The code deals with character codepoints, not with their multibyte
representation. So UTF-8 or not doesn't seem relevant here. It seems
to all be about character codes with modifier bits set.
- Re: Moving kbd to subr.el, (continued)
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/14
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/14
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/14
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/14
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/14
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/14
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/14
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/14
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/14
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/15
- Re: Moving kbd to subr.el,
Eli Zaretskii <=
- 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, 2021/10/15