Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion but extra options allowed



On Feb 10,  7:51pm, Andy Spiegl wrote:
} Subject: Re: completion but extra options allowed
}
} Hi Bart,
} 
} > This means that you type "mutt -f +<TAB>" and zsh will complete files in
} > your $HOME/Mail directory following the + sign.  Mutt understands the + as
} > an abbreviation for the mail directory.  In the absence of a +, zsh just
} > completes file names after "mutt -f".
} This is exactly what I am trying to teach zsh-3.1.6.pws16 to do.

Yes, I noticed just after posting that this isn't actually handled by
_mutt and _mailboxes.  In attempting to do something with this, I found
some rather strange things going on in the guts of the completion.

_mutt calls _arguments in the expected way.

_arguments calls "_description arguments expl mailbox" which sets expl
to (-J -default-).

_arguments then calls "_mailboxes -J -default-" which (after setting up
the cache) calls "_wanted files expl 'mailbox specification'" which again
sets expl to (-J -default-).

_mailboxes then calls "compadd -J -default- -J -default- - ..." which
seems a bit odd.  The first -J -default- is from "$@" and the second is
of course "$expl[@]".  Is that really doing the right thing?

} And it doesn't expand local filenames either:
} eule:~>cd Mail
} eule:~/Mail>mutt -f a<TAB>

I think that's intentional on the grounds that files not in the mail
directory are not likely to be mail files.  It should probably be set
by a style, if the 'mailbox' style won't already work.

} BTW, _mailboxes expects the "mailboxes" definition to be in ~/.muttrc.  I
} had to change it, because I've got it in ~/.mutt/local, which is sourced
} from ~/.muttrc.  The same goes for the aliases. :-(

You don't need to edit _mailboxes, you just need

	set muttrc=~/.mutt/local

somewhere in your startup files.  You can do the same for pinedirectory
and maildirectory if they aren't ~/mail and ~/Mail (respectively).

Oh, wait -- _mutt is itself stomping $muttrc.  That's wrong;  I can at
least fix that part:

Index: Completion/User/_mutt
===================================================================
@@ -1,6 +1,6 @@
 #compdef mutt
 
-local curcontext="$curcontext" state line muttrc="~/.muttrc" ret=1
+local curcontext="$curcontext" state line ret=1
 
  _arguments -C \
  '::recipient:->userhost' \


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author