[Top][All Lists]

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

Re: Towards a cleaner build: arc-mode

From: Lars Ingebrigtsen
Subject: Re: Towards a cleaner build: arc-mode
Date: Fri, 17 May 2019 12:35:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

This is the most head-scratchiest of all the string-to-multibyte stuff.

  (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)))))

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.  Well, that's one way of doing it...  er...  I think...

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

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