add EDITMODE variable (from PLD) Index: pdksh-5.2.14/ksh.Man =================================================================== --- pdksh-5.2.14.orig/ksh.Man 2009-09-16 23:24:45.000000000 +0200 +++ pdksh-5.2.14/ksh.Man 2009-09-16 23:24:49.000000000 +0200 @@ -791,13 +791,21 @@ \fBselect\fP, \fBset \-o\fP and \fBkill \-l\fP commands to format information in columns. .\"}}} +.\"{{{ EDITMODE +.ksh( +.IP \fBEDITMODE\fP +If set, this parameter controls the command line editing mode for +interactive shells. If the last component of the path specified in this +parameter contains the string \fBvi\fP, \fBemacs\fP or \fBgmacs\fP, the +vi, emacs or gmacs (Gosling emacs) editing mode is enabled, respectively. +.\"}}} +.ksh) .\"{{{ EDITOR .ksh( .IP \fBEDITOR\fP If the \fBVISUAL\fP parameter is not set, this parameter controls the command line editing mode for interactive shells. -See \fBVISUAL\fP parameter below for how this works. -.ksh) +See \fBEDITMODE\fP parameter above for how this works. .\"}}} .\"{{{ ENV .IP \fBENV\fP @@ -1044,7 +1052,7 @@ .\"{{{ VISUAL .ksh( .IP \fBVISUAL\fP -If set, this parameter controls the command line editing mode for +If set, and \fBEDITMODE\fP is unset, this parameter controls the command line editing mode for interactive shells. If the last component of the path specified in this parameter contains the string \fBvi\fP, \fBemacs\fP or \fBgmacs\fP, the vi, emacs or gmacs (Gosling emacs) editing mode is enabled, respectively. Index: pdksh-5.2.14/table.h =================================================================== --- pdksh-5.2.14.orig/table.h 2009-09-16 23:24:45.000000000 +0200 +++ pdksh-5.2.14/table.h 2009-09-16 23:24:49.000000000 +0200 @@ -168,6 +168,7 @@ #define V_TMOUT 15 #define V_TMPDIR 16 #define V_LINENO 17 +#define V_EDITMODE 18 /* values for set_prompt() */ #define PS1 0 /* command */ Index: pdksh-5.2.14/var.c =================================================================== --- pdksh-5.2.14.orig/var.c 2009-09-16 23:24:45.000000000 +0200 +++ pdksh-5.2.14/var.c 2009-09-16 23:24:49.000000000 +0200 @@ -95,6 +95,7 @@ #endif /* HISTORY */ #ifdef EDIT { "EDITOR", V_EDITOR }, + { "EDITMODE", V_EDITMODE }, { "VISUAL", V_VISUAL }, #endif /* EDIT */ #ifdef KSH @@ -111,7 +112,7 @@ int i; struct tbl *tp; - tinit(&specials, APERM, 32); /* must be 2^n (currently 17 specials) */ + tinit(&specials, APERM, 32); /* must be 2^n (currently 18 specials) */ for (i = 0; names[i].name; i++) { tp = tenter(&specials, names[i].name, hash(names[i].name)); tp->flag = DEFINED|ISSET; @@ -1017,11 +1018,15 @@ #endif /* HISTORY */ #ifdef EDIT case V_VISUAL: - set_editmode(str_val(vp)); + if (!(global("EDITMODE")->flag & ISSET)) + set_editmode(str_val(vp)); break; case V_EDITOR: - if (!(global("VISUAL")->flag & ISSET)) - set_editmode(str_val(vp)); + if (!(global("EDITMODE")->flag & ISSET)) + if(!(global("VISUAL")->flag & ISSET)) + set_editmode(str_val(vp)); + case V_EDITMODE: + set_editmode(str_val(vp)); break; case V_COLUMNS: if ((x_cols = intval(vp)) <= MIN_COLS)