From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7187 invoked by alias); 8 Jan 2013 18:24:45 -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: 17539 Received: (qmail 14919 invoked from network); 8 Jan 2013 18:24:31 -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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130108102404.ZM4596@torch.brasslantern.com> Date: Tue, 08 Jan 2013 10:24:04 -0800 In-reply-to: <20130108170145.GA4762@kelebek.lublin.se> Comments: In reply to Daniel "Re: completer that first expands global aliases (Re: dsf)" (Jan 8, 6:01pm) References: <1357650387.9070.YahooMailNeo@web171903.mail.ir2.yahoo.com> <20130108170145.GA4762@kelebek.lublin.se> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-users@zsh.org" Subject: Re: completer that first expands global aliases (Re: dsf) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 8, 6:01pm, Daniel wrote: } } If I add the _expand_alias like below, hitting ^Xm gives the expansion with a } trailing space. And nothing more happens. The hash is the cursor position: } } zstyle ':completion:most-recent-*::::' completer _expand_alias _menu _complete _match } } $ cat ~/dl/ # The problem here is that the completer style tries each function in the list until it finds one that succeeds (returns 0) at which point it stops. So you need _expand_alias to "fail" (return nonzero). You can hack this by using a little wrapper function: _expand_alias_hack() { _expand_alias "$@" return 1 } zstyle ':completion:most-recent-*::::' completer \ _expand_alias_hack _menu _complete _match However, a cleaner way to do it would be to use the compprefuncs array. This documentation for this is rather minimal; it's mostly used by the _next_tags widget to force completion to walk through the tags array. However, you can use it for oether completers as well. In this case, you can either create a new widget for the most-recent-* completion and assign to compprefuncs in the widget, or you can embed it in the completer style definition by using the -e option: zstyle -e ':completion:most-recent-*::::' completer \ 'compprefuncs=(_expand_alias) reply=(_menu _complete _match)' Note the quoting, it's important. -- Barton E. Schaefer