+0

(no strong feelings either way)

On Fri, Mar 20, 2015 at 07:05:25AM +0100, Pedro Martelletto wrote:
> +1
> 
> >No objection here
> >
> >On Thu, 19 Mar 2015 19:58 Martin Natano <[email protected]> wrote:
> >
> >>Hello,
> >>
> >>does anyone actually use the 'version' keybinding in emacs or vi mode?
> >>I would like to remove it. The command isn't bound to a key per default
> >>and the functionality (and implementation) seems rather odd. The
> >>keybinding is strictly for interactive use, so I don't expect the
> >>removal to break any scripts. The KSH_VERSION environment variable is
> >>still available for interactive and non-interactive use.
> >>
> >>See the natano_ksh_noversion branch, or the diff below.
> >>
> >>ok?
> >>
> >>cheers,
> >>natano
> >>
> >>
> >>commit 184795a06cee14761ed8ef0d866c5b477b6a9d9f
> >>Author: Martin Natano <[email protected]>
> >>Date:   Thu Mar 19 20:39:49 2015 +0100
> >>
> >>    Remove version command from emacs and vi mode.
> >>
> >>diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c
> >>index 4f83dbe..8dd7c21 100644
> >>--- a/bin/ksh/emacs.c
> >>+++ b/bin/ksh/emacs.c
> >>@@ -176,7 +176,6 @@ static int  x_set_mark(int);
> >> static int     x_stuff(int);
> >> static int     x_stuffreset(int);
> >> static int     x_transpose(int);
> >>-static int     x_version(int);
> >> static int     x_xchg_point_mark(int);
> >> static int     x_yank(int);
> >> static int     x_comp_list(int);
> >>@@ -235,7 +234,6 @@ static const struct x_ftab x_ftab[] = {
> >>        { x_stuff,              "stuff",                        0 },
> >>        { x_stuffreset,         "stuff-reset",                  0 },
> >>        { x_transpose,          "transpose-chars",              0 },
> >>-       { x_version,            "version",                      0 },
> >>        { x_xchg_point_mark,    "exchange-point-and-mark",      0 },
> >>        { x_yank,               "yank",                         0 },
> >>        { x_comp_list,          "complete-list",                0 },
> >>@@ -1576,33 +1574,6 @@ x_xchg_point_mark(int c)
> >> }
> >>
> >> static int
> >>-x_version(int c)
> >>-{
> >>-       char *o_xbuf = xbuf, *o_xend = xend;
> >>-       char *o_xep = xep, *o_xcp = xcp;
> >>-
> >>-       xbuf = xcp = (char *) ksh_version + 4;
> >>-       xend = xep = (char *) ksh_version + 4 + strlen(ksh_version + 4);
> >>-       x_redraw(1);
> >>-       x_flush();
> >>-
> >>-       c = x_e_getc(0);
> >>-       xbuf = o_xbuf;
> >>-       xend = o_xend;
> >>-       xep = o_xep;
> >>-       xcp = o_xcp;
> >>-       x_redraw(1);
> >>-
> >>-       if (c < 0)
> >>-               return KSTD;
> >>-       /* This is what at&t ksh seems to do...  Very bizarre */
> >>-       if (c != ' ')
> >>-               x_e_ungetc(c);
> >>-
> >>-       return KSTD;
> >>-}
> >>-
> >>-static int
> >> x_noop(int c)
> >> {
> >>        return KSTD;
> >>diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c
> >>index c325d85..6a37a4e 100644
> >>--- a/bin/ksh/vi.c
> >>+++ b/bin/ksh/vi.c
> >>@@ -138,7 +138,6 @@ const unsigned char classify[128] = {
> >> #define VREDO          7               /* . */
> >> #define VLIT           8               /* ^V */
> >> #define VSEARCH                9               /* /, ? */
> >>-#define VVERSION       10              /* <ESC> ^V */
> >>
> >> static char            undocbuf[CMDLEN];
> >>
> >>@@ -221,7 +220,7 @@ x_vi(char *buf, size_t len)
> >>                                trapsig(c == edchars.intr ? SIGINT :
> >>SIGQUIT);
> >>                                x_mode(false);
> >>                                unwind(LSHELL);
> >>-                       } else if (c == edchars.eof && state != VVERSION) {
> >>+                       } else if (c == edchars.eof) {
> >>                                if (es->linelen == 0) {
> >>                                        x_vi_zotc(edchars.eof);
> >>                                        c = -1;
> >>@@ -322,14 +321,6 @@ vi_hook(int ch)
> >>                                                return -1;
> >>                                        refresh(0);
> >>                                }
> >>-                               if (state == VVERSION) {
> >>-                                       save_cbuf();
> >>-                                       es->cursor = 0;
> >>-                                       es->linelen = 0;
> >>-                                       putbuf(ksh_version + 4,
> >>-                                           strlen(ksh_version + 4), 0);
> >>-                                       refresh(0);
> >>-                               }
> >>                        }
> >>                }
> >>                break;
> >>@@ -344,12 +335,6 @@ vi_hook(int ch)
> >>                state = VNORMAL;
> >>                break;
> >>
> >>-       case VVERSION:
> >>-               restore_cbuf();
> >>-               state = VNORMAL;
> >>-               refresh(0);
> >>-               break;
> >>-
> >>        case VARG1:
> >>                if (isdigit(ch))
> >>                        argc1 = argc1 * 10 + ch - '0';
> >>@@ -571,8 +556,6 @@ nextstate(int ch)
> >>                return VXCH;
> >>        else if (ch == '.')
> >>                return VREDO;
> >>-       else if (ch == Ctrl('v'))
> >>-               return VVERSION;
> >>        else if (is_cmd(ch))
> >>                return VCMD;
> >>        else
> >>
> >>
> 

Attachment: pgpBLAez8RzEm.pgp
Description: PGP signature

Reply via email to