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

Re: add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded")



On Aug 30,  5:23pm, Daniel Shahaf wrote:
} Subject: add-zle-hook-widget: infinite recursion ("job table full or recur
}
} +add-zle-hook-widget:21> '(anon)' zle-line-pre-redraw f
} +(anon):2> emulate -L zsh
} +(anon):5> zmodload -e zsh/zle
} +(anon):5> return 1

Ah ...

} Running 'zmodload zsh/zle' before the call appears to prevent hte
} problem.  I can do that in my callsite (z-sy-h's "make check"), but
} I assume zsh shouldn't enter an infinite loop, either.

Need to move the sanity checks out of the anonymous function.  Unless
someone suggests a variation of "return" that works like "break 2".


diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget
index c47d9a3..572de25 100644
--- a/Functions/Misc/add-zle-hook-widget
+++ b/Functions/Misc/add-zle-hook-widget
@@ -18,10 +18,6 @@
 #
 # The -L option lists the hooks and their associated widgets.
 
-() { # Preserve caller global option settings
-
-emulate -L zsh
-
 # This is probably more safeguarding than necessary
 zmodload -e zsh/zle || return 1
 { zmodload zsh/parameter && zmodload zsh/zleparameter } || {
@@ -29,6 +25,10 @@ zmodload -e zsh/zle || return 1
     return 1
 }
 
+() { # Preserve caller global option settings
+
+emulate -L zsh
+
 # Setup - create the base functions for hook widgets that call the others
 
 local -a hooktypes=( zle-isearch-exit zle-isearch-update



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