all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Transposing words over middle words
@ 2017-11-15 23:17 Bob Proulx
  2017-11-15 23:35 ` Eric Abrahamsen
                   ` (3 more replies)
  0 siblings, 4 replies; 32+ messages in thread
From: Bob Proulx @ 2017-11-15 23:17 UTC (permalink / raw)
  To: help-gnu-emacs

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

Of course we all know about C-t transpose-chars.  And there is the
corresponding M-t transpose-words too.  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,’.

When modifying a list of comma separated s strings this works great.
But often I find myself wanting to transpose words in an "and"
structure.

  Jack and Jill went up the hill.

With the point on the space after Jack the easiest way I know to
transpose those words is to M-d to kill-word forward deleting the
"and" leaving.

  Jack and Jill went up the hill.
      ^ point is here: M-d
  Jack Jill went up the hill.

Then M-t to transpose those words:

  Jack Jill went up the hill.
      ^ point is here: M-t
  Jill Jack went up the hill.

Then restore the "and" which is somewhat inelegant

  Jill Jack went up the hill.
      ^ point is here: C-b C-y
  Jill and Jack went up the hill.

Obviously I can use other brute force make the change.

  Jack and Jill went up the hill.
           ^ point is here: M-d
  Jack and  went up the hill.
           ^ point is here: M-b M-b
  Jack and  went up the hill.
  ^ point is here: C-y M-d M-f
  Jill and  went up the hill.
          ^ point is here: C-f C-y
  Jill and Jack went up the hill.

That or something similar is usually what I do.  This is one of those
nuisance items I have always wished had a better way to accomplish but
just always worked through it by brute force.  But transpose-words has
always been taunting me that it almost does what I want with M-t but
doesn't work in this situation.

Is there a way to use M-t to transpose words skipping over middle
words like it does for punctuation?  Perhaps there isn't a better way.

Thanks,
Bob



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

end of thread, other threads:[~2017-11-19 14:56 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15 23:17 Transposing words over middle words Bob Proulx
2017-11-15 23:35 ` Eric Abrahamsen
2017-11-16  6:03   ` Emanuel Berg
2017-11-16  0:04 ` Emanuel Berg
2017-11-18 17:07   ` ken
2017-11-18 19:34     ` Emanuel Berg
2017-11-19  2:06       ` ken
2017-11-19  2:15         ` Emanuel Berg
2017-11-19  2:34           ` John Mastro
2017-11-19  3:39             ` Emanuel Berg
2017-11-19  4:37               ` Drew Adams
2017-11-19  4:58                 ` Drew Adams
2017-11-19 14:56                 ` Emanuel Berg
2017-11-16 19:34 ` Charles A. Roelli
2017-11-16 19:41   ` Emanuel Berg
2017-11-16 20:09   ` Marcin Borkowski
2017-11-16 21:15     ` Emanuel Berg
2017-11-16 22:55       ` Bob Proulx
2017-11-16 23:02         ` Emanuel Berg
2017-11-16 21:18     ` Emanuel Berg
2017-11-16 22:43       ` Drew Adams
2017-11-16 22:59         ` Emanuel Berg
2017-11-17 16:21           ` Drew Adams
2017-11-17 20:52             ` Emanuel Berg
2017-11-16 22:28   ` Bob Proulx
     [not found] ` <mailman.3765.1510789425.27995.help-gnu-emacs@gnu.org>
2017-11-16 22:02   ` Michael Piotrowski
2017-11-16 23:00     ` Bob Proulx
2017-11-16 23:29     ` Eric Abrahamsen
2017-11-16 23:30       ` Eric Abrahamsen
2017-11-17  0:27         ` put it in MELPA (was: Re: Transposing words over middle words) Emanuel Berg
2017-11-17  0:30           ` put it in MELPA Eric Abrahamsen
2017-11-17 15:16           ` put it in MELPA (was: Re: Transposing words over middle words) Tim Visher

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.