From d825d1f28decd671feb71c7657d41d0502ab5cf5 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 10 Feb 2017 00:35:22 +0200 Subject: [PATCH] * 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. --- doc/emacs/search.texi | 8 ++++++-- lisp/info.el | 7 +++---- lisp/isearch.el | 8 +++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index fa69ba48f6a..77baae2a8f7 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -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 diff --git a/lisp/info.el b/lisp/info.el index 0cfcec32f82..5f4ae5f0b09 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -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)))) diff --git a/lisp/isearch.el b/lisp/isearch.el index 5c48c30daa9..4b35f256644 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -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)))) -- 2.39.2