From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 542 invoked by alias); 14 Aug 2015 18:03:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36171 Received: (qmail 26036 invoked from network); 14 Aug 2015 18:03:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=vsvWagmW+ydQ7+Mre1IvvhefUvAnC55RrLhP0Kv2LaA=; b=iaXOeHSDe6Q95PVulguFdOflLSDqf/Ua6ZPVr6Pq+W4fkVi5LVWOx8IHPZnE3s2Gpk qp6f6UpkiMRCHCkZTlQMY8rPPtMC9zU2pmkVAM8hoH4zxWOwiBpEE61yXbZZ33+V7LIy 29/SrqoGcTknZkuP1MJKnfid7xKZY6j7FFVzNH3+KdkFAZjRJ7RNElir2ADaEYi1sJSw bxk92HbWU3U/Pg9lsluKe0OzcezV3eceGcs3/4JxBpwAK0oZBKX+3ooQt/U6oaq2GOQ4 U/nofjoNNCiDubOEdcVsOPafahxUXNlC7S7MCa3PCahwrDNYUP1aOlnYjlREMxV+rvUg mrDg== X-Gm-Message-State: ALoCoQnrVm+sv9YPxrKZCtSK4MYnOV+DobWUn/e+PkdG8BaxaL7ispT98HOGQxVrH4f8LznXPmQv X-Received: by 10.202.240.215 with SMTP id o206mr38772216oih.94.1439575406323; Fri, 14 Aug 2015 11:03:26 -0700 (PDT) From: Bart Schaefer Message-Id: <150814110322.ZM1299@torch.brasslantern.com> Date: Fri, 14 Aug 2015 11:03:22 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Repeatable (@M) bug" (Aug 14, 10:53am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Repeatable (@M) bug MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 14, 10:53am, Sebastian Gniazdowski wrote: } } Also, when I wrote a script to repeat v-history calls automatically (no } through command line) it resulted in: } v-history:fc:21: no such event: 1000 } } This is a very interesting result, as the `history -rn 1000` call just must } work. Scripts don't normally have history. How did you run the script? Glancing through your source code, I suspect the error is not with (@M). "history 1000" means to start at the 1000th history entry and list up to the current history entry (which must be event number 1000 or greater, otherwise you get that "no such event" error). Adding -r reverses the order of the output, not the direction of selecting the event numbers. I suspect you mean "history -rn -1000" to select events up to 1000 history entries ago and list them starting with the current entry. However, You might avoid running `history -rn` and instead examine the array $historywords from the zsh/parameter module. It has all the individual words from the history with the most recent at the beginning of the array, which seems to be exactly what you want. That is, instead of list=( `history -rn 1000` ) list=( "${(@M)list:#*$1*}" ) use zmodload zsh/parameter list=( "${(@M)historywords:#*$1*}" )