[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to reverse a region of several words?

From: Pascal J. Bourguignon
Subject: Re: how to reverse a region of several words?
Date: Wed, 30 Jul 2008 09:00:51 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux)

sunway <address@hidden> writes:
> On Jul 29, 1:46 pm, address@hidden (Pascal J. Bourguignon)
> wrote:
>> sunway <address@hidden> 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?
----------> <-----------
---> <---

__Pascal Bourguignon__           

reply via email to

[Prev in Thread] Current Thread [Next in Thread]