zsh-workers
 help / color / mirror / code / Atom feed
* Re: #compdef tag and menu-select
@ 2000-05-30  8:16 Sven Wischnowsky
  2000-05-30 15:36 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-05-30  8:16 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> If one has already loaded the complist module before running compinit, then
> one can use `#compdef -k menu-select ...' at the top of completion functions.
> 
> If one has not already loaded complist, then compdef chokes.
> 
> At other places in the completion system we automatically load complist when
> it seems wanted.  Perhaps compdef should too?

If I had thought of it, I probably would have done that.

Nowadays I'm a bit reluctant to change that because I've too often
thought about removing menu-select -- after all, it's just
menu-complete with enforcing selection, which can be achieved by other 
means.

And there is the question if menu-select should be re-bound to
_main_complete when compdef finds a widget using menu-select.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: #compdef tag and menu-select
  2000-05-30  8:16 #compdef tag and menu-select Sven Wischnowsky
@ 2000-05-30 15:36 ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2000-05-30 15:36 UTC (permalink / raw)
  To: zsh-workers

On May 30, 10:16am, Sven Wischnowsky wrote:
} 
} Bart Schaefer wrote:
} 
} > At other places in the completion system we automatically load complist when
} > it seems wanted.  Perhaps compdef should too?
} 
} Nowadays I'm a bit reluctant to change that because I've too often
} thought about removing menu-select -- after all, it's just
} menu-complete with enforcing selection, which can be achieved by other 
} means.

Really?  What other means?  Specifically, I have a widget that is entirely
independent of the completion system (except that it's created with zle -C
and uses compadd; but it has nothing to do with _main_complete) and *for
that widget only* I want menu-select behavior *all the time*.

It's convenient to put `#compdef -k menu-select ^X:' at the top of the
file that defines this widget and let compinstall bind it for me, even
though it's otherwise not part of the completion system.

What can I put *in the definition file* for this widget that will enable
menu selection "by other means"?  I tried everything I could think of,
poking into various values of compstate and assigning to MENUSELECT and
whatnot, and I couldn't force menu-selection to start if the widget was
e.g. bound with `#compdef -k menu-complete ^X:'.

} And there is the question if menu-select should be re-bound to
} _main_complete when compdef finds a widget using menu-select.

In the situation described above I definitely do not want that.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: #compdef tag and menu-select
  2000-05-31  6:51 Sven Wischnowsky
@ 2000-05-31 14:08 ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2000-05-31 14:08 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

On May 31,  8:51am, Sven Wischnowsky wrote:
} Subject: Re: #compdef tag and menu-select
}
} > What can I put *in the definition file* for this widget that will enable
} > menu selection "by other means"?  I tried everything I could think of
} 
}   foo() {
}     compadd ...
}     MENUSELECT=0
}     compstate[insert]=menu
}   }
}   zle -C foo complete-word foo
}   bindkey '...' foo
} 
} Works for me.

It doesn't work for me.  I get a listing and the first match inserted.

Ah, but I don't have the complist module loaded from .zshrc ... that's
the missing tidbit.  So (prior to the patch for autoloading menu-select)
I'd also have to put a zmodload in the definition file.

I therefore think it's worth keeping menu-select around as a widget even
if just as an autoloading hook.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: #compdef tag and menu-select
@ 2000-05-31  6:51 Sven Wischnowsky
  2000-05-31 14:08 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-05-31  6:51 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On May 30, 10:16am, Sven Wischnowsky wrote:
> } 
> } Bart Schaefer wrote:
> } 
> } > At other places in the completion system we automatically load complist when
> } > it seems wanted.  Perhaps compdef should too?
> } 
> } Nowadays I'm a bit reluctant to change that because I've too often
> } thought about removing menu-select -- after all, it's just
> } menu-complete with enforcing selection, which can be achieved by other 
> } means.
> 
> Really?  What other means?  Specifically, I have a widget that is entirely
> independent of the completion system (except that it's created with zle -C
> and uses compadd; but it has nothing to do with _main_complete) and *for
> that widget only* I want menu-select behavior *all the time*.
> 
> It's convenient to put `#compdef -k menu-select ^X:' at the top of the
> file that defines this widget and let compinstall bind it for me, even
> though it's otherwise not part of the completion system.

Yes.

> What can I put *in the definition file* for this widget that will enable
> menu selection "by other means"?  I tried everything I could think of,
> poking into various values of compstate and assigning to MENUSELECT and
> whatnot, and I couldn't force menu-selection to start if the widget was
> e.g. bound with `#compdef -k menu-complete ^X:'.

  foo() {
    compadd ...
    MENUSELECT=0
    compstate[insert]=menu
  }
  zle -C foo complete-word foo
  bindkey '...' foo

Works for me.

> } And there is the question if menu-select should be re-bound to
> } _main_complete when compdef finds a widget using menu-select.
> 
> In the situation described above I definitely do not want that.

Err, I meant the automatic re-binding compinit already does for all
the completion widgets (including menu-select if complist is already
loaded), at line 452. So if compdef can make complist be loaded
automatically, should it do the same for menu-select if that isn't
re-bound already? Probably not very important...


Should I apply the patch? Shouldn't be able to do any harm, should it?

Bye
 Sven

Index: Completion/Core/compinit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/compinit,v
retrieving revision 1.3
diff -u -r1.3 compinit
--- Completion/Core/compinit	2000/05/25 14:48:38	1.3
+++ Completion/Core/compinit	2000/05/31 06:49:03
@@ -232,6 +232,7 @@
 	fi
 	[[ $1 = _* ]] || 1="_$1"
 	[[ $2 = .* ]] || 2=".$2"
+        [[ $2 = .menu-select ]] && zmodload -i zsh/complist
 	zle -C "$1" "$2" "$func"
 	if [[ -n $new ]]; then
 	  bindkey "$3" | read -A opt
@@ -250,8 +251,10 @@
 
       # Define the widget.
       if [[ $1 = .* ]]; then
+        [[ $1 = .menu-select ]] && zmodload -i zsh/complist
 	zle -C "$func" "$1" "$func"
       else
+        [[ $1 = menu-select ]] && zmodload -i zsh/complist
 	zle -C "$func" ".$1" "$func"
       fi
       shift

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* #compdef tag and menu-select
@ 2000-05-30  7:54 Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2000-05-30  7:54 UTC (permalink / raw)
  To: zsh-workers

If one has already loaded the complist module before running compinit, then
one can use `#compdef -k menu-select ...' at the top of completion functions.

If one has not already loaded complist, then compdef chokes.

At other places in the completion system we automatically load complist when
it seems wanted.  Perhaps compdef should too?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-05-31 14:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-30  8:16 #compdef tag and menu-select Sven Wischnowsky
2000-05-30 15:36 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-05-31  6:51 Sven Wischnowsky
2000-05-31 14:08 ` Bart Schaefer
2000-05-30  7:54 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).