help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: quick 'perform last replace again'


From: Phil Carmody
Subject: Re: quick 'perform last replace again'
Date: 21 Apr 2008 23:15:33 +0300
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

David Kastrup <dak@gnu.org> writes:
> Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes:
> > Subject line seems to describe the question succinctly.
> >
> > I've been inserting some typedefs in some C code, and using 
> > query-replace to turn uint8_t's into whatever_t's. However,
> > I'm only changing a small proportion of each match, so it 
> > became a drag. I'd rather just have the ability to move and 
> > scroll around the file (so _not_ in query-replace mode), and 
> > when I spot something that needs to be changed I'd like to 
> > just move the cursor onto the line containing it, press some 
> > magic key sequence, and have it replace either the first 
> > (or all) instances of the most-recently-used match with the
> > most-recently-used replacement on the current line. I do not
> > want to be left in query-replace mode - I want to then 
> > continue editing.
> 
> C-x ESC ESC RET

Fails horribly. And for good reason:

<<<
C-x ESC ESC runs the command repeat-complex-command
   which is an interactive compiled Lisp function in `simple'.
(repeat-complex-command ARG)

Edit and re-evaluate last complex command, or ARGth from last.
...
>>>

I don't want to do the last complex command, which may have
been a file open, or an incremental search, or practically
anything. I want to redo the last search and replace. I did 
say "perform last replace again" in my subject line for a 
reason. A file open, or an incremental search, or killing a 
buffer, or whatever, is not the last replace.
 
> Do the replacement with . (which is bound to act-and-exit).
> 
> Or use just M-% RET (which uses the defaults) and then . for
> act-and-exit.

That seems to also fail horribly. 

M-% RET does not use what I used in my last search and replace.
Quite what it does use, I don't know, but after a file open,
an incremental search, and killing a buffer, it doesn't have
any default. In fact, immediately after the M-%, there is no 
default either, it just thinks that I want to search for ''. 
I'm running GNU Emacs 21.4.1 and 21.2.1 on a variety of archs, 
they all behave the same way.

'.', however, was a useful addition to my day-to-day emacs-use
armory, so thanks for that.

Phil
-- 
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration


reply via email to

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