[Top][All Lists]

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

Re: A better UI than perform-replace

From: David Kastrup
Subject: Re: A better UI than perform-replace
Date: Thu, 19 Nov 2015 20:46:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

John Yates <address@hidden> writes:

> On Thu, Nov 19, 2015 at 11:31 AM, John Wiegley <address@hidden> wrote:
>> Wanting to use Emacs for other editing, while in the middle of a replace
>> operation, is fairly expert also. We don't use a separate window with "Find
>> Next" and "Replace" buttons, as graphical editors do: we use a modal
>> prompt in
>> the mini-buffer. Most Emacs users expect this to mean that they must
>> complete
>> their operation before Emacs is fully available again.
> Disclaimer: my model for the proposed interaction is query-replace.
> If we are actually contemplating something quite different then
> perhaps my comments are irrelevant.  That said...
> The usage scenario is not uncommon and is not an instance of wanting
> to perform arbitrary editing in the middle of a replace operation.
> Rather it is a question of wanting (or needing) to clean-up alignment
> _after_ replacing a token with a token of a different length.  A very
> common instance is ensuring that end of line comments start at a
> specified column.
> IIUC when prompted as to whether I wish to replace the current token
> the recursive edit approach requires that I:
>   1) type C-r to enter a recursive edit
>   2) adjust whitespace (thereby corrupting the visible alignment
>      around the as yet un-replaced token) hoping that I properly
>      anticipate the whitespace needs that will obtain once the
>      replace actually occurs
>   3) type C-M-c to exit recursive edit
>   4) respond to the query-replace prompt
> Following 4) token replacement occurs and the display updates to
> the next match.

Wrong response to the query-replace prompt then.

    Type Space or ‘y’ to replace one match, Delete or ‘n’ to skip to next,
    RET or ‘q’ to exit, Period to replace one match and exit,
    Comma to replace but not move point immediately,
    C-r to enter recursive edit (C-M-c to get out again),
    C-w to delete match and recursive edit,
    C-l to clear the screen, redisplay, and offer same replacement again,
    ! to replace all remaining matches in this buffer with no more questions,
    ^ to move point back to previous match,
    E to edit the replacement string.
    In multi-buffer replacements type ‘Y’ to replace all remaining
    matches in all remaining buffers with no more questions,
    ‘N’ to skip to the next buffer without replacing remaining matches
    in the current buffer.

So you should have typed a comma.

Or, once you consider yourself foiled, follow the "press ? for help"
prompt and discover "^ to move point back to previous match".

David Kastrup

reply via email to

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