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 21:06:14 -0500 Message-ID: <1ef14395-df19-9b47-b952-1328368ce689@mousecar.com> References: <20171115155650067497545@bob.proulx.com> <86375fytqn.fsf@zoho.com> <86h8tr2xes.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 1511057228 24883 195.159.176.226 (19 Nov 2017 02:07:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Nov 2017 02:07:08 +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 Sun Nov 19 03:07:01 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 1eGF0e-0005uY-Jv for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Nov 2017 03:07:00 +0100 Original-Received: from localhost ([::1]:51655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGF0k-0006v8-8B for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 21:07:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGF07-0006v1-Pg for help-gnu-emacs@gnu.org; Sat, 18 Nov 2017 21:06:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGF04-0003Br-KS for help-gnu-emacs@gnu.org; Sat, 18 Nov 2017 21:06:27 -0500 Original-Received: from mout.perfora.net ([74.208.4.194]:61384) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGF04-0003BT-Cv for help-gnu-emacs@gnu.org; Sat, 18 Nov 2017 21:06:24 -0500 Original-Received: from nv.mousecar.net ([96.27.75.237]) by mrelay.perfora.net (mreueus001 [74.208.5.2]) with ESMTPSA (Nemesis) id 0Lh4nx-1evbMg2WgR-00oM4h for ; Sun, 19 Nov 2017 03:06:21 +0100 In-Reply-To: <86h8tr2xes.fsf@zoho.com> Content-Language: en-US X-Provags-ID: V03:K0:mlX0/HO0FOLasYzilV+7IUcwYDXAZNPhZ4j1GGkAQekI9IuIuUb ffK4lvXmUc1RMbAXWQAakni1vx+p8Ys8J8cFKdfnKyGybjBA5U0bnmSSd/ErtWLILMpGbXM Dyau+cfuiTzcLz+4dVT35jSkVW4BZA527g+vdymWNjUIxHj4paxYyMITg2uet8nKJpsmwzn V/pYWkg5vyhpQjtIwFAmg== X-UI-Out-Filterresults: notjunk:1;V01:K0:/FhgAiNroJo=:LVS6gQz4TdJPCuOIIXUGqc 9Oui6SCflP9J8QIj8IYqSKNMa0DAhTC49hP3KYUd9S8/CHxL6OzdzyLMzVhWz8kh1MvF3w5qW q0LJKgEIls921K2q1RGggmwwmHg06F3gJjvoY1G3/j6l0jcZQ7GlbUHdxxtlZiCAvhW2Ku9k+ lmDOTNCD51tliWCFVRyby1eB1sCpO2W9h8+dvyv/pK9Zr4qOkm4oCrTcXQnfHz1MIXd6h6dFA zNjLNDRCd4cxjL7O1qSDFL6DqU5jJ4DM2hmI3SLUwQhvrcBk+t3XvYn4AIqPDRSJ0kvyfDFwf YwRZqvw2sCnE3ySEvUYgN01PBwlSqx1lAY5+nfE85fXkRWw5/8lbqVPTBWg6O5ox1re2okpCR VShwlOiNje9PH7uhr8ETmFTd1mtfZGnwSvD31RElZH7o/a4FcHrZzjw+9gsz05d7GCYZZGEPd eydZlOx5ZCoBCiWWyIN5lMlunOXft7sLPseU+VLMZOyQ7f0SOLwm3NAm3d0fnXjf1GIVeHcNR fW9xjb+jloB0T8ETxlCArnFF45bP22sio6x2FrVa0JNFn6vVyrZorYbEcwTDxwo3GtnoIxxZe PkXzHXXMfiVYYzx5K2WlVAwRopLWejIXEJu3xFZWywW1SqeTTgWBNz52jvYITVD0SHvLVobSn rqpH8yRDwm+BYfi7x+OdC23cfMr9zhcAyNNmfXgFul0p5RLoBBai7/21UQb9o3zChjbYllCUt YBsj+xJQX25wNX+s38i1YJNa/Ys43twBCktmc2Ymh6kRAq4NgxfJ05d8kps= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.208.4.194 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:114964 Archived-At: On 11/18/2017 02:34 PM, Emanuel Berg wrote: > ken wrote: > >> 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 > You are right, here the other function is > better > > (defun transpose-over-word-2 () > (interactive) > (backward-char 1) > (push-mark) > (forward-word 3) > (backward-char 1) > (transpose-words 0) > (forward-word 1) ) > > (local-set-key (kbd "M-a") #'transpose-over-word-2) ; try it > That's great.  Thanks.  It's  quite nice that the point remains in place.  Is there perhaps a way to return the mark to where it was prior to invoking "M-a" so that it, too, remains in place?