all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: Chong Yidong <cyd@stupidchicken.com>, emacs-devel@gnu.org
Subject: Re: Strange behavior of word isearch
Date: Sat, 08 Nov 2008 21:35:43 -0500	[thread overview]
Message-ID: <jwv8wrt8wb5.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ljvtg6i0.fsf@jurta.org> (Juri Linkov's message of "Sun, 09 Nov 2008 00:59:11 +0200")

> 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




  reply	other threads:[~2008-11-09  2:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 16:58 Strange behavior of word isearch Chong Yidong
2008-09-25  3:46 ` Chong Yidong
2008-09-25  9:11   ` martin rudalics
2008-09-25 14:34     ` Chong Yidong
2008-09-25 15:17       ` martin rudalics
2008-09-25 16:41         ` Chong Yidong
2008-09-25 17:10           ` Chong Yidong
2008-11-08 22:59             ` Juri Linkov
2008-11-09  2:35               ` Stefan Monnier [this message]
2008-11-09 17:45                 ` Juri Linkov
2008-09-25 13:35   ` Stefan Monnier
2008-09-25 15:34 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8wrt8wb5.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.