Commit d825d1f2 authored by Juri Linkov's avatar Juri Linkov

* lisp/isearch.el (isearch-search-fun-default): Set isearch-adjusted

to t to display "Pending" in the search prompt for lax
word/symbol search (bug#25562).  Don't use lax for lazy-highlighting
when 'bound' is non-nil.
(word-search-regexp, isearch-symbol-regexp): Don't depend on lax
at the beginning of regexp (bug#22589).

* lisp/info.el (Info-isearch-search):
Use isearch--lax-regexp-function-p.

* doc/emacs/search.texi (Word Search, Symbol Search):
Mention "Pending" prompt for lax word/symbol search.
parent 35b9b7e7
......@@ -609,6 +609,8 @@ string, its first and last words need not match whole words. This is
so that the matching can proceed incrementally as you type. This
additional laxity does not apply to the lazy highlight
(@pxref{Incremental Search}), which always matches whole words.
While you are typing the search string, @samp{Pending} appears in the
search prompt until you use a search repeating key like @kbd{C-s}.
The word search commands don't perform character folding, and
toggling lax whitespace matching (@pxref{Lax Search, lax space
......@@ -661,8 +663,10 @@ search is not already active, this runs the command
active, @kbd{M-s _} switches to a symbol search, preserving the
direction of the search and the current search string; you can disable
symbol search by typing @kbd{M-s _} again. In incremental symbol
search, only the beginning of the search string is required to match
the beginning of a symbol.
search, while you are typing the search string, only the beginning
of the search string is required to match the beginning of a symbol,
and @samp{Pending} appears in the search prompt until you use a search
repeating key like @kbd{C-s}.
To begin a nonincremental symbol search, type @kbd{M-s _ @key{RET}}
for a forward search, or @kbd{M-s _ C-r @key{RET}} or a backward
......
......@@ -2118,10 +2118,9 @@ If DIRECTION is `backward', search in the reverse direction."
(cond
(isearch-regexp-function
;; Lax version of word search
(let ((lax (not (or isearch-nonincremental
(eq (length string)
(length (isearch--state-string
(car isearch-cmds))))))))
(let ((lax (and (not bound) (isearch--lax-regexp-function-p))))
(when lax
(setq isearch-adjusted t))
(if (functionp isearch-regexp-function)
(funcall isearch-regexp-function string lax)
(word-search-regexp string lax))))
......
......@@ -1621,7 +1621,7 @@ Used in `word-search-forward', `word-search-backward',
((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 @@ the beginning or the end of the string need not match a symbol boundary."
((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 "\\_>")))))))
......@@ -2740,7 +2740,9 @@ Can be changed via `isearch-search-fun-function' for special needs."
(funcall
(if isearch-forward #'re-search-forward #'re-search-backward)
(cond (isearch-regexp-function
(let ((lax (isearch--lax-regexp-function-p)))
(let ((lax (and (not bound) (isearch--lax-regexp-function-p))))
(when lax
(setq isearch-adjusted t))
(if (functionp isearch-regexp-function)
(funcall isearch-regexp-function string lax)
(word-search-regexp string lax))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment