[Top][All Lists]

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

Re: Towards a cleaner build: arc-mode

From: Eli Zaretskii
Subject: Re: Towards a cleaner build: arc-mode
Date: Fri, 17 May 2019 15:01:27 +0300

> From: Lars Ingebrigtsen <address@hidden>
> Date: Fri, 17 May 2019 12:35:47 +0200
> This is the most head-scratchiest of all the string-to-multibyte stuff.
> (eval-when-compile
>   (defsubst byte-after (pos)
>     "Like char-after but an eight-bit char is converted to unibyte."
>     (multibyte-char-to-unibyte (char-after pos)))
>   (defsubst insert-unibyte (&rest args)
>     "Like insert but don't make unibyte string and eight-bit char multibyte."
>     (dolist (elt args)
>       (if (integerp elt)
>         (insert (if (< elt 128) elt (decode-char 'eight-bit elt)))
>       (insert (string-to-multibyte elt)))))
>   )

We have get-byte nowadays, so I believe the first defsubst is not
needed.  You just need to catch errors, maybe.

> First of all, it defines defsubsts in the global namespace, but
> (decode-char 'eight-bit 130) => 4194178
> Hm...  Oh!  Is it working in a multibyte buffer, so it wants to insert
> bytes that are in Emacs' "byte plane"?
> (insert (decode-char 'eight-bit 130))
> => \202
> I guess.

Yes.  However, I suspect this juggling is no longer need nowadays.  If
you just use 'insert', does arc-mode break when you invoke the
commands that end up using these calls?  This should be tried also in
a locale whose codeset is not UTF-8.


reply via email to

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