summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2011-05-26 13:36:55 +0800
committerLeo Liu <sdl.web@gmail.com>2011-05-26 13:36:55 +0800
commit0f4aebc0ebc91099461f5af63f3034709336f233 (patch)
tree1d4f479bdedcd33ac1d90855b95cedf5eba88a86 /src/editfns.c
parente4245494bac8d6305d408772c1fa99b28b36612d (diff)
downloademacs-0f4aebc0ebc91099461f5af63f3034709336f233.tar.gz
Allow empty regions in transpose-regions
See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8699.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c5
1 files changed, 3 insertions, 2 deletions
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