From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13783 invoked by alias); 13 Feb 2013 09:50:37 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17636 Received: (qmail 1909 invoked from network); 13 Feb 2013 09:50:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at desy.de does not designate permitted sender hosts) Message-ID: <511B6069.1070302@desy.de> Date: Wed, 13 Feb 2013 10:44:09 +0100 From: Jan Eike von Seggern User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Caching variables during completion Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 13 Feb 2013 09:44:09.0321 (UTC) FILETIME=[ABF53590:01CE09CE] Hello, my question first: Is it possible to set a variable only once during every command-line completion, i.e. only after hitting for the first time and then keeping the contents for this specific command-line? Explanation: I'm trying to improve the completion for xrandr (mainly screen-scraping the available outputs and associated modes). However, my first try involved screen-scraping the output of `xrandr -q` every time a completion was made, which was slow. I then resorted to cache the available output/modes in a global variable. But this fails if a new output gets available. Best, Eike