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

From: Dani Moncayo <[email-masked]>
Date: Mon, 6 Dec 2010 11:41:32 +0100

On Mon, Dec 6, 2010 at 00:11, Juri Linkov <[email-masked]> wrote:
>> So, IMO, the main principle for C-g (within Isearch mode) should be:
>> * if there is unmatched and/or incomplete input --> Delete it.
>> * Otherwise --> Exit Isearch mode.
>
> Please try the following patch.  Does it provide the behavior
> you are asking for?
>

It does. Thank you.

PS: The patch bellow is like your's, but it also updates the comment
accordingly.

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2010-10-16 14:11:06.000000000 +0200
+++ lisp/isearch.el	2010-12-06 11:27:33.000000000 +0100
@@ -1244,9 +1244,9 @@
   (interactive)
 ;;  (ding)  signal instead below, if quitting
   (discard-input)
-  (if isearch-success
-      ;; If search is successful, move back to starting point
-      ;; and really do quit.
+  (if (and isearch-success (not isearch-error))
+      ;; If search is successful and there is no incomplete regexp,
+      ;; move back to starting point and really do quit.
       (progn
         (setq isearch-success nil)
         (isearch-cancel))

-- 
Dani Moncayo