* mail paths and IMAP
@ 2006-06-21 11:23 Phil Pennock
2006-06-27 9:45 ` Phil Pennock
0 siblings, 1 reply; 2+ messages in thread
From: Phil Pennock @ 2006-06-21 11:23 UTC (permalink / raw)
To: Zsh Users
Hi,
I'm having trouble twisting the new completion system to another of my
whims. I'd like to be able to tab-complete IMAP mail-folders. I have
GSSAPI authentication, so no password prompt is needed, and I have a
tool which will list all subscribed folders, one per line. I can make
this work interactively, but want to automate it. Could someone please
point me to which bit of the completion system I need to be using to do
this (preferably a snippet, if it's "just" configuration):
If I type:
% mutt -f +<TAB><Ctrl-C>
% klist -t && set -A _mbox_cache ${(@f):-"$(mailcheck -B -l 2>/dev/null)"}
(and have mutt "set folder=imap://$IMAP_SERVER/") then I can
tab-complete as desired.
The problem is setting this up to work without first kicking _mailboxes
into life, to create the cache. I know that the above is bad and wrong
because it's messing with internals.
I can set explicit IMAP URLs into $mailpath, but that doesn't help since
zsh isn't too happy with the URLs:
% set -A mailboxes imap://$IMAP_SERVER/${^${(@f):-"$(mailcheck -B -l 2>/dev/null)"}// /%20}
Is there a way to do this "properly" without changing the completion
widgets? Failing that, is there a way to initialise the stuff without
typing in the "mutt -f +<TAB>" part, so that I can use the _mbox_cache
hack above?
Thank you,
--
VISTA: Viruses, Infections, Spyware, Trojans & Adware
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: mail paths and IMAP
2006-06-21 11:23 mail paths and IMAP Phil Pennock
@ 2006-06-27 9:45 ` Phil Pennock
0 siblings, 0 replies; 2+ messages in thread
From: Phil Pennock @ 2006-06-27 9:45 UTC (permalink / raw)
To: Zsh Users
On 2006-06-21 at 13:23 +0200, Phil Pennock wrote:
> I'm having trouble twisting the new completion system to another of my
> whims. I'd like to be able to tab-complete IMAP mail-folders. I have
> GSSAPI authentication, so no password prompt is needed, and I have a
> tool which will list all subscribed folders, one per line. I can make
> this work interactively, but want to automate it. Could someone please
> point me to which bit of the completion system I need to be using to do
> this (preferably a snippet, if it's "just" configuration):
Solved.
The key is to keep the data from being overriden, which can be done by
zstyle'ing muttrc to /nonexistant.
~/.zshrc contains (inter alia):
-----------------------------< cut here >-------------------------------
export IMAP_SERVER=host.example.net
# ...
function smutt { mutt "${(@)argv[1,-2]}" -f "+Shared Folders/shared/$argv[-1]" }
function init_mua_completion {
typeset -aU -g imap_folders _mutt_cache
imap_folders=(${(@f):-"$(mailcheck -B -l 2>/dev/null)"})
zstyle ':completion:*' muttrc /nonexistant # override _mutt_cache
zstyle ':completion:*' mail-directory imap://$IMAP_SERVER/
mailpath=(imap://$IMAP_SERVER/$imap_folders) # not used yet
_mutt_cache=(+$imap_folders)
compdef '_values ${${(M)imap_folders:#Shared Folders/shared/*}#Shared Folders/shared/}' smutt
# 'mutt -f +<x>' actually relative to $(mutt -Q folder)
}
klist -t && init_mua_completion
-----------------------------< cut here >-------------------------------
and I can choose my own method for calling init_mua_completion in the
window which calls kinit.
--
VISTA: Viruses, Infections, Spyware, Trojans & Adware
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-27 9:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-21 11:23 mail paths and IMAP Phil Pennock
2006-06-27 9:45 ` Phil Pennock
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).