diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2000-04-30 10:04:29 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2000-04-30 10:04:29 +0000 |
commit | 5c327339f5b6973a9355d3edc564def697b7cbdd (patch) | |
tree | d26009801390dd5d4e096fe965b35fcce0398df3 /Completion/Commands | |
parent | cb9408982ffc60e2883b76d676bfd11d5643c1e3 (diff) | |
download | zsh-5c327339f5b6973a9355d3edc564def697b7cbdd.tar.gz zsh-5c327339f5b6973a9355d3edc564def697b7cbdd.tar.xz zsh-5c327339f5b6973a9355d3edc564def697b7cbdd.zip |
11024: The _complete_debug widget enables and captures xtrace from completion.
Diffstat (limited to 'Completion/Commands')
-rw-r--r-- | Completion/Commands/_complete_debug | 26 |
1 files changed, 26 insertions, 0 deletions
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 |