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

PATCH: Re: Why does ^X? behave differently than TAB?



On May 19,  3:24pm, Sven Wischnowsky wrote:
} Subject: Re: Why does ^X? behave differently than TAB?
}
} You wrote:
} 
} > Here's the actual script.  Run it as an autoloaded function.  At the
} > "ftpupdate command: " prompt, type ^X? twice.
} > 
} > ...
} > 
} > trap "$r ; trap - 0 2 3 15 ZERR ; return 1" 0 2 3 15 ZERR
} 
} The `compadd -x' in _message returns non-zero and makes this trap be
} called. And of course, the next time round, there is no `compctl -T'
} anymore.
} 
} Hm. I don't want to change the return value of compadd and it wouldn't 
} solve the problem anyway. Do we have to temporarily unset/default all
} traps in completion? Urgh.

Not all traps, just ZERR.  We should handle the errexit option, too.

Index: Completion/Commands/_complete_debug
===================================================================
@@ -3,6 +3,8 @@
 setopt localoptions nullglob rcexpandparam extendedglob
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 
+setopt localtraps noerrexit ; trap - ZERR
+
 (( $+_debug_count )) || integer -g _debug_count
 local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count]
 local w="${(qq)words}"
Index: Completion/Core/_main_complete
===================================================================
@@ -20,6 +20,9 @@
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 exec </dev/null	# ZLE closes stdin, which can cause errors
 
+# Failed returns from this code are not real errors
+setopt localtraps noerrexit ; trap - ZERR
+
 local func funcs ret=1 tmp _compskip format nm call \
       _completers _completer _completer_num curtag _comp_force_list \
       _matchers _matcher _matcher_num _comp_tags _comp_mesg \

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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