]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert move of interactive `transpose-regions' to Lisp
authorKarl Fogel <kfogel@red-bean.com>
Mon, 19 Mar 2018 17:21:03 +0000 (12:21 -0500)
committerAndrew G Cohen <cohen@andy.bu.edu>
Tue, 11 Dec 2018 06:17:52 +0000 (14:17 +0800)
This reverts my commit 3a3aa0e056a of 2018-03-18 at 21:43:18 UTC.
I thought consensus had been reached, but it had not: Eli Zaretskii
felt the pre-3a3aa0e056a situation was fine and would not like to
see it changed without at least further discussion.

lisp/simple.el
src/editfns.c

index 61d09329da358faa87b7d66e3f89b2beca4b255d..7d8010fa507349429bce2ac81244807d85ee58bf 100644 (file)
@@ -7014,34 +7014,6 @@ With argument 0, interchanges line point is in with line mark is in."
                       (forward-line arg))))
                  arg))
 
-(defun transpose-regions (startr1 endr1 startr2 endr2 &optional leave-markers)
-  "Transpose region STARTR1 to ENDR1 with STARTR2 to ENDR2.
-The regions should not be overlapping, because the size of the buffer is
-never changed in a transposition.
-
-Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update
-any markers that happen to be located in the regions.
-
-Transposing beyond buffer boundaries is an error.
-
-Interactively, STARTR1 and ENDR1 are point and mark; STARTR2 and ENDR2
-are the last two marks pushed to the mark ring; LEAVE-MARKERS is nil.
-If a prefix argument N is given, STARTR2 and ENDR2 are the two
-successive marks N entries back in the mark ring.  A negative prefix
-argument instead counts forward from the oldest mark in the mark
-ring."
-  (interactive
-   (if (< (length mark-ring) 2)
-       (error "Other region must be marked before transposing two regions")
-     (let* ((num (if current-prefix-arg
-                    (prefix-numeric-value current-prefix-arg)
-                  0))
-           (ring-length (length mark-ring))
-           (eltnum (mod num ring-length))
-           (eltnum2 (mod (1+ num) ring-length)))
-       (list (point) (mark) (elt mark-ring eltnum) (elt mark-ring eltnum2)))))
-  (transpose-regions-internal startr1 endr1 startr2 endr2 leave-markers))
-
 ;; FIXME seems to leave point BEFORE the current object when ARG = 0,
 ;; which seems inconsistent with the ARG /= 0 case.
 ;; FIXME document SPECIAL.
index e24867298e1f87e4074d160d505246002642b0a1..d26319441b33c89db98f26c5a2e76210e100c9bb 100644 (file)
@@ -5112,7 +5112,16 @@ transpose_markers (ptrdiff_t start1, ptrdiff_t end1,
     }
 }
 
-DEFUN ("transpose-regions-internal", Ftranspose_regions_internal, Stranspose_regions_internal, 4, 5, 0,
+DEFUN ("transpose-regions", Ftranspose_regions, Stranspose_regions, 4, 5,
+       "(if (< (length mark-ring) 2)\
+           (error \"Other region must be marked before transposing two regions\")\
+         (let* ((num (if current-prefix-arg\
+                        (prefix-numeric-value current-prefix-arg)\
+                       0))\
+                (ring-length (length mark-ring))\
+                (eltnum (mod num ring-length))\
+                (eltnum2 (mod (1+ num) ring-length)))\
+           (list (point) (mark) (elt mark-ring eltnum) (elt mark-ring eltnum2))))",
        doc: /* Transpose region STARTR1 to ENDR1 with STARTR2 to ENDR2.
 The regions should not be overlapping, because the size of the buffer is
 never changed in a transposition.
@@ -5120,7 +5129,14 @@ never changed in a transposition.
 Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update
 any markers that happen to be located in the regions.
 
-Transposing beyond buffer boundaries is an error.  */)
+Transposing beyond buffer boundaries is an error.
+
+Interactively, STARTR1 and ENDR1 are point and mark; STARTR2 and ENDR2
+are the last two marks pushed to the mark ring; LEAVE-MARKERS is nil.
+If a prefix argument N is given, STARTR2 and ENDR2 are the two
+successive marks N entries back in the mark ring.  A negative prefix
+argument instead counts forward from the oldest mark in the mark
+ring.  */)
   (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
 {
   register ptrdiff_t start1, end1, start2, end2;
@@ -5565,5 +5581,5 @@ functions if all the text being accessed has this property.  */);
   defsubr (&Swiden);
   defsubr (&Snarrow_to_region);
   defsubr (&Ssave_restriction);
-  defsubr (&Stranspose_regions_internal);
+  defsubr (&Stranspose_regions);
 }