]> git.eshelyaron.com Git - emacs.git/commitdiff
(Ftranspose_regions): Fix overlays after moving markers.
authorKarl Heuer <kwzh@gnu.org>
Tue, 17 May 1994 03:28:55 +0000 (03:28 +0000)
committerKarl Heuer <kwzh@gnu.org>
Tue, 17 May 1994 03:28:55 +0000 (03:28 +0000)
Update point as if it were a marker.

src/editfns.c

index e0b4a4897945bce85a44f26f458b9400f22ac95d..28036650c92653f072beb406367b74a17d00f12c 100644 (file)
@@ -1640,6 +1640,17 @@ transpose_markers (start1, end1, start2, end2)
   register Lisp_Object marker;
   register struct Lisp_Marker *m;
 
+  /* Update point as if it were a marker.
+     Do this before adjusting the start/end values for the gap.  */
+  if (PT < start1)
+    ;
+  else if (PT < end1)
+    TEMP_SET_PT (PT + (end2 - end1));
+  else if (PT < start2)
+    TEMP_SET_PT (PT + (end2 - start2) - (end1 - start1));
+  else if (PT < end2)
+    TEMP_SET_PT (PT - (start2 - start1));
+
   /* Internally, marker positions take the gap into account, so if the
    * gap is before one or both of the regions, the region's limits
    * must be adjusted to compensate.  The caller guaranteed that the
@@ -1939,7 +1950,10 @@ Transposing beyond buffer boundaries is an error.")
      be nicer, and more beneficial in the long run, but would be a
      bunch of work.  Plus the way they're arranged now is nice.  */
   if (NILP (leave_markers))
-    transpose_markers (start1, end1, start2, end2);
+    {
+      transpose_markers (start1, end1, start2, end2);
+      fix_overlays_in_range (start1, end2);
+    }
 
   return Qnil;
 }