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

Re: PATCH: add zle-line-finish special widget



Hi Peter and Bart,

Here is an updated version of the patch for this feature.

thanks for your help on this,
Greg


Index: Doc/Zsh/zle.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v
retrieving revision 1.76
diff -u -r1.76 zle.yo
--- Doc/Zsh/zle.yo	19 Jan 2009 17:57:43 -0000	1.76
+++ Doc/Zsh/zle.yo	28 Jan 2009 04:26:36 -0000
@@ -871,6 +872,11 @@
 (The command inside the function sets the keymap directly; it is
 equivalent to tt(zle vi-cmd-mode).)
 )
+tindex(zle-line-finish)
+item(tt(zle-line-finish))(
+This is similar to tt(zle-line-init) but is executed every time the
+line editor has finished reading a line of input.
+)
 tindex(zle-keymap-select)
 item(tt(zle-keymap-select))(
 Executed every time the keymap changes, i.e. the special parameter
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.121
diff -u -r1.121 zle_main.c
--- Src/Zle/zle_main.c	9 Dec 2008 17:37:01 -0000	1.121
+++ Src/Zle/zle_main.c	28 Jan 2009 04:26:36 -0000
@@ -1212,6 +1212,19 @@
 
     zlecore();
 
+    if (done && !exit_pending && !errflag &&
+	(initthingy = rthingy_nocreate("zle-line-finish"))) {
+	int saverrflag = errflag;
+	int savretflag = retflag;
+	char *args[2];
+	args[0] = initthingy->nam;
+	args[1] = NULL;
+	execzlefunc(initthingy, args, 1);
+	unrefthingy(initthingy);
+	errflag = saverrflag;
+	retflag = savretflag;
+    }
+
     statusline = NULL;
     invalidatelist();
     trashzle();


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