mksh now does not look at $EDITOR and $VISUAL any more to determine
the editing mode; default is emacs (vi and gmacs off). mksh also defaults to emacs-usemeta=OFF now.
This commit is contained in:
parent
bfc5b81602
commit
3fb44287d4
24
edit.c
24
edit.c
@ -1,4 +1,4 @@
|
||||
/** $MirOS: src/bin/mksh/edit.c,v 1.8 2005/06/08 22:34:02 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/edit.c,v 1.9 2005/07/04 12:07:40 tg Exp $ */
|
||||
/* $OpenBSD: edit.c,v 1.29 2005/04/13 02:33:08 deraadt Exp $ */
|
||||
/* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */
|
||||
/* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
@ -10,7 +10,7 @@
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.8 2005/06/08 22:34:02 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.9 2005/07/04 12:07:40 tg Exp $");
|
||||
|
||||
#define BEL 0x07
|
||||
|
||||
@ -269,24 +269,6 @@ promptlen(const char *cp, const char **spp)
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
set_editmode(const char *ed)
|
||||
{
|
||||
static const enum sh_flag edit_flags[] = {
|
||||
FEMACS, FGMACS, FVI
|
||||
};
|
||||
char *rcp;
|
||||
unsigned i;
|
||||
|
||||
if ((rcp = strrchr(ed, '/')))
|
||||
ed = ++rcp;
|
||||
for (i = 0; i < NELEM(edit_flags); i++)
|
||||
if (strstr(ed, options[(int)edit_flags[i]].name)) {
|
||||
change_flag(edit_flags[i], OF_SPECIAL, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Misc common code for vi/emacs */
|
||||
|
||||
@ -2371,7 +2353,7 @@ x_init_emacs(void)
|
||||
for (j = 0; j < X_TABSZ; j++)
|
||||
x_atab[i][j] = NULL;
|
||||
|
||||
Flag(FEMACSUSEMETA) = 1;
|
||||
Flag(FEMACSUSEMETA) = 0;
|
||||
}
|
||||
|
||||
static void bind_if_not_bound(int p, int k, int func);
|
||||
|
50
mksh.1
50
mksh.1
@ -1,4 +1,4 @@
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.10 2005/07/04 11:57:55 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.11 2005/07/04 12:07:40 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.99 2005/05/25 16:52:06 jaredy Exp $
|
||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||
.\"
|
||||
@ -1355,28 +1355,6 @@ This parameter is used by the interactive line editing modes, and by the
|
||||
and
|
||||
.Ic kill -l
|
||||
commands to format information columns.
|
||||
.It Ev EDITOR
|
||||
If the
|
||||
.Ev VISUAL
|
||||
parameter is not set, this parameter controls the command-line editing mode for
|
||||
interactive shells.
|
||||
See the
|
||||
.Ev VISUAL
|
||||
parameter below for how this works.
|
||||
.Pp
|
||||
Note:
|
||||
traditionally,
|
||||
.Ev EDITOR
|
||||
was used to specify the name of an (old-style) line editor, such as
|
||||
.Xr ed 1 ,
|
||||
and
|
||||
.Ev VISUAL
|
||||
was used to specify a (new-style) screen editor, such as
|
||||
.Xr vi 1 .
|
||||
Hence if
|
||||
.Ev VISUAL
|
||||
is set, it overrides
|
||||
.Ev EDITOR .
|
||||
.It Ev ENV
|
||||
If this parameter is found to be set after any profile files are executed, the
|
||||
expanded value is used as a shell startup file.
|
||||
@ -1599,24 +1577,6 @@ If this parameter is not
|
||||
set, or does not contain the absolute path of a writable directory, temporary
|
||||
files are created in
|
||||
.Pa /tmp .
|
||||
.It Ev VISUAL
|
||||
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
|
||||
.Dq vi ,
|
||||
.Dq emacs ,
|
||||
or
|
||||
.Dq gmacs ,
|
||||
the
|
||||
.Xr vi ,
|
||||
.Xr emacs ,
|
||||
or
|
||||
.Xr gmacs
|
||||
(Gosling emacs) editing mode is enabled, respectively.
|
||||
See also the
|
||||
.Ev EDITOR
|
||||
parameter, above.
|
||||
.El
|
||||
.Ss Tilde expansion
|
||||
Tilde expansion, which is done in parallel with parameter substitution, is done
|
||||
@ -3459,7 +3419,7 @@ Enable BRL emacs-like command-line editing (interactive shells only); see
|
||||
.Sx Emacs editing mode .
|
||||
.It Ic emacs-usemeta
|
||||
In emacs command-line editing, use the 8th bit as meta (^[) prefix.
|
||||
This is the default.
|
||||
This is disabled by default, so you can use high-bit7 characters in pathnames.
|
||||
.It Ic gmacs
|
||||
Enable gmacs-like command-line editing (interactive shells only).
|
||||
Currently identical to emacs editing except that transpose (^T) acts slightly
|
||||
@ -4434,11 +4394,7 @@ The default is
|
||||
.Ic emacs .
|
||||
Editing modes can be set explicitly using the
|
||||
.Ic set
|
||||
built-in, or implicitly via the
|
||||
.Ev EDITOR
|
||||
and
|
||||
.Ev VISUAL
|
||||
environment variables.
|
||||
built-in.
|
||||
If none of these options are enabled,
|
||||
the shell simply reads lines using the normal
|
||||
.Xr tty 4
|
||||
|
3
sh.h
3
sh.h
@ -1,4 +1,4 @@
|
||||
/** $MirOS: src/bin/mksh/sh.h,v 1.12 2005/06/24 15:36:57 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/sh.h,v 1.13 2005/07/04 12:07:41 tg Exp $ */
|
||||
/* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */
|
||||
/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
|
||||
@ -1028,7 +1028,6 @@ int c_test(char **);
|
||||
/* edit.c */
|
||||
void x_init(void);
|
||||
int x_read(char *, size_t);
|
||||
void set_editmode(const char *);
|
||||
int x_bind(const char *, const char *, int, int);
|
||||
/* eval.c */
|
||||
char * substitute(const char *, int);
|
||||
|
16
var.c
16
var.c
@ -1,4 +1,4 @@
|
||||
/** $MirOS: src/bin/mksh/var.c,v 1.6 2005/05/28 21:11:35 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/var.c,v 1.7 2005/07/04 12:07:41 tg Exp $ */
|
||||
/* $OpenBSD: var.c,v 1.26 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
@ -6,7 +6,7 @@
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.6 2005/05/28 21:11:35 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.7 2005/07/04 12:07:41 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@ -94,8 +94,6 @@ initvar(void)
|
||||
{ "TMPDIR", V_TMPDIR },
|
||||
{ "HISTFILE", V_HISTFILE },
|
||||
{ "HISTSIZE", V_HISTSIZE },
|
||||
{ "EDITOR", V_EDITOR },
|
||||
{ "VISUAL", V_VISUAL },
|
||||
{ "RANDOM", V_RANDOM },
|
||||
{ "SECONDS", V_SECONDS },
|
||||
{ "TMOUT", V_TMOUT },
|
||||
@ -990,13 +988,6 @@ setspec(struct tbl *vp)
|
||||
case V_HISTFILE:
|
||||
sethistfile(str_val(vp));
|
||||
break;
|
||||
case V_VISUAL:
|
||||
set_editmode(str_val(vp));
|
||||
break;
|
||||
case V_EDITOR:
|
||||
if (!(global("VISUAL")->flag & ISSET))
|
||||
set_editmode(str_val(vp));
|
||||
break;
|
||||
case V_COLUMNS:
|
||||
if ((x_cols = intval(vp)) <= MIN_COLS)
|
||||
x_cols = MIN_COLS;
|
||||
@ -1063,8 +1054,7 @@ unsetspec(struct tbl *vp)
|
||||
* Don't know what at&t does for:
|
||||
* HISTSIZE, HISTFILE,
|
||||
* Unsetting these in at&t ksh does not loose the 'specialness':
|
||||
* no effect: IFS, COLUMNS, PATH, TMPDIR,
|
||||
* VISUAL, EDITOR,
|
||||
* no effect: IFS, COLUMNS, PATH, TMPDIR
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user