From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16357 invoked by alias); 26 Aug 2014 13:57:12 -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: 19035 Received: (qmail 26848 invoked from network); 26 Aug 2014 13:56:59 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f156d0000063c7-06-53fc8fccec03 Date: Tue, 26 Aug 2014 14:46:51 +0100 From: Peter Stephenson To: Zsh Users Subject: Re: site-function for completion from specific directory Message-id: <20140826144651.26888ba9@pwslap01u.europe.root.pri> In-reply-to: References: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd0z/X+CDXaeUbXYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Mr60NbAXdHFXPGluZGpgfMvRxcjJISFgIrF2wgwWCFtM4sK9 9WxdjFwcQgJLGSWWtv9mgnKYJGae7GYHqWIRUJXY+eYYG4jNJmAoMXXTbEYQW0RAUeLMr29M ILawgKPE5VVHWUFsXgF7iQ1/FjKD2JwC1hKLblwFqxcSsJK4uOQUmM0voC9x9e8nJogr7CVm XjnDCNErKPFj8j2w65gFtCQ2b2tihbDlJTavecs8gVFgFpKyWUjKZiEpW8DIvIpRNLU0uaA4 KT3XUK84Mbe4NC9dLzk/dxMjJAi/7GBcfMzqEKMAB6MSD++Hkt/BQqyJZcWVuYcYJTiYlUR4 fyT9CRbiTUmsrEotyo8vKs1JLT7EyMTBKdXA6PjMP7zzCttOrR0NLks4ts3/I6q2zfq7eO00 EeN7x9z8VedFpTQwHyzaF68brLW8V7fjacwZl4sNDTYLZ9cd/pnMd8ODMzlQbuXmE7pek+qd 16zkX7ba33VxmV27vbfS+ZU3rgQH7HxpfVae6xGb0So/+xhpO4VnInMuMmmsPjGrcf2fJ2pt SizFGYmGWsxFxYkAcRQCUiACAAA= On Tue, 26 Aug 2014 15:00:24 +0200 Eric Smith wrote: > Oh zshellers, > > This is my use case. > > I want to complete the following command; > mutt -f [foo] > > so that it expands nothing or the string `foo' as if they were > ~/Mail/ or ~/Mail/foo > respectively. > > How would I write a compdef site-function for this and also > ideally for my shell function wrapper around `mutt -f'? If I've understood the basics of what you're trying to do --- check for mailboxes in your mail directory and complete the bare name, removing the common directory part --- then this completion should already work. However, it looks like the function that handles this, _mailboxes from Completion/Unix/Type/_mailboxes, makes some assumptions about where to get the values for your mutt configuration. Try using ^X? to get some output and work out which paths it's taking through the function. My reading of the code (which I'm just looking at for the first time, at least that I can remember, I expect I glanced at it years ago) is it should pick the directories in the code following line 152 of that file. You'll need to trace back where those variables come from if this isn't happening. I haven't worked out when you'd want it to complete nothing, and if the square brackets are somehow crucial to the completion then I'm missing the point entirely. pws