[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: repeat-complex-command on current marked region
From: |
andrew . maguire |
Subject: |
RE: repeat-complex-command on current marked region |
Date: |
Wed, 3 Dec 2003 11:13:50 -0500 |
> If I use C-x ESC ESC to repeat a command, the previously marked region
> shows up as an argument. For example:
> (replace-string "foo" "bar" nil 675 779)
>
> What if I want to repeat the replacement on the current highlighted
> region, rather than from 675 to 779?
>
> This used to work as desired in emacs 20.x,
> but it somehow changed in
> 21.x.
At Emacs 20, replace-string only took three args, i.e. it did not optionally
restrict replacements to a region.
At Emacs 21, two optional args were added to provide this region capability.
Since these are optional just edit the command perhaps to:
(replace-string "foo" "bar" nil (point) (mark))
if you want to do it on a different region.
Or, don't forget that you can use M-p and M-n in the replace-string
interactive prompt to retrieve
previously entered strings.
Or, use narrow to region first.
Andrew