diff --git a/ChangeLog b/ChangeLog index 7c46f1b64..b7c6783cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-03-21 Peter Stephenson + + * zsh-users/10047 : Doc/Zsh/zle.yo, Src/Zle/zle_thingy.c, + Functions/Zle/read_from_minibuffer: add and use -K option + to select keymap for use with widget. + +2006-03-19 Peter Stephenson + + * 22638: MACHINES: compilation with cc on Irix 6.5. + 2006-03-20 Clint Adams * 22371, 22372: Src/Zle/zle.h, Src/Zle/zle_word.c: use diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index fb6f508a0..937f70942 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -332,7 +332,7 @@ xitem(tt(zle) tt(-U) var(string)) xitem(tt(zle) tt(-K) var(keymap)) xitem(tt(zle) tt(-F) [ tt(-L) ] [ var(fd) [ var(handler) ] ]) xitem(tt(zle) tt(-I)) -item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)( +item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -N ] [ -K) var(keymap) tt(]) var(args) ...)( The tt(zle) builtin performs a number of different actions concerning ZLE. @@ -529,7 +529,7 @@ this may have been by a previous call to `tt(zle -I)' or by a system notification. To test if a zle widget may be called at this point, execute tt(zle) with no arguments and examine the return status. ) -item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)( +item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ] [ -K) var(keymap) tt(]) var(args) ...)( Invoke the specified widget. This can only be done when ZLE is active; normally this will be within a user-defined widget. @@ -538,6 +538,10 @@ saved and then restored after the call to tt(widget); `tt(-n) var(num)' sets the numerical argument temporarily to var(num), while `tt(-N)' sets it to the default, i.e. as if there were none. +With the option tt(-K), var(keymap) will be used as the current keymap +during the execution of the widget. The previous keymap will be +restored when the widget exits. + Any further arguments will be passed to the widget. If it is a shell function, these are passed down as positional parameters; for builtin widgets it is up to the widget in question what it does with them. diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer index ba75cbdce..30dfe8338 100644 --- a/Functions/Zle/read-from-minibuffer +++ b/Functions/Zle/read-from-minibuffer @@ -33,7 +33,7 @@ if [[ -n $keys ]]; then read -k $keys stat=$? else - zle recursive-edit + zle recursive-edit -K main stat=$? (( stat )) || REPLY=$BUFFER fi diff --git a/MACHINES b/MACHINES index 820e3655a..973753ebb 100644 --- a/MACHINES +++ b/MACHINES @@ -178,8 +178,11 @@ SGI: IRIX 6.2, 6.3 Should build `out-of-the-box'. SGI: IRIX 6.5 - Should build `out-of-the-box'. - Use of gcc for compilation is recommended. + Should build `out-of-the-box'; however, if using the native + compiler, "cc" rather than "c99" is recommended. Compilation + with gcc is also reported to work. Multibyte is supported, + for example: + CC=cc ./configure --enable-multibyte On 6.5.2, zsh malloc routines are reported not to work; also full optimization (cc -O3 -OPT:Olimit=0) causes problems. diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 96c9e935e..b0f295e10 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -642,7 +642,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) Thingy t; struct modifier modsave = zmod; int ret, saveflag = 0; - char *wname = *args++; + char *wname = *args++, *keymap_restore = NULL, *keymap_tmp; if (!wname) return !zle_usable(); @@ -680,6 +680,18 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) zmod.mult = 1; zmod.flags &= ~MOD_MULT; break; + case 'K': + keymap_tmp = args[0][1] ? args[0]+1 : args[1]; + if (!keymap_tmp) { + zwarnname(name, "keymap expected after -%c", NULL, **args); + return 1; + } + if (!args[0][1]) + *++args = "" - 1; + keymap_restore = dupstring(curkeymapname); + if (selectkeymap(keymap_tmp, 0)) + return 1; + break; default: zwarnnam(name, "unknown option: %s", *args, 0); return 1; @@ -693,6 +705,8 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) unrefthingy(t); if (saveflag) zmod = modsave; + if (keymap_restore) + selectkeymap(keymap_restore, 0); return ret; }