From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master fe3676f: (Finsert_file_contents): Keep buffer consistent in non-local exit Date: Thu, 04 Jul 2019 16:28:16 +0300 Message-ID: <83a7duapzj.fsf@gnu.org> References: <83d0ird3ka.fsf@gnu.org> <83muhvavsf.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="139608"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 04 15:29:02 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hj1nK-000aDN-Gs for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 15:29:02 +0200 Original-Received: from localhost ([::1]:46080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hj1nJ-0001Td-G7 for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 09:29:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49987) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hj1mo-0001Sn-17 for emacs-devel@gnu.org; Thu, 04 Jul 2019 09:28:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hj1ml-0002h5-LM; Thu, 04 Jul 2019 09:28:28 -0400 Original-Received: from [176.228.60.248] (port=3285 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hj1mj-0000YB-P4; Thu, 04 Jul 2019 09:28:27 -0400 In-reply-to: (message from Stefan Monnier on Wed, 03 Jul 2019 13:48:27 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.emacs.devel:238351 Archived-At: > From: Stefan Monnier > Date: Wed, 03 Jul 2019 13:48:27 -0400 > > > I think we should do 2. > > I think as a user, after an error, I'd rather see the text decoded with > `raw-text-unix` (which is what we get now) than no text at all. > Also until now, the behavior has been to show the text we loaded, so > this would be a more significant change. > > What would be the benefit of making the buffer empty? I think our usual practice is to roll back any failed operations, leaving things as they were before the problematic transaction started. > > I think we should restore undo-list, because (a) it isn't hard, and > > (b) someone at some point will complain if we don't. > > Fair enough, I'll do that. > > >> > . fail to reset the markers and overlays to their previous state > >> > . fail to reset intervals > >> > >> These only need to be "reset" in the normal code path because we remove > >> the text from the buffer (to put it into the gap and then decode it), > >> but since in this case we don't remove the text, there's no need to do > >> that (and remember that the buffer was empty to start with so there's > >> not much "previous state" to restore in this respect). > > I don't think I understand this. Are you saying that empty buffers > > cannot have markers and overlays? > > No I'm saying that all the markers were at BOB and it's perfectly > correct to have them moved elsewhere after the insertion of text in > the buffer. > > The resetting of markers in the normal codepath is required for > correctness reasons (without it, we can end up with markers pointing > outside of the actual buffer text, for example), but in the non-local > exit case it's not needed and would only throw away information. > > But if you prefer, I can move that back to the unwind function (along > with the undo-list resetting), of course. To reset the undo-list, you already need an unwind function, right? If you are sure that markers and overlays will not be affected by insertion that was aborted half-way, then the unwind function doesn't need to do anything with them. I couldn't convince myself that none of these will be affected.