aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c
index e24867298e1..d26319441b3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -5112,7 +5112,16 @@ transpose_markers (ptrdiff_t start1, ptrdiff_t end1,
5112 } 5112 }
5113} 5113}
5114 5114
5115DEFUN ("transpose-regions-internal", Ftranspose_regions_internal, Stranspose_regions_internal, 4, 5, 0, 5115DEFUN ("transpose-regions", Ftranspose_regions, Stranspose_regions, 4, 5,
5116 "(if (< (length mark-ring) 2)\
5117 (error \"Other region must be marked before transposing two regions\")\
5118 (let* ((num (if current-prefix-arg\
5119 (prefix-numeric-value current-prefix-arg)\
5120 0))\
5121 (ring-length (length mark-ring))\
5122 (eltnum (mod num ring-length))\
5123 (eltnum2 (mod (1+ num) ring-length)))\
5124 (list (point) (mark) (elt mark-ring eltnum) (elt mark-ring eltnum2))))",
5116 doc: /* Transpose region STARTR1 to ENDR1 with STARTR2 to ENDR2. 5125 doc: /* Transpose region STARTR1 to ENDR1 with STARTR2 to ENDR2.
5117The regions should not be overlapping, because the size of the buffer is 5126The regions should not be overlapping, because the size of the buffer is
5118never changed in a transposition. 5127never changed in a transposition.
@@ -5120,7 +5129,14 @@ never changed in a transposition.
5120Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update 5129Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update
5121any markers that happen to be located in the regions. 5130any markers that happen to be located in the regions.
5122 5131
5123Transposing beyond buffer boundaries is an error. */) 5132Transposing beyond buffer boundaries is an error.
5133
5134Interactively, STARTR1 and ENDR1 are point and mark; STARTR2 and ENDR2
5135are the last two marks pushed to the mark ring; LEAVE-MARKERS is nil.
5136If a prefix argument N is given, STARTR2 and ENDR2 are the two
5137successive marks N entries back in the mark ring. A negative prefix
5138argument instead counts forward from the oldest mark in the mark
5139ring. */)
5124 (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers) 5140 (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
5125{ 5141{
5126 register ptrdiff_t start1, end1, start2, end2; 5142 register ptrdiff_t start1, end1, start2, end2;
@@ -5565,5 +5581,5 @@ functions if all the text being accessed has this property. */);
5565 defsubr (&Swiden); 5581 defsubr (&Swiden);
5566 defsubr (&Snarrow_to_region); 5582 defsubr (&Snarrow_to_region);
5567 defsubr (&Ssave_restriction); 5583 defsubr (&Ssave_restriction);
5568 defsubr (&Stranspose_regions_internal); 5584 defsubr (&Stranspose_regions);
5569} 5585}