| Subject: | Re: how to reverse a region of several words? |
|---|---|
| From: | pjb@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon) |
| Date: | Wed, 30 Jul 2008 09:00:51 +0200 |
| Newsgroups: | gnu.emacs.help |
sunway <sunwayforever@xxxxxxxxx> writes:
>
> On Jul 29, 1:46 pm, p...@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon)
> wrote:
>> sunway <sunwayfore...@xxxxxxxxx> 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
>
> no, I want to transpose "one two three four" to "four three two one"
(defun reverse-words (start end)
(interactive "r")
(let ((words (reverse (split-string (buffer-substring start end)))))
(delete-region start end)
(dolist (word words)
(insert word " "))
(backward-char 1)
(delete-char 1)))
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
----------> http://www.netmeister.org/news/learn2quote.html <-----------
---> http://homepage.ntlworld.com/g.mccaughan/g/remarks/uquote.html <---
__Pascal Bourguignon__ http://www.informatimago.com/
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: how to reverse a region of several words?, sunway |
|---|---|
| Next by Date: | Re: how to reverse a region of several words?, Thierry Volpiatto |
| Previous by Thread: | Re: how to reverse a region of several words?, sunway |
| Next by Thread: | Re: how to reverse a region of several words?, Thierry Volpiatto |
| Indexes: | [Date] [Thread] [Top] [All Lists] |