diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-11-28 02:42:51 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-11-28 02:42:51 +0000 |
commit | 8b56e02dd55e22bdf5391cc61503ba80b2edac53 (patch) | |
tree | 2185c256aa12606aece074bc2932e7347a6c15d6 /lisp | |
parent | dc32c4fafbc0d9b2096baf41406f10216d4f737f (diff) | |
download | emacs-8b56e02dd55e22bdf5391cc61503ba80b2edac53.tar.gz |
(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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/simple.el | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 9e51d95d9bc..6a4734a8004 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2524,56 +2524,66 @@ With argument 0, interchanges line point is in with line mark is in." (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))) |