From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 25e461c 1/2: Fix visiting files with raw-text Date: Sun, 13 Dec 2015 23:25:28 -0500 Message-ID: References: <20151213195208.12085.93274@vcs.savannah.gnu.org> <83k2oi3wm7.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1450067177 7315 80.91.229.3 (14 Dec 2015 04:26:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Dec 2015 04:26:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 14 05:25:58 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 1a8Khx-0007I2-OG for ged-emacs-devel@m.gmane.org; Mon, 14 Dec 2015 05:25:57 +0100 Original-Received: from localhost ([::1]:57711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Khw-0005M0-Vm for ged-emacs-devel@m.gmane.org; Sun, 13 Dec 2015 23:25:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Khc-0005Lr-G5 for emacs-devel@gnu.org; Sun, 13 Dec 2015 23:25:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8KhX-0002fz-Ci for emacs-devel@gnu.org; Sun, 13 Dec 2015 23:25:36 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:39452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8KhX-0002fu-3n; Sun, 13 Dec 2015 23:25:31 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id tBE4PSpu012288; Sun, 13 Dec 2015 23:25:29 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 665B8AE06F; Sun, 13 Dec 2015 23:25:28 -0500 (EST) In-Reply-To: <83k2oi3wm7.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 13 Dec 2015 22:46:24 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5519=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5519> : inlines <4104> : streams <1553847> : uri <2101158> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:196235 Archived-At: >> > - Fset_buffer_multibyte (Qnil); >> > + if (inserted > 0) >> > + bset_enable_multibyte_characters (current_buffer, Qnil); >> > + else >> > + Fset_buffer_multibyte (Qnil); >> >> Hmm... IIUC if (inserted > 0) we need bset_enable_multibyte_characters >> because Fset_buffer_multibyte would try to convert the chars we >> just inserted. >> >> And IIUC we recently switched to Fset_buffer_multibyte in order to >> handle the case where the buffer was not empty when we started (in >> which case we need to convert the content that was present before we >> started insertion). >> >> So, IIUC if the buffer was not empty to start with *and* (inserted > 0), >> then we have a problem because neither function is right. >> >> Or did I miss something? > 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)? Stefan