bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31837: 26.1; replace-buffer-contents doesn't work if buffer has mult


From: Eli Zaretskii
Subject: bug#31837: 26.1; replace-buffer-contents doesn't work if buffer has multibyte characters
Date: Mon, 18 Jun 2018 21:16:42 +0300

> From: Milan Stanojević <address@hidden>
> Date: Mon, 18 Jun 2018 13:44:08 -0400
> Cc: address@hidden
> 
> I haven't had a chance to read this email or try your patch until today.
> I just tried it and it seems to work.
> 
> Thanks for the quick fix, Eli!

Thanks for catching the blunder in the first place.

> Not sure that [enable_multibyte_characters] check buys us much in
> practice. At least in my case, it is always true.

It is easy enough to get a unibyte buffer: just use
find-file-literally or insert-file-literally.

> But what matters is whether there are actual multibyte characters in
> the buffer

If a buffer is unibyte, there could be no multibyte characters in it,
by definition.

> buf_charpos_to_bytepos already shortcircuits if there are none.

Not before it calls some macros.  And it is confusing to call a
conversion function when no conversion is needed, because the
correctness of that can only be established by looking at the called
conversion function.  That gets in the way of code reading, IME.

> We are starting to migrate our code base to use automatic code
> formatting and we use this for applying the formatting changes so we
> should have a lot of devs using this soon.

Thanks, please be sure to report any problems.





reply via email to

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