about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2000-04-30 10:04:29 +0000
committerBart Schaefer <barts@users.sourceforge.net>2000-04-30 10:04:29 +0000
commit5c327339f5b6973a9355d3edc564def697b7cbdd (patch)
treed26009801390dd5d4e096fe965b35fcce0398df3
parentcb9408982ffc60e2883b76d676bfd11d5643c1e3 (diff)
downloadzsh-5c327339f5b6973a9355d3edc564def697b7cbdd.tar.gz
zsh-5c327339f5b6973a9355d3edc564def697b7cbdd.tar.xz
zsh-5c327339f5b6973a9355d3edc564def697b7cbdd.zip
11024: The _complete_debug widget enables and captures xtrace from completion.
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Commands/_complete_debug26
-rw-r--r--Doc/Zsh/compsys.yo9
3 files changed, 39 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ea6cc57ff..5c023c022 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,12 @@
-2000-04-29  Adam Spiers  <adam@spiers.net>
+2000-04-30  Bart Schaefer  <schaefer@zsh.org>
 
-	* 11019: Doc/Zsh/compsys.yo: fix bug in _description example
+	* 11024: Completion/Commands/_complete_debug, Doc/Zsh/compsys.yo:
+	Completion widget that enables and captures xtrace output.
 
 2000-04-29  Adam Spiers  <adam@spiers.net>
 
+	* 11019: Doc/Zsh/compsys.yo: fix bug in _description example
+
 	* 11017: Completion/Linux/_rpm: fixes for --rmsource and
 	--recompile options, and for breakage caused by 10772
 
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
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index e3274cabf..f68375a3d 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2308,7 +2308,7 @@ on the command line (which may be blank).  If given a numeric argument
 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 @@ incomplete. I.e. depending on the settings for some styles other
 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)