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: Mon, 28 Jul 2008 11:03:41 +0200 Message-ID: <877ib6tm6q.fsf@tux.homenetwork> References: <87e3b971-584c-42c5-8f4b-6a0eb32a206b@j1g2000prb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1217236902 22040 80.91.229.12 (28 Jul 2008 09:21:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Jul 2008 09:21:42 +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 Mon Jul 28 11:22:31 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 1KNOvl-0007iH-DX for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Jul 2008 11:22:13 +0200 Original-Received: from localhost ([127.0.0.1]:60268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNOup-0000nU-W3 for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Jul 2008 05:21:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNOgR-0006DK-QA for help-gnu-emacs@gnu.org; Mon, 28 Jul 2008 05:06:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNOgN-0006CW-Qn for help-gnu-emacs@gnu.org; Mon, 28 Jul 2008 05:06:21 -0400 Original-Received: from [199.232.76.173] (port=53778 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNOgL-0006C4-W8 for help-gnu-emacs@gnu.org; Mon, 28 Jul 2008 05:06:18 -0400 Original-Received: from ug-out-1314.google.com ([66.249.92.168]:64794) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KNOgL-0003Yn-EM for help-gnu-emacs@gnu.org; Mon, 28 Jul 2008 05:06:17 -0400 Original-Received: by ug-out-1314.google.com with SMTP id l31so2754ugc.48 for ; Mon, 28 Jul 2008 02:06:16 -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; bh=de3J9kGpzkBXjpYsNlMaI1igWLGwpQTLARZaaxV3mtY=; b=FfW1AISLXRTW4XHY1rwMUQ97Id7JOiCCB11mA8KRlNNeTwNwI/VHY5kFl6zQ9BpnPy Lb6Ax5YTPfhNSZ4glenRt0Z9xTTTTm5dTWvBTfLu5FagkEeowHVtLs5eABiWrEFj9/4D Hv1LplJHgqFVQ08lrKrf0b5nvBJZb36IKS9TI= 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; b=LPWSBepliiyVaGK81/Uy39bWpg8fQgqOXdHuSs4pUo2XIxuYPdb9na6JeP/D2elHN1 y+hpcZD6IoGPlhOj6bVQc/9+M/gEz2Q1HEZPgd+Du38Zi2b0FcZGc2UrToNCREeD78tp JwTjc2nPEOmOEnzb6IGQfBdOGuYvN8rpTI8KY= Original-Received: by 10.67.40.6 with SMTP id s6mr1924229ugj.33.1217235976045; Mon, 28 Jul 2008 02:06:16 -0700 (PDT) Original-Received: from tux.homenetwork ( [77.197.77.194]) by mx.google.com with ESMTPS id o30sm119273ugd.67.2008.07.28.02.06.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Jul 2008 02:06:15 -0700 (PDT) In-Reply-To: <87e3b971-584c-42c5-8f4b-6a0eb32a206b@j1g2000prb.googlegroups.com> (sunway's message of "Mon, 28 Jul 2008 01:11:20 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:55984 Archived-At: sunway writes: > e.g. the region contains words like "aaa bbb ccc ddd",I want to > reverse it to "ddd ccc bbb aaa" > kill your region with some kill func (check elisp man) and store it (A) Be sure to remember the position of your text. ,---- | ELISP> (setq A "aaa bbb ccc ddd") | "aaa bbb ccc ddd" | ELISP> (setq A (split-string A)) | ("aaa" "bbb" "ccc" "ddd") | | ELISP> (setq A (reverse A)) | ("ddd" "ccc" "bbb" "aaa") | | ELISP> (mapconcat #'(lambda (x) x) A " ") | "ddd ccc bbb aaa" `---- And now insert the new text at the saved position. -- A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France