[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: Sat, 18 May 2019 06:21:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> 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.

The string bit in

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

is used two places; both for renaming (and they don't work).  But here's
the lzh version:

  (let ((name (concat newname (substring "\0\0\0\0\0\0\0\0\0\0\0\0\0"
                                         (length newname))))
        (inhibit-read-only t))
        (goto-char (+ archive-proper-file-start (aref descr 4) 2))
        (delete-char 13)
        (insert-unibyte name)))))

If newname is ascii, then the string-to-multibyte thing isn't needed.
If newname is not ascii, then it fails, anyway:

(setq newname "f⚀o")
(setq name (concat newname (substring "\0\0\0\0\0\0\0\0\0\0\0\0\0"
(length newname))))
=> "address@hidden@address@hidden@address@hidden@address@hidden@address@hidden@"

(insert-unibyte name)
=> address@hidden@address@hidden@address@hidden@address@hidden@address@hidden@

And then do a

(multibyte-char-to-unibyte (char-after (point)))

on the die and get a


which doesn't seem very useful, because it'll probably turn into an #ff
when the file is read back.

byte-after, on the other hand, will bug out:

Debugger entered--Lisp error: (error "Not an ASCII nor an 8-bit character: 

so you're right -- we can't just replace the calls with get-byte, but
will have to add some error handling to be er feature compatible.

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