[Top][All Lists]

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

Re: What exactly does "read -e" do? bind weirdnesses

From: Chet Ramey
Subject: Re: What exactly does "read -e" do? bind weirdnesses
Date: Sat, 13 Sep 2008 18:29:22 -0400
User-agent: Thunderbird (Macintosh/20080707)

Rocky Bernstein wrote:
There is a connection between the "set -o emacs",  "set -o vi", and "set -o
history" commands and the way "read -e" works. But there is nothing that I
could find in any of the bash/readline/history documents that make this
connection explicit. Changing one of these "line editing" settings changes
key bindings that are used in "read -e".  But this is not mentioned when
describing either "set" or "read". Of course, if one thinks about line
editing and considers where that might be used, then "read -e" is tempting.

Actually, `set -o history' is independent of command line editing; you can
have a history list without any editing at all.  It has no effect on key

The rest is a question of how many places you want to put the same
information.  The text describing the -e option to read references
the readline or command line editing sections of the man page and
info file, respectively.  Those sections note that the default editing
mode is emacs (``By default, the line editing commands are similar to
those of emacs.''), how to change the editing mode from emacs to vi,
how to enable and disable line editing, and that the default values of
the `editing-mode' and `keymap' variables are `emacs', with appropriate
descriptions of their meaning.

The text accompanying `set -o emacs' notes that it is enabled by default
when the shell initializes line editing.

Furthermore, when one puts "read -e" in a file without any line editing
settings, there is by default some sort of key bindings that are in effect.
They look like some of emacs settings, perhaps all of them. But, again, I
don't think one can figure this out by reading available documents and I
don't see it obvious why that this should be the default, yet  "bind" should
not show this.

As noted above, the documentation makes it clear in a number of places
that the default editing mode and key bindings are emacs-like.

I can put something with the text describing `read -e' that it uses the
current or default, if editing is not active, editing settings, but I'd
really like to keep the amount of duplicated information down.

By the way, is "line editing" also an implied by virtue of a combination of
settings or is there some variable, or status display that makes this

It's pretty simple.  If `set -o emacs' is on, there is emacs-like line
editing; if `set -o vi' is on, there is vi-like editing (implmented as
Posix specifies); if neither are on, there is no editing.

``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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