Subject: bug#22589: 25.0.90; First match found by isearch-forward-symbol is not necessarily a symbol.

From: Juri Linkov <[email-masked]>
Date: Mon, 06 Feb 2017 01:39:13 +0200

> Then it will match at the beginning of the symbol for a forward search,
> and at the end for a backward search.  Same for the word search.

In bug#25562 we found no more ideas how to improve the support for
the process of entering incomplete words, so in addition to the patch
in bug#25562 that adds indication, also I'm going to install this patch
that will optimize the incomplete search by removing conditional
matching at the beginning:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5c48c30..90ffbec 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1621,7 +1621,7 @@ (defun word-search-regexp (string &optional lax)
    ((string-match-p "\\`\\W+\\'" string) "\\W+")
    (t (concat
        (if (string-match-p "\\`\\W" string) "\\W+"
-	 (unless lax "\\<"))
+	 "\\<")
        (mapconcat 'regexp-quote (split-string string "\\W+" t) "\\W+")
        (if (string-match-p "\\W\\'" string) "\\W+"
 	 (unless lax "\\>"))))))
@@ -1749,7 +1749,7 @@ (defun isearch-symbol-regexp (string &optional lax)
      ((string-match-p (format "\\`%s\\'" not-word-symbol-re) string) not-word-symbol-re)
      (t (concat
 	 (if (string-match-p (format "\\`%s" not-word-symbol-re) string) not-word-symbol-re
-	   (unless lax "\\_<"))
+	   "\\_<")
 	 (mapconcat 'regexp-quote (split-string string not-word-symbol-re t) not-word-symbol-re)
 	 (if (string-match-p (format "%s\\'" not-word-symbol-re) string) not-word-symbol-re
 	   (unless lax "\\_>")))))))