|
|
Up |
|
|
  |
Author: sunwaysunway Date: Jul 28, 2008 01:11
e.g. the region contains words like "aaa bbb ccc ddd",I want to
reverse it to "ddd ccc bbb aaa"
|
| |
|
| | 10 Comments |
|
  |
|
|
  |
Author: tylertyler Date: Jul 28, 2008 08:00
sunway gmail.com> writes:
> e.g. the region contains words like "aaa bbb ccc ddd",I want to
> reverse it to "ddd ccc bbb aaa"
>
I think you probably want the words themselves to stay in the original
order, i.e., one two => two one? If not, if you want to completely
reverse the text, i.e., one two => owt eno, I use the following
function:
|
| Show full article (0.91Kb) |
| no comments |
|
  |
Author: Pascal J. BourguignonPascal J. Bourguignon Date: Jul 28, 2008 10:44
sunway gmail.com> writes:
> e.g. the region contains words like "aaa bbb ccc ddd",I want to
> reverse it to "ddd ccc bbb aaa"
Select it and M-x reverse-line RET
--
__Pascal Bourguignon__ http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay
|
| |
| no comments |
|
  |
Author: tylertyler Date: Jul 28, 2008 11:51
> sunway gmail.com> writes:
>
>> e.g. the region contains words like "aaa bbb ccc ddd",I want to
>> reverse it to "ddd ccc bbb aaa"
>
> Select it and M-x reverse-line RET
What version are you running? 23.0.60.1 doesn't have reverse-line...
Tyler
|
| |
| no comments |
|
  |
Author: sunwaysunway Date: Jul 28, 2008 20:13
I want to transpose "one two" to " two one"
On Jul 28, 11:00 pm, tyler wrote:
> sunway gmail.com> writes:
>> e.g. the region contains words like "aaa bbb ccc ddd",I want to
>> reverse it to "ddd ccc...
|
| Show full article (1.15Kb) |
| no comments |
|
  |
Author: Thierry VolpiattoThierry Volpiatto Date: Jul 28, 2008 22:35
sunway gmail.com> writes:
> I want to transpose "one two" to " two one"
Put the point on two and hit M-t.
,----[ C-h k M-t ]
| M-t runs the command transpose-words, which is an interactive compiled
| Lisp function in `simple.el'.
|
| It is bound to M-t.
|
| (transpose-words arg)
|
| Interchange words around point, leaving point at end of them.
| With prefix arg arg, effect is to take word before or around point
| and drag it forward past arg other words (backward if arg negative).
| If arg is zero, the words around or after point and around or after mark
| are interchanged.
|
| [back]
`----
> On Jul 28, 11:00 pm, tyler wrote:
>> sunway gmail.com> writes:
>>> e.g. the region contains words like "aaa bbb ccc ddd",I want to
>>> reverse it to "ddd...
|
| Show full article (1.84Kb) |
| no comments |
|
  |
Author: Pascal J. BourguignonPascal J. Bourguignon Date: Jul 28, 2008 22:46
sunway gmail.com> 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__ http://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.
|
| |
| no comments |
|
  |
Author: sunwaysunway Date: Jul 29, 2008 23:27
no, I want to transpose "one two three four" to "four three two one"
On Jul 29, 1:46 pm, p...@ informatimago.com (Pascal J. Bourguignon)
wrote:
> sunway gmail.com> 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__ http://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.
|
| |
| no comments |
|
  |
|
|
  |
Author: Pascal J. BourguignonPascal J. Bourguignon Date: Jul 30, 2008 00:00
sunway gmail.com> writes:
>> sunway gmail.com> 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)))
|
| Show full article (1.04Kb) |
| no comments |
|
|
|
|