zsh-workers
 help / color / mirror / code / Atom feed
* Code cleanup in ZLE bindings
@ 1996-05-08 15:30 Zefram
  1996-05-08 22:55 ` Zoltan Hidvegi
  0 siblings, 1 reply; 7+ messages in thread
From: Zefram @ 1996-05-08 15:30 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

This patch is a cleanup of part of the ZLE key binding system.
Currently there is a large set of #defines in zle.h, that should be
changed to an enum; this patch does that.  I also take the opportunity
to reorder these symbols alphabetically, to improve maintainability.
The table in zle_bindings.c is necessarily reordered the same way.
Those z_foobar symbols that did not match their editing command (foo-bar)
are renamed, as are a couple of the editing command functions (foobar())
that needlessly differed from the command name.

 -zefram

      Index: Src/hist.c
      *** Src/hist.c	1996/05/07 22:24:21	1.1.1.4
      --- Src/hist.c	1996/05/08 03:26:23
      ***************
      *** 832,838 ****
        char *
        hgetline(void)
        {
      !     /* Currently only used by pushpopinput().
             * It's necessary to prevent that from getting too pally with
             * the history code.
             */
      --- 832,838 ----
        char *
        hgetline(void)
        {
      !     /* Currently only used by pushlineoredit().
             * It's necessary to prevent that from getting too pally with
             * the history code.
             */
      Index: Src/zle.h
      *** Src/zle.h	1996/05/07 22:55:46	1.3
      --- Src/zle.h	1996/05/08 03:27:52
      ***************
      *** 249,416 ****
        ZLEXTERN char *vibuf[36];
        ZLEXTERN char vilinebuf[36];
        
      ! #define z_acceptandhold 0
      ! #define z_acceptandinfernexthistory 1
      ! #define z_acceptandmenucomplete 2
      ! #define z_acceptline 3
      ! #define z_acceptlineanddownhistory 4
      ! #define z_backwardchar 5
      ! #define z_backwarddeletechar 6
      ! #define z_backwarddeleteword 7
      ! #define z_backwardkillline 8
      ! #define z_backwardkillword 9
      ! #define z_backwardword 10
      ! #define z_beginningofbufferorhistory 11
      ! #define z_beginningofhistory 12
      ! #define z_beginningofline 13
      ! #define z_beginningoflinehist 14
      ! #define z_capitalizeword 15
      ! #define z_clearscreen 16
      ! #define z_completeword 17
      ! #define z_copyprevword 18
      ! #define z_copyregionaskill 19
      ! #define z_deletechar 20
      ! #define z_deletecharorlist 21
      ! #define z_deleteword 22
      ! #define z_digitargument 23
      ! #define z_downcaseword 24
      ! #define z_downhistory 25
      ! #define z_downlineorhistory 26
      ! #define z_endofbufferorhistory 27
      ! #define z_endofhistory 28
      ! #define z_endofline 29
      ! #define z_endoflinehist 30
      ! #define z_exchangepointandmark 31
      ! #define z_executelastnamedcmd 32
      ! #define z_executenamedcmd 33
      ! #define z_expandhistory 34
      ! #define z_expandorcomplete 35
      ! #define z_expandword 36
      ! #define z_forwardchar 37
      ! #define z_forwardword 38
      ! #define z_getline 39
      ! #define z_gosmacstransposechars 40
      ! #define z_historyincrementalsearchbackward 41
      ! #define z_historyincrementalsearchforward 42
      ! #define z_historysearchbackward 43
      ! #define z_historysearchforward 44
      ! #define z_infernexthistory 45
      ! #define z_insertlastword 46
      ! #define z_killbuffer 47
      ! #define z_killline 48
      ! #define z_killregion 49
      ! #define z_killwholeline 50
      ! #define z_listchoices 51
      ! #define z_listexpand 52
      ! #define z_magicspace 53
      ! #define z_menucompleteword 54
      ! #define z_menuexpandorcomplete 55
      ! #define z_overwritemode 56
      ! #define z_pushline 57
      ! #define z_quotedinsert 58
      ! #define z_quoteline 59
      ! #define z_quoteregion 60
      ! #define z_redisplay 61
      ! #define z_reversemenucomplete 62
      ! #define z_runhelp 63
      ! #define z_selfinsert 64
      ! #define z_selfinsertunmeta 65
      ! #define z_sendbreak 66
      ! #define z_sendstring 67
      ! #define z_sequenceleadin 68
      ! #define z_setmarkcommand 69
      ! #define z_spellword 70
      ! #define z_transposechars 71
      ! #define z_transposewords 72
      ! #define z_undefinedkey 73
      ! #define z_undo 74
      ! #define z_universalargument 75
      ! #define z_upcaseword 76
      ! #define z_uphistory 77
      ! #define z_uplineorhistory 78
      ! #define z_viaddeol 79
      ! #define z_viaddnext 80
      ! #define z_vibackwardblankword 81
      ! #define z_vibackwardchar 82
      ! #define z_vibackwarddeletechar 83
      ! #define z_vibeginningofline 84
      ! #define z_vicapslockpanic 85
      ! #define z_vichange 86
      ! #define z_vichangeeol 87
      ! #define z_vichangewholeline 88
      ! #define z_vicmdmode 89
      ! #define z_videlete 90
      ! #define z_videletechar 91
      ! #define z_vidigitorbeginningofline 92
      ! #define z_viendofline 93
      ! #define z_vifetchhistory 94
      ! #define z_vifindnextchar 95
      ! #define z_vifindnextcharskip 96
      ! #define z_vifindprevchar 97
      ! #define z_vifindprevcharskip 98
      ! #define z_vifirstnonblank 99
      ! #define z_viforwardblankword 100
      ! #define z_viforwardblankwordend 101
      ! #define z_viforwardchar 102
      ! #define z_viforwardwordend 103
      ! #define z_vigotocolumn 104
      ! #define z_vigotomark 105
      ! #define z_vigotomarkline 106
      ! #define z_vihistorysearchbackward 107
      ! #define z_vihistorysearchforward 108
      ! #define z_viindent 109
      ! #define z_viinsert 110
      ! #define z_viinsertbol 111
      ! #define z_vijoin 112
      ! #define z_vimatchbracket 113
      ! #define z_viopenlineabove 114
      ! #define z_viopenlinebelow 115
      ! #define z_vioperswapcases 116
      ! #define z_viputafter 117
      ! #define z_virepeatchange 118
      ! #define z_virepeatfind 119
      ! #define z_virepeatsearch 120
      ! #define z_vireplace 121
      ! #define z_vireplacechars 122
      ! #define z_virevrepeatfind 123
      ! #define z_virevrepeatsearch 124
      ! #define z_visetbuffer 125
      ! #define z_visetmark 126
      ! #define z_visubstitute 127
      ! #define z_viswapcase 128
      ! #define z_viundochange                   129
      ! #define z_viunindent                     130
      ! #define z_viyank                         131
      ! #define z_viyankeol                      132
      ! #define z_whichcommand                   133
      ! #define z_yank                           134
      ! #define z_yankpop                        135
      ! #define z_emacsbackwardword              136
      ! #define z_emacsforwardword               137
      ! #define z_killword                       138
      ! #define z_vikillline                     139
      ! #define z_vibackwardkillword             140
      ! #define z_expandcmdpath                  141
      ! #define z_negargument                    142
      ! #define z_poundinsert                    143
      ! #define z_viforwardword                  144
      ! #define z_vibackwardword                 145
      ! #define z_uplineorsearch                 146
      ! #define z_downlineorsearch               147
      ! #define z_pushinput                      148
      ! #define z_pushpopinput                   149
      ! #define z_historybeginningsearchbackward 150
      ! #define z_historybeginningsearchforward  151
      ! #define z_expandorcompleteprefix         152
      ! #define z_describekeybriefly             153
      ! #define z_whereis                        154
      ! #define z_vikilleol                      155
      ! #define z_viyankwholeline                156
      ! #define z_viputbefore                    157
      ! #define z_vipoundinsert                  158
      ! #define z_viuplineorhistory              159
      ! #define z_vidownlineorhistory            160
      ! #define z_viquotedinsert                 161
      ! #define ZLECMDCOUNT                      162
        
        extern struct zlecmd zlecmds[];
      --- 249,418 ----
        ZLEXTERN char *vibuf[36];
        ZLEXTERN char vilinebuf[36];
        
      ! enum {
      !     z_acceptandhold,
      !     z_acceptandinfernexthistory,
      !     z_acceptandmenucomplete,
      !     z_acceptline,
      !     z_acceptlineanddownhistory,
      !     z_backwardchar,
      !     z_backwarddeletechar,
      !     z_backwarddeleteword,
      !     z_backwardkillline,
      !     z_backwardkillword,
      !     z_backwardword,
      !     z_beginningofbufferorhistory,
      !     z_beginningofhistory,
      !     z_beginningofline,
      !     z_beginningoflinehist,
      !     z_capitalizeword,
      !     z_clearscreen,
      !     z_completeword,
      !     z_copyprevword,
      !     z_copyregionaskill,
      !     z_deletechar,
      !     z_deletecharorlist,
      !     z_deleteword,
      !     z_describekeybriefly,
      !     z_digitargument,
      !     z_downcaseword,
      !     z_downhistory,
      !     z_downlineorhistory,
      !     z_downlineorsearch,
      !     z_emacsbackwardword,
      !     z_emacsforwardword,
      !     z_endofbufferorhistory,
      !     z_endofhistory,
      !     z_endofline,
      !     z_endoflinehist,
      !     z_exchangepointandmark,
      !     z_executelastnamedcmd,
      !     z_executenamedcmd,
      !     z_expandcmdpath,
      !     z_expandhistory,
      !     z_expandorcomplete,
      !     z_expandorcompleteprefix,
      !     z_expandword,
      !     z_forwardchar,
      !     z_forwardword,
      !     z_getline,
      !     z_gosmacstransposechars,
      !     z_historybeginningsearchbackward,
      !     z_historybeginningsearchforward,
      !     z_historyincrementalsearchbackward,
      !     z_historyincrementalsearchforward,
      !     z_historysearchbackward,
      !     z_historysearchforward,
      !     z_infernexthistory,
      !     z_insertlastword,
      !     z_killbuffer,
      !     z_killline,
      !     z_killregion,
      !     z_killwholeline,
      !     z_killword,
      !     z_listchoices,
      !     z_listexpand,
      !     z_magicspace,
      !     z_menucomplete,
      !     z_menuexpandorcomplete,
      !     z_negargument,
      !     z_overwritemode,
      !     z_poundinsert,
      !     z_prefix,
      !     z_pushinput,
      !     z_pushline,
      !     z_pushlineoredit,
      !     z_quotedinsert,
      !     z_quoteline,
      !     z_quoteregion,
      !     z_redisplay,
      !     z_reversemenucomplete,
      !     z_runhelp,
      !     z_selfinsert,
      !     z_selfinsertunmeta,
      !     z_sendbreak,
      !     z_sendstring,
      !     z_setmarkcommand,
      !     z_spellword,
      !     z_transposechars,
      !     z_transposewords,
      !     z_undefinedkey,
      !     z_undo,
      !     z_universalargument,
      !     z_upcaseword,
      !     z_uphistory,
      !     z_uplineorhistory,
      !     z_uplineorsearch,
      !     z_viaddeol,
      !     z_viaddnext,
      !     z_vibackwardblankword,
      !     z_vibackwardchar,
      !     z_vibackwarddeletechar,
      !     z_vibackwardkillword,
      !     z_vibackwardword,
      !     z_vibeginningofline,
      !     z_vicapslockpanic,
      !     z_vichange,
      !     z_vichangeeol,
      !     z_vichangewholeline,
      !     z_vicmdmode,
      !     z_videlete,
      !     z_videletechar,
      !     z_vidigitorbeginningofline,
      !     z_vidownlineorhistory,
      !     z_viendofline,
      !     z_vifetchhistory,
      !     z_vifindnextchar,
      !     z_vifindnextcharskip,
      !     z_vifindprevchar,
      !     z_vifindprevcharskip,
      !     z_vifirstnonblank,
      !     z_viforwardblankword,
      !     z_viforwardblankwordend,
      !     z_viforwardchar,
      !     z_viforwardword,
      !     z_viforwardwordend,
      !     z_vigotocolumn,
      !     z_vigotomark,
      !     z_vigotomarkline,
      !     z_vihistorysearchbackward,
      !     z_vihistorysearchforward,
      !     z_viindent,
      !     z_viinsert,
      !     z_viinsertbol,
      !     z_vijoin,
      !     z_vikilleol,
      !     z_vikillline,
      !     z_vimatchbracket,
      !     z_viopenlineabove,
      !     z_viopenlinebelow,
      !     z_vioperswapcases,
      !     z_vipoundinsert,
      !     z_viputafter,
      !     z_viputbefore,
      !     z_viquotedinsert,
      !     z_virepeatchange,
      !     z_virepeatfind,
      !     z_virepeatsearch,
      !     z_vireplace,
      !     z_vireplacechars,
      !     z_virevrepeatfind,
      !     z_virevrepeatsearch,
      !     z_visetbuffer,
      !     z_visetmark,
      !     z_visubstitute,
      !     z_viswapcase,
      !     z_viundochange,
      !     z_viunindent,
      !     z_viuplineorhistory,
      !     z_viyank,
      !     z_viyankeol,
      !     z_viyankwholeline,
      !     z_whereis,
      !     z_whichcommand,
      !     z_yank,
      !     z_yankpop,
      !     ZLECMDCOUNT
      ! };
        
        extern struct zlecmd zlecmds[];
      Index: Src/zle_bindings.c
      *** Src/zle_bindings.c	1996/04/16 22:17:20	1.3
      --- Src/zle_bindings.c	1996/05/08 03:27:50
      ***************
      *** 57,66 ****
      --- 57,70 ----
            {"delete-char", deletechar, ZLE_DELETE},
            {"delete-char-or-list", deletecharorlist, ZLE_MENUCMP},
            {"delete-word", deleteword, ZLE_DELETE},
      +     {"describe-key-briefly", describekeybriefly, ZLE_MENUCMP},
            {"digit-argument", digitargument, ZLE_DIGIT | ZLE_ARG | ZLE_MENUCMP},
            {"down-case-word", downcaseword, 0},
            {"down-history", downhistory, 0},
            {"down-line-or-history", downlineorhistory, ZLE_MOVEMENT | ZLE_LINEMOVE},
      +     {"down-line-or-search", downlineorsearch, ZLE_MOVEMENT | ZLE_LINEMOVE | ZLE_HISTSEARCH},
      +     {"emacs-backward-word", emacsbackwardword, ZLE_MOVEMENT},
      +     {"emacs-forward-word", emacsforwardword, ZLE_MOVEMENT},
            {"end-of-buffer-or-history", endofbufferorhistory, ZLE_MOVEMENT},
            {"end-of-history", endofhistory, 0},
            {"end-of-line", endofline, ZLE_MOVEMENT},
      ***************
      *** 68,80 ****
      --- 72,88 ----
            {"exchange-point-and-mark", exchangepointandmark, ZLE_MOVEMENT},
            {"execute-last-named-cmd", (F) 0, 0},
            {"execute-named-cmd", (F) 0, 0},
      +     {"expand-cmd-path", expandcmdpath, 0},
            {"expand-history", expandhistory, 0},
            {"expand-or-complete", expandorcomplete, ZLE_MENUCMP},
      +     {"expand-or-complete-prefix", expandorcompleteprefix, ZLE_MENUCMP},
            {"expand-word", expandword, 0},
            {"forward-char", forwardchar, ZLE_MOVEMENT},
            {"forward-word", forwardword, ZLE_MOVEMENT},
            {"get-line", getline, 0},
            {"gosmacs-transpose-chars", gosmacstransposechars, 0},
      +     {"history-beginning-search-backward", historybeginningsearchbackward, ZLE_HISTSEARCH},
      +     {"history-beginning-search-forward", historybeginningsearchforward, ZLE_HISTSEARCH},
            {"history-incremental-search-backward", historyincrementalsearchbackward, 0},
            {"history-incremental-search-forward", historyincrementalsearchforward, 0},
            {"history-search-backward", historysearchbackward, ZLE_HISTSEARCH},
      ***************
      *** 85,97 ****
            {"kill-line", killline, ZLE_KILL},
            {"kill-region", killregion, ZLE_KILL},
            {"kill-whole-line", killwholeline, ZLE_KILL},
      !     {"list-choices", listchoices, ZLE_DELETE | ZLE_MENUCMP},	/* ZLE_DELETE fixes autoremoveslash */
            {"list-expand", listexpand, ZLE_MENUCMP},
            {"magic-space", magicspace, 0},
      !     {"menu-complete", menucompleteword, ZLE_MENUCMP},
            {"menu-expand-or-complete", menuexpandorcomplete, ZLE_MENUCMP},
            {"overwrite-mode", overwritemode, 0},
            {"push-line", pushline, 0},
            {"quoted-insert", quotedinsert, ZLE_INSERT},
            {"quote-line", quoteline, 0},
            {"quote-region", quoteregion, 0},
      --- 93,111 ----
            {"kill-line", killline, ZLE_KILL},
            {"kill-region", killregion, ZLE_KILL},
            {"kill-whole-line", killwholeline, ZLE_KILL},
      !     {"kill-word", killword, ZLE_KILL},
      !     {"list-choices", listchoices, ZLE_MENUCMP},
            {"list-expand", listexpand, ZLE_MENUCMP},
            {"magic-space", magicspace, 0},
      !     {"menu-complete", menucomplete, ZLE_MENUCMP},
            {"menu-expand-or-complete", menuexpandorcomplete, ZLE_MENUCMP},
      +     {"neg-argument", negargument, ZLE_NEGARG | ZLE_ARG | ZLE_MENUCMP},
            {"overwrite-mode", overwritemode, 0},
      +     {"pound-insert", poundinsert, 0},
      +     {"prefix", (F) 0, 0},
      +     {"push-input", pushinput, 0},
            {"push-line", pushline, 0},
      +     {"push-line-or-edit", pushlineoredit, 0},
            {"quoted-insert", quotedinsert, ZLE_INSERT},
            {"quote-line", quoteline, 0},
            {"quote-region", quoteregion, 0},
      ***************
      *** 102,108 ****
            {"self-insert-unmeta", selfinsertunmeta, ZLE_INSERT},
            {"send-break", sendbreak, 0},
            {"send-string", sendstring, 0},
      -     {"prefix", (F) 0, 0},
            {"set-mark-command", setmarkcommand, ZLE_MENUCMP},
            {"spell-word", spellword, 0},
            {"transpose-chars", transposechars, 0},
      --- 116,121 ----
      ***************
      *** 113,123 ****
      --- 126,139 ----
            {"up-case-word", upcaseword, 0},
            {"up-history", uphistory, 0},
            {"up-line-or-history", uplineorhistory, ZLE_LINEMOVE | ZLE_MOVEMENT},
      +     {"up-line-or-search", uplineorsearch, ZLE_MOVEMENT | ZLE_LINEMOVE | ZLE_HISTSEARCH},
            {"vi-add-eol", viaddeol, 0},
            {"vi-add-next", viaddnext, 0},
            {"vi-backward-blank-word", vibackwardblankword, ZLE_MOVEMENT},
            {"vi-backward-char", vibackwardchar, ZLE_MOVEMENT},
            {"vi-backward-delete-char", vibackwarddeletechar, ZLE_DELETE},
      +     {"vi-backward-kill-word", vibackwardkillword, ZLE_KILL},
      +     {"vi-backward-word", vibackwardword, ZLE_MOVEMENT},
            {"vi-beginning-of-line", vibeginningofline, ZLE_MOVEMENT},
            {"vi-caps-lock-panic", vicapslockpanic, 0},
            {"vi-change", vichange, 0},
      ***************
      *** 127,132 ****
      --- 143,149 ----
            {"vi-delete", videlete, ZLE_KILL},
            {"vi-delete-char", videletechar, ZLE_DELETE},
            {"vi-digit-or-beginning-of-line", (F) 0, 0},
      +     {"vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE | ZLE_MOVEMENT},
            {"vi-end-of-line", viendofline, ZLE_MOVEMENT},
            {"vi-fetch-history", vifetchhistory, 0},
            {"vi-find-next-char", vifindnextchar, ZLE_MOVEMENT},
      ***************
      *** 137,142 ****
      --- 154,160 ----
            {"vi-forward-blank-word", viforwardblankword, ZLE_MOVEMENT},
            {"vi-forward-blank-word-end", viforwardblankwordend, ZLE_MOVEMENT},
            {"vi-forward-char", viforwardchar, ZLE_MOVEMENT},
      +     {"vi-forward-word", viforwardword, ZLE_MOVEMENT},
            {"vi-forward-word-end", viforwardwordend, ZLE_MOVEMENT},
            {"vi-goto-column", vigotocolumn, ZLE_MOVEMENT},
            {"vi-goto-mark", vigotomark, ZLE_MOVEMENT},
      ***************
      *** 147,157 ****
      --- 165,180 ----
            {"vi-insert", viinsert, 0},
            {"vi-insert-bol", viinsertbol, 0},
            {"vi-join", vijoin, 0},
      +     {"vi-kill-eol", vikilleol, ZLE_KILL},
      +     {"vi-kill-line", vikillline, ZLE_KILL},
            {"vi-match-bracket", vimatchbracket, ZLE_MOVEMENT},
            {"vi-open-line-above", viopenlineabove, 0},
            {"vi-open-line-below", viopenlinebelow, 0},
            {"vi-oper-swap-case", vioperswapcase, 0},
      +     {"vi-pound-insert", vipoundinsert, 0},
            {"vi-put-after", viputafter, ZLE_YANK},
      +     {"vi-put-before", viputbefore, ZLE_YANK},
      +     {"vi-quoted-insert", viquotedinsert, ZLE_INSERT},
            {"vi-repeat-change", virepeatchange, 0},
            {"vi-repeat-find", virepeatfind, ZLE_MOVEMENT},
            {"vi-repeat-search", virepeatsearch, ZLE_MOVEMENT},
      ***************
      *** 165,201 ****
            {"vi-swap-case", viswapcase, 0},
            {"vi-undo-change", undo, 0},
            {"vi-unindent", viunindent, 0},
            {"vi-yank", viyank, 0},
            {"vi-yank-eol", viyankeol, 0},
            {"which-command", processcmd, ZLE_MENUCMP},
            {"yank", yank, ZLE_YANK},
            {"yank-pop", yankpop, ZLE_YANK},
      -     {"emacs-backward-word", emacsbackwardword, ZLE_MOVEMENT},
      -     {"emacs-forward-word", emacsforwardword, ZLE_MOVEMENT},
      -     {"kill-word", killword, ZLE_KILL},
      -     {"vi-kill-line", vikillline, ZLE_KILL},
      -     {"vi-backward-kill-word", vibackwardkillword, ZLE_KILL},
      -     {"expand-cmd-path", expandcmdpath, 0},
      -     {"neg-argument", negargument, ZLE_NEGARG | ZLE_ARG | ZLE_MENUCMP},
      -     {"pound-insert", poundinsert, 0},
      -     {"vi-forward-word", viforwardword, ZLE_MOVEMENT},
      -     {"vi-backward-word", vibackwardword, ZLE_MOVEMENT},
      -     {"up-line-or-search", uplineorsearch, ZLE_MOVEMENT | ZLE_LINEMOVE | ZLE_HISTSEARCH},
      -     {"down-line-or-search", downlineorsearch, ZLE_MOVEMENT | ZLE_LINEMOVE | ZLE_HISTSEARCH},
      -     {"push-input", pushinput, 0},
      -     {"push-line-or-edit", pushpopinput, 0},
      -     {"history-beginning-search-backward", historybeginningsearchbackward, ZLE_HISTSEARCH},
      -     {"history-beginning-search-forward", historybeginningsearchforward, ZLE_HISTSEARCH},
      -     {"expand-or-complete-prefix", expandorcompleteprefix, ZLE_MENUCMP},
      -     {"describe-key-briefly", describekeybriefly, ZLE_MENUCMP},
      -     {"where-is", whereis, ZLE_MENUCMP},
      -     {"vi-kill-eol", vikilleol, ZLE_KILL},
      -     {"vi-yank-whole-line", viyankwholeline, 0},
      -     {"vi-put-before", viputbefore, ZLE_YANK},
      -     {"vi-pound-insert", vipoundinsert, 0},
      -     {"vi-up-line-or-history", viuplineorhistory, ZLE_LINEMOVE | ZLE_MOVEMENT},
      -     {"vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE | ZLE_MOVEMENT},
      -     {"vi-quoted-insert", viquotedinsert, ZLE_INSERT},
            {"", (F) 0, 0}
        };
        
      --- 188,201 ----
            {"vi-swap-case", viswapcase, 0},
            {"vi-undo-change", undo, 0},
            {"vi-unindent", viunindent, 0},
      +     {"vi-up-line-or-history", viuplineorhistory, ZLE_LINEMOVE | ZLE_MOVEMENT},
            {"vi-yank", viyank, 0},
            {"vi-yank-eol", viyankeol, 0},
      +     {"vi-yank-whole-line", viyankwholeline, 0},
      +     {"where-is", whereis, ZLE_MENUCMP},
            {"which-command", processcmd, ZLE_MENUCMP},
            {"yank", yank, ZLE_YANK},
            {"yank-pop", yankpop, ZLE_YANK},
            {"", (F) 0, 0}
        };
        
      ***************
      *** 225,234 ****
            /* ^U */ z_killwholeline,
            /* ^V */ z_quotedinsert,
            /* ^W */ z_backwardkillword,
      !     /* ^X */ z_sequenceleadin,
            /* ^Y */ z_yank,
            /* ^Z */ z_undefinedkey,
      !     /* ^[ */ z_sequenceleadin,
            /* ^\ */ z_undefinedkey,
            /* ^] */ z_undefinedkey,
            /* ^^ */ z_undefinedkey,
      --- 225,234 ----
            /* ^U */ z_killwholeline,
            /* ^V */ z_quotedinsert,
            /* ^W */ z_backwardkillword,
      !     /* ^X */ z_prefix,
            /* ^Y */ z_yank,
            /* ^Z */ z_undefinedkey,
      !     /* ^[ */ z_prefix,
            /* ^\ */ z_undefinedkey,
            /* ^] */ z_undefinedkey,
            /* ^^ */ z_undefinedkey,
      ***************
      *** 488,494 ****
            /* ^X */ z_selfinsert,
            /* ^Y */ z_selfinsert,
            /* ^Z */ z_selfinsert,
      !     /* ^[ */ z_sequenceleadin,
            /* ^\ */ z_selfinsert,
            /* ^] */ z_selfinsert,
            /* ^^ */ z_selfinsert,
      --- 488,494 ----
            /* ^X */ z_selfinsert,
            /* ^Y */ z_selfinsert,
            /* ^Z */ z_selfinsert,
      !     /* ^[ */ z_prefix,
            /* ^\ */ z_selfinsert,
            /* ^] */ z_selfinsert,
            /* ^^ */ z_selfinsert,
      ***************
      *** 524,530 ****
            /* ^X */ z_undefinedkey,
            /* ^Y */ z_undefinedkey,
            /* ^Z */ z_undefinedkey,
      !     /* ^[ */ z_sequenceleadin,
            /* ^\ */ z_undefinedkey,
            /* ^] */ z_undefinedkey,
            /* ^^ */ z_undefinedkey,
      --- 524,530 ----
            /* ^X */ z_undefinedkey,
            /* ^Y */ z_undefinedkey,
            /* ^Z */ z_undefinedkey,
      !     /* ^[ */ z_prefix,
            /* ^\ */ z_undefinedkey,
            /* ^] */ z_undefinedkey,
            /* ^^ */ z_undefinedkey,
      Index: Src/zle_hist.c
      *** Src/zle_hist.c	1996/05/07 22:55:47	1.4
      --- Src/zle_hist.c	1996/05/08 03:25:45
      ***************
      *** 494,500 ****
        
        /**/
        void
      ! pushpopinput(void)
        {
            int ics;
            char *iline, *hline = hgetline();
      --- 494,500 ----
        
        /**/
        void
      ! pushlineoredit(void)
        {
            int ics;
            char *iline, *hline = hgetline();
      ***************
      *** 525,531 ****
        	return;
            if (!isfirstln)
        	mult++;
      !     pushpopinput();
        }
        
        /**/
      --- 525,531 ----
        	return;
            if (!isfirstln)
        	mult++;
      !     pushlineoredit();
        }
        
        /**/
      Index: Src/zle_main.c
      *** Src/zle_main.c	1996/05/07 22:55:47	1.6
      --- Src/zle_main.c	1996/05/08 03:28:37
      ***************
      *** 516,522 ****
            if ((c = getkey(0)) < 0)
        	return -1;
            keybuf[0] = c;
      !     if ((ret = bindtab[c]) == z_sequenceleadin) {
        	int lastlen = 0, t0 = 1, firstc = c;
        	Key ky;
        
      --- 516,522 ----
            if ((c = getkey(0)) < 0)
        	return -1;
            keybuf[0] = c;
      !     if ((ret = bindtab[c]) == z_prefix) {
        	int lastlen = 0, t0 = 1, firstc = c;
        	Key ky;
        
      ***************
      *** 955,961 ****
        		return 1;
        	    }
        	    if (ops['r']) {
      ! 		if (len == 1 && func != z_sequenceleadin) {
        		    tab[(unsigned char)*s] = z_undefinedkey;
        		    if (func == z_sendstring)
        			free(keybindtab->removenode(keybindtab, s));
      --- 955,961 ----
        		return 1;
        	    }
        	    if (ops['r']) {
      ! 		if (len == 1 && func != z_prefix) {
        		    tab[(unsigned char)*s] = z_undefinedkey;
        		    if (func == z_sendstring)
        			free(keybindtab->removenode(keybindtab, s));
      ***************
      *** 1010,1016 ****
        	} else
        	    func = z_sendstring;
        
      ! 	if (len == 1 && tab[(unsigned char)*s] != z_sequenceleadin) {
        	    if (ops['s']) {
        		keybindtab->addnode(keybindtab, ztrdup(s), cur = makefunckey(z_sendstring));
        	    } else if (tab[(unsigned char)*s] == z_sendstring)
      --- 1010,1016 ----
        	} else
        	    func = z_sendstring;
        
      ! 	if (len == 1 && tab[(unsigned char)*s] != z_prefix) {
        	    if (ops['s']) {
        		keybindtab->addnode(keybindtab, ztrdup(s), cur = makefunckey(z_sendstring));
        	    } else if (tab[(unsigned char)*s] == z_sendstring)
      ***************
      *** 1043,1051 ****
        		keybindtab->addnode(keybindtab, ztrdup(s), cur = makefunckey(func));
        	    if (firstzero)
        		*s = 0;
      ! 	    if (tab[(unsigned char)*s] != z_sequenceleadin) {
        		cur->func = tab[(unsigned char)*s];
      ! 		tab[(unsigned char)*s] = z_sequenceleadin;
        	    }
        	}
        	if (ops['s']) {
      --- 1043,1051 ----
        		keybindtab->addnode(keybindtab, ztrdup(s), cur = makefunckey(func));
        	    if (firstzero)
        		*s = 0;
      ! 	    if (tab[(unsigned char)*s] != z_prefix) {
        		cur->func = tab[(unsigned char)*s];
      ! 		tab[(unsigned char)*s] = z_prefix;
        	    }
        	}
        	if (ops['s']) {
      Index: Src/zle_tricky.c
      *** Src/zle_tricky.c	1996/05/07 22:55:49	1.8
      --- Src/zle_tricky.c	1996/05/08 03:24:21
      ***************
      *** 212,218 ****
        
        /**/
        void
      ! menucompleteword(void)
        {
            usemenu = 1;
            useglob = isset(GLOBCOMPLETE);
      --- 212,218 ----
        
        /**/
        void
      ! menucomplete(void)
        {
            usemenu = 1;
            useglob = isset(GLOBCOMPLETE);
      ***************
      *** 304,310 ****
        reversemenucomplete(void)
        {
            if (!menucmp) {
      ! 	menucompleteword();	/* better than just feep'ing, pem */
        	return;
            }
            if (menucur == amatches)
      --- 304,310 ----
        reversemenucomplete(void)
        {
            if (!menucmp) {
      ! 	menucomplete();	/* better than just feep'ing, pem */
        	return;
            }
            if (menucur == amatches)
      ***************
      *** 341,347 ****
            menuend = cs + (lsuf ? strlen(lsuf) : 0);
            menulen = 0;
            menuwe = 1;
      !     menucompleteword();
        }
        
        /* these are flags saying if we are completing in the command
      --- 341,347 ----
            menuend = cs + (lsuf ? strlen(lsuf) : 0);
            menulen = 0;
            menuwe = 1;
      !     menucomplete();
        }
        
        /* these are flags saying if we are completing in the command
      Index: Src/zle_vi.c
      *** Src/zle_vi.c	1996/04/18 16:23:17	1.4
      --- Src/zle_vi.c	1996/05/08 03:28:18
      ***************
      *** 86,92 ****
        	return 0;
            }
            cmd = mainbindtab[c];
      !     if(cmd == z_sequenceleadin) {
        	char buf[2];
        	Key ky;
        	buf[0] = c;
      --- 86,92 ----
        	return 0;
            }
            cmd = mainbindtab[c];
      !     if(cmd == z_prefix) {
        	char buf[2];
        	Key ky;
        	buf[0] = c;

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMZAX8HD/+HJTpU/hAQEewQQArlGWK9EqKohqQ2P4Wjh64/M83RgCLS/B
LNxOiquZFE1lL5oZLCgZns0UjyPTkdmWy3PvnkVFU4+XJM0Lbm3LLCCHBPqU1IP1
vEPRsqz9Eq7A4sO6Cqr81yPBIZaVq+yZpQf1SyGqT9MKy8O2B0bTy+7MkS1VrDuh
DwyXT5btTpY=
=cn1Z
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Code cleanup in ZLE bindings
  1996-05-08 15:30 Code cleanup in ZLE bindings Zefram
@ 1996-05-08 22:55 ` Zoltan Hidvegi
  1996-05-09  0:27   ` Zefram
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zoltan Hidvegi @ 1996-05-08 22:55 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> This patch is a cleanup of part of the ZLE key binding system.
> Currently there is a large set of #defines in zle.h, that should be
> changed to an enum; this patch does that.  I also take the opportunity

I think enum is not supported by all compilers.  There is no enum in the
original K&R C.  Please send this patch again leaving the #define's (or
convince me that enum is supported by all C compilers on all Unix systems).

Zoltan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Code cleanup in ZLE bindings
  1996-05-08 22:55 ` Zoltan Hidvegi
