unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / 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; 68+ 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] 68+ messages in thread

end of thread, other threads:[~2017-11-22 21:33 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3764.1510787840.27995.help-gnu-emacs@gnu.org>
2017-11-16  7:04 ` Transposing words over middle words Loris Bennett
2017-11-16  8:41   ` Joost Kremers
2017-11-16  8:47     ` Joost Kremers
2017-11-16 16:06   ` Eli Zaretskii
2017-11-16 22:26     ` Bob Proulx
2017-11-17  5:00       ` Yuri Khan
2017-11-17  5:08         ` Emanuel Berg
2017-11-17  8:55       ` Gian Uberto Lauri
2017-11-17  8:58         ` Gian Uberto Lauri
2017-11-17  9:10           ` Eli Zaretskii
2017-11-17  9:35             ` Gian Uberto Lauri
2017-11-17 16:03           ` Stefan Monnier
2017-11-17 16:19             ` Robert Pluim
2017-11-17 20:41               ` Marcin Borkowski
2017-11-17 16:42             ` Eli Zaretskii
2017-11-17 22:53               ` Stefan Monnier
2017-11-17 23:02                 ` Emanuel Berg
     [not found]             ` <mailman.3897.1510936953.27995.help-gnu-emacs@gnu.org>
2017-11-17 16:57               ` Rusi
2017-11-17 17:26                 ` Drew Adams
2017-11-17 18:05                 ` Eli Zaretskii
2017-11-17 22:55             ` Stefan Monnier
2017-11-17 23:09               ` Emanuel Berg
2017-11-21 17:21               ` Tomas Nordin
2017-11-22 18:18                 ` Arnaldo Mandel
2017-11-22 19:15                   ` Emanuel Berg
2017-11-22 21:33                 ` Stefan Monnier
2017-11-17 20:38         ` Marcin Borkowski
2017-11-18 17:11       ` Robert Thorpe
2017-11-16 21:55 ` Michael Piotrowski
2017-11-16 23:05 ` Joseph C. Fineman
2017-11-17  0:39   ` Emanuel Berg
2017-11-17  7:19   ` Eli Zaretskii
2017-11-18 20:29     ` clhs on other languages f.nikolakopoulos
2017-11-21  0:43       ` Robert Thorpe
     [not found]   ` <mailman.3847.1510879170.27995.help-gnu-emacs@gnu.org>
2017-11-17 23:34     ` Transposing words over middle words Joseph C. Fineman
2017-11-18  0:05       ` Emanuel Berg
     [not found]       ` <mailman.3932.1510963563.27995.help-gnu-emacs@gnu.org>
2017-11-18 22:55         ` Joseph C. Fineman
2017-11-18 23:57           ` Emanuel Berg
     [not found]   ` <mailman.3856.1510903218.27995.help-gnu-emacs@gnu.org>
2017-11-17 23:35     ` Joseph C. Fineman
2017-11-15 23:17 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

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).