]> code.delx.au - gnu-emacs/commitdiff
Fix point positioning after transposing with negative arg
authorEli Barzilay <eli@barzilay.org>
Fri, 13 Nov 2015 09:46:20 +0000 (11:46 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 13 Nov 2015 09:46:20 +0000 (11:46 +0200)
* lisp/simple.el (transpose-subr): When invoked with a negative
argument, move point to after the transposed text, like we do
when invoked with a positive argument.  (Bug#21885)

lisp/simple.el

index 2781ad02b9704bbcb356ae30d11ddada38b87877..b115a2a0cbb30a1b37b043aaab1098d00100e57e 100644 (file)
@@ -6634,7 +6634,8 @@ current object."
       (setq pos1 (funcall aux -1))
       (goto-char (car pos1))
       (setq pos2 (funcall aux arg))
-      (transpose-subr-1 pos1 pos2)))))
+      (transpose-subr-1 pos1 pos2)
+      (goto-char (+ (car pos2) (- (cdr pos1) (car pos1))))))))
 
 (defun transpose-subr-1 (pos1 pos2)
   (when (> (car pos1) (cdr pos1)) (setq pos1 (cons (cdr pos1) (car pos1))))