zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: Can't redefine execute-named-cmd ??
Date: Mon, 21 Mar 2005 16:57:20 +0000	[thread overview]
Message-ID: <200503211657.j2LGvKqW015426@news01.csr.com> (raw)
In-Reply-To: <1050321161151.ZM12393@candle.brasslantern.com>

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@csr.com>                  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.

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


      reply	other threads:[~2005-03-21 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21  1:50 Bart Schaefer
2005-03-21 11:13 ` Peter Stephenson
2005-03-21 11:24   ` Geoff Wing
2005-03-21 16:11   ` Bart Schaefer
2005-03-21 16:57     ` Peter Stephenson [this message]

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=200503211657.j2LGvKqW015426@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /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).