[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: isearch-yank-char
From: |
Miles Bader |
Subject: |
Re: isearch-yank-char |
Date: |
30 Apr 2004 19:12:26 +0900 |
Alan Mackenzie <address@hidden> writes:
> > 2. Bind C-b in isearch-mode to a function (name TBD) that loses
> > one char from the search string.
>
> NOT SO FAST! Tell me, where does point get left after a C-b? Normally,
> one character backwards. No problem. But....
>
> Where does point get left in a regexp-search after C-b?
An obvious implementation might be: Act exactly like `M-e DEL RET'.
However that's no good because M-e _always_ moves forward, even if
the search string got shorter, and I think that would surprise many
people -- who will expect C-b to act sort of like DEL but without
removing large chunks like those added by C-w.
Another idea might be:
(1) Save the current search-string ORIG-SEARCH-STRING, with
length LEN.
(2) Backtrack like DEL until the length of the search-string is
<= LEN - 1 (if you had done a C-w, then that's probably right
before you did it).
(3) Now start searching forward (or backward, if C-r) again from
the point you backed up to, for the first LEN - 1 characters
of ORIG-SEARCH-STRING.
This makes the assumption that you're probably typing C-b because
the current search string is too long and doesn't match what you
want, and thus any search history that includes it should be
removed.
It reflects what many people probably already do manually when C-w
adds slightly too much text: they hit DEL until the text added by
C-w is gone, and then retype all but the unwanted text character by
character.
Even when you don't use C-w, the above behavior is a convenient way
to skip back to the last point where you actually added search
text, without having to hit DEL a bunch of times to backtrack first
(I want to do this quite often).
-Miles
--
We are all lying in the gutter, but some of us are looking at the stars.
-Oscar Wilde
- Re: isearch-yank-char, (continued)
- Re: isearch-yank-char, Juri Linkov, 2004/04/30
- Re: isearch-yank-char, Romain Francoise, 2004/04/30
- Re: isearch-yank-char, Karl Fogel, 2004/04/30
- Re: isearch-yank-char, Juri Linkov, 2004/04/30
- Re: isearch-yank-char, Karl Fogel, 2004/04/30
- Re: isearch-yank-char, Juri Linkov, 2004/04/30
- Re: isearch-yank-char, Karl Fogel, 2004/04/30
- Re: isearch-yank-char, Juri Linkov, 2004/04/30
- Re: isearch-yank-char, Alan Mackenzie, 2004/04/30
- Re: isearch-yank-char, Juri Linkov, 2004/04/30
- Re: isearch-yank-char,
Miles Bader <=
- Re: isearch-yank-char, Karl Fogel, 2004/04/30
- Re: isearch-yank-char, Juri Linkov, 2004/04/28