On Wed, Aug 30 2017, Jeremie Courreges-Anglas <[email protected]> wrote:
> On Wed, Aug 30 2017, Jeremie Courreges-Anglas <[email protected]> wrote:
>> As mentioned in https://marc.info/?l=openbsd-tech&m=150401359712984&w=2
>> emacs-usemeta isn't used since some time already. I have a diff that
>> just hides the flag but I changed my mind. The people who use the saved
>> output of "set +o" from an earlier ksh might be negatively affected, but
>> that's a bit far-fetched.
>>
>> So here's the simple diff. ok?
>>
>> The first hunk also deletes a useless comment.
>
> Actually my tests weren't thorough, it turns out we should probably hide
> the emacs-usemeta option instead of completely deleting it. Else ksh
> will stop processing a .profile/.kshrc that contains set +/-o
> emacs-usemeta, which could lead to confusion...
>
> I'll go back to my previous diff.
So here's another take, with input from anton@. Seems to behave well,
but I managed to mess up the previous one, so please watch out. ;)
Comments? ok?
Index: sh.h
===================================================================
RCS file: /d/cvs/src/bin/ksh/sh.h,v
retrieving revision 1.61
diff -u -p -r1.61 sh.h
--- sh.h 4 Jul 2017 11:46:15 -0000 1.61
+++ sh.h 30 Aug 2017 12:10:38 -0000
@@ -139,7 +139,7 @@ enum sh_flag {
FCSHHISTORY, /* csh-style history enabled */
#ifdef EMACS
FEMACS, /* emacs command editing */
- FEMACSUSEMETA, /* use 8th bit as meta */
+ FEMACSUSEMETA, /* XXX delete after 6.2 */
#endif
FERREXIT, /* -e: quit on error */
#ifdef EMACS
Index: misc.c
===================================================================
RCS file: /d/cvs/src/bin/ksh/misc.c,v
retrieving revision 1.57
diff -u -p -r1.57 misc.c
--- misc.c 4 Jul 2017 11:46:15 -0000 1.57
+++ misc.c 30 Aug 2017 12:10:38 -0000
@@ -129,7 +129,7 @@ const struct option options[] = {
{ "csh-history", 0, OF_ANY }, /* non-standard */
#ifdef EMACS
{ "emacs", 0, OF_ANY },
- { "emacs-usemeta", 0, OF_ANY }, /* non-standard */
+ { "emacs-usemeta", 0, OF_ANY }, /* XXX delete after 6.2 */
#endif
{ "errexit", 'e', OF_ANY },
#ifdef EMACS
@@ -185,8 +185,11 @@ option(const char *n)
int i;
for (i = 0; i < NELEM(options); i++)
- if (options[i].name && strcmp(options[i].name, n) == 0)
+ if (options[i].name && strcmp(options[i].name, n) == 0) {
+ if (i == FEMACSUSEMETA)
+ warningf(true, "%s: deprecated option", n);
return i;
+ }
return -1;
}
@@ -226,7 +229,9 @@ printoptions(int verbose)
/* verbose version */
shprintf("Current option settings\n");
- for (i = n = oi.opt_width = 0; i < NELEM(options); i++)
+ for (i = n = oi.opt_width = 0; i < NELEM(options); i++) {
+ if (i == FEMACSUSEMETA)
+ continue;
if (options[i].name) {
len = strlen(options[i].name);
oi.opts[n].name = options[i].name;
@@ -234,16 +239,20 @@ printoptions(int verbose)
if (len > oi.opt_width)
oi.opt_width = len;
}
+ }
print_columns(shl_stdout, n, options_fmt_entry, &oi,
oi.opt_width + 5, 1);
} else {
/* short version ala ksh93 */
shprintf("set");
- for (i = 0; i < NELEM(options); i++)
+ for (i = 0; i < NELEM(options); i++) {
+ if (i == FEMACSUSEMETA)
+ continue;
if (options[i].name)
shprintf(" %co %s",
Flag(i) ? '-' : '+',
options[i].name);
+ }
shprintf("\n");
}
}
Index: emacs.c
===================================================================
RCS file: /d/cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.71
diff -u -p -r1.71 emacs.c
--- emacs.c 29 Aug 2017 23:04:50 -0000 1.71
+++ emacs.c 30 Aug 2017 12:10:38 -0000
@@ -1452,9 +1452,6 @@ x_init_emacs(void)
ainit(AEDIT);
x_nextcmd = -1;
- /* XXX unused */
- Flag(FEMACSUSEMETA) = 1;
-
/* new keybinding stuff */
TAILQ_INIT(&kblist);
Index: ksh.1
===================================================================
RCS file: /d/cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.193
diff -u -p -r1.193 ksh.1
--- ksh.1 19 Aug 2017 06:19:42 -0000 1.193
+++ ksh.1 30 Aug 2017 12:10:38 -0000
@@ -3587,9 +3587,6 @@ character.
.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
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE