help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transposing words over middle words


From: Emanuel Berg
Subject: Re: Transposing words over middle words
Date: Sat, 18 Nov 2017 20:34:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

ken wrote:

> I prefer this method because it's
> straightforward and easy to understand, plus,
> it leaves the mark where it was. However, in
> instances in which the middle word is at the
> end of the line, the result is unexpected:
>
> With the point after the '3':
>
> 1 2 3 4
> 5 6 7 8
>
> invoking M-a yields this:
>
> 1 2 5
> 4 3 6 7 8

You are right, here the other function is
better

(defun transpose-over-word-2 ()
  (interactive)
  (backward-char 1)
  (push-mark)
  (forward-word 3)
  (backward-char 1)
  (transpose-words 0)
  (forward-word 1) )

(local-set-key (kbd "M-a") #'transpose-over-word-2) ; try it

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]