all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	12925@debbugs.gnu.org, ethan.glasser.camp@gmail.com
Subject: bug#12925: 24.1; string-make-unibyte instead of string-as-unibyte
Date: Tue, 01 Jun 2021 09:45:07 -0400	[thread overview]
Message-ID: <jwvv96xln5t.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83fsy123yg.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 01 Jun 2021 14:56:39 +0300")

> 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






  reply	other threads:[~2021-06-01 13:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-18 17:45 bug#12925: 24.1; string-make-unibyte instead of string-as-unibyte Ethan Glasser-Camp
2012-11-19  2:27 ` Stefan Monnier
2021-06-01  7:02   ` Lars Ingebrigtsen
2021-06-01 11:56     ` Eli Zaretskii
2021-06-01 13:45       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-06-01 14:03         ` Eli Zaretskii
2021-06-01 14:25           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-01 15:26             ` Eli Zaretskii
2021-06-02  5:07       ` Lars Ingebrigtsen
2021-06-02 12:07         ` Eli Zaretskii
2021-06-02 13:09           ` Lars Ingebrigtsen
2021-06-02 13:36             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvv96xln5t.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=12925@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ethan.glasser.camp@gmail.com \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.