Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

bindkey -u is obsolete



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

My previous patch (subject "ZLE extendability phase I") removes the
original use for unbindzlefunc().  This patch removes the other use,
bindkey -u (and -U), which was only added in 3.1.0.  bindkey -u is of
very little use -- even less with thingies -- and in my opinion is not
worth maintaining as an independent feature.

 -zefram

      *** Doc/zsh.texi	1996/12/31 17:10:40	1.7
      --- Doc/zsh.texi	1997/01/03 07:50:47
      ***************
      *** 5618,5624 ****
        
        @item bindkey -mevd
        @itemx bindkey -r @var{in-string} @dots{}
      - @itemx bindkey -uU @var{command}
        @itemx bindkey [ -a ] @var{in-string} [ @var{command} ] @dots{}
        @itemx bindkey -s [ -a ] @var{in-string} @var{out-string} @dots{}
        @cindex rebinding the keys
      --- 5618,5623 ----
      ***************
      *** 5634,5642 ****
        bindings of these characters for the mode determined by the preceding
        options, or the current mode if used alone.  Any previous binding done
        by the user will be preserved.  If the @samp{-r} option is given, remove
      ! any binding for each @var{in-string}.  If the @samp{-u} option is given,
      ! undefine every key bound to @var{command} in the current keymap;
      ! with @samp{-U}, do so in every keymap.  If the @samp{-s} option is not
        specified, bind each @var{in-string} to a specified @var{command}.  If
        no @var{command} is specified, print the binding of @var{in-string} if
        it is bound, or return a nonzero exit code if it is not bound.  If the
      --- 5633,5639 ----
        bindings of these characters for the mode determined by the preceding
        options, or the current mode if used alone.  Any previous binding done
        by the user will be preserved.  If the @samp{-r} option is given, remove
      ! any binding for each @var{in-string}.  If the @samp{-s} option is not
        specified, bind each @var{in-string} to a specified @var{command}.  If
        no @var{command} is specified, print the binding of @var{in-string} if
        it is bound, or return a nonzero exit code if it is not bound.  If the
      *** Doc/zshbuiltins.man	1996/12/26 19:13:21	1.17
      --- Doc/zshbuiltins.man	1997/01/03 07:50:01
      ***************
      *** 70,83 ****
        .TP
        \fBbindkey\fP [ \fIoptions\fP ] \fB\-N\fP \fInew-keymap\fP [ \fIold-keymap\fP ]
        .TP
      - \fBbindkey\fP [ \fIoptions\fP ] \fB\-U\fP \fIcommand\fP ...
      - .TP
        \fBbindkey\fP [ \fIoptions\fP ] \fB\-m\fP
        .TP
        \fBbindkey\fP [ \fIoptions\fP ] \fB\-r\fP \fIin-string\fP ...
        .TP
      - \fBbindkey\fP [ \fIoptions\fP ] \fB\-u\fP \fIcommand\fP ...
      - .TP
        \fBbindkey\fP [ \fIoptions\fP ] \fB\-s\fP \fIin-string out-string\fP ...
        .TP
        \fBbindkey\fP [ \fIoptions\fP ] \fIin-string command\fP ...
      --- 70,79 ----
      ***************
      *** 130,138 ****
        name, it is deleted.  If an \fIold-keymap\fP name is given, the new keymap
        is initialised to be a duplicate of it, otherwise the new keymap will
        be empty.
      - .TP
      - \fB\-U\fP \fIcommand\fP ...
      - Delete all bindings of the named \fIcommand\fPs from all keymaps.
        .PP
        (The operations above do not accept a keymap selection as described above.
        The operations below do.)
      --- 126,131 ----
      ***************
      *** 147,155 ****
        Unbind the specified \fIin-string\fPs in the selected keymap.
        This is exactly equivalent to binding the strings to
        .BR undefined-key .
      - .TP
      - \fB\-u\fP \fIcommand\fP ...
      - Delete all bindings of the named \fIcommand\fPs from the selected keymap.
        .TP
        \fB\-s\fP \fIin-string out-string\fP ...
        Bind each \fIin-string\fP to each \fIout-string\fP.
      --- 140,145 ----
      *** Doc/Zsh/builtins.yo	1996/12/30 05:42:32	1.2
      --- Doc/Zsh/builtins.yo	1997/01/03 07:51:21
      ***************
      *** 99,108 ****
        xitem(tt(bindkey) [ var(options) ] tt(-D) var(keymap) ...)
        xitem(tt(bindkey) [ var(options) ] tt(-A) var(old-keymap new-keymap))
        xitem(tt(bindkey) [ var(options) ] tt(-N) var(new-keymap) [ var(old-keymap) ])
      - xitem(tt(bindkey) [ var(options) ] tt(-U) var(command) ...)
        xitem(tt(bindkey) [ var(options) ] tt(-m))
        xitem(tt(bindkey) [ var(options) ] tt(-r) var(in-string) ...)
      - xitem(tt(bindkey) [ var(options) ] tt(-u) var(command) ...)
        xitem(tt(bindkey) [ var(options) ] tt(-s) var(in-string out-string) ...)
        xitem(tt(bindkey) [ var(options) ] var(in-string command) ...)
        item(tt(bindkey) [ var(options) ] [ var(in-string) ])(
      --- 99,106 ----
      ***************
      *** 154,162 ****
        is initialised to be a duplicate of it, otherwise the new keymap will
        be empty.
        )
      - item(tt(-U) var(command) ...)(
      - Delete all bindings of the named var(command)s from all keymaps.
      - )
        enditem()
        
        The following operations require a keymap to be selected:
      --- 152,157 ----
      ***************
      *** 169,177 ****
        item(tt(-r) var(in-string) ...)(
        Unbind the specified var(in-string)s in the selected keymap.
        This is exactly equivalent to binding the strings to tt(undefined-key).
      - )
      - item(tt(-u) var(command) ...)(
      - Delete all bindings of the named var(command)s from the selected keymap.
        )
        item(tt(-s) var(in-string out-string) ...)(
        Bind each var(in-string) to each var(out-string).
      --- 164,169 ----
      *** Src/Zle/zle_keymap.c	1997/01/03 07:23:26	1.4
      --- Src/Zle/zle_keymap.c	1997/01/03 07:44:48
      ***************
      *** 98,107 ****
        
        static HashTable keymapnamtab;
        
      - /* linked list of all keymaps, used by unbindzlefunc() */
      - 
      - static LinkList keymaplist;
      - 
        /* key sequence reading data */
        
        static char *keybuf;
      --- 98,103 ----
      ***************
      *** 129,135 ****
        static int bin_bindkey_link _((char *, char *, Keymap, char **, char *, char));
        static int bin_bindkey_new _((char *, char *, Keymap, char **, char *, char));
        static int bin_bindkey_meta _((char *, char *, Keymap, char **, char *, char));
      - static int bin_bindkey_unbind _((char *, char *, Keymap, char **, char *, char));
        static int bin_bindkey_bind _((char *, char *, Keymap, char **, char *, char));
        static int bin_bindkey_list _((char *, char *, Keymap, char **, char *, char));
        static void scanbindlist _((char *, Thingy, char *, void *));
      --- 125,130 ----
      ***************
      *** 139,146 ****
        
        static int getkeybuf _((int));
        
      - static void zerobinding _((char *, Thingy, char *, void *));
      - 
        /**********************************/
        /* hashtable management functions */
        /**********************************/
      --- 134,139 ----
      ***************
      *** 248,256 ****
        	for(i = 256; i--; )
        	    km->first[i] = refthingy(t_undefinedkey);
            }
      -     PERMALLOC {
      - 	addlinknode(keymaplist, km);
      -     } LASTALLOC;
            return km;
        }
        
      --- 241,246 ----
      ***************
      *** 271,281 ****
        {
            int i;
        
      -     PERMALLOC {
      - 	LinkNode ln;
      - 	for (ln = firstnode(keymaplist); ln->dat != km; incnode(ln)) ;
      - 	remnode(keymaplist, ln);
      -     } LASTALLOC;
            deletehashtable(km->multi);
            for(i = 256; i--; )
        	unrefthingy(km->first[i]);
      --- 261,266 ----
      ***************
      *** 577,589 ****
         *   -A   link the two named keymaps (2 arguments)
         *   -N   create new empty keymap (1 argument)
         *   -N   create new keymap, copying the second named keymap (2 arguments)
      -  *   -U   unbind all instances of the named commands in all keymaps
         *
         * Other operations:
         *
         *   -m   add the meta bindings to the selected keymap (no arguments)
         *   -r   unbind each named string in the selected keymap
      -  *   -u   unbind all instances of the named commands in the selected keymap
         *   -s   bind send-strings in the selected keymap (2+ arguments)
         *        bind commands in the selected keymap (2+ arguments)
         *        display one binding in the selected keymap (1 argument)
      --- 562,572 ----
      ***************
      *** 613,622 ****
        	{ 'D', 0, bin_bindkey_del,    1, -1 },
        	{ 'A', 0, bin_bindkey_link,   2,  2 },
        	{ 'N', 0, bin_bindkey_new,    1,  2 },
      - 	{ 'U', 0, bin_bindkey_unbind, 1, -1 },
        	{ 'm', 1, bin_bindkey_meta,   0,  0 },
        	{ 'r', 1, bin_bindkey_bind,   1, -1 },
      - 	{ 'u', 1, bin_bindkey_unbind, 1, -1 },
        	{ 's', 1, bin_bindkey_bind,   2, -1 },
        	{ 0,   1, bin_bindkey_bind,   0, -1 },
            };
      --- 596,603 ----
      ***************
      *** 812,835 ****
            return 0;
        }
        
      - /* remove all bindings of particular ZLE functions */
      - 
      - static int
      - bin_bindkey_unbind(char *name, char *kmname, Keymap km, char **argv, char *ops, char func)
      - {
      -     if(km && (km->flags & KM_IMMUTABLE)) {
      - 	zerrnam(name, "keymap `%s' is protected", kmname, 0);
      - 	return 1;
      -     }
      -     do {
      - 	Thingy fn = rthingy(*argv);
      - 
      - 	unbindzlefunc(fn, km);
      - 	unrefthingy(fn);
      -     } while(*++argv);
      -     return 0;
      - }
      - 
        /* Change key bindings.  func can be:              *
         *   'r'  bind sequences to undefined-key          *
         *   's'  bind sequneces to specified send-strings *
      --- 793,798 ----
      ***************
      *** 1011,1019 ****
        void
        init_keymaps(void)
        {
      -     PERMALLOC {
      - 	keymaplist = newlinklist();
      -     } LASTALLOC;
            createkeymapnamtab();
            default_bindings();
            keybuf = (char *)zalloc(keybufsz);
      --- 974,979 ----
      ***************
      *** 1245,1303 ****
        	func = (lastcmd & ZLE_DIGIT) ?
        	    Th(z_digitargument) : Th(z_vibeginningofline);
            return func;
      - }
      - 
      - /***************************/
      - /* unbinding ZLE functions */
      - /***************************/
      - 
      - /* Unbind the specified ZLE function.  if km is NULL, unbind in all keymaps *
      -  * and also the last named command, otherwise only process the specified    *
      -  * keymap.                                                                  */
      - 
      - struct unbind {
      -     LinkList l;
      -     Thingy f;
      - };
      -  
      - /**/
      - void
      - unbindzlefunc(Thingy func, Keymap km)
      - {
      -     struct unbind u;
      -     LinkNode ln;
      - 
      -     if(!km) {
      - 	if(lastnamed == func) {
      - 	    unrefthingy(lastnamed);
      - 	    lastnamed = refthingy(t_undefinedkey);
      - 	}
      - 	for (ln = firstnode(keymaplist); ln; incnode(ln))
      - 	    unbindzlefunc(func, ln->dat);
      - 	return;
      -     }
      - 
      -     PERMALLOC {
      - 	/* It's dangerous to modify a hash table while scanning, *
      - 	 * so put the bindings found in a list and delete them   *
      - 	 * one by one later.                                     */
      - 	u.l = newlinklist();
      - 	u.f = func;
      - 	scankeymap(km, 0, zerobinding, &u);
      - 	for (ln = firstnode(u.l); ln; incnode(ln)) {
      - 	    bindkey(km, ln->dat, refthingy(t_undefinedkey), NULL);
      - 	    zsfree(ln->dat);
      - 	}
      - 	freelinklist(u.l, NULL);
      -     } LASTALLOC;
      - 
      - }
      - 
      - static void
      - zerobinding(char *seq, Thingy func, char *str, void *magic)
      - {
      -     struct unbind *u = magic;
      - 
      -     if (func == u->f)
      - 	addlinknode(u->l, ztrdup(seq));
        }
      --- 1205,1208 ----
      *** Src/Zle/zle_main.c	1997/01/03 07:23:27	1.12
      --- Src/Zle/zle_main.c	1997/01/03 07:48:01
      ***************
      *** 694,700 ****
        }
        
        static struct binlist bintab[] = {
      !     { "bindkey", 0, bin_bindkey, 0, -1, 0, "evaMldDANUmrusLR", NULL, 0 },
            { "vared",   0, bin_vared,   1,  7, 0, NULL,               NULL, 0 },
        };
        
      --- 694,700 ----
        }
        
        static struct binlist bintab[] = {
      !     { "bindkey", 0, bin_bindkey, 0, -1, 0, "evaMldDANmrsLR",   NULL, 0 },
            { "vared",   0, bin_vared,   1,  7, 0, NULL,               NULL, 0 },
        };
        

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

iQCVAwUBMsy9VnD/+HJTpU/hAQHexAQAjaD8BHfKxNymN3gprFYqjHGmt6tWpUGr
6cL/K2biRjh2F7vWNSRVKr2JtWcH6rsX5vags3a+mth7uuqWqWBlXwJl12IQ9UJv
4gkLPwyNT/1/ilMaC3iZR53xE4ArQG9i5U/7MgSLV/Zb36bJWzcXs9hDLIM9tIiV
+dYki3W7+10=
=vuTV
-----END PGP SIGNATURE-----



Messages sorted by: Reverse Date, Date, Thread, Author