summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog4
-rw-r--r--src/editfns.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e98cb2848a9..c4f5ef4b920 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-26 Leo Liu <sdl.web@gmail.com>
+
+ * editfns.c (Ftranspose_regions): Allow empty regions. (Bug#8699)
+
2011-05-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p.
diff --git a/src/editfns.c b/src/editfns.c
index 5e1dcce0275..881e0c7f3e2 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4353,8 +4353,9 @@ Transposing beyond buffer boundaries is an error. */)
if (start2 < end1)
error ("Transposed regions overlap");
- else if (start1 == end1 || start2 == end2)
- error ("Transposed region has length 0");
+ /* Nothing to change for adjacent regions with one being empty */
+ else if ((start1 == end1 || start2 == end2) && end1 == start2)
+ return Qnil;
/* The possibilities are:
1. Adjacent (contiguous) regions, or separate but equal regions