From 5c327339f5b6973a9355d3edc564def697b7cbdd Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sun, 30 Apr 2000 10:04:29 +0000 Subject: 11024: The _complete_debug widget enables and captures xtrace from completion. --- Completion/Commands/_complete_debug | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Completion/Commands/_complete_debug (limited to 'Completion') diff --git a/Completion/Commands/_complete_debug b/Completion/Commands/_complete_debug new file mode 100644 index 000000000..5d3e8d9e3 --- /dev/null +++ b/Completion/Commands/_complete_debug @@ -0,0 +1,26 @@ +#compdef -k complete-word \C-x? + +setopt localoptions nullglob rcexpandparam extendedglob +unsetopt markdirs globsubst shwordsplit nounset ksharrays + +(( $+_debug_count )) || integer -g _debug_count +local tmp=${TMPPREFIX}${$}${words[1]}$[++_debug_count] +local w="${(qqq)words}" + +[[ -t 2 ]] && exec 3>&2 2>| $tmp + +setopt xtrace +_main_complete +integer ret=$? +unsetopt xtrace + +[[ -t 2 ]] || { + ## Calling "print -s" during completion is presently broken. + # _message -r "Trace output left in $tmp (up-history to view)" + # print -sR "${VISUAL:-${EDITOR:-${PAGER:-more}}} $tmp ;: $w" + _message -r "Trace output left in $tmp" + print -zR "${VISUAL:-${EDITOR:-${PAGER:-more}}} $tmp ;: $w" + exec 2>&3 3>&- +} + +return ret -- cgit 1.4.1