Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion issues



Bart Schaefer wrote:

> On Apr 1,  9:26pm, Peter Stephenson wrote:
> } Subject: Completion issues
> }
> } First, I hate the new behaviour of _complete_help.  I use it to find out
> } what context I'm in.  Unfortunately I don't get to see that, because a huge
> } list of style has scrolled by.
> 
> I won't say I *hate* the new behavior, but I was certainly alarmed by the
> amount of style output that was generated even for something like "ls" or
> "echo" that doesn't have any special handling.  "cvs <^Xh>" is horrifying.
> That list-colors, list-packed, list-rows-first, last-prompt, accept-exact,
> and menu appear no less than 8 times each seems a tad excessive.

I get them only three times -- it all depends on ones setup...

> } I don't think a style to turn off styles in ^Xh is good enough,
> } there's too much mucking around, and you may want the style information
> } anyway.  A workable alternative is that a numeric argument activates the
> } style list --- this feature could be configurable by a style.
> 
> I like the numeric-argument idea.  If we wanted to get really fancy, a
> number from 1-4 could denote increasingly verbose output, so that using
> universal-argument would produce the full-blown listing.
> 
> I'm not convinced we'd need a style to make that configurable, though.
> It's pretty straightforward to create a zle widget that sets NUMERIC and
> then calls another widget.

Ok. The patch makes the style list be shown only if _complete_help is
given a numeric argument.

I haven't tried to make this support multiple levels of verboseness
yet. The only probelm I have with that is to decide what to show on
the intermediate levels, though. I mean, for example, showing the
styles used without the contexts in which they are used can be both
misleading and useless. In some cases. I think. Hm.

Bye
 Sven

Index: Completion/Commands/_complete_help
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_complete_help,v
retrieving revision 1.2
diff -u -r1.2 _complete_help
--- Completion/Commands/_complete_help	2000/04/01 20:43:43	1.2
+++ Completion/Commands/_complete_help	2000/04/03 12:50:02
@@ -44,21 +44,22 @@
     text="${text}${tmp}"
   done
 
-  text="$text
+  if [[ ${NUMERIC:-1} -ne 1 ]]; then
+    text="$text
 "
-  for i in "${(@ok)help_sfuncs}"; do
-    text="${text}
+    for i in "${(@ok)help_sfuncs}"; do
+      text="${text}
 styles in context ${i}"
-    tmp=()
-    for j in "${(@s.:.)help_sfuncs[$i][2,-1]}"; do
-      tmp=( "$tmp[@]" "${(@s.,.)help_styles[${i}${j}][2,-1]}" )
-    done
-    zformat -a tmp '  (' "$tmp[@]"
-    tmp=( '
+      tmp=()
+      for j in "${(@s.:.)help_sfuncs[$i][2,-1]}"; do
+        tmp=( "$tmp[@]" "${(@s.,.)help_styles[${i}${j}][2,-1]}" )
+      done
+      zformat -a tmp '  (' "$tmp[@]"
+      tmp=( '
     '${^tmp}')' )
-    text="${text}${tmp}"
-  done
-
+      text="${text}${tmp}"
+    done
+  fi
   compstate[list]='list force'
   compstate[insert]=''
 
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.2
diff -u -r1.2 compsys.yo
--- Doc/Zsh/compsys.yo	2000/04/01 20:43:44	1.2
+++ Doc/Zsh/compsys.yo	2000/04/03 12:50:05
@@ -355,8 +355,7 @@
 ifnzman(noderef(Bindable Commands))
 can be invoked to find out the context and tag names and styles used at a particular
 point in completion.  It shows a list of context names and the 
-tag names used in those contexts and then a list of context names and
-the styles used in those contexts if completion were tried at the
+tag names used in those contexts if completion were tried at the
 current cursor position.  Hence one can easily find out all the
 information needed to change the behaviour of the tt(tag-order) style
 for a particular context.
@@ -2200,8 +2199,10 @@
 findex(_complete_help (^Xh))
 item(tt(_complete_help (^Xh)))(
 This widget displays information about the context names, 
-the tags, the styles, and the completion functions used 
-when completing at the current cursor position.
+the tags, and the completion functions used 
+when completing at the current cursor position. If given a numeric
+argument other than tt(1) (as in `tt(ESC-2 ^Xh)'), then the styles
+used and the contexts for which they are used will be shown, too.
 
 Note that, depending on the control flow in the completion functions
 called, the information about the styles may be

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author