GNU bug report logs - #23785
Emacs 25: "Undo" overdoes things.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Fri, 17 Jun 2016 15:03:01 UTC

Severity: normal

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #65 received at 23785 <at> debbugs.gnu.org (full text, mbox):

From: phillip.lord <at> russet.org.uk (Phillip Lord)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: acm <at> muc.de, 23785 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#23785: Emacs 25: 'Undo' overdoes things.
Date: Mon, 20 Jun 2016 18:12:29 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: phillip.lord <at> russet.org.uk (Phillip Lord)
>> Cc: "Eli Zaretskii" <eliz <at> gnu.org>,  acm <at> muc.de,  23785 <at> debbugs.gnu.org
>> Date: Mon, 20 Jun 2016 16:03:35 +0100
>> 
>> My suggestion: this patch goes to Emacs-25.
>
> What patch?

Eli, do pay attention! The one that I didn't attach obviously.

Phil

[0001-Ensure-undo-boundary-after-insert-file-contents.patch (text/x-diff, inline)]
From a77a8683cddf918869b63fc3242ae594b186cc94 Mon Sep 17 00:00:00 2001
From: Phillip Lord <phillip.lord <at> russet.org.uk>
Date: Mon, 20 Jun 2016 14:26:02 +0100
Subject: [PATCH] Ensure undo-boundary after insert-file-contents.

* src/fileio.c: Record undoable change during insert-file-contents.

Addresses Bug #23785.
---
 src/fileio.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/fileio.c b/src/fileio.c
index b11f923..9fc1bd8 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4047,8 +4047,16 @@ by calling `format-decode', which see.  */)
 	 being called in insert_from_buffer (via in
 	 prepare_to_modify_buffer).  */
       specbind (intern ("buffer-file-name"), Qnil);
+
+      /*
+        Temporarily enable the undo-buffer to ensure that the change
+        is marked as an undoable one. Bug #23785.
+       */
+      bset_undo_list(current_buffer,Qnil);
       insert_from_buffer (XBUFFER (conversion_buffer),
 			  same_at_start_charpos, inserted_chars, 0);
+      bset_undo_list(current_buffer,Qt);
+
       /* Set `inserted' to the number of inserted characters.  */
       inserted = PT - temp;
       /* Set point before the inserted characters.  */
-- 
2.9.0


This bug report was last modified 4 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.