[Top][All Lists]

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

Re: isearch-yank-char

From: Karl Fogel
Subject: Re: isearch-yank-char
Date: 30 Apr 2004 08:58:45 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Alan Mackenzie <address@hidden> writes:
> Excellent idea!  Let's do it!


> >   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....

That's what I was thinking.  It would be "just as if" you hadn't typed
the character just dropped from the search string in the first place.

> Where does point get left in a regexp-search after C-b?  Suppose that the
> last character entered into the regexp search string was a closing
> parenthesis (or whatever) that caused the the regexp search to backtrack,
> moving point to an earlier position?  I can think of several ideas for
> handling this, e.g.:

Oooh.  Glad you asked -- hadn't even thought about isearch-*-regexp,
since I rarely use them.

> (i) Point moves _forward_ to where it was before the ] was entered, i.e.
> C-b works just like <del> in this case;  However, the search string might
> just have been extended by several characters at once (with M-y).  This
> looks like getting hairy;
> (ii) C-b only works in normal (non-regexp) search;
> (iii) C-b is disallowed in regexp-search for quirky characters like );
> (iv) C-b is disallowed in regexp-search whenever it would cause point to
> jump forward;
> (v) Point is left where it was, and the currently highlighted "match" is
> no longer a match at all;
> (vi) C-b in such circumstances acts like M-e, leaving the user directly
> editing the search string.
> I think it would be a good idea to resolve this issue before implementing
> a C-b.  I'm not sure whether I'd rather do without C-b here than have
> some ugly inconsistency, even if that inconsistency only appears in
> marginal circumstances.

Yes, we should figure out the desired behavior first.

I think it should drop the last (regexp-quoted) character inserted
into the search string, for consistency, and then the search string
would behave as it normally would if that character (or characters, if
it got regexp-quoted) were dropped.

In other words, your option (i), which is to behave almost like <del>,
except remember that <del> actually drops "last unit added".  I.e.,
del after C-w drops a word, and after C-y can drop even more.  But C-b
would always drop a character, plus any regexp quoting that got added
to that character when it was brought into the search string.

I think to flesh this proposal out, we'd have to look more into how
<del> behaves currently in the isearch-*-regexp functions.  I haven't
had time to do that yet, so please don't take the above as much more
than hand-waving :-).


reply via email to

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