From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21045 invoked from network); 30 Apr 2000 09:50:38 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Apr 2000 09:50:38 -0000 Received: (qmail 13095 invoked by alias); 30 Apr 2000 09:50:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11024 Received: (qmail 13075 invoked from network); 30 Apr 2000 09:50:31 -0000 From: "Bart Schaefer" Message-Id: <1000430095026.ZM216@candle.brasslantern.com> Date: Sun, 30 Apr 2000 09:50:26 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: Completion debugging MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii The following is a little function to assist with debugging completers and completion functions. I put it in the Commands directory even though I think that directory needs renaming (hmm, renaming to "Widgets" perhaps?). BTW, is it intentional that the findex entries for the completion widgets include their keybinding? I presumed so and fixed _next_tags, but perhaps it was the rest of them that needed fixing. (If it's not intentional, it may even be my own mistake ....) Index: 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 Index: Doc/Zsh/compsys.yo =================================================================== @@ -2308,7 +2308,7 @@ var(N), complete the var(N)th most recently modified file. Note the completion, if any, is always unique. ) -findex(_next_tags) +findex(_next_tags (^Xn)) item(tt(_next_tags) (^Xn))( This allows to complete types of matches that are not immediately offered because of the setting of the tt(tag-order) style. After a @@ -2354,6 +2354,13 @@ styles may be used, and, depending on the user's settings, only the first sort of styles may be detected by tt(_complete_help). ) +findex(_complete_debug (^X?)) +item(tt(_complete_debug (^X?)))( +This widget performs ordinary completion, but captures in a temporary file +a trace of the shell commands executed by the completion system. Each +completion attempt gets its own file. A command to view each of these +files is pushed onto the editor buffer stack. +) enditem() texinode(Completion Functions)(Completion Directories)(Bindable Commands)(Completion System) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com