zsh-users
 help / color / mirror / code / Atom feed
* site-function for completion from specific directory
@ 2014-08-26 13:00 Eric Smith
  2014-08-26 13:46 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Smith @ 2014-08-26 13:00 UTC (permalink / raw)
  To: Zsh Users

Oh zshellers,

This is my use case.

I want to complete the following command;
mutt -f [foo]<tab>

so that it expands nothing or the string `foo' as if they were
~/Mail/<tab> or ~/Mail/foo<tab>
respectively.

How would I write a compdef site-function for this and also
ideally for my shell function wrapper around `mutt -f'?

-- 
Eric Smith


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: site-function for completion from specific directory
  2014-08-26 13:00 site-function for completion from specific directory Eric Smith
@ 2014-08-26 13:46 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2014-08-26 13:46 UTC (permalink / raw)
  To: Zsh Users

On Tue, 26 Aug 2014 15:00:24 +0200
Eric Smith <es@fruitcom.com> wrote:
> Oh zshellers,
> 
> This is my use case.
> 
> I want to complete the following command;
> mutt -f [foo]<tab>
> 
> so that it expands nothing or the string `foo' as if they were
> ~/Mail/<tab> or ~/Mail/foo<tab>
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-26 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 13:00 site-function for completion from specific directory Eric Smith
2014-08-26 13:46 ` Peter Stephenson

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).