changeset 23775:e2b39708c646

(transpose-subr, transpose-subr-1): Rename variables bound in one function and used in the other. (transpose-subr-start1, transpose-subr-start2): Add defvars. (transpose-subr-end1, transpose-subr-end2): Add defvars.
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 Nov 1998 02:42:51 +0000
parents 43fd01db076b
children 529965d3c653
files lisp/simple.el
diffstat 1 files changed, 31 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Fri Nov 27 22:30:31 1998 +0000
+++ b/lisp/simple.el	Sat Nov 28 02:42:51 1998 +0000
@@ -2524,56 +2524,66 @@
 		       (forward-line arg))))
 		  arg))
 
+(defvar transpose-subr-start1)
+(defvar transpose-subr-start2)
+(defvar transpose-subr-end1)
+(defvar transpose-subr-end2)
+
 (defun transpose-subr (mover arg)
-  (let (start1 end1 start2 end2)
+  (let (transpose-subr-start1
+	transpose-subr-end1
+	transpose-subr-start2
+	transpose-subr-end2)
     (if (= arg 0)
 	(progn
 	  (save-excursion
 	    (funcall mover 1)
-	    (setq end2 (point))
+	    (setq transpose-subr-end2 (point))
 	    (funcall mover -1)
-	    (setq start2 (point))
+	    (setq transpose-subr-start2 (point))
 	    (goto-char (mark))
 	    (funcall mover 1)
-	    (setq end1 (point))
+	    (setq transpose-subr-end1 (point))
 	    (funcall mover -1)
-	    (setq start1 (point))
+	    (setq transpose-subr-start1 (point))
 	    (transpose-subr-1))
 	  (exchange-point-and-mark))
       (if (> arg 0)
 	  (progn
 	    (funcall mover -1)
-	    (setq start1 (point))
+	    (setq transpose-subr-start1 (point))
 	    (funcall mover 1)
-	    (setq end1 (point))
+	    (setq transpose-subr-end1 (point))
 	    (funcall mover arg)
-	    (setq end2 (point))
+	    (setq transpose-subr-end2 (point))
 	    (funcall mover (- arg))
-	    (setq start2 (point))
+	    (setq transpose-subr-start2 (point))
 	    (transpose-subr-1)
-	    (goto-char end2))
+	    (goto-char transpose-subr-end2))
 	(funcall mover -1)
-	(setq start2 (point))
+	(setq transpose-subr-start2 (point))
 	(funcall mover 1)
-	(setq end2 (point))
+	(setq transpose-subr-end2 (point))
 	(funcall mover (1- arg))
-	(setq start1 (point))
+	(setq transpose-subr-start1 (point))
 	(funcall mover (- arg))
-	(setq end1 (point))
+	(setq transpose-subr-end1 (point))
 	(transpose-subr-1)))))
 
 (defun transpose-subr-1 ()
-  (if (> (min end1 end2) (max start1 start2))
+  (if (> (min transpose-subr-end1 transpose-subr-end2)
+	 (max transpose-subr-start1 transpose-subr-start2))
       (error "Don't have two things to transpose"))
-  (let* ((word1 (buffer-substring start1 end1))
+  (let* ((word1 (buffer-substring transpose-subr-start1 transpose-subr-end1))
 	 (len1 (length word1))
-	 (word2 (buffer-substring start2 end2))
+	 (word2 (buffer-substring transpose-subr-start2 transpose-subr-end2))
 	 (len2 (length word2)))
-    (delete-region start2 end2)
-    (goto-char start2)
+    (delete-region transpose-subr-start2 transpose-subr-end2)
+    (goto-char transpose-subr-start2)
     (insert word1)
-    (goto-char (if (< start1 start2) start1
-		 (+ start1 (- len1 len2))))
+    (goto-char (if (< transpose-subr-start1 transpose-subr-start2)
+		   transpose-subr-start1
+		 (+ transpose-subr-start1 (- len1 len2))))
     (delete-region (point) (+ (point) len1))
     (insert word2)))