all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: sunway <sunwayforever@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: how to reverse a region of several words?
Date: Mon, 28 Jul 2008 11:03:41 +0200	[thread overview]
Message-ID: <877ib6tm6q.fsf@tux.homenetwork> (raw)
In-Reply-To: <87e3b971-584c-42c5-8f4b-6a0eb32a206b@j1g2000prb.googlegroups.com> (sunway's message of "Mon, 28 Jul 2008 01:11:20 -0700 (PDT)")

sunway <sunwayforever@gmail.com> 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




  reply	other threads:[~2008-07-28  9:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28  8:11 how to reverse a region of several words? sunway
2008-07-28  9:03 ` Thierry Volpiatto [this message]
2008-07-28 15:00 ` tyler
2008-07-28 17:44 ` Pascal J. Bourguignon
2008-07-28 18:51   ` tyler
     [not found] ` <mailman.15498.1217257259.18990.help-gnu-emacs@gnu.org>
2008-07-29  3:13   ` sunway
2008-07-29  5:35     ` Thierry Volpiatto
2008-07-29  5:46     ` Pascal J. Bourguignon
2008-07-30  6:27       ` sunway
2008-07-30  7:00         ` Pascal J. Bourguignon
2008-07-30  7:43         ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877ib6tm6q.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=sunwayforever@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.