<<< Date Index >>>     <<< Thread Index >>>

Re: Getting mutt to NOT open default IMAP folder at startup



On Thu, May/29/2008 02:52:17PM, Kyle Wheeler wrote:
> On Thursday, May 29 at 03:06 PM, quoth Ethan Mallove:
> > When mutt starts up, it immediately selects my =Inbox. Is there a 
> > way to turn this behavior off? I ask because I'm launching mutt 
> > using -e, e.g.,
> >
> >  $ mutt -e 'push "c=foo\n"'
> >
> > (It may seem odd to not just do "-f =foo". I'm using "push" 
> > to get the "foo" folder in my "Open mailbox" history.) The 
> > problem is that when I use the "-e push" command, mutt opens 
> > two folders one after the other: first Inbox (default?), and 
> > then "foo". Is there a way to tell mutt to *not* open Inbox 
> > at startup?
> 
> So, if I understand you, the goal is to get mutt to have "foo" in the 
> history, and the issue here is that your workaround to manually put 
> something into the history has a side-effect you don't like (namely, 
> opening the inbox).
> 
> How about combining things? Like so:
> 
>      $ mutt -f =foo -e 'push "c=foo\n"'
> 
> Of course, what'll happen there is that mutt will do exactly what it's 
> told. It'll open the foo mailbox, and then will re-open it. But at 
> least it won't open the inbox first.
> 
> I think you may be able to avoid opening it twice by telling mutt to 
> do something other than open a mailbox at first. Like so:
> 
>      $ mutt -y -e 'push "c<kill-line>=foo\n "'
> 
> What that'll do is tell mutt to open up to a mailbox listing first, 
> and THEN change into the foo mailbox, thereby only opening foo once 
> (the "kill-line" bit is because the chdir prompt in the mailbox 
> browser behaves a little differently than the chdir prompt in the 
> index listing, and the space at the end is important for the same 
> reason).
> 
> One last thing... when you're doing macros (that includes push 
> commands), it's *best* to avoid using command letters. What can happen 
> is that someday you may change a key binding and then discover that 
> all your macros need to be modified. You should really get into the 
> habit of calling functions directly. Presumably you're going to be 
> using a script to call mutt, so you don't have to retype this all the 
> time. So, try this:
> 
>     $ mutt -y -e 'push "<change-dir><kill-line>=foo<enter><view-file>"'

This does *exactly* what I want. Thanks!

-Ethan

> 
> ... of course, if all you want is for mutt to have a specific thing in 
> its history, it's more direct to simply use the $history_file setting, 
> and then add something to the end of it just before launching mutt. 
> For example...
> 
>      $ echo '6:=foo|' >> ~/.mutthistory && mutt -f =foo
> 
> ~Kyle
> -- 
> What progress we are making. In the Middle Ages they would have burned 
> me. Now they are content with burning my books.
>                                                        -- Sigmund Freud