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

Re: Can't redefine execute-named-cmd ??



Bart Schaefer wrote:
> On Mar 21, 11:13am, Peter Stephenson wrote:
> }
> } execute-named-command as well as the isearch commands have horribly
> } incestuous ways of using key bindings.
> 
> Obviously so, but what does that have to do with the inability to
> redefine it?

It's kludged into getkeycmd() in a horrible way.  It doesn't have its
own separate widget; it simply gets recognised when we try to read a
command from keystrokes, and the resulting command read by
executenamedcommand() is returned instead.  It's the same for
execute-last-named-command.

> And why does it cause a crash when calling it by name
> with "zle execute-named-cmd"?

Because it doesn't work like a proper widget, the value of the function
is set to NULL.  This isn't handled.

Until someone can de-kludge it, the best we can do is test for the NULL
and document the limitations.

Index: Doc/Zsh/zle.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v
retrieving revision 1.45
diff -u -r1.45 zle.yo
--- Doc/Zsh/zle.yo	16 Nov 2004 19:06:40 -0000	1.45
+++ Doc/Zsh/zle.yo	21 Mar 2005 16:55:22 -0000
@@ -1670,10 +1670,14 @@
 Any other character that is not bound to tt(self-insert) or
 tt(self-insert-unmeta) will beep and be ignored.
 The bindings of the current insert mode will be used.
+
+Currently this command may not be redefined or called by name.
 )
 tindex(execute-last-named-cmd)
 item(tt(execute-last-named-cmd) (ESC-z) (unbound) (unbound))(
 Redo the last function executed with tt(execute-named-cmd).
+
+Currently this command may not be redefined or called by name.
 )
 tindex(get-line)
 item(tt(get-line) (ESC-G ESC-g) (unbound) (unbound))(
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.65
diff -u -r1.65 zle_main.c
--- Src/Zle/zle_main.c	15 Mar 2005 10:51:04 -0000	1.65
+++ Src/Zle/zle_main.c	21 Mar 2005 16:55:22 -0000
@@ -1053,6 +1053,8 @@
 		ret = completecall(args);
 		if (atcurhist)
 		    histline = curhist;
+	    } else if (!w->u.fn) {
+		handlefeep(zlenoargs);
 	    } else {
 		queue_signals();
 		ret = w->u.fn(args);

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


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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