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

PATCH: Re: Odd autoremoveslash behaviour



Peter Stephenson wrote:

> Sven wrote:
> > > % echo /
> > >       ^gorn.
> > 
> > (Hey, super woody word...)
> 
> It's quite olde englishe.  There's a song by Flanders and Swann to the tune
> of the rondo to Mozart's fourth horn concerto with the words (to the slow,
> minor key episode in the middle) `Lost that horn... Found that
> horn... Gorn'.

I was thinking about the Monty Python sketch...

> The removeslash behaviour now works.  I had a play round with menu
> selection and found if you try and turn it off by setting the menu style,
> it doesn't work because _main_complete doesn't unset MENUSELECT unless
> explicitly told to. 

Hm, yes, let's try this.

> Is there any reason not to make that local in
> _main_complete?

Yes: complist gets its hands on MENUSELECT only after the completion
widget has returned.

> Further, setting the style to select=long does set MENUSELECT correctly,
> but unless I've misunderstood doesn't seem to have the effect that menu
> selection is only started for lists longer than a page.

Ugh, right.

> The following simple function, zse (Z style edit) makes it easy to edit
> styles on the fly; it's sort of zed-like.  Any interest in including it?
> Having argued for vared to behave as if you were editing the parameter
> value, I now find I need to make it behave as if you had a full command
> line, since you do.  How do I do that with compcontext?

;-) By using the patch below which adds `#compdef -command-line-' to
_normal. Then you can do `compcontext=-command-line-'.

Bye
 Sven

Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.18
diff -u -r1.18 _main_complete
--- Completion/Core/_main_complete	2000/05/15 13:19:26	1.18
+++ Completion/Core/_main_complete	2000/05/16 11:42:30
@@ -168,9 +168,11 @@
   if [[ "$compstate[insert]" = *menu* ]]; then
     if [[ -n "$_menu_style[(r)no-select*]" ]]; then
       unset MENUSELECT
-    elif [[ -n "$_menu_style[(r)select=long*]" && tmp -gt LINES ]]; then
-      zmodload -i zsh/complist
-      MENUSELECT=0
+    elif [[ -n "$_menu_style[(r)select=long*]" ]]; then
+      if [[ tmp -gt LINES ]]; then
+        zmodload -i zsh/complist
+        MENUSELECT=0
+      fi
     else
       sel=( "${(@M)_menu_style:#select*}" )
 
@@ -191,6 +193,8 @@
 
         zmodload -i zsh/complist
         MENUSELECT="$min"
+      else
+        unset MENUSELECT
       fi
     fi
   fi
Index: Completion/Core/_normal
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_normal,v
retrieving revision 1.1.1.18
diff -u -r1.1.1.18 _normal
--- Completion/Core/_normal	2000/02/15 09:07:11	1.1.1.18
+++ Completion/Core/_normal	2000/05/16 11:42:30
@@ -1,4 +1,4 @@
-#autoload
+#compdef -command-line-
 
 local comp command cmd1 cmd2 pat val name i ret=1 _compskip="$_compskip"
 local curcontext="$curcontext"
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.47
diff -u -r1.47 compsys.yo
--- Doc/Zsh/compsys.yo	2000/05/15 13:19:26	1.47
+++ Doc/Zsh/compsys.yo	2000/05/16 11:42:31
@@ -2096,7 +2096,11 @@
 Before trying to find a function for a specific context, tt(_complete) 
 checks if the parameter `tt(compcontext)' is set to a non-empty
 value. If it is, the value is taken as the name of the context to use
-and the function defined for that context will be called.
+and the function defined for that context will be called. For this
+purpose, there is a special context named tt(-command-line-) that
+completes whole command lines (commands and their arguments) and is
+not used by the completion system itself, but has a function handling
+completion for it.
 )
 findex(_approximate)
 item(tt(_approximate))(

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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