1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 14:04:03 +01:00
zsh/Completion/Commands/_complete_debug

31 lines
856 B
Plaintext
Raw Normal View History

#compdef -k complete-word \C-x?
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}"
exec 3>&- # Too bad if somebody else is using it ...
[[ -t 2 ]] && exec 3>&2 2>| $tmp
setopt xtrace
_main_complete
integer ret=$?
unsetopt xtrace
[[ -t 3 ]] && {
## 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"
compstate[list]='list force'
print -zR "${VISUAL:-${EDITOR:-${PAGER:-more}}} $tmp ;: $w"
exec 2>&3 3>&-
}
return ret