unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Milan Stanojević" <mstanojevic@janestreet.com>
Cc: 31837@debbugs.gnu.org
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	[thread overview]
Message-ID: <83sh5krmd1.fsf@gnu.org> (raw)
In-Reply-To: <CAArdBwMSvz+21UEd03iAmCPG_kA_NLR72Vz-JqaMXG3j5GJ-2A@mail.gmail.com> (message from Milan Stanojević on Mon, 18 Jun 2018 13:44:08 -0400)

> From: Milan Stanojević <mstanojevic@janestreet.com>
> Date: Mon, 18 Jun 2018 13:44:08 -0400
> Cc: 31837@debbugs.gnu.org
> 
> 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	other threads:[~2018-06-18 18:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14 21:34 bug#31837: 26.1; replace-buffer-contents doesn't work if buffer has multibyte characters Milan Stanojević
2018-06-15  8:34 ` Eli Zaretskii
2018-06-18 17:44   ` Milan Stanojević
2018-06-18 18:16     ` Eli Zaretskii [this message]
2018-06-18 20:29       ` Milan Stanojević
2018-06-19  2:30         ` Eli Zaretskii
2018-07-01 17:32   ` Philipp Stephani

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83sh5krmd1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=31837@debbugs.gnu.org \
    --cc=mstanojevic@janestreet.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).