Subject: bug#7534: 24.0.50; G-g within Isearch regexp mode

From: Juri Linkov <[email-masked]>
Date: Thu, 02 Dec 2010 22:31:48 +0000

> Recipe:
> 0) Start Emacs (-Q)
> 1) Place point at the beginning of the *scratch* buffer.
> 2) Search for the regexp "iss" (C-M-s iss) --> The last `s' is
> unmatched as expected, OK.
> 3) Type C-g --> The unmatched part disappears. Everything OK so far.
> 4) Now repeat steps #2 and #3 with the regexp "is[". --> This time C-g
> behaves differently. Instead of deleting the unmatched part, it ends
> Isearch mode.
>
> The fail seems to appear whenever `[' is the first character in the
> unmatched part. For instance:
>  * C-M-s iss[ C-g --> Works as expected (unmatched part deleted).
>  * C-M-s is[blablabla --> Doesn't work as expected (Isearch cancelled).

IMO, this is consistent behavior.  As the message says after typing `['
it's incomplete input, so C-g behaves exactly like if there is no input
for `[' (and an unfinished sequence of characters that follows it).

So the main principle here is that "incomplete input" means "no input"
for Isearch, and given this rule all your examples work as expected, i.e.

"C-M-s is[ C-g" works like "C-M-s is C-g"
"C-M-s iss[ C-g" works like "C-M-s iss C-g"
"C-M-s is[blablabla C-g" works like "C-M-s is C-g"