Subject: Re: bug#21208: 25.0.50; isearch gets confused with 'too many words'

From: Juri Linkov <[email-masked]>
Date: Fri, 04 Sep 2015 01:27:30 +0300

> 6. Eventually (column 239 or so) the minibuffer says 'too many words',
> and the search no longer matches anything on either line. The sought
> string looks like it's appending words without spaces ("123412341234"
> instead of "1234 1234 1234"). Manually fixing that with M-e doesn't
> appear to help.

A possible solution in case of the error “Too many words” is to fall back
to the ordinary search, and continue the search with success:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 8d4bf24..a888f79 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2720,6 +2734,10 @@ (defun isearch-search ()
       ((and (not isearch-regexp)
 	    (string-match "\\`Regular expression too big" isearch-error))
        (cond
+        ((eq isearch-word #'character-fold-to-regexp)
+         ;; Fallback to an ordinary search
+         (setq isearch-word nil)
+         (isearch-search))
 	(isearch-word
 	 (setq isearch-error "Too many words"))
 	((and isearch-lax-whitespace search-whitespace-regexp)