@ 1996-05-09  0:27   ` Zefram
  1996-05-09  2:01     ` Richard Ohnemus
  1996-05-09 13:39     ` Hrvoje Niksic
  1996-05-09  0:32   ` Wayne Davison
  1996-05-09  1:27   ` Bart Schaefer
  2 siblings, 2 replies; 7+ messages in thread
From: Zefram @ 1996-05-09  0:27 UTC (permalink / raw)
  To: Zoltan Hidvegi

>I think enum is not supported by all compilers.  There is no enum in the
>original K&R C.  Please send this patch again leaving the #define's (or
>convince me that enum is supported by all C compilers on all Unix systems).

When I learned C, there was no ANSI standard, but there was most
definitely enum.  I remember using it in VAX C in about 1988 -- that
was basically K&R C plus void.  When I first read K&R, it was the first
edition, and enum was there.

-zefram



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Code cleanup in ZLE bindings
  1996-05-08 22:55 ` Zoltan Hidvegi
  1996-05-09  0:27   ` Zefram
@ 1996-05-09  0:32   ` Wayne Davison
  1996-05-09  1:27   ` Bart Schaefer
  2 siblings, 0 replies; 7+ messages in thread
From: Wayne Davison @ 1996-05-09  0:32 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: Zefram, zsh-workers

Zoltan Hidvegi writes:
> I think enum is not supported by all compilers.  There is no enum in the
> original K&R C.

How about extending ansi2knr to filter enums into a series of #defines?
Or maybe putting an enum test into configure and filtering zsh.h into
#defines if they aren't supported?  That would allow the code to remain
in an enum format (which makes for smaller patches if you keep the list
in alphabetical order) and still support the non-enum folks.

..wayne..



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Code cleanup in ZLE bindings
  1996-05-08 22:55 ` Zoltan Hidvegi
  1996-05-09  0:27   ` Zefram
  1996-05-09  0:32   ` Wayne Davison
@ 1996-05-09  1:27   ` Bart Schaefer
  2 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 1996-05-09  1:27 UTC (permalink / raw)
  To: Zoltan Hidvegi, zsh-workers

On May 9, 12:55am, Zoltan Hidvegi wrote:
} Subject: Re: Code cleanup in ZLE bindings
}
} I think enum is not supported by all compilers.  There is no enum in the
} original K&R C.  Please send this patch again leaving the #define's (or
} convince me that enum is supported by all C compilers on all Unix systems).

We build Z-Mail on 23 different Unix platforms (more if you count different
version numbers of the same OS).  Every one of them has enum.

I've built or been in contact with people who built the mail user's shell 
(Mush) on Xenix, AT&T 3b2, and even some sort of SVR2 machine.  They all
had enum, too.

What some of them don't have is the extension that permits you to assign
specific int values to the members of the enum type.

Others of them won't permit you to use enum in place of int as an array
index, without an explicit cast.  This is the only gotcha I'd be worried
about for zsh purposes.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Code cleanup in ZLE bindings
  1996-05-09  0:27   ` Zefram
@ 1996-05-09  2:01     ` Richard Ohnemus
  1996-05-09 13:39     ` Hrvoje Niksic
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Ohnemus @ 1996-05-09  2:01 UTC (permalink / raw)
  To: zsh-workers

> >I think enum is not supported by all compilers.  There is no enum in the
> >original K&R C.  Please send this patch again leaving the #define's (or
> >convince me that enum is supported by all C compilers on all Unix systems).
> 
> When I learned C, there was no ANSI standard, but there was most
> definitely enum.  I remember using it in VAX C in about 1988 -- that
> was basically K&R C plus void.  When I first read K&R, it was the first
> edition, and enum was there.
> 

The first edition of K&R, published in 1978, doesn't have enum as part of the
language. However, "The C Programmer's Handbook" published by Bell Labs in
1985 has enum. Also, the second edition of K&R, published in 1988, has this
little note (middle of page 215 in my copy): 'Enumerations are new since the
first edition of this book, but have been part of the language for some
years.'

I've used many different C compilers and it has been a long time since I've
seen one that doesn't support enumerations. So, I think it is safe to use
enum unless someone can document that enum is not supported by a compiler
on a system that is currently supported by zsh.

-- 
Richard J. Ohnemus	(Richard_Ohnemus@csg.stercomm.com)	(214) 868-5411
Sterling Commerce CSG
5215 North O'Connor Boulevard, Suite 1500
Irving, Texas  75039-3771



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Code cleanup in ZLE bindings
  1996-05-09  0:27   ` Zefram
  1996-05-09  2:01     ` Richard Ohnemus
@ 1996-05-09 13:39     ` Hrvoje Niksic
  1 sibling, 0 replies; 7+ messages in thread
From: Hrvoje Niksic @ 1996-05-09 13:39 UTC (permalink / raw)
  To: zsh-workers

In your mail, you said:
> When I learned C, there was no ANSI standard, but there was most
> definitely enum.  I remember using it in VAX C in about 1988 -- that
> was basically K&R C plus void.  When I first read K&R, it was the first
> edition, and enum was there.

They say that enum wasn't used for a long time because of bugs in several
old compilers. I do not think it is of any relevance nowadays.

-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
`VI' - An editor used by those heretics that don't subscribe to
       the Emacs religion.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1996-05-09 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-08 15:30 Code cleanup in ZLE bindings Zefram
1996-05-08 22:55 ` Zoltan Hidvegi
1996-05-09  0:27   ` Zefram
1996-05-09  2:01     ` Richard Ohnemus
1996-05-09 13:39     ` Hrvoje Niksic
1996-05-09  0:32   ` Wayne Davison
1996-05-09  1:27   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).