From f31bf084e3fc8c91d10d1e6561f9774a7d9b49ef Mon Sep 17 00:00:00 2001 From: tg Date: Thu, 26 Jun 2003 18:26:21 +0000 Subject: [PATCH] new non-standard mode: -o emacs-usemeta (on by default) from naddy@, thanks --- emacs.c | 6 +++--- ksh.1tbl | 17 +++++++++++++---- misc.c | 2 ++ sh.h | 3 ++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/emacs.c b/emacs.c index 392b024..683ee1b 100644 --- a/emacs.c +++ b/emacs.c @@ -1,3 +1,4 @@ +/* $MirBSD: emacs.c,v 1.2 2003/06/26 18:26:21 tg Exp $ */ /* $OpenBSD: emacs.c,v 1.19 2003/04/16 23:11:52 tdeval Exp $ */ /* @@ -25,7 +26,7 @@ static Area aedit; #define CTRL(x) ((x) == '?' ? 0x7F : (x) & 0x1F) /* ASCII */ #define UNCTRL(x) ((x) == 0x7F ? '?' : (x) | 0x40) /* ASCII */ #define META(x) ((x) & 0x7f) -#define ISMETA(x) (x_usemeta && ((x) & 0x80)) +#define ISMETA(x) (Flag(FEMACSUSEMETA) && ((x) & 0x80)) /* values returned by keyboard functions */ @@ -101,7 +102,6 @@ static int x_col; static int x_displen; static int x_arg; /* general purpose arg */ static int x_arg_defaulted;/* x_arg not explicitly set; defaulted to 1 */ -static int x_usemeta; /* no 8-bit ascii, meta = ESC */ static int xlp_valid; /* end from 4.9 edit.h } */ @@ -1530,7 +1530,7 @@ x_init_emacs() */ locale = setlocale(LC_CTYPE, NULL); if (locale == NULL || !strcmp(locale, "C") || !strcmp(locale, "POSIX")) - x_usemeta = 1; + Flag(FEMACSUSEMETA) = 1; } static void diff --git a/ksh.1tbl b/ksh.1tbl index 880f582..cddd7b1 100644 --- a/ksh.1tbl +++ b/ksh.1tbl @@ -1,4 +1,4 @@ -.\" $MirBSD: ksh.1tbl,v 1.6 2003/06/14 11:51:40 tg Exp $ +.\" $MirBSD: ksh.1tbl,v 1.7 2003/06/26 18:26:21 tg Exp $ .\" $OpenBSD: ksh.1tbl,v 1.53 2003/06/06 10:05:52 jmc Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 @@ -3353,6 +3353,9 @@ Enable brace expansion (a.k.a., alternation). .It Ic emacs 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. .It Ic gmacs Enable gmacs-like command-line editing (interactive shells only). Currently identical to emacs editing except that transpose (^T) acts slightly @@ -4313,9 +4316,15 @@ When the .Ic emacs option is set, interactive input line editing is enabled. Warning: This mode is -slightly different from the emacs mode in the original Korn shell and the 8th -bit is stripped in emacs mode. -In this mode, various editing commands +slightly different from the emacs mode in the original Korn shell. +By default, the eight bit is used as Meta, but this can be turned +off by entering +.Ic set +o emacs-usemeta , +which is default in the +.Mx 6 +.Pa /etc/profile +file. +In the emacs mode, various editing commands (typically bound to one or more control characters) cause immediate actions without waiting for a newline. Several editing commands are bound to particular diff --git a/misc.c b/misc.c index dbbc222..5146b48 100644 --- a/misc.c +++ b/misc.c @@ -1,3 +1,4 @@ +/* $MirBSD: misc.c,v 1.2 2003/06/26 18:26:21 tg Exp $ */ /* $OpenBSD: misc.c,v 1.16 2003/04/16 23:11:52 tdeval Exp $ */ /* @@ -143,6 +144,7 @@ const struct option options[] = { { (char *) 0, 'c', OF_CMDLINE }, #ifdef EMACS { "emacs", 0, OF_ANY }, + { "emacs-usemeta", 0, OF_ANY }, /* non-standard */ #endif { "errexit", 'e', OF_ANY }, #ifdef EMACS diff --git a/sh.h b/sh.h index a43a825..9b1d3f0 100644 --- a/sh.h +++ b/sh.h @@ -1,4 +1,4 @@ -/* $MirBSD: sh.h,v 1.3 2003/05/22 14:06:07 tg Exp $ */ +/* $MirBSD: sh.h,v 1.4 2003/06/26 18:26:21 tg Exp $ */ /* $OpenBSD: sh.h,v 1.13 2003/05/16 19:58:57 jsyn Exp $ */ /* @@ -475,6 +475,7 @@ enum sh_flag { FCOMMAND, /* -c: (invocation) execute specified command */ #ifdef EMACS FEMACS, /* emacs command editing */ + FEMACSUSEMETA, /* use 8th bit as meta */ #endif FERREXIT, /* -e: quit on error */ #ifdef EMACS