all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Barzilay <eli@barzilay.org>
To: 21885@debbugs.gnu.org
Subject: bug#21885: 24.5; Transposing things with a negative argument
Date: Thu, 12 Nov 2015 03:12:07 -0500	[thread overview]
Message-ID: <22084.18903.339422.795322@lambda.ccs.neu.edu> (raw)

[-- 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!

             reply	other threads:[~2015-11-12  8:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  8:12 Eli Barzilay [this message]
2015-11-12 16:18 ` bug#21885: 24.5; Transposing things with a negative argument 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22084.18903.339422.795322@lambda.ccs.neu.edu \
    --to=eli@barzilay.org \
    --cc=21885@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.