* suppress terminating return by shell-command-on-region
@ 2010-08-20 15:09 Cecil Westerhof
2010-08-20 15:53 ` Pascal J. Bourguignon
0 siblings, 1 reply; 4+ messages in thread
From: Cecil Westerhof @ 2010-08-20 15:09 UTC (permalink / raw)
To: help-gnu-emacs
I needed to reverse some text in a buffer. For this I used:
C-u M-| rev
This works, except that there is put a return after the replaced
region. Is it possible to suppress this return? It is not a biggy, I
can remove it, but it would be nice if this was not necessary.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: suppress terminating return by shell-command-on-region
2010-08-20 15:09 suppress terminating return by shell-command-on-region Cecil Westerhof
@ 2010-08-20 15:53 ` Pascal J. Bourguignon
2010-08-21 3:29 ` Cecil Westerhof
0 siblings, 1 reply; 4+ messages in thread
From: Pascal J. Bourguignon @ 2010-08-20 15:53 UTC (permalink / raw)
To: help-gnu-emacs
Cecil Westerhof <Cecil@decebal.nl> writes:
> I needed to reverse some text in a buffer. For this I used:
> C-u M-| rev
>
> This works, except that there is put a return after the replaced
> region. Is it possible to suppress this return? It is not a biggy, I
> can remove it, but it would be nice if this was not necessary.
Instead you could use M-x reverse-lines RET
(there's also a reverse-region).
--
__Pascal Bourguignon__ http://www.informatimago.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: suppress terminating return by shell-command-on-region
2010-08-20 15:53 ` Pascal J. Bourguignon
@ 2010-08-21 3:29 ` Cecil Westerhof
2010-08-21 15:00 ` Pascal J. Bourguignon
0 siblings, 1 reply; 4+ messages in thread
From: Cecil Westerhof @ 2010-08-21 3:29 UTC (permalink / raw)
To: help-gnu-emacs
Op vrijdag 20 aug 2010 17:53 CEST schreef Pascal J. Bourguignon:
> Cecil Westerhof <Cecil@decebal.nl> writes:
>
>> I needed to reverse some text in a buffer. For this I used:
>> C-u M-| rev
>>
>> This works, except that there is put a return after the replaced
>> region. Is it possible to suppress this return? It is not a biggy, I
>> can remove it, but it would be nice if this was not necessary.
>
> Instead you could use M-x reverse-lines RET
My Emacs does not know this function.
> (there's also a reverse-region).
That does not what I want. It changes lines, but I want to change
characters. For example from:
Some before text. Decebal Computing Some after text.
to:
Some before text. gnitupmoC labeceD Some after text.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: suppress terminating return by shell-command-on-region
2010-08-21 3:29 ` Cecil Westerhof
@ 2010-08-21 15:00 ` Pascal J. Bourguignon
0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2010-08-21 15:00 UTC (permalink / raw)
To: help-gnu-emacs
Cecil Westerhof <Cecil@decebal.nl> writes:
> Op vrijdag 20 aug 2010 17:53 CEST schreef Pascal J. Bourguignon:
>
>> Cecil Westerhof <Cecil@decebal.nl> writes:
>>
>>> I needed to reverse some text in a buffer. For this I used:
>>> C-u M-| rev
>>>
>>> This works, except that there is put a return after the replaced
>>> region. Is it possible to suppress this return? It is not a biggy, I
>>> can remove it, but it would be nice if this was not necessary.
>>
>> Instead you could use M-x reverse-lines RET
>
> My Emacs does not know this function.
Oops, sorry, it's in http://tinyurl.com/pjb-utilities
(defun reverse-lines (start end)
"Reverse the order of the characters in each lines in the region."
(interactive "r")
(let* ((text)(lines)(first))
(setq text (buffer-substring-no-properties start end))
(setq lines (split-string text "[\n]"))
(setq first lines)
(while lines
(if (< 0 (length (car lines)))
(setcar lines (apply 'string (reverse (string-to-list (car lines))))))
(setq lines (cdr lines)))
(delete-region start end)
(insert (unsplit-string first "\n"))))
;; unsplit-string is in pjb-strings, get the whole sources...
>> (there's also a reverse-region).
>
> That does not what I want. It changes lines, but I want to change
> characters. For example from:
> Some before text. Decebal Computing Some after text.
> to:
> Some before text. gnitupmoC labeceD Some after text.
--
__Pascal Bourguignon__ http://www.informatimago.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-21 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-20 15:09 suppress terminating return by shell-command-on-region Cecil Westerhof
2010-08-20 15:53 ` Pascal J. Bourguignon
2010-08-21 3:29 ` Cecil Westerhof
2010-08-21 15:00 ` Pascal J. Bourguignon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).