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: Thu, 16 Nov 2017 01:04:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Bob Proulx wrote:

> TL;DR: How can I transpose words jumping over
> middle words?

(defun transpose-over-word ()
  (interactive)
  (transpose-subr 'forward-word 2)
  (backward-word 1)
  (transpose-subr 'forward-word -1)
  )
(local-set-key (kbd "M-a") #'transpose-over-word) ; try it
;; Wolvie and Jubilee
;;       ^
;;      point at invocation

> Of course we all know about C-t
> transpose-chars. And there is the
> corresponding M-t transpose-words too.

... and many other transpose-*'es as well :)

> Here is the documentation.
>
> ‘M-t’ transposes the word before point with
> the word after point (‘transpose-words’).
> It moves point forward over a word, dragging
> the word preceding or containing point
> forward as well. The punctuation characters
> between the words do not move. For example,
> ‘FOO, BAR’ transposes into ‘BAR, FOO’ rather
> than ‘BAR FOO,’.

The documentation shouldn't say what *doesn't*
happen. Before long, people will start to think
that is what actually happens...

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




reply via email to

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