GNU bug report logs -
#25562
25.1; isearch-forward-word first matches a non-word
Previous Next
Full log
Message #49 received at 25562 <at> debbugs.gnu.org (full text, mbox):
> I tried it. Works as I would expect in *scratch* and dired, but hmm,
> not in Info (the prompt just doesn't contain "pending" there). I tried
> with emacs -Q, and in any buffer I started a word search and just began
> typing characters.
Thanks for discovering the problem in Info, it will be fixed by the next patch.
It seems to work while I used it to search for the mentions of the word
“pending” in the Emacs manual - there is no one, so we could document it
in (info "(emacs) Word Search") with the second patch below.
> BTW, a different question: when I delete characters from my input (with
> backspace) in a word search and then add some new characters, I somehow
> expected that isearch would return to that "pending" state. But I got
> the jumpy (nonlax) incremental search behavior instead. I don't have an
> opinion about that, just wanted to mention it.
“Pending” is not displayed in the prompt while deleting with backspace
since this state in not stored in isearch-cmds. But I see no problem
because “pending” appears again when you continue typing new characters.
diff --git a/lisp/info.el b/lisp/info.el
index e32b6b3..3eb2021 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2107,11 +2107,10 @@ (defun Info-isearch-search ()
(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))))))))
- (if (functionp isearch-regexp-function)
+ (let ((lax (isearch--lax-regexp-function-p string)))
+ (when lax
+ (setq isearch-adjusted t))
+ (if (functionp isearch-regexp-function)
(funcall isearch-regexp-function string lax)
(word-search-regexp string lax))))
(isearch-regexp string)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5c48c30..856738e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2718,11 +2718,11 @@ (defun isearch-search-fun ()
Can be changed via `isearch-search-fun-function' for special needs."
(funcall (or isearch-search-fun-function 'isearch-search-fun-default)))
-(defun isearch--lax-regexp-function-p ()
+(defun isearch--lax-regexp-function-p (&optional string)
"Non-nil if next regexp-function call should be lax."
(not (or isearch-nonincremental
(null (car isearch-cmds))
- (eq (length isearch-string)
+ (eq (length (or string isearch-string))
(length (isearch--state-string
(car isearch-cmds)))))))
@@ -2741,6 +2741,8 @@ (defun isearch-search-fun-default ()
(if isearch-forward #'re-search-forward #'re-search-backward)
(cond (isearch-regexp-function
(let ((lax (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/doc/emacs/search.texi b/doc/emacs/search.texi
index b728258..1296b3b 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -609,6 +609,8 @@ Word Search
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
This bug report was last modified 8 years and 99 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.