[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Operations on a region
From: |
Frédéric Bothamy |
Subject: |
Re: Operations on a region |
Date: |
Fri, 22 Nov 2002 17:31:22 +0100 |
User-agent: |
Mutt/1.3.28i |
* Arnold <oscar@trashcan.com> [2002-11-22 10:04] :
> Hi,
> I'm a vi user trying to learn emacs. In vi, I could very easily mark a
> region and do an operation on it. e.g. :'a,'bs/blah/word/' or
> :'a,'b!sort. So far, the closest I've seen is to mark a region and then
> narrow into it, but that's not as easy as on vi and it I can't run a
> command on it and have the output replace that contents of that region.
>
> Lisp is also new to me, but I'm thinking of trying to craft a script
> that will automatically narrow in, prompt me for the search-replace
> stuff, and then automatically widen back out.
>
> Does anyone have a better way, or is this problem perhaps already solved
> already?
Well, according to query-replace documentation, in
transient-mark-mode, if the mark active, query-replace (M-%) will do
exactly what you want. And indeed, it works! (for Emacs 21.2 and 20.7)
Fred