emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112762: * src/fileio.c (Finsert_file


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112762: * src/fileio.c (Finsert_file_contents): Preserve undo info when reverting
Date: Tue, 28 May 2013 21:07:53 -0400
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112762
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8447
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2013-05-28 21:07:53 -0400
message:
  * src/fileio.c (Finsert_file_contents): Preserve undo info when reverting
  a buffer.
modified:
  src/ChangeLog
  src/fileio.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-05-27 16:54:33 +0000
+++ b/src/ChangeLog     2013-05-29 01:07:53 +0000
@@ -1,3 +1,8 @@
+2013-05-29  Stefan Monnier  <address@hidden>
+
+       * fileio.c (Finsert_file_contents): Preserve undo info when reverting
+       a buffer (bug#8447).
+
 2013-05-27  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a
@@ -25,8 +30,8 @@
        (struct MonitorInfo): New struct.
        (free_monitors, make_monitor_attribute_list): Declare.
 
-       * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): New
-       Lisp_Object:s.
+       * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource):
+       New Lisp_Object:s.
        (free_monitors, make_monitor_attribute_list): New functions.
        (syms_of_frame): DEFSYM Qgeometry, Qworkarea, Qmm_size, Qframes,
        Qsource.

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2013-05-18 05:32:17 +0000
+++ b/src/fileio.c      2013-05-29 01:07:53 +0000
@@ -3506,6 +3506,11 @@
   bool set_coding_system = 0;
   Lisp_Object coding_system;
   bool read_quit = 0;
+  /* If the undo log only contains the insertion, there's no point
+     keeping it.  It's typically when we first fill a file-buffer.  */
+  bool empty_undo_list_p
+    = (!NILP (visit) && NILP (BVAR (current_buffer, undo_list))
+       && BEG == Z);
   Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
   bool we_locked_file = 0;
   bool deferred_remove_unwind_protect = 0;
@@ -4108,6 +4113,7 @@
        {
          del_range_byte (same_at_start, same_at_end, 0);
          temp = GPT;
+         eassert (same_at_start == GPT_BYTE);
          same_at_start = GPT_BYTE;
        }
       else
@@ -4120,6 +4126,7 @@
        = buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
                                  same_at_start - BEGV_BYTE
                                  + BUF_BEG_BYTE (XBUFFER (conversion_buffer)));
+      eassert (same_at_start_charpos == temp - (BEGV - BEG));
       inserted_chars
        = (buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
                                   same_at_start + inserted - BEGV_BYTE
@@ -4404,7 +4411,7 @@
 
   if (!NILP (visit))
     {
-      if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
+      if (empty_undo_list_p)
        bset_undo_list (current_buffer, Qnil);
 
       if (NILP (handler))
@@ -4546,7 +4553,7 @@
          p = XCDR (p);
        }
 
-      if (NILP (visit))
+      if (!empty_undo_list_p)
        {
          bset_undo_list (current_buffer, old_undo);
          if (CONSP (old_undo) && inserted != old_inserted)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]