Subject: RE: bug#3746: M-r in comint mode should use isearch

From: "Drew Adams" <[email-masked]>
Date: Thu, 9 Jul 2009 08:01:43 -0700

> > The general objection is rather Occam's razor: _Why_ add 
> > such complexity? What is gained? Occasionally the added
> > convenience of having a single key to use makes a DWIM
> > command worth it. But usually not.
> 
> This case is an exception.

I leave that to your judgment; I can't speak to that.

> C-r is the most frequent key I use in bash running in xterm because
> it is very convenient to search for old commands in the shell history.
> I suppose the same is true for other users.
> 
> Using a different key in Emacs for the same functionality
> will cause too much trouble.  Just imagine when you have a habit
> typing C-r to search on the shell history, typing it in the Emacs
> shell buffer will not do what you mean.  This recalls that
> Emacs has a different key M-r.  Then switching back to xterm
> and typing M-r: Ahh, that M-r is valid only in Emacs,
> but in xterm it is C-r.  Arrrgh!
> 
> I think having two different keys for the same functionality
> (C-r and M-r for Isearch on the history) is worse than having
> the same key for different contexts (the shell prompt or the
> rest of the shell buffer).

The alternative is not necessarily to have two completely different keys. The
typical, traditional, and simpler approach is to use the same key but still
allow two behaviors and keep the behavior distinction under explicit user
control: Initiate one of the two behaviors using `C-u'. Depending on context is
far more complicated.

And depending on context doesn't necessarily mean fewer keystrokes (even though
you never need to hit `C-u'): If the cursor is not in the right place for the
particular behavior you want, then you must first move it there. I'm not sure
that anything significant is gained by the approach you propose, except added
complexity. `C-r' for history search and `C-u C-r' for normal search seems
reasonable, to me.

But it's your call, of course.