zsh-users
 help / color / mirror / code / Atom feed
From: Nicholas Riley <njriley@illinois.edu>
To: zsh-users@zsh.org
Subject: Lazy loading completions
Date: Thu, 18 Apr 2013 17:23:11 -0500	[thread overview]
Message-ID: <njriley-497078.17231118042013@news.gmane.org> (raw)

I noticed that virtualenvwrapper was taking about 90% of my shell's 
startup time, so I switched to a lazy-loading version. However, it 
doesn't handle completions all that well, with the following:

compctl -K virtualenvwrapper_load $(echo ${_VIRTUALENVWRAPPER_API})

This loads on the first completion request then works on the second one, 
and breaks completions on other commands - $_VIRTUALENVWRAPPER_API is a 
superset of the functions for which completions are defined.

I tried this:

    source /usr/local/bin/virtualenvwrapper_lazy.sh
    _virtualenvwrapper_load_compctl() {
      compctl + ${=_VIRTUALENVWRAPPER_API}
      virtualenvwrapper_load
      eval ${$(compctl | egrep '^'$_comp_command1' -K')[3]}
    }
    compctl -K _virtualenvwrapper_load_compctl ${=_VIRTUALENVWRAPPER_API}

It works much better, except it still requires two completion requests 
for functions for which completions are *not* defined, since the eval 
does nothing in that case. Short of making my own version of 
_VIRTUALENVWRAPPER_API, is there a way to return the default completion 
result in this case?  (Or more generally, can I replace the eval 
entirely?)

Thanks,
-- 
Nicholas Riley <njriley@illinois.edu>


             reply	other threads:[~2013-04-18 22:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 22:23 Nicholas Riley [this message]
2013-04-18 23:37 ` 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-497078.17231118042013@news.gmane.org \
    --to=njriley@illinois.edu \
    --cc=zsh-users@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).