[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ksh: set +o emacs-usemeta
I am happy with this, as an option.
> Return-Path: owner-tech+M4474=deraadt=cvs.openbsd.org@openbsd.org
> Delivery-Date: Sat Jun 14 14:32:59 2003
> Received: from openbsd.cs.colorado.edu (openbsd.cs.colorado.edu [128.138.192.83])
> by cvs.openbsd.org (8.12.9/8.12.1) with ESMTP id h5EKWwiV030064
> (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=FAIL)
> for <deraadt@cvs.openbsd.org>; Sat, 14 Jun 2003 14:32:58 -0600 (MDT)
> Received: from openbsd.org (localhost.cs.colorado.edu [127.0.0.1])
> by openbsd.cs.colorado.edu (8.12.9/8.12.9) with ESMTP id h5EKV19i003492
> for <deraadt@cvs.openbsd.org>; Sat, 14 Jun 2003 14:31:14 -0600 (MDT)
> Received: from mail.inka.de (mail@quechua.inka.de [193.197.184.2])
> by openbsd.cs.colorado.edu (8.12.9/8.12.9) with ESMTP id h5EKUqws016394 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO)
> for <tech@openbsd.org>; Sat, 14 Jun 2003 14:30:53 -0600 (MDT)
> Received: from kemoauc.mips.inka.de (uucp@)
> by mail.inka.de with gbsmtp id 19RHfk-0005oX-04; Sat, 14 Jun 2003 22:30:48 +0200
> Received: from kemoauc.mips.inka.de (localhost [127.0.0.1])
> by kemoauc.mips.inka.de (8.12.9/8.12.6) with ESMTP id h5EJkXih045267
> for <tech@openbsd.org>; Sat, 14 Jun 2003 21:46:33 +0200 (CEST) (envelope-from naddy@localhost.mips.inka.de)
> Received: (from naddy@localhost)
> by kemoauc.mips.inka.de (8.12.9/8.12.9/Submit) id h5EJkXTU045266
> for tech@openbsd.org; Sat, 14 Jun 2003 21:46:33 +0200 (CEST)
> Date: Sat, 14 Jun 2003 21:46:33 +0200
> From: Christian Weisgerber <naddy@mips.inka.de>
> To: tech@openbsd.org
> Subject: ksh: set +o emacs-usemeta
> Message-ID: <20030614194633.GA45005@kemoauc.mips.inka.de>
> Mime-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> User-Agent: Mutt/1.4.1i
> X-Spam-Level:
> X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
> X-Loop: tech@openbsd.org
> Precedence: list
> Sender: owner-tech@openbsd.org
>
> Currently, our system ksh always interprets the 8th bit as meta
> (^[) prefix in emacs command-line editing mode. This means that
> you cannot enter 8-bit characters for filenames etc.
>
> The small patch below makes this behavior configurable by way of a
> new emacs-usemeta shell option. "set +o emacs-usemeta" and type
> away characters with the 8th bit set.
>
> Do we want this? Does anybody care? Comments?
>
> Index: emacs.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/emacs.c,v
> retrieving revision 1.19
> diff -u -r1.19 emacs.c
> --- emacs.c 16 Apr 2003 23:11:52 -0000 1.19
> +++ emacs.c 14 Jun 2003 00:41:06 -0000
> @@ -25,7 +25,7 @@
> #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 +101,6 @@
> 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 +1529,7 @@
> */
> locale = setlocale(LC_CTYPE, NULL);
> if (locale == NULL || !strcmp(locale, "C") || !strcmp(locale, "POSIX"))
> - x_usemeta = 1;
> + Flag(FEMACSUSEMETA) = 1;
> }
>
> static void
> Index: ksh.1tbl
> ===================================================================
> RCS file: /cvs/src/bin/ksh/ksh.1tbl,v
> retrieving revision 1.53
> diff -u -r1.53 ksh.1tbl
> --- ksh.1tbl 6 Jun 2003 10:05:52 -0000 1.53
> +++ ksh.1tbl 14 Jun 2003 19:36:17 -0000
> @@ -3352,6 +3352,9 @@
> .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
> @@ -4307,8 +4310,7 @@
> .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.
> +slightly different from the emacs mode in the original Korn shell.
> In this mode, various editing commands
> (typically bound to one or more control characters) cause immediate actions
> without waiting for a newline.
> Index: misc.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/misc.c,v
> retrieving revision 1.16
> diff -u -r1.16 misc.c
> --- misc.c 16 Apr 2003 23:11:52 -0000 1.16
> +++ misc.c 14 Jun 2003 00:30:44 -0000
> @@ -143,6 +143,7 @@
> { (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
> Index: sh.h
> ===================================================================
> RCS file: /cvs/src/bin/ksh/sh.h,v
> retrieving revision 1.13
> diff -u -r1.13 sh.h
> --- sh.h 16 May 2003 19:58:57 -0000 1.13
> +++ sh.h 14 Jun 2003 00:41:47 -0000
> @@ -474,6 +474,7 @@
> 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
> --
> Christian "naddy" Weisgerber naddy@mips.inka.de