On Tue, Nov 21 2017, Anton Lindqvist <an...@openbsd.org> wrote:
> Hi,
> While writing tests for the Emacs editing mode in ksh I discovered some
> potential errors in the manual:
>
> - Sync the order of key bindings in emacs.c with the manual
>
> - ^W is bound to delete-word-backward and not kill-region which is
>   mentioned in emacs.c. I don't know the full history here...
>
> - Add missing '^' in backward-char binding
>
> - The WERASE control character is also bound to delete-word-backward,
>   see x_emacs_keys().
>
> - Rephrase delete-word-forward to match the other bindings
>
> - Move kill-region to a separate list of commands without default
>   bindings

The last points brings the following question: what should we do with
other undocumented functions?

--8<--
--- a   Wed Nov 22 02:47:00 2017
+++ b   Wed Nov 22 02:47:07 2017
@@ -1,4 +1,5 @@
 abort
+auto-insert
 backward-char
 backward-word
 beginning-of-history
@@ -19,12 +20,14 @@
 end-of-line
 eot
 eot-or-delete
+error
 exchange-point-and-mark
 expand-file
 forward-char
 forward-word
 goto-history
 kill-line
+kill-region
 kill-to-eol
 list
 list-command
@@ -42,5 +45,6 @@
 transpose-chars
 up-history
 upcase-word
+version
 yank
 yank-pop
-->8--

I assume that "auto-insert" and "error" should be left out as
implementation details, but what about "version"?

Here's a diff to remove that function.  If people want to keep and
document it I would not object, but I don't really see the point.
Quick way to see for yourself: bind ^[v=version then type ESC v

ok?


Index: emacs.c
===================================================================
RCS file: /d/cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.74
diff -u -p -r1.74 emacs.c
--- emacs.c     22 Nov 2017 12:17:34 -0000      1.74
+++ emacs.c     26 Nov 2017 18:12:30 -0000
@@ -186,7 +186,6 @@ static int  x_search_char_back(int);
 static int     x_search_hist(int);
 static int     x_set_mark(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);
@@ -243,7 +242,6 @@ static const struct x_ftab x_ftab[] = {
        { x_search_hist,        "search-history",               0 },
        { x_set_mark,           "set-mark-command",             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 },
@@ -1619,35 +1617,6 @@ x_xchg_point_mark(int c)
        tmp = xmp;
        xmp = xcp;
        x_goto( tmp );
-       return KSTD;
-}
-
-static int
-x_version(int c)
-{
-       char *o_xbuf = xbuf, *o_xend = xend;
-       char *o_xbp = xbp, *o_xep = xep, *o_xcp = xcp;
-       int lim = x_lastcp() - xbp;
-
-       xbuf = xbp = xcp = (char *) ksh_version + 4;
-       xend = xep = (char *) ksh_version + 4 + strlen(ksh_version + 4);
-       x_redraw(lim);
-       x_flush();
-
-       c = x_e_getc();
-       xbuf = o_xbuf;
-       xend = o_xend;
-       xbp = o_xbp;
-       xep = o_xep;
-       xcp = o_xcp;
-       x_redraw(strlen(ksh_version));
-
-       if (c < 0)
-               return KSTD;
-       /* This is what at&t ksh seems to do...  Very bizarre */
-       if (c != ' ')
-               x_e_ungetc(c);
-
        return KSTD;
 }
 



-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to