From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bob Proulx Newsgroups: gmane.emacs.help Subject: Transposing words over middle words Date: Wed, 15 Nov 2017 16:17:12 -0700 Message-ID: <20171115155650067497545@bob.proulx.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1510787876 25027 195.159.176.226 (15 Nov 2017 23:17:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 15 Nov 2017 23:17:56 +0000 (UTC) User-Agent: NeoMutt/20170609 (1.8.3) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 16 00:17:52 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF6wJ-00063w-Fu for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Nov 2017 00:17:51 +0100 Original-Received: from localhost ([::1]:38284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eF6wP-0005HD-28 for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Nov 2017 18:17:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eF6vl-0005H7-PT for help-gnu-emacs@gnu.org; Wed, 15 Nov 2017 18:17:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eF6vi-00013x-KB for help-gnu-emacs@gnu.org; Wed, 15 Nov 2017 18:17:17 -0500 Original-Received: from havoc.proulx.com ([96.88.95.61]:36175) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eF6vi-00010k-EI for help-gnu-emacs@gnu.org; Wed, 15 Nov 2017 18:17:14 -0500 Original-Received: from joseki.proulx.com (localhost [127.0.0.1]) by havoc.proulx.com (Postfix) with ESMTP id 98934B4B for ; Wed, 15 Nov 2017 16:17:12 -0700 (MST) Original-Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 62BC1217E5 for ; Wed, 15 Nov 2017 16:17:12 -0700 (MST) Original-Received: by hysteria.proulx.com (Postfix, from userid 1000) id 598D02DC5C; Wed, 15 Nov 2017 16:17:12 -0700 (MST) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 96.88.95.61 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114890 Archived-At: 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. =E2=80=98M-t=E2=80=99 transposes the word before point with the wo= rd after point (=E2=80=98transpose-words=E2=80=99). It moves point forward over a w= ord, dragging the word preceding or containing point forward as well. The punctuation characters between the words do not move. For example, =E2=80=98FOO,= BAR=E2=80=99 transposes into =E2=80=98BAR, FOO=E2=80=99 rather than =E2=80=98BAR F= OO,=E2=80=99. 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