zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: squashing key bindings
Date: Fri, 15 Nov 1996 13:37:10 +0000 (GMT)	[thread overview]
Message-ID: <6555.199611151337@stone.dcs.warwick.ac.uk> (raw)

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

Peter's patch 2370, to remove all bindings of a ZLE function when it
goes away, doesn't look at the command saved by execute-named-command.
It is possible to load a module, execute its ZLE function with
execute-named-command, unload the module and load a different one, and
then execute the newly loaded function with execute-last-named-command.
This patch fixes this.

 -zefram

      Index: Src/zle_main.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zle_main.c,v
      retrieving revision 1.25
      diff -c -r1.25 zle_main.c
      *** zle_main.c	1996/11/15 00:30:55	1.25
      --- zle_main.c	1996/11/15 12:09:02
      ***************
      *** 981,987 ****
        		zerr("undefined function: %s", *argv, 0);
        		return 1;
        	    }
      ! 	    unbindzlefunc(func, ops['U'] ? 0 : ops['a'] ? 2 : 1);
        	    argv++;
        	    continue;
        	}
      --- 981,987 ----
        		zerr("undefined function: %s", *argv, 0);
        		return 1;
        	    }
      ! 	    unbindzlefunc(func, ops['U'] ? 0 : ops['a'] ? 6 : 5);
        	    argv++;
        	    continue;
        	}
      ***************
      *** 1238,1244 ****
            showinglist = 0;
        }
        
      ! LinkList bindremlist;
        
        /**/
        void
      --- 1238,1244 ----
            showinglist = 0;
        }
        
      ! static LinkList bindremlist;
        
        /**/
        void
      ***************
      *** 1250,1258 ****
        
        /*
         * Unbind the given zle function ifunc wherever it occurs.
      !  * With notall = 0, do this for all binding tables.
      !  *	       = 1, do this in the main binding table.
      !  *             = 2, do this in the alternate binding table.
         * Note that the main and alternate binding tables share
         * the same table for sequences with prefixes.
         */
      --- 1250,1259 ----
        
        /*
         * Unbind the given zle function ifunc wherever it occurs.
      !  * With notall &3 == 0, do this for all binding tables.
      !  *             &3 == 1, do this only in the main binding table.
      !  *             &3 == 2, do this only in the alternate binding table.
      !  *             &4, don't mangle the last named command.
         * Note that the main and alternate binding tables share
         * the same table for sequences with prefixes.
         */
      ***************
      *** 1271,1277 ****
        	for (keybindptr = keybindlist; *keybindptr; keybindptr++) {
        	    LinkNode ln;
        	    bindremlist = newlinklist();
      ! 	    if (notall)
        		keybindptr = &keybindtab;
        
        	    /*
      --- 1272,1278 ----
        	for (keybindptr = keybindlist; *keybindptr; keybindptr++) {
        	    LinkNode ln;
        	    bindremlist = newlinklist();
      ! 	    if (notall & 3)
        		keybindptr = &keybindtab;
        
        	    /*
      ***************
      *** 1291,1312 ****
        	    }
        
        	    freelinklist(bindremlist, NULL);
      ! 	    if (notall)
        		break;
        	}
        	bindremlist = NULL;
            } LASTALLOC;
        
            for (bindptr = bindlist; *bindptr; bindptr++) {
      ! 	/* if notall == 2, we are doing altbindtab first anyway */
      ! 	if (notall == 1)
        	    bindptr = &mainbindtab;
        	for (i = 0; i < 256; i++)
        	    if ((*bindptr)[i] == ifunc)
        		(*bindptr)[i] = z_undefinedkey;
      ! 	if (notall)
        	    break;
            }
        }
        
        /**/
      --- 1292,1316 ----
        	    }
        
        	    freelinklist(bindremlist, NULL);
      ! 	    if (notall & 3)
        		break;
        	}
        	bindremlist = NULL;
            } LASTALLOC;
        
            for (bindptr = bindlist; *bindptr; bindptr++) {
      ! 	/* if (notall & 3) == 2, we are doing altbindtab first anyway */
      ! 	if ((notall & 3) == 1)
        	    bindptr = &mainbindtab;
        	for (i = 0; i < 256; i++)
        	    if ((*bindptr)[i] == ifunc)
        		(*bindptr)[i] = z_undefinedkey;
      ! 	if (notall & 3)
        	    break;
            }
      + 
      +     if(!(notall & 4) && lastnamed == ifunc)
      + 	lastnamed = z_undefinedkey;
        }
        
        /**/

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

iQCVAwUBMoxeCnD/+HJTpU/hAQGEiQP8D4ukJMC/uxYgnmKWObQ2H7xTVT2kOcD9
YW5Hp9fCvepdjAEZIBdG2YZ0QyWqxIv3ATwVS8T3Zoh3V1RdPUL7WMsHFgDQ1Zhs
AFfJer0TP9ChGMZr8Knym9FEJRBnAGCMpAgKrgENCnmfb0wCyjhfpgGzVBbefjw6
89exgSL3RCk=
=SoYA
-----END PGP SIGNATURE-----


                 reply	other threads:[~1996-11-15 13:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6555.199611151337@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).