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

Re: PATCH: documentation on keymap selection



On Tue, 07 Sep 2010 09:58:48 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> schaefer<501> bindkey -lL
> bindkey -N .safe
> bindkey -N command
> bindkey -N emacs
> bindkey -N isearch
> bindkey -N listscroll
> bindkey -A emacs main
> bindkey -N menuselect
> bindkey -N vicmd
> bindkey -N viins
> 
> Is it really correct to include "bindkey -N .safe" in that output?

Hmm, that's definitely a good point.

If we simply omit it the output is no longer printing all the keymaps, as
it used to.  Of course, bindkey -l does that, and you can argue bindkey -lL
needs to be useful, which is after all the aim of the previous change.
Given the new behaviour is incompatible with the old, and the old was a
lie, maybe that is the right thing to do.

Index: Doc/Zsh/zle.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v
retrieving revision 1.87
diff -p -u -r1.87 zle.yo
--- Doc/Zsh/zle.yo	6 Sep 2010 08:50:05 -0000	1.87
+++ Doc/Zsh/zle.yo	7 Sep 2010 17:54:10 -0000
@@ -185,7 +185,10 @@ those keymaps.
 If the tt(-L) option is also used, list in the form of tt(bindkey)
 commands to create or link the keymaps.  `tt(bindkey -lL
 main)' shows which keymap is linked to `tt(main)', if any, and hence if
-the standard emacs or vi emulation is in effect.
+the standard emacs or vi emulation is in effect.  This option does
+not show the tt(.safe) keymap because it cannot be created in that
+fashion; however, neither is `tt(bindkey -lL .safe)' reported as an
+error, it simply outputs nothing.
 )
 item(tt(-d))(
 Delete all existing keymaps and reset to the default state.
Index: Src/Zle/zle_keymap.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_keymap.c,v
retrieving revision 1.34
diff -p -u -r1.34 zle_keymap.c
--- Src/Zle/zle_keymap.c	5 Sep 2010 20:39:09 -0000	1.34
+++ Src/Zle/zle_keymap.c	7 Sep 2010 17:54:10 -0000
@@ -829,12 +829,18 @@ bin_bindkey_lsmaps(char *name, UNUSED(ch
 
 /**/
 static void
-scanlistmaps(HashNode hn, int list)
+scanlistmaps(HashNode hn, int list_verbose)
 {
     KeymapName n = (KeymapName) hn;
 
-    if (list) {
+    if (list_verbose) {
 	Keymap km = n->keymap;
+	/*
+	 * Don't list ".safe" as a bindkey command; we can't
+	 * actually create it that way.
+	 */
+	if (!strcmp(n->nam, ".safe"))
+	    return;
 	fputs("bindkey -", stdout);
 	if (km->primary && km->primary != n) {
 	    KeymapName pn = km->primary;

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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