[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Browsing the history of commands. Inconsistency between Bash and Ema
From: |
Dani Moncayo |
Subject: |
Re: Browsing the history of commands. Inconsistency between Bash and Emacs |
Date: |
Fri, 14 Feb 2014 13:46:33 +0100 |
> This is completely putting the cart before the horse. And going down
> that road creates a circular line of reasoning which has no end to the
> loop cycle. Plus it is a radical change in fundamental behavior.
> Please don't.
I disagree with the above, obviously. See below.
> The entire reason that bash's readline emacs mode uses C-n and C-p is
> that those are the emacs keys for next-line and previous-line. If
> emacs were using M-p and M-n for previous and next then bash would
> have done so too. Bash didn't make this up. It is using the keys
> from emacs for emacs mode and those keys are C-n and C-p. Editing the
> history is just like editing a file. C-p takes you to the previous
> line. C-n takes you to the next line.
Then, that model used in bash is precisely what I think should be
changed (generalized), to match the emacs one: Emacs' minibuffer
distinguishes between (a) different lines within the current command
and (b) different commands. And that distinction is good, because it
allows for a richer user interface: you can, on one hand, move across
different commands (with M-p/M-n), and OTOH, move across different
lines in the current selected command (with C-p/C-n). It is simply a
richer (better) model, IMHO.
> Now enter emacs. I mean literally. (I have been using emacs for a
> very long time by the way. I am using it now.) Emacs has the feature
> including of being able to edit the minibuffer and also being able to
> run an inferior shell process in a buffer. Both are very similar
> cases and should be discussed together.
I definitely think they are different scenarios. But see below.
> In those buffers if you want
> to go to the previous line or the next line then what keys do you use?
> You use C-p and C-n to go to the previous line or the next line.
Of course: you are in a buffer in Emacs, and the standard commands to
move across lines within a buffer are those (C-p/C-n).
> But that is not editing the history. That is editing the buffer.
Indeed.
> There the previous and next lines are parts of the visible screen. It
> isn't a history of the screen. For using bash in an inferior shell if
> you want to recall shell history you can't use C-p and C-n because
> those are shadowed by the emacs layer of keybindings that move
> previous and next lines. Therefore M-p and M-n were the natural
> second choice to navigate by adding another mental layer of
> navigation. (Although emacs itself is keeping the input history.)
> Same thing for the minibuffer.
That is another example of the inconsistency I'd like to remove: In
Emacs, the standard commands for moving across "histories" (commands,
files, buffers, bookmarks, etc) are M-p and M-n. And for that reason,
you have to use those keys for browsing the command history of the
inferior shell (and C-p/C-n are, as always, employed for moving across
lines in the current buffer).
> So now people say, I am now used to using M-p and M-n in emacs to
> avoid the C-p/C-n. Let's set that up for bash. (Of course you can
> easily do this if you desire. Just do it. Several people suggested
> it.)
Yes, I can do it in my .bashrc, but the point is to remove this
inconsistency upstream.
> Well, let's say for discussion that you get used to that
> setting. The entire argument so far is that people are "used to it".
No. See above. The entire argument is that Emacs uses a more general
and richer model, and it would be nice if Bash could adopt that same
model.
> Now people become used to navigating the previous line with M-p and
> the next line with M-n in bash. Now they go to emacs. What do they
> do there? They find that in emacs M-p and M-n *do not navigate* the
> previous line and next line. They find that bash and emacs are once
> again inconsistent!
Not at all. They find that in Emacs, M-p and M-n, as always, are for
navigating across consecutive entries (whether multiline or
single-line) in every history of elements (including commands). And
that would be perfectly consistent with Bash (if it used M-p/M-n for
the same purpose, instead of C-p/C-n).
> In that future time let me file a bug with emacs asking for them to
> change their previous-line and next-line key bindings to be compatible
> with the new bash bindings of M-p and M-n for previous and next line.
> Why? Because they are "used to it". That request is just as valid as
> this request to do so with bash.
Not at all. See above. Againg: Emacs would not have to change
anything to be consistent with Bash:
* M-p/M-n for browsing the history.
* C-p/C-n for moving across lines within a single entry/buffer.
I think/hope that my point is clear enough already.
--
Dani Moncayo