unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21885: 24.5; Transposing things with a negative argument
@ 2015-11-12  8:12 Eli Barzilay
  2015-11-12 16:18 ` Eli Zaretskii
  2015-11-12 18:11 ` Stephen Leake
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Barzilay @ 2015-11-12  8:12 UTC (permalink / raw)
  To: 21885

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 627 bytes --]

In the past (IIRC, up to around v24.3) transposing things (chars,
words, sexprs, lines) would always leave the point after the
transposed thing.  This means that I could always use a `C--' prefix
to "drag" the current thing backwards in the same way that the default
action drags it forwards.  This is no longer happenning.

After a few trials the thing that seems to fix it is adding this line
at the end of the `transpose-subr' definition:

    (goto-char (+ (car pos2) (- (cdr pos1) (car pos1))))

To be clear, this is not a backward incompatible change -- it fixes
the *current* incompatible change.

Patch file attached.


[-- Attachment #2: 0001-Fix-transpose-subr-with-a-negative-argument.patch --]
[-- Type: application/octet-stream, Size: 918 bytes --]

From 84a951fa309ff45c033428c7cb8c32290ab13168 Mon Sep 17 00:00:00 2001
From: Eli Barzilay <eli@barzilay.org>
Date: Thu, 12 Nov 2015 03:00:33 -0500
Subject: [PATCH] Fix `transpose-subr' with a negative argument

Make the cursor go to the end of the transposed text, in the same way it
does with a positive argument.
---
 lisp/simple.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 1f2f4fe..86fa16d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6497,7 +6497,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))))
-- 
2.6.3


[-- Attachment #3: .signature --]
[-- Type: text/plain, Size: 151 bytes --]


-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-11-13 13:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-12  8:12 bug#21885: 24.5; Transposing things with a negative argument Eli Barzilay
2015-11-12 16:18 ` Eli Zaretskii
2015-11-12 18:00   ` martin rudalics
2015-11-12 18:17     ` Eli Zaretskii
2015-11-12 18:11 ` Stephen Leake
2015-11-12 18:24   ` Eli Zaretskii
2015-11-12 19:27     ` Eli Barzilay
2015-11-13  9:47       ` Eli Zaretskii
2015-11-13 13:13         ` Juanma Barranquero
2015-11-13 13:36           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).