]> git.eshelyaron.com Git - emacs.git/commitdiff
* buffer.c (Fkill_buffer): When killing an indirect buffer,
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 21 Jan 2014 02:28:57 +0000 (06:28 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 21 Jan 2014 02:28:57 +0000 (06:28 +0400)
re-attach intervals to its base buffer (Bug#16502).
* intervals.c (set_interval_object): Move from here...
* intervals.h (set_interval_object): ... to here.  Fix comments.

src/ChangeLog
src/buffer.c
src/intervals.c
src/intervals.h

index ac7624ee4abd5ffe69ce3edf219608410eb1c229..99a3e7e729906015f40fde07f10575ab2aef7ca9 100644 (file)
@@ -1,3 +1,10 @@
+2014-01-21  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * buffer.c (Fkill_buffer): When killing an indirect buffer,
+       re-attach intervals to its base buffer (Bug#16502).
+       * intervals.c (set_interval_object): Move from here...
+       * intervals.h (set_interval_object): ... to here.  Fix comments.
+
 2014-01-20  Paul Eggert  <eggert@cs.ucla.edu>
 
        Avoid undefined behavior by initializing buffer redisplay bit.
index 8f557634b2a75f71e1ce1aa3463409b61af4845a..33bd80d3f4fc2f828b557fef633dde6f53501d66 100644 (file)
@@ -1868,6 +1868,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
 
   if (b->base_buffer)
     {
+      INTERVAL i;
       /* Unchain all markers that belong to this indirect buffer.
         Don't unchain the markers that belong to the base buffer
         or its other indirect buffers.  */
@@ -1882,6 +1883,14 @@ cleaning up all windows currently displaying the buffer to be killed. */)
          else
            mp = &m->next;
        }
+      /* Intervals should be owned by the base buffer (Bug#16502).  */
+      i = buffer_intervals (b);
+      if (i)
+       {
+         Lisp_Object owner;
+         XSETBUFFER (owner, b->base_buffer);
+         set_interval_object (i, owner);
+       }
     }
   else
     {
index 13ff9a9e3db8c2b8f9b6790aea9e6fde87a3b17d..703c0cefbd50c9f01eaa7f4ed28dfbf4392e194a 100644 (file)
@@ -60,16 +60,7 @@ static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
 \f
 /* Utility functions for intervals.  */
 
-/* Use these functions to set Lisp_Object
-   or pointer slots of struct interval.  */
-
-static void
-set_interval_object (INTERVAL i, Lisp_Object obj)
-{
-  eassert (BUFFERP (obj) || STRINGP (obj));
-  i->up_obj = 1;
-  i->up.obj = obj;
-}
+/* Use these functions to set pointer slots of struct interval.  */
 
 static void
 set_interval_left (INTERVAL i, INTERVAL left)
index 45c2e5f5e5435b54c7e2aa38907f876944a6a0f9..e901f99747db0b111bfa5cb70ce589edde9bf3fc 100644 (file)
@@ -133,6 +133,14 @@ struct interval
 /* Use these functions to set Lisp_Object
    or pointer slots of struct interval.  */
 
+INLINE void
+set_interval_object (INTERVAL i, Lisp_Object obj)
+{
+  eassert (BUFFERP (obj) || STRINGP (obj));
+  i->up_obj = 1;
+  i->up.obj = obj;
+}
+
 INLINE void
 set_interval_parent (INTERVAL i, INTERVAL parent)
 {