From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: Caching variables during completion
Date: Wed, 13 Feb 2013 20:30:44 +0000 [thread overview]
Message-ID: <20130213203044.3c9d5c27@pws-pc.ntlworld.com> (raw)
In-Reply-To: <130213093924.ZM831@torch.brasslantern.com>
On Wed, 13 Feb 2013 09:39:24 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Crudely:
>
> _xrcache() {
> if (( $_xr_HISTNO != $HISTNO ))
> then
> _xr_HISTNO=$HISTNO
> _xr_output=$(xrandr -q)
> fi
> return 1 # always "fail" so other completers are tried
> }
> zstyle ':completion:*' completer _xrcache _oldlist _expand _complete # etc.
I don't see why you couldn't put that inside the completion function
that needs the cache, so you don't need anything special with
completers:
_xrandr() { # except this is the file _xrandr
if (( $_xr_HISTNO != $HISTNO ))
then
_xr_HISTNO=$HISTNO
_xr_output=$(xrandr -q)
fi
# use $_xr_output here
}
pws
next prev parent reply other threads:[~2013-02-13 22:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 9:44 Jan Eike von Seggern
2013-02-13 17:39 ` Bart Schaefer
2013-02-13 20:30 ` Peter Stephenson [this message]
2013-02-14 0:39 ` Bart Schaefer
2013-02-14 8:38 ` Jan Eike von Seggern
2013-03-18 17:34 ` xrandr completion (was Re: Caching variables during completion) Jan Eike von Seggern
2013-03-18 21:14 ` Oliver Kiddle
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=20130213203044.3c9d5c27@pws-pc.ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--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).