[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange behavior of word isearch
From: |
Stefan Monnier |
Subject: |
Re: Strange behavior of word isearch |
Date: |
Sat, 08 Nov 2008 21:35:43 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
> word forms and not plurals ("default" vs "defaults" etc.) And typing
> additional whitespace at the end is both inconvenient and not self-apparent
> especially when there is only one word and not a list of words separated
> by whitespace. However, there exists a good solution.
I disagree with SPC being inconvenient, but I agree that it's not
self-evident.
> Index: lisp/isearch.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/isearch.el,v
> retrieving revision 1.331
> diff -c -r1.331 isearch.el
> *** lisp/isearch.el 19 Oct 2008 22:33:17 -0000 1.331
> --- lisp/isearch.el 8 Nov 2008 22:54:14 -0000
> ***************
> *** 2178,2184 ****
> (funcall isearch-search-fun-function)
> (cond
> (isearch-word
> ! (if isearch-forward 'word-search-forward-lax
> 'word-search-backward-lax))
> (isearch-regexp
> (if isearch-forward 're-search-forward 're-search-backward))
> (t
> --- 2182,2193 ----
> (funcall isearch-search-fun-function)
> (cond
> (isearch-word
> ! ;; 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
Looks good. Can people try it out and see if they are surprised?
I know a case where it won't work as nicely as just SPC for me:
I often use C-w to fill the search, but I often don't start at the right
position, so I type in the beginning of the word I want, then maybe hit
C-s a few times to jump to the right occurrence (when it's easier than
to keep on typing), then C-w. But with your change, the C-s will skip
the right occurrence.
Stefan