From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 25e461c 1/2: Fix visiting files with raw-text Date: Mon, 14 Dec 2015 17:52:31 +0200 Message-ID: <83bn9t3u4g.fsf@gnu.org> References: <20151213195208.12085.93274@vcs.savannah.gnu.org> <83k2oi3wm7.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1450108430 5855 80.91.229.3 (14 Dec 2015 15:53:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Dec 2015 15:53:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 14 16:53:35 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a8VRH-0000x4-VM for ged-emacs-devel@m.gmane.org; Mon, 14 Dec 2015 16:53:28 +0100 Original-Received: from localhost ([::1]:60663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VRH-0000Ah-Cq for ged-emacs-devel@m.gmane.org; Mon, 14 Dec 2015 10:53:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VQG-0007CO-S5 for emacs-devel@gnu.org; Mon, 14 Dec 2015 10:52:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8VQD-0002xV-Mj for emacs-devel@gnu.org; Mon, 14 Dec 2015 10:52:24 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8VQD-0002xR-JV; Mon, 14 Dec 2015 10:52:21 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4894 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1a8VQA-0006JV-Bb; Mon, 14 Dec 2015 10:52:21 -0500 In-reply-to: (message from Stefan Monnier on Sun, 13 Dec 2015 23:25:28 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196243 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Sun, 13 Dec 2015 23:25:28 -0500 > > > If inserted is positive, there's code after that which takes care of > > adjusting the buffer's gap etc. So it's only needed when nothing was > > inserted. > > But if (inserted > 0) and the buffer was not empty beforehand, how can > the subsequent code know (after we've called > bset_enable_multibyte_characters) that it has to decode the earlier > buffer's content (since bset_enable_multibyte_characters has thrown away > the information that the earlier buffer's content was multibyte)? adjust_after_insert (which is the code I alluded to above) doesn't do any such decoding, it never did. IOW, I just returned the situation in this particular case to what it was before. The unconditional call to Fset_buffer_multibyte erroneously caused the gap and ZV adjustments to be done twice when inserted is positive; this commit fixed that. Feel free to make more changes there, I don't claim I understand this code better than you do. (I asked for comments, but no one responded.) Just make sure the two test cases, viz.: http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-12/msg00171.html http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-12/msg00442.html both still work correctly. Thanks.