zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: Completion debugging
Date: Sun, 30 Apr 2000 09:50:26 +0000	[thread overview]
Message-ID: <1000430095026.ZM216@candle.brasslantern.com> (raw)

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


                 reply	other threads:[~2000-04-30  9:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000430095026.ZM216@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).