GNU bug report logs - #12925
24.1; string-make-unibyte instead of string-as-unibyte

Previous Next

Package: emacs;

Reported by: Ethan Glasser-Camp <ethan.glasser.camp <at> gmail.com>

Date: Sun, 18 Nov 2012 17:47:01 UTC

Severity: minor

Found in version 24.1

Full log


Message #17 received at 12925 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 12925 <at> debbugs.gnu.org,
 ethan.glasser.camp <at> gmail.com
Subject: Re: bug#12925: 24.1; string-make-unibyte instead of string-as-unibyte
Date: Tue, 01 Jun 2021 09:45:07 -0400
> Why not make both methods do the same: insert the bytes of the
> multibyte text into the unibyte buffer?

AFAIK it's rather unusual to need to insert a text that's multibyte into
a buffer that's unibyte.  And in those cases, the right behavior is not
always the same (sometimes it should covert using something like
locale-coding-system, sometimes it should preserve the actual
byte-sequence used internally, sometimes it should signal an error, ...).

So I think, as much as possible, we should refrain from guessing and
rather request that the coder call `encode-coding-string` or something
like that explicitly to say what they want.

> Making the buffer unibyte after insertion is a PITA, because it could
> be very slow if the text in the buffer is long.

Agreed.  In my book `set-buffer-multibyte` should signal an error if the
buffer is not empty (yes, I know it's not going to happen, but I think
it's the direction we should be headed).


        Stefan





This bug report was last modified 4 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.