From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: how to reverse a region of several words? Date: Wed, 30 Jul 2008 09:43:56 +0200 Message-ID: <87od4f95qb.fsf@tux.homenetwork> References: <87e3b971-584c-42c5-8f4b-6a0eb32a206b@j1g2000prb.googlegroups.com> <6d2c67ca-89f5-4a72-81d1-be69ff37d4fe@x29g2000prd.googlegroups.com> <87vdyp9r95.fsf@hubble.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1217404031 8050 80.91.229.12 (30 Jul 2008 07:47:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Jul 2008 07:47:11 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: sunway Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 30 09:47:58 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KO6Pb-0005dS-Nf for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Jul 2008 09:47:56 +0200 Original-Received: from localhost ([127.0.0.1]:35218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KO6Oh-0000v7-9z for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Jul 2008 03:46:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KO6OM-0000v2-Ks for help-gnu-emacs@gnu.org; Wed, 30 Jul 2008 03:46:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KO6OL-0000ud-A4 for help-gnu-emacs@gnu.org; Wed, 30 Jul 2008 03:46:38 -0400 Original-Received: from [199.232.76.173] (port=38762 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KO6OL-0000ua-3N for help-gnu-emacs@gnu.org; Wed, 30 Jul 2008 03:46:37 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:40972) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KO6OK-00053n-Np for help-gnu-emacs@gnu.org; Wed, 30 Jul 2008 03:46:37 -0400 Original-Received: from ug-out-1314.google.com ([66.249.92.169]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KO6OJ-0007DK-C8 for help-gnu-emacs@gnu.org; Wed, 30 Jul 2008 03:46:35 -0400 Original-Received: by ug-out-1314.google.com with SMTP id l31so227634ugc.48 for ; Wed, 30 Jul 2008 00:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=CqR2KFl0WHqb57P9xgNnZNw12xIm0tvrggfbZlWl/tI=; b=xs1vJ3gdNDee2O9mdQTljVUHGf/Cn5zyUpWt21H10m4mie6peL3Yr94D+W03EZvkbD sTGm+GdJOMv1OPMrloCk/dAkNy083LAGYYbmetOeXV5aVHin+aQERnF5Rz1fJstgE6+8 Sk935pVKbW86wUDcnm7SvIz1F/12BvVFEDXZQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; b=kNlAmn43+QYy0CmmG3w/uSXMYUxtrta/yHaymufnLYrZsllpE/fe1/oCiL+JQpqBtn YB8AIDxNunaw/jwbCAjIGr/63KTBdro8XDQuJZ/wE4bnRHJrHx6HOB1xJuAMTpZ0aFll QMd8Fyi4QaiCBzKod0mkkno2ewCja8LzTNz+A= Original-Received: by 10.66.221.6 with SMTP id t6mr904579ugg.55.1217403993275; Wed, 30 Jul 2008 00:46:33 -0700 (PDT) Original-Received: from tux.homenetwork ( [77.197.77.194]) by mx.google.com with ESMTPS id x37sm1579316ugc.74.2008.07.30.00.46.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 30 Jul 2008 00:46:32 -0700 (PDT) In-Reply-To: (sunway's message of "Tue, 29 Jul 2008 23:27:14 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56052 Archived-At: sunway writes: > no, I want to transpose "one two three four" to "four three two one" ,---- | (defun reverse-sentence-region (&optional separator) | (interactive "P") | (let ((beg (point)) | (sentence) | (separator)) | (when current-prefix-arg | (setq separator (read-string "Separator: "))) | (kill-region beg (mark)) | (setq sentence (nth 0 kill-ring)) | (setq sentence (split-string sentence (if separator | separator))) | (setq sentence (reverse sentence)) | (setq sentence (mapconcat #'(lambda (x) x) | sentence | (if separator | separator | " "))) | (insert sentence))) `---- 1) Mark region 2) Run M-x reverse-sentence-region or C-u M-x reverse-sentence-region if the words in region are separated with something else than " " > On Jul 29, 1:46=C2=A0pm, p...@informatimago.com (Pascal J. Bourguignon) > wrote: >> sunway writes: >> > I want to transpose "one two" to " two one" >> >> put the cursor between one and two and type: >> M-x transpose-words RET or M-t >> >> -- >> __Pascal Bourguignon__ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0http://www.informatimago.com/ >> >> NOTE: The most fundamental particles in this product are held >> together by a "gluing" force about which little is currently known >> and whose adhesive power can therefore not be permanently >> guaranteed. > --=20 A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France