diff options
author | Juri Linkov <juri@jurta.org> | 2008-11-11 19:43:09 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2008-11-11 19:43:09 +0000 |
commit | 8c740e4c10912a048e0d02aeb0b78e4579d39fb6 (patch) | |
tree | e03cdbfa82e99ab6b65153422ca7223b64e8f643 /lisp/isearch.el | |
parent | f399e4ade9d83ba532aaa5f71f27db2760622a8a (diff) | |
download | emacs-8c740e4c10912a048e0d02aeb0b78e4579d39fb6.tar.gz |
(isearch-search-fun): Compare the length of the
current search string with the length of the string from the
previous search state to detect the situation when the user
adds or removes characters in the search string.
Use word-search-forward-lax and word-search-backward-lax in this
case, and otherwise word-search-forward and word-search-backward.
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r-- | lisp/isearch.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 525106246d4..ac911de3ffb 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2178,7 +2178,12 @@ Can be changed via `isearch-search-fun-function' for special needs." (funcall isearch-search-fun-function) (cond (isearch-word - (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax)) + ;; Use lax versions to not fail at the end of the word while the user + ;; adds and removes characters in the search string + (if (not (eq (length isearch-string) + (length (isearch-string-state (car isearch-cmds))))) + (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax) + (if isearch-forward 'word-search-forward 'word-search-backward))) (isearch-regexp (if isearch-forward 're-search-forward 're-search-backward)) (t |