help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: word complete goes to far


From: Alan Mackenzie
Subject: Re: word complete goes to far
Date: Thu, 24 Jul 2003 08:50:19 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Leo <leo.broska@nospam.isys.com.au> wrote on Thu, 24 Jul 2003 13:04:07 +1000:
> hi all,

> in isearch, when i use Ctrl-w to complete the search to the underlying
> word, emacs goes too far when there are quotes involved:

> eg. in the text there is the quoted term 'Peter'. i place the cursor on the
> P and press Ctrl-s Ctrl-w. then emacs searches for peter' (note the single
> quote at the end!).

> that's not what i want.obviously i want to search just for peter.

I've got a feeling this has been fixed in the Emacs CVS.  It's irritated
me over the years a fair amount, too.

> how can i tell that emacs?

If you're an elisp programmer, you could try something like this:

The incremental search functions are in the file ../lisp/isearch.el.  C-w
is bound to isearch-yank-word.  isearch-yank-word calls
isearch-yank-internal. 

In isearch-yank-internal, forward-word is used to decide exactly what a
"word" is.  Currently it is finding "Peter'" rather than "Peter".  This
is due to the syntax-table current at the time.

Set up a syntax-table so that forward-word doesn't find the '.  Use
defadvice to wrap a call of with-syntax-table around the forward-word
call.

> thanks for any advice,

Or, if you can't do this or can't be bothered, after C-w yanks "Peter'",
type M-e and edit the search string to get rid of the ' then type C-s
again.

> leo

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

[Prev in Thread] Current Thread [Next in Thread]