From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: Transposing words over middle words Date: Sat, 18 Nov 2017 12:07:47 -0500 Message-ID: References: <20171115155650067497545@bob.proulx.com> <86375fytqn.fsf@zoho.com> Reply-To: gebser@mousecar.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1511024913 18592 195.159.176.226 (18 Nov 2017 17:08:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2017 17:08:33 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 18 18:08:23 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 1eG6bK-000404-Hj for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 18:08:18 +0100 Original-Received: from localhost ([::1]:50687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eG6bR-0005Gb-SL for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 12:08:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eG6b1-0005GW-Vf for help-gnu-emacs@gnu.org; Sat, 18 Nov 2017 12:08:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eG6ay-0001kF-Qp for help-gnu-emacs@gnu.org; Sat, 18 Nov 2017 12:07:59 -0500 Original-Received: from mout.perfora.net ([74.208.4.197]:64153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eG6ay-0001gi-JS for help-gnu-emacs@gnu.org; Sat, 18 Nov 2017 12:07:56 -0500 Original-Received: from nv.mousecar.net ([96.27.75.237]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MFrWa-1eM90B1zU6-00EtPK for ; Sat, 18 Nov 2017 18:07:53 +0100 In-Reply-To: <86375fytqn.fsf@zoho.com> Content-Language: en-US X-Provags-ID: V03:K0:YFkwPSg34bI36eNtzXo9cFjsglRAIePGdOhRPSudUFpBT/f2zFu QcVLb1bYP2AgU4o4Pwa/ypPZexfjxYJdA7KPMdu4gWdYDz5u28GorcYeBRuRDwFXvZXoYl+ WTv2VYfBxiJyQpd5kzW5Cvr6sOUmYkDu0a99GC2QFfr3JYCsc5yb/Ug8yGCKc5trfRS1gBD 3gGeRlpij59zycRg4NUpw== X-UI-Out-Filterresults: notjunk:1;V01:K0:cYCP3+n35Ok=:QGKotPkBtlo2L6C+cWySeQ TCKkm9qbd0gS98PVUxcEnKsF3FoKniiQlT8qZ2FsLj9FWXexnZVJlCkiRsAufVf5PbA9m1mlH 5jDSD8tmBNQwJ1ku1VhGXQCAw35MIGclvVx0MaVGsBsJE/6TSBKP3bcL8emWTgOJd/9LofOZe uQR9qydfOGdjJyirmO5GeGAMaQCNofuzRETw21PMJsQjo2i3PdY6GtvR13XcNnDinwTHjnMmf OsO0Qqqtc+hfl5bSEraECtCA8Dyq51l8N7FGxtygDUpp+D5xeSzylzjPyB0ZRJ8Anm8KqnMi7 C4MQ98S9vTTkaqC7om8Qn0dX8J1+V43TK5bP0NKwwQAyvFNgsodMslfyoxiilcEbhMEodw0Wc slzceP+10wrdwEs2Nnz+rNrG43vLujqwhU1RsHbru1g2klY+hk6r1QBk5P8CmGbeH4JEjPtjP brpinNETnS04V9OJCTa/5wZ1ggNBj5DU4WppwS48+92MC3gQVufw4cbkL7IApqWOGPNl71u/V wCKcg5YAacFGkt9Hgl43ATwUXV0uqef861CH2q5QVHl8cN8ypDZo1XvOVmPcd40VBaVztFXbx f8FEwY7y2lgen86Iq6Yd2CnGbWVj/Rz5uZSC+tXfPjei9AKKFlYaWnl/a+L/z9tRsuCSe4La4 ZIxoj6YYscJUHkwVUJYWNLWd2Nhdweb1bqisVFQfb8awl1Djdbq+AeS9G5vxNsv3DvMU5lN3R j9rs3Jm8Y35lYFRliVh4BkE3D/g7iNZ8yROirJU7nVlAgEl2J3l8n+w2fLs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.208.4.197 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 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:114954 Archived-At: On 11/15/2017 07:04 PM, Emanuel Berg wrote: >> 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 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