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:
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.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: 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 $ */
|
/* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <libgen.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
|
#define BEL 0x07
|
||||||
|
|
||||||
@ -269,24 +269,6 @@ promptlen(const char *cp, const char **spp)
|
|||||||
return count;
|
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 */
|
/* Misc common code for vi/emacs */
|
||||||
|
|
||||||
@ -2371,7 +2353,7 @@ x_init_emacs(void)
|
|||||||
for (j = 0; j < X_TABSZ; j++)
|
for (j = 0; j < X_TABSZ; j++)
|
||||||
x_atab[i][j] = NULL;
|
x_atab[i][j] = NULL;
|
||||||
|
|
||||||
Flag(FEMACSUSEMETA) = 1;
|
Flag(FEMACSUSEMETA) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bind_if_not_bound(int p, int k, int func);
|
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: 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 $
|
.\" $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
|
and
|
||||||
.Ic kill -l
|
.Ic kill -l
|
||||||
commands to format information columns.
|
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
|
.It Ev ENV
|
||||||
If this parameter is found to be set after any profile files are executed, the
|
If this parameter is found to be set after any profile files are executed, the
|
||||||
expanded value is used as a shell startup file.
|
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
|
set, or does not contain the absolute path of a writable directory, temporary
|
||||||
files are created in
|
files are created in
|
||||||
.Pa /tmp .
|
.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
|
.El
|
||||||
.Ss Tilde expansion
|
.Ss Tilde expansion
|
||||||
Tilde expansion, which is done in parallel with parameter substitution, is done
|
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 .
|
.Sx Emacs editing mode .
|
||||||
.It Ic emacs-usemeta
|
.It Ic emacs-usemeta
|
||||||
In emacs command-line editing, use the 8th bit as meta (^[) prefix.
|
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
|
.It Ic gmacs
|
||||||
Enable gmacs-like command-line editing (interactive shells only).
|
Enable gmacs-like command-line editing (interactive shells only).
|
||||||
Currently identical to emacs editing except that transpose (^T) acts slightly
|
Currently identical to emacs editing except that transpose (^T) acts slightly
|
||||||
@ -4434,11 +4394,7 @@ The default is
|
|||||||
.Ic emacs .
|
.Ic emacs .
|
||||||
Editing modes can be set explicitly using the
|
Editing modes can be set explicitly using the
|
||||||
.Ic set
|
.Ic set
|
||||||
built-in, or implicitly via the
|
built-in.
|
||||||
.Ev EDITOR
|
|
||||||
and
|
|
||||||
.Ev VISUAL
|
|
||||||
environment variables.
|
|
||||||
If none of these options are enabled,
|
If none of these options are enabled,
|
||||||
the shell simply reads lines using the normal
|
the shell simply reads lines using the normal
|
||||||
.Xr tty 4
|
.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: 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: 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 $ */
|
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
|
||||||
@ -1028,7 +1028,6 @@ int c_test(char **);
|
|||||||
/* edit.c */
|
/* edit.c */
|
||||||
void x_init(void);
|
void x_init(void);
|
||||||
int x_read(char *, size_t);
|
int x_read(char *, size_t);
|
||||||
void set_editmode(const char *);
|
|
||||||
int x_bind(const char *, const char *, int, int);
|
int x_bind(const char *, const char *, int, int);
|
||||||
/* eval.c */
|
/* eval.c */
|
||||||
char * substitute(const char *, int);
|
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 $ */
|
/* $OpenBSD: var.c,v 1.26 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.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
|
* Variables
|
||||||
@ -94,8 +94,6 @@ initvar(void)
|
|||||||
{ "TMPDIR", V_TMPDIR },
|
{ "TMPDIR", V_TMPDIR },
|
||||||
{ "HISTFILE", V_HISTFILE },
|
{ "HISTFILE", V_HISTFILE },
|
||||||
{ "HISTSIZE", V_HISTSIZE },
|
{ "HISTSIZE", V_HISTSIZE },
|
||||||
{ "EDITOR", V_EDITOR },
|
|
||||||
{ "VISUAL", V_VISUAL },
|
|
||||||
{ "RANDOM", V_RANDOM },
|
{ "RANDOM", V_RANDOM },
|
||||||
{ "SECONDS", V_SECONDS },
|
{ "SECONDS", V_SECONDS },
|
||||||
{ "TMOUT", V_TMOUT },
|
{ "TMOUT", V_TMOUT },
|
||||||
@ -990,13 +988,6 @@ setspec(struct tbl *vp)
|
|||||||
case V_HISTFILE:
|
case V_HISTFILE:
|
||||||
sethistfile(str_val(vp));
|
sethistfile(str_val(vp));
|
||||||
break;
|
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:
|
case V_COLUMNS:
|
||||||
if ((x_cols = intval(vp)) <= MIN_COLS)
|
if ((x_cols = intval(vp)) <= MIN_COLS)
|
||||||
x_cols = MIN_COLS;
|
x_cols = MIN_COLS;
|
||||||
@ -1063,8 +1054,7 @@ unsetspec(struct tbl *vp)
|
|||||||
* Don't know what at&t does for:
|
* Don't know what at&t does for:
|
||||||
* HISTSIZE, HISTFILE,
|
* HISTSIZE, HISTFILE,
|
||||||
* Unsetting these in at&t ksh does not loose the 'specialness':
|
* Unsetting these in at&t ksh does not loose the 'specialness':
|
||||||
* no effect: IFS, COLUMNS, PATH, TMPDIR,
|
* no effect: IFS, COLUMNS, PATH, TMPDIR
|
||||||
* VISUAL, EDITOR,
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user