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

resetting browser when using set folder



Hi,

I'm using folder hooks and "set folder" in order to switch seput between
local mail and a few imap accounts. To each imap inbox corresponds a
different folder.
I find it really annoying that "c<tab><tab>" opens the last browsed
folder instead of the current value of "set folder", when it just
changed. I don't want mutt to show local folders when i just changed to
remote imap.
I could use c+<tab><tab> to get this behavior, but i tend to forget the
"+". Additionally, i use something like:
macro index,pager B "<change-folder>?" "show folder"
Which i would like to follow folder, when it changes.

The following patch do that, by reinitializing the browser directory
when "set folder" is used.

Best regards,
antoine
--- browser.c.orig      Wed Sep  5 20:28:05 2007
+++ browser.c
@@ -57,6 +57,7 @@ typedef struct folder_t
 
 static char LastDir[_POSIX_PATH_MAX] = "";
 static char LastDirBackup[_POSIX_PATH_MAX] = "";
+static char LastMaildir[_POSIX_PATH_MAX] = "";
 
 /* Frees up the memory allocated for the local-global variables.  */
 static void destroy_state (struct browser_state *state)
@@ -609,8 +610,11 @@ void _mutt_select_file (char *f, size_t 
   {
     if (!folder)
       getcwd (LastDir, sizeof (LastDir));
-    else if (!LastDir[0])
+    else if (!LastDir[0] || mutt_strcmp(LastMaildir,NONULL(Maildir)))
+    {
+      strfcpy (LastMaildir, NONULL(Maildir), sizeof (LastMaildir));
       strfcpy (LastDir, NONULL(Maildir), sizeof (LastDir));
+    }
     
 #ifdef USE_IMAP
     if (!buffy && mx_is_imap (LastDir))

Attachment: pgpyJiaH11saC.pgp
Description: PGP signature