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

Re: Bug#190948: Violation against The Single UNIX ? Specification, Version 2

Peter Stephenson wrote:
> +pindex(VI)
> +item(tt(VI))(
> +If ZLE is loaded, turning on this option has the equivalent effect
> +of `tt(bindkey -v)'.  In addition, the EMACS option is unset.
> +Turning it off has no effect.  The option setting is
> +not guaranteed to reflect the current keymap.  This option is
> +provided for compatibility; tt(bindkey) is the recommended interface.
>  )

Sigh.  Doesn't autoload zle, so `set -o vi' before any zle configuration
in .zshrc doesn't have any effect.  Actually covered by the weasel words
at the start of the manual entry, but I think this is one of those
occasions where implementing the feature is easier than explaining every
time why it doesn't work the way that's expected.

By the way, this neighbourhood of init.c contains the comment:

/* ZLE entry point pointers.  They are defined here because the initial *
 * values depend on whether ZLE is linked in or not -- if it is, we     *
 * avoid wasting space with the fallback functions.  No other source    *
 * file needs to know which modules are linked in.                      */

Except we don't avoid wasting space with the fallback functions, they
are defined unconditionally.  Anyone remember what's happening?

Index: Src/init.c
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.33
diff -u -r1.33 init.c
--- Src/init.c	14 May 2003 15:09:14 -0000	1.33
+++ Src/init.c	15 May 2003 09:12:10 -0000
@@ -1122,11 +1122,12 @@
 mod_export ZleVoidIntFn spaceinlineptr = noop_function_int;
 # ifdef UNLINKED_XMOD_zshQszle
 mod_export ZleReadFn zlereadptr = autoload_zleread;
+mod_export ZleVoidIntFn zlesetkeymapptr = autoload_zlesetkeymap;
 # else /* !UNLINKED_XMOD_zshQszle */
 mod_export ZleReadFn zlereadptr = fallback_zleread;
+mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
 # endif /* !UNLINKED_XMOD_zshQszle */
-mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
 #endif /* !LINKED_XMOD_zshQszle */
@@ -1152,6 +1153,16 @@
     return (unsigned char *)shingetline();
+static void
+autoload_zlesetkeymap(int mode)
+    zlesetkeymapptr = noop_function_int;
+    load_module("zsh/zle");
+    (*zlesetkeymapptr)(mode);
 /* compctl entry point pointers.  Similar to the ZLE ones. */

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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