Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Completion debugging
- X-seq: zsh-workers 11024
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Completion debugging
- Date: Sun, 30 Apr 2000 09:50:26 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author