From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: #compdef tag and menu-select
Date: Wed, 31 May 2000 08:51:02 +0200 (MET DST) [thread overview]
Message-ID: <200005310651.IAA22451@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Tue, 30 May 2000 15:36:20 +0000
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
next reply other threads:[~2000-05-31 6:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-31 6:51 Sven Wischnowsky [this message]
2000-05-31 14:08 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
2000-05-30 8:16 Sven Wischnowsky
2000-05-30 15:36 ` Bart Schaefer
2000-05-30 7:54 Bart Schaefer
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=200005310651.IAA22451@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--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).