zsh-workers
 help / color / mirror / code / Atom feed
From: Nicholas Riley <njriley@illinois.edu>
To: zsh-workers@zsh.org
Subject: Re: Lazy loading completions
Date: Thu, 18 Apr 2013 19:53:59 -0500	[thread overview]
Message-ID: <njriley-E4EB8D.19535918042013@news.gmane.org> (raw)
In-Reply-To: <130418163739.ZM8718__6202.1464844749$1366328467$gmane$org@torch.brasslantern.com>

In article 
<130418163739.ZM8718__6202.1464844749$1366328467$gmane$org@torch.brassla
ntern.com>,
 Bart Schaefer <schaefer@brasslantern.com> wrote:

> compctl has been mostly deprecated for several years.  You should look
> into running compinit from your shell startup to set up more modern
> completions.

Yeah, I already do use the modern completions a lot elsewhere.  I'm just 
trying to get this to work here :-)

> In fact, someone should suggest to Doug Hellmann that he stop using
> compctl commands in virtualenvwrapper.sh ... compctl won't work at all
> for someone using compinit unless they've configured it to fall through
> to old-style completions when no modern completion is found.

Huh, sounds like it's worth a bug report.  I don't have any mention of 
compctl in my compinit but maybe I got lucky.

> }     source /usr/local/bin/virtualenvwrapper_lazy.sh
> }     _virtualenvwrapper_load_compctl() {
> }       compctl + ${=_VIRTUALENVWRAPPER_API}
> }       virtualenvwrapper_load
> }       eval ${$(compctl | egrep '^'$_comp_command1' -K')[3]}
> }     }
> 
> ??  Where is the value of $_comp_command1 coming from here?  It's not set
> by virtualenvwrapper_load or virtualenvwrapper.sh as far as I can tell,
> so that egrep is doing nothing ...?

It's being set by the completion system, I guess.  I inserted a 'set' 
into the completion and grabbed the variable which contained the 
function name whose argument was being completed.  In any case, if I can 
do without it using compdef, I'm all for it...

> }     compctl -K _virtualenvwrapper_load_compctl ${=_VIRTUALENVWRAPPER_API}
> 
> With compinit loaded, I believe what you want here is
> 
>     _virtualenvwrapper_load_compctl() {
>       unset '_comps['${(k)^_comps[(R)_virtualenvwrapper_load_compctl]}']'
>       virtualenvwrapper_load
>       # Until Doug gets his act together
>       zmodload -i zsh/compctl
>       zstyle ':completion:*' use-compctl yes
>       _default
>       # After togetherness
>       # _normal
>     }
>     compdef _virtualenvwrapper_load_compctl ${=_VIRTUALENVWRAPPER_API}
> 
> but I'm not entirely confident.

Works great, thanks, though I now need to move the above to below where 
I call compinit; that may break a lot of users of virtualenvwrapper.
-- 
Nicholas Riley <njriley@illinois.edu>


       reply	other threads:[~2013-04-19  0:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <njriley-497078.17231118042013@news.gmane.org>
     [not found] ` <130418163739.ZM8718__6202.1464844749$1366328467$gmane$org@torch.brasslantern.com>
2013-04-19  0:53   ` Nicholas Riley [this message]
2013-04-20 15:26     ` 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=njriley-E4EB8D.19535918042013@news.gmane.org \
    --to=njriley@illinois.edu \
    --cc=zsh-workers@zsh.org \
    /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).