[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master fe3676f: (Finsert_file_contents): Keep buffer c
Re: [Emacs-diffs] master fe3676f: (Finsert_file_contents): Keep buffer consistent in non-local exit
Wed, 03 Jul 2019 20:10:40 +0300
> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Wed, 03 Jul 2019 12:43:10 -0400
> 1- do as I do now (i.e. stay in unibyte even if the buffer was
> originally in multibyte).
> 2- erase the text we loaded (i.e. all the text, since the buffer
> started as empty) and revert the buffer to its original multibyteness
> 3- decode the text with some "default" coding system. Note that the
> behavior (1) basically corresponds to a `no-conversion` coding system
> (since such a coding system also forces the buffer to unibyte).
> 4- keep the old "arbitrary bytes in a multibyte buffer" bug.
> I think only (4) is clearly inferior and neither of the other is clearly
> superior, so I went with the easier choice, especially since it's
> expected to be a very rare corner case occurrence anyway (after all, we
> lived with (4) for many years).
I think we should do 2.
> W.r.t the undo-list, I don't have a good reason for this choice, it was
> just easier. Since the buffer started as empty, there's a good chance
> that the undo list had no interesting info anyway, so I felt like this
> is even less important.
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.
> > . 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?