* Completion debugging
@ 2000-04-30 9:50 Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2000-04-30 9:50 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-04-30 9:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-30 9:50 Completion debugging Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).