Subject: bin/14578: sh(1) doesn't indicate what emacs keys to use
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 11/13/2001 11:57:41
>Number:         14578
>Category:       bin
>Synopsis:       sh(1) doesn't explain emacs editing mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 13 11:58:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy C. Reed
>Release:        -current
>Organization:
http://bsd.reedmedia.net/
>Environment:
	
System: NetBSD rainier.reedmedia.net 1.5.1_BETA NetBSD 1.5.1_BETA (JCR-1.5-20010407) #0: Sat Apr 7 01:44:35 PDT 2001 reed@rainier:/usr/src/sys/arch/i386/compile/JCR-1.5-20010407 i386


>Description:
sh.1 manual mentions emacs editing mode but doesn't explain what keys.
In addition, sh(1) doesn't indicate use of libedit/editline library.

It also references non-existant emacs(1) manual page. Should base
manual pages reference manual pages from software installed via package
collection?

The sh.1 "Command Line Editing" section is too short and doesn't
mention emacs. In addition, it mentions that some commands are "described
below" -- they aren't.

By the way, I see pr 10097 "key bindings and editrc for /bin/sh".
What is the plan with it?

Should the sh(1) manual page indicate ~/.editrc?
(Even editrc(5) doesn't mention location of file.)

Should sh(1) explain what keystrokes to use for emacs mode or
reference a different document?

Do the keystrokes change from architecture to architecture -- and
is this why it isn't explained?

I see the auto-generated lib/libedit/emacs.h file -- what file shows the
defaults? Is this defined via termcap?
>How-To-Repeat:
man sh # and try to figure out what keys do what

>Fix:

A patch for sh.1 is below. It still needs to reference editrc if applicable.
And sh still needs some documentation telling which key does what (.i.e.
CTRL-A goes to beginning of line).

--- sh.1.orig	Tue Nov 13 11:06:00 2001
+++ sh.1	Tue Nov 13 11:54:42 2001
@@ -239,12 +239,17 @@
 command line editor (disables
 .Fl E
 if it has been set).
+(See the
+.Sx Command Line Editing
+section below.)
 .It Fl E Em emacs
-Enable the built-in
-.Xr emacs 1
+Enable the built-in emacs style
 command line editor (disables
 .Fl V
 if it has been set).
+(See the
+.Sx Command Line Editing
+section below.)
 .It Fl b Em notify
 Enable asynchronous notification of background job completion.
 (UNIMPLEMENTED for 4.4alpha)
@@ -1481,18 +1486,32 @@
 .Ic fc
 in
 .Sx Builtins )
-can be edited using vi-mode command-line editing. This mode uses commands,
-described below, similar to a subset of those described in the vi man
-page. The command
+can be edited using emacs-mode or vi-mode command-line editing.
+The command
+.Ql set -o emacs
+enables emacs-mode editing.
+The command
 .Ql set -o vi
-enables vi-mode editing and place sh into vi insert mode. With vi-mode
-enabled, sh can be switched between insert mode and command mode. The
-editor is not described in full here, but will be in a later document.
+enables vi-mode editing and places sh into vi insert mode.
+(See the
+.Sx Argument List Processing
+section above.) 
+.Pp
+The vi mode uses commands similar to a subset of those described in the
+.Xr vi 1
+man page.  With vi-mode
+enabled, sh can be switched between insert mode and command mode.
 It's similar to vi: typing
 .Aq ESC
 will throw you into command VI command mode. Hitting
 .Aq return
 while in command mode will pass the line to the shell.
+.Pp
+.Nm
+uses the
+.Xr editline 3
+library.
+The editor is not described in full here, but will be in a later document.
 .Sh ENVIRONMENT
 .Bl -tag -width MAILCHECK
 .It Ev HOME

>Release-Note:
>Audit-Trail:
>Unformatted: