[Top][All Lists]

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

Re: isearch-query-replace-regexp and stuff

From: Juri Linkov
Subject: Re: isearch-query-replace-regexp and stuff
Date: Thu, 08 Jul 2004 19:45:59 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:
> Juri Linkov <address@hidden> writes:
>> David Kastrup <address@hidden> writes:
>> > Juri Linkov <address@hidden> writes:
>> >> The current behavior of C-M-s to repeat the non-regexp search is not
>> >> the most reasonable one.  More correct would be to switch the search
>> >> to regexp mode before doing the search again.  I guess it works now
>> >> that way because it was simpler to implement and nobody cared about
>> >> handling this case specially.  But we could change the behavior of
>> >> C-M-s in non-regexp mode to switch to regexp mode for consistency
>> >> with C-M-%.
>> >
>> > But that's inconsistent with being able to use both C-s and M-C-s in
>> > regexp searches.
>> >
>> > Don't you see that?
>> You can see the following comments for `isearch-mode-map' in isearch.el
>> (underlining is mine):
>>     ;; Define M-C-s and M-C-r like C-s and C-r so that the same key
>>     ;; combinations can be used to repeat regexp isearches that can
>>                                           ================
>>     ;; be used to start these searches.
>> So the meaning of C-M-s in a non-regexp search is still undefined,
> Because of some internal comment?

There is no other source of information about the current implementation,
but this comment explicitly states the intention of introducing those
keybindings.  The intention was to allow to repeat regexp isearches
with the same key that started these searches.

>> and the fact that C-M-s can repeat a non-regexp search is a side
>> effect of the current implementation.
> If you want to call explicitly coded "consistency" a side effect.

The current behavior is a consequence of a simpler implementation
that ignores the case of using C-M-s in normal searches as unimportant.

>> And there is no symmetry between normal and regexp searches
> Not?  Considering that both behave the same with regard to C-s and
> C-M-s I would think there was.  And intentionally so.

According to comments in isearch.el (supposedly written by authors of
the current implementation) it is not intentional.

Anyway, I don't want to make C-M-% consistent with accidental features,
but what I want is to make it more convenient.  Invoking `query-replace-regexp'
makes sense even in a non-regexp search for the sake of using features
available only in regexp replacements (like using \# and \,), for example:

C-s foo C-M-% \&<\#> RET

Juri Linkov

reply via email to

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