--- orig-OPS	2002-04-25 06:26:56.000000000 -0700
+++ OPS	2006-07-09 21:24:45.000000000 -0700
@@ -9,10 +9,11 @@
 OP_BROWSER_TELL "display the currently selected file's name"
 OP_BROWSER_SUBSCRIBE "subscribe to current mailbox (IMAP only)"
 OP_BROWSER_UNSUBSCRIBE "unsubscribe to current mailbox (IMAP only)"
 OP_BROWSER_TOGGLE_LSUB "toggle view all/subscribed mailboxes (IMAP only)"
 OP_CHANGE_DIRECTORY "change directories"
+OP_CHOOSE_DIRECTORY "choose a directory"
 OP_CHECK_NEW "check mailboxes for new mail"
 OP_COMPOSE_ATTACH_FILE "attach a file(s) to this message"
 OP_COMPOSE_ATTACH_MESSAGE "attach message(s) to this message"
 OP_COMPOSE_EDIT_BCC "edit the BCC list"
 OP_COMPOSE_EDIT_CC "edit the CC list"
@@ -66,10 +67,11 @@
 OP_EDITOR_EOL "jump to the end of the line"
 OP_EDITOR_FORWARD_CHAR "move the cursor one character to the right"
 OP_EDITOR_FORWARD_WORD "move the cursor to the end of the word"
 OP_EDITOR_HISTORY_DOWN "scroll down through the history list"
 OP_EDITOR_HISTORY_UP "scroll up through the history list"
+OP_EDITOR_KILL_BOL "delete chars from cursor to beginning of line"
 OP_EDITOR_KILL_EOL "delete chars from cursor to end of line"
 OP_EDITOR_KILL_EOW "delete chars from the cursor to the end of the word"
 OP_EDITOR_KILL_LINE "delete all chars on the line"
 OP_EDITOR_KILL_WORD "delete the word in front of the cursor"
 OP_EDITOR_QUOTE_CHAR "quote the next typed key"
--- orig-OPS.PGP	2001-02-13 07:01:57.000000000 -0800
+++ OPS.PGP	2006-07-03 12:39:25.000000000 -0700
@@ -1,7 +1,9 @@
 OP_COMPOSE_ATTACH_KEY "attach a PGP public key"
 OP_COMPOSE_PGP_MENU "show PGP options"
+OP_COMPOSE_TOGGLE_SIGN "sign/don't sign current message"
+OP_COMPOSE_TOGGLE_ENCRYPT "encrypt/don't encrypt current message"
 OP_EXTRACT_KEYS "extract PGP public keys"
 OP_FORGET_PASSPHRASE "wipe PGP passphrase from memory"
 OP_MAIL_KEY "mail a PGP public key"
 OP_VERIFY_KEY "verify a PGP public key"
 OP_VIEW_ID "view the key's user id"
--- orig-browser.c	2002-07-24 02:33:59.000000000 -0700
+++ browser.c	2006-07-03 12:39:25.000000000 -0700
@@ -37,10 +37,11 @@
 #include <errno.h>
 
 static struct mapping_t FolderHelp[] = {
   { N_("Exit"),  OP_EXIT },
   { N_("Chdir"), OP_CHANGE_DIRECTORY },
+  { N_("Newdir"), OP_CHOOSE_DIRECTORY },
   { N_("Mask"),  OP_ENTER_MASK },
   { N_("Help"),  OP_HELP },
   { NULL }
 };
 
@@ -534,11 +535,11 @@
   char helpstr[SHORT_STRING];
   char title[STRING];
   struct browser_state state;
   MUTTMENU *menu;
   struct stat st;
-  int i, killPrefix = 0;
+  int i, killPrefix = 0, len;
   int multiple = (flags & M_SEL_MULTI)  ? 1 : 0;
   int folder   = (flags & M_SEL_FOLDER) ? 1 : 0;
   int buffy    = (flags & M_SEL_BUFFY)  ? 1 : 0;
 
   buffy = buffy && folder;
@@ -642,10 +643,12 @@
 
   FOREVER
   {
     switch (i = mutt_menuLoop (menu))
     {
+      case OP_CHANGE_DIRECTORY:
+	/* Fall through to OP_GENERIC_SELECT_ENTRY */
       case OP_GENERIC_SELECT_ENTRY:
 
 	if (!state.entrylen)
 	{
 	  mutt_error _("No files match the file mask");
@@ -670,15 +673,20 @@
 	  else if (state.imap_browse)
 	  {
             strfcpy (buf, state.entry[menu->current].name, sizeof (buf));
 	  }
 #endif
-	  else
-	    snprintf (buf, sizeof (buf), "%s/%s", LastDir, 
+	  else {
+	    /* Pretend a trailing '/' in LastDir doesn't exist */
+	    len = mutt_strlen (LastDir);
+	    if (len>1 && LastDir[len-1]=='/')
+	      len--;
+	    snprintf (buf, sizeof (buf), "%.*s/%s", len, LastDir, 
 		      state.entry[menu->current].name);
+	  }
 
-	  if ((mx_get_magic (buf) <= 0)
+	  if ((i == OP_CHANGE_DIRECTORY) || (mx_get_magic (buf) <= 0)
 #ifdef USE_IMAP
 	    || state.entry[menu->current].inferiors
 #endif
 	    )
 	  {
@@ -687,25 +695,21 @@
 	    /* save the old directory */
 	    strfcpy (OldLastDir, LastDir, sizeof (OldLastDir));
 
 	    if (mutt_strcmp (state.entry[menu->current].name, "..") == 0)
 	    {
-	      if (mutt_strcmp ("..", LastDir + mutt_strlen (LastDir) - 2) == 0)
-		strcat (LastDir, "/..");	/* __STRCAT_CHECKED__ */
-	      else
-	      {
-		char *p = strrchr (LastDir + 1, '/');
-
-		if (p)
-		  *p = 0;
-		else
-		{
-		  if (LastDir[0] == '/')
-		    LastDir[1] = 0;
-		  else
-		    strcat (LastDir, "/..");	/* __STRCAT_CHECKED__ */
-		}
+	      char *p;
+	      len = mutt_strlen (LastDir);
+	      if (len > 1 && LastDir[len-1] == '/')
+		LastDir[--len] = 0;
+
+	      p = strrchr (LastDir + 1, '/');
+	      if (p)
+		*++p = 0;
+	      else {
+		LastDir[0] = '/';
+		LastDir[1] = 0;
 	      }
 	    }
 	    else if (buffy)
 	    {
 	      strfcpy (LastDir, state.entry[menu->current].name, sizeof (LastDir));
@@ -734,11 +738,14 @@
 	    }
 #endif
 	    else
 	    {
 	      char tmp[_POSIX_PATH_MAX];
-	      snprintf (tmp, sizeof (tmp), "%s/%s", LastDir, state.entry[menu->current].name);
+	      len = mutt_strlen (LastDir);
+	      if (len>1 && LastDir[len-1]=='/')
+		LastDir[--len] = 0;
+	      snprintf (tmp, sizeof (tmp), "%s/%s/", LastDir, state.entry[menu->current].name);
 	      strfcpy (LastDir, tmp, sizeof (LastDir));
 	    }
 
 	    destroy_state (&state);
 	    if (killPrefix)
@@ -906,11 +913,11 @@
 	  FREE (&mx.mbox);
         }
         break;
 #endif
       
-      case OP_CHANGE_DIRECTORY:
+      case OP_CHOOSE_DIRECTORY:
 
 	strfcpy (buf, LastDir, sizeof (buf));
 #ifdef USE_IMAP
 	if (!state.imap_browse)
 #endif
@@ -923,10 +930,34 @@
 
 	if (mutt_get_field (_("Chdir to: "), buf, sizeof (buf), M_FILE) == 0 &&
 	    buf[0])
 	{
 	  buffy = 0;	  
+#ifdef USE_IMAP
+	  if (!state.imap_browse)
+#endif
+	  {
+	    /* add '/' at the end of the directory name */
+	    len = mutt_strlen (buf);
+	    if (sizeof (buf) > len+1 && buf[len-1] != '/') {
+	      buf[len] = '/';
+	      buf[++len] = 0;
+	    }
+	    /* manually take care of trailing ".." */
+	    if (len>3 && 0 == mutt_strcmp (&buf[len-4], "/../")) {
+	      char *p;
+	      buf[len-4] = 0;
+	      p = strrchr (buf, '/');
+	      if (p)
+		len = p - buf + 1;
+	      else {
+		buf[0] = '/';
+		len = 1;
+	      }
+	      buf[len] = 0;
+	    }
+	  }
 	  mutt_expand_path (buf, sizeof (buf));
 #ifdef USE_IMAP
 	  if (mx_is_imap (buf))
 	  {
 	    strfcpy (LastDir, buf, sizeof (LastDir));
--- orig-compose.c	2002-07-24 01:41:29.000000000 -0700
+++ compose.c	2006-07-03 12:39:25.000000000 -0700
@@ -1190,10 +1190,22 @@
       case OP_COMPOSE_PGP_MENU:
 
 	msg->pgp = pgp_send_menu (msg->pgp, &menu->redraw);
 	break;
 
+      case OP_COMPOSE_TOGGLE_SIGN:
+
+	msg->pgp ^= PGPSIGN;
+	redraw_pgp_lines (msg->pgp);
+	break;
+
+      case OP_COMPOSE_TOGGLE_ENCRYPT:
+
+	msg->pgp ^= PGPENCRYPT;
+	redraw_pgp_lines (msg->pgp);
+	break;
+
       case OP_FORGET_PASSPHRASE:
 
 	mutt_forget_passphrase ();
 	break;
 
--- orig-configure	2004-02-11 06:04:31.000000000 -0800
+++ configure	2006-07-09 21:37:28.000000000 -0700
@@ -4502,14 +4502,10 @@
 
         cat >> confdefs.h <<\EOF
 #define HOMESPOOL 1
 EOF
 
-        cat >> confdefs.h <<\EOF
-#define USE_DOTLOCK 1
-EOF
-
         mutt_cv_setgid=no
 else
         # Check whether --with-mailpath or --without-mailpath was given.
 if test "${with_mailpath+set}" = set; then
   withval="$with_mailpath"
@@ -4583,14 +4579,11 @@
 
 echo "$ac_t""$mutt_cv_worldwrite" 1>&6
 
         mutt_cv_setgid=no
         if test $mutt_cv_worldwrite = yes; then
-                cat >> confdefs.h <<\EOF
-#define USE_DOTLOCK 1
-EOF
-
+                true
         else
 
                 echo $ac_n "checking if $mutt_cv_mailpath is group writable""... $ac_c" 1>&6
 echo "configure:4596: checking if $mutt_cv_mailpath is group writable" >&5
 if eval "test \"`echo '$''{'mutt_cv_groupwrite'+set}'`\" = set"; then
@@ -4630,14 +4623,10 @@
 
 echo "$ac_t""$mutt_cv_groupwrite" 1>&6
 
                 if test $mutt_cv_groupwrite = yes; then
                         cat >> confdefs.h <<\EOF
-#define USE_DOTLOCK 1
-EOF
-
-                        cat >> confdefs.h <<\EOF
 #define USE_SETGID 1
 EOF
 
                         mutt_cv_setgid=yes
                 fi
--- orig-copy.c	2001-09-26 03:33:09.000000000 -0700
+++ copy.c	2006-07-03 12:39:25.000000000 -0700
@@ -28,11 +28,11 @@
 #endif
 
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <unistd.h> /* needed for SEEK_SET under SunOS 4.1.4 */
+#include <unistd.h>
 
 static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout, char *date);
 
 /* Ok, the only reason for not merging this with mutt_copy_header()
  * below is to avoid creating a HEADER structure in message_handler().
@@ -483,11 +483,12 @@
 
 	if (fail)
 	{
 	  mutt_error ("The length calculation was wrong by %ld bytes", fail);
 	  new_length += fail;
-	  mutt_sleep (1);
+	  if (ErrorDelay)
+	    mutt_sleep (1000UL * ErrorDelay);
 	}
       }
 #endif
 
       /* Update original message if we are sync'ing a mailfolder */ 
--- orig-enter.c	2001-10-02 15:20:03.000000000 -0700
+++ enter.c	2006-07-03 12:39:25.000000000 -0700
@@ -308,10 +308,21 @@
 
 	case OP_EDITOR_KILL_LINE:
 	  state->curpos = state->lastchar = 0;
 	  break;
 
+	case OP_EDITOR_KILL_BOL:
+	  /* delete to begining of line */
+	  if (state->curpos != 0)
+	  {
+	    memmove (state->wbuf, state->wbuf + state->curpos,
+		     (state->lastchar - state->curpos) * sizeof (wchar_t));
+	    state->lastchar -= state->curpos;
+	    state->curpos = 0;
+	  }
+	  break;
+
 	case OP_EDITOR_KILL_EOL:
 	  state->lastchar = state->curpos;
 	  break;
 
 	case OP_EDITOR_BACKWARD_CHAR:
--- orig-functions.h	2001-09-11 04:20:34.000000000 -0700
+++ functions.h	2006-07-03 12:39:25.000000000 -0700
@@ -46,22 +46,22 @@
   { "first-entry",	OP_FIRST_ENTRY,		"=" },
   { "enter-command",	OP_ENTER_COMMAND,	":" },
   { "next-line",	OP_NEXT_LINE,		">" },
   { "previous-line",	OP_PREV_LINE,		"<" },
   { "half-up",		OP_HALF_UP,		"[" },
-  { "half-down", 	OP_HALF_DOWN,		"]" },
+  { "half-down",	OP_HALF_DOWN,		"]" },
   { "help",		OP_HELP,		"?" },
   { "tag-prefix",	OP_TAG_PREFIX,		";" },
   { "shell-escape",	OP_SHELL_ESCAPE,	"!" },
   { "select-entry",	OP_GENERIC_SELECT_ENTRY,M_ENTER_S },
   { "search",		OP_SEARCH,		"/" },
   { "search-reverse",	OP_SEARCH_REVERSE,	"\033/" },
   { "search-opposite",	OP_SEARCH_OPPOSITE,	NULL },
   { "jump",		OP_JUMP,		NULL },
-  { "current-top",      OP_CURRENT_TOP,		NULL },
-  { "current-middle",   OP_CURRENT_MIDDLE,	NULL },
-  { "current-bottom",   OP_CURRENT_BOTTOM,	NULL },
+  { "current-top",	OP_CURRENT_TOP,		NULL },
+  { "current-middle",	OP_CURRENT_MIDDLE,	NULL },
+  { "current-bottom",	OP_CURRENT_BOTTOM,	NULL },
   { NULL,		0,			NULL }
 };
 
 struct binding_t OpMain[] = {
   { "create-alias",		OP_CREATE_ALIAS,		"a" },
@@ -86,11 +86,11 @@
   { "fetch-mail",		OP_MAIN_FETCH_MAIL,		"G" },
 #endif
 #ifdef USE_IMAP
   { "imap-fetch-mail",		OP_MAIN_IMAP_FETCH,		NULL },
 #endif
-  { "display-toggle-weed",		OP_DISPLAY_HEADERS,		"h" },
+  { "display-toggle-weed",	OP_DISPLAY_HEADERS,		"h" },
   { "next-undeleted",		OP_MAIN_NEXT_UNDELETED,		"j" },
   { "previous-undeleted",	OP_MAIN_PREV_UNDELETED,		"k" },
   { "limit",			OP_MAIN_LIMIT,			"l" },
   { "list-reply",		OP_LIST_REPLY,			"L" },
   { "mail",			OP_MAIL,			"m" },
@@ -115,11 +115,11 @@
   { "tag-pattern",		OP_MAIN_TAG_PATTERN,		"T" },
   { "tag-subthread",		OP_TAG_SUBTHREAD,		NULL },
   { "tag-thread",		OP_TAG_THREAD,			"\033t" },
   { "untag-pattern",		OP_MAIN_UNTAG_PATTERN,		"\024" },
   { "undelete-message",		OP_UNDELETE,			"u" },
-  { "undelete-pattern",		OP_MAIN_UNDELETE_PATTERN,	"U"},
+  { "undelete-pattern",		OP_MAIN_UNDELETE_PATTERN,	"U" },
   { "undelete-subthread",	OP_UNDELETE_SUBTHREAD,		"\033u" },
   { "undelete-thread",		OP_UNDELETE_THREAD,		"\025" },
   { "view-attachments",		OP_VIEW_ATTACHMENTS,		"v" },
   { "show-version",		OP_VERSION,			"V" },
   { "set-flag",			OP_MAIN_SET_FLAG,		"w" },
@@ -131,23 +131,18 @@
   { "next-new",			OP_MAIN_NEXT_NEW,		"\t" },
   { "previous-new",		OP_MAIN_PREV_NEW,		"\033\t" },
   { "next-unread",		OP_MAIN_NEXT_UNREAD,		NULL },
   { "previous-unread",		OP_MAIN_PREV_UNREAD,		NULL },
   { "parent-message",		OP_MAIN_PARENT_MESSAGE,		"P" },
-
-
 #ifdef HAVE_PGP
   { "check-traditional-pgp",	OP_CHECK_TRADITIONAL,		"\033P" },
   { "extract-keys",		OP_EXTRACT_KEYS,		"\013" },
   { "forget-passphrase",	OP_FORGET_PASSPHRASE,		"\006" },
   { "mail-key",			OP_MAIL_KEY,			"\033k" },
   { "decrypt-copy",		OP_DECRYPT_COPY,		NULL },
   { "decrypt-save",		OP_DECRYPT_SAVE,		NULL },
 #endif
-
-
-
   { NULL,			0,				NULL }
 };
 
 struct binding_t OpPager[] = {
   { "create-alias",	OP_CREATE_ALIAS,		"a" },
@@ -165,11 +160,11 @@
   { "flag-message",	OP_FLAG_MESSAGE,		"F" },
   { "group-reply",	OP_GROUP_REPLY,			"g" },
 #ifdef USE_IMAP
   { "imap-fetch-mail",  OP_MAIN_IMAP_FETCH,		NULL },
 #endif
-  { "display-toggle-weed",	OP_DISPLAY_HEADERS,		"h" },
+  { "display-toggle-weed",OP_DISPLAY_HEADERS,		"h" },
   { "next-undeleted",	OP_MAIN_NEXT_UNDELETED,		"j" },
   { "next-entry",	OP_NEXT_ENTRY,			"J" },
   { "previous-undeleted",OP_MAIN_PREV_UNDELETED,	"k" },
   { "previous-entry",	OP_PREV_ENTRY,			"K" },
   { "list-reply",	OP_LIST_REPLY,			"L" },
@@ -221,32 +216,24 @@
   { "half-up",		OP_HALF_UP,			NULL },
   { "half-down",	OP_HALF_DOWN,			NULL },
   { "previous-line",	OP_PREV_LINE,			NULL },
   { "bottom",		OP_PAGER_BOTTOM,		NULL },
   { "parent-message",	OP_MAIN_PARENT_MESSAGE,		"P" },
-
-
-
-
 #ifdef HAVE_PGP
-  { "check-traditional-pgp",	OP_CHECK_TRADITIONAL,		"\033P"   },
+  { "check-traditional-pgp",OP_CHECK_TRADITIONAL,	"\033P" },
   { "extract-keys",	OP_EXTRACT_KEYS,		"\013" },
   { "forget-passphrase",OP_FORGET_PASSPHRASE,		"\006" },
   { "mail-key",		OP_MAIL_KEY,			"\033k" },
-  { "decrypt-copy",		OP_DECRYPT_COPY,		NULL },
-  { "decrypt-save",		OP_DECRYPT_SAVE,		NULL },
+  { "decrypt-copy",	OP_DECRYPT_COPY,		NULL },
+  { "decrypt-save",	OP_DECRYPT_SAVE,		NULL },
 #endif
-
-
-
-
   { NULL,		0,				NULL }
 };
 
 struct binding_t OpAttach[] = {
   { "bounce-message",	OP_BOUNCE_MESSAGE,		"b" },
-  { "display-toggle-weed",	OP_DISPLAY_HEADERS,	"h" },
+  { "display-toggle-weed",OP_DISPLAY_HEADERS,		"h" },
   { "edit-type",	OP_EDIT_TYPE,			"\005" },
   { "print-entry",	OP_PRINT,			"p" },
   { "save-entry",	OP_SAVE,			"s" },
   { "pipe-entry",	OP_PIPE,			"|" },
   { "view-mailcap",	OP_ATTACH_VIEW_MAILCAP,		"m" },
@@ -258,20 +245,15 @@
   { "view-text",	OP_ATTACH_VIEW_TEXT,		"T" },
   { "view-attach",	OP_VIEW_ATTACH,			M_ENTER_S },
   { "delete-entry",	OP_DELETE,			"d" },
   { "undelete-entry",	OP_UNDELETE,			"u" },
   { "collapse-parts",	OP_ATTACH_COLLAPSE,		"v" },
-  
-
 #ifdef HAVE_PGP
-  { "check-traditional-pgp",	OP_CHECK_TRADITIONAL,		"\033P"   },
-  { "extract-keys",		OP_EXTRACT_KEYS,		"\013" },
-  { "forget-passphrase",	OP_FORGET_PASSPHRASE,		"\006" },
+  { "check-traditional-pgp",OP_CHECK_TRADITIONAL,	"\033P" },
+  { "extract-keys",	OP_EXTRACT_KEYS,		"\013" },
+  { "forget-passphrase",OP_FORGET_PASSPHRASE,		"\006" },
 #endif
-
-
-
   { NULL,		0,				NULL }
 };
 
 struct binding_t OpCompose[] = {
   { "attach-file",	OP_COMPOSE_ATTACH_FILE,		"a" },
@@ -288,11 +270,11 @@
   { "edit-encoding",	OP_COMPOSE_EDIT_ENCODING,	"\005" },
   { "edit-from",	OP_COMPOSE_EDIT_FROM,		"\033f" },
   { "edit-fcc",		OP_COMPOSE_EDIT_FCC,		"f" },
   { "filter-entry",	OP_FILTER,			"F" },
   { "get-attachment",	OP_COMPOSE_GET_ATTACHMENT,	"G" },
-  { "display-toggle-weed",	OP_DISPLAY_HEADERS,		"h" },
+  { "display-toggle-weed",OP_DISPLAY_HEADERS,		"h" },
   { "ispell",		OP_COMPOSE_ISPELL,		"i" },
   { "print-entry",	OP_PRINT,			"l" },
   { "edit-mime",	OP_COMPOSE_EDIT_MIME,		"m" },
   { "new-mime",		OP_COMPOSE_NEW_MIME,		"n" },
   { "postpone-message",	OP_COMPOSE_POSTPONE_MESSAGE,	"P" },
@@ -306,21 +288,20 @@
   { "toggle-recode",    OP_COMPOSE_TOGGLE_RECODE,	NULL },
   { "update-encoding",	OP_COMPOSE_UPDATE_ENCODING,	"U" },
   { "view-attach",	OP_VIEW_ATTACH,			M_ENTER_S },
   { "send-message",	OP_COMPOSE_SEND_MESSAGE,	"y" },
   { "pipe-entry",	OP_PIPE,			"|" },
-
 #ifdef HAVE_PGP
   { "attach-key",	OP_COMPOSE_ATTACH_KEY,		"\033k" },
   { "forget-passphrase",OP_FORGET_PASSPHRASE,		"\006"  },
   { "pgp-menu",		OP_COMPOSE_PGP_MENU,		"p" 	},
+  { "toggle-sign",	OP_COMPOSE_TOGGLE_SIGN,		"[" },
+  { "toggle-encrypt",	OP_COMPOSE_TOGGLE_ENCRYPT,	"]" },
 #endif
-
 #ifdef MIXMASTER
   { "mix",		OP_COMPOSE_MIX,			"M" },
 #endif
-  
   { NULL,		0,				NULL }
 };
 
 struct binding_t OpPost[] = {
   { "delete-entry",	OP_DELETE,	"d" },
@@ -331,17 +312,17 @@
 struct binding_t OpAlias[] = {
   { "delete-entry",	OP_DELETE,	"d" },
   { "undelete-entry",	OP_UNDELETE,	"u" },
   { NULL,		0,		NULL }
 };
-  
 
 /* The file browser */
 struct binding_t OpBrowser[] = {
   { "change-dir",	OP_CHANGE_DIRECTORY,	"c" },
   { "display-filename",	OP_BROWSER_TELL,	"@" },
   { "enter-mask",	OP_ENTER_MASK,		"m" },
+  { "choose-dir",	OP_CHOOSE_DIRECTORY,	"C" },
   { "sort",		OP_SORT,		"o" },
   { "sort-reverse",	OP_SORT_REVERSE,	"O" },
   { "select-new",	OP_BROWSER_NEW_FILE,	"N" },
   { "check-new",	OP_CHECK_NEW,		NULL },
   { "toggle-mailboxes", OP_TOGGLE_MAILBOXES, 	"\t" },
@@ -375,11 +356,12 @@
   { "delete-char",	OP_EDITOR_DELETE_CHAR,		"\004" },
   { "eol",		OP_EDITOR_EOL,			"\005" },
   { "forward-char",	OP_EDITOR_FORWARD_CHAR,		"\006" },
   { "forward-word",	OP_EDITOR_FORWARD_WORD,		"\033f"},
   { "backspace",	OP_EDITOR_BACKSPACE,		"\010" },
-  { "kill-eol",		OP_EDITOR_KILL_EOL,		"\013" },
+  { "kill-bol",		OP_EDITOR_KILL_BOL,		"\013" },
+  { "kill-eol",		OP_EDITOR_KILL_EOL,		NULL   },
   { "kill-eow",		OP_EDITOR_KILL_EOW,		"\033d"},
   { "kill-line",	OP_EDITOR_KILL_LINE,		"\025" },
   { "quote-char",	OP_EDITOR_QUOTE_CHAR,		"\026" },
   { "kill-word",	OP_EDITOR_KILL_WORD,		"\027" },
   { "complete",		OP_EDITOR_COMPLETE,		"\t"   },
@@ -389,27 +371,24 @@
   { "history-down",	OP_EDITOR_HISTORY_DOWN,		NULL   },
   { "transpose-chars",	OP_EDITOR_TRANSPOSE_CHARS,	NULL   },
   { NULL,		0,				NULL   }
 };
 
-
-
 #ifdef HAVE_PGP
 struct binding_t OpPgp[] = {
   { "verify-key",	OP_VERIFY_KEY,		"c" },
   { "view-name",	OP_VIEW_ID,		"%" },
-  { NULL,		0,				NULL }
+  { NULL,		0,			NULL }
 };
 #endif /* HAVE_PGP */
 
-
 #ifdef MIXMASTER
 struct binding_t OpMix[] = {
-  { "accept",		OP_MIX_USE,	M_ENTER_S },
-  { "append",		OP_MIX_APPEND,	"a"       },
-  { "insert",		OP_MIX_INSERT,	"i"       },
-  { "delete",		OP_MIX_DELETE,  "d"	  },
-  { "chain-prev",	OP_MIX_CHAIN_PREV, "<left>" },
-  { "chain-next",	OP_MIX_CHAIN_NEXT, "<right>" },
-  { NULL, 		0, 		NULL }
+  { "accept",		OP_MIX_USE,		M_ENTER_S },
+  { "append",		OP_MIX_APPEND,		"a" },
+  { "insert",		OP_MIX_INSERT,		"i" },
+  { "delete",		OP_MIX_DELETE,		"d" },
+  { "chain-prev",	OP_MIX_CHAIN_PREV,	"<left>" },
+  { "chain-next",	OP_MIX_CHAIN_NEXT,	"<right>" },
+  { NULL, 		0, 			NULL }
 };
 #endif /* MIXMASTER */
--- orig-globals.h	2002-01-03 12:57:19.000000000 -0800
+++ globals.h	2006-07-03 12:39:25.000000000 -0700
@@ -139,10 +139,13 @@
 #else
 extern unsigned char QuadOptions[];
 #endif
 
 WHERE unsigned short Counter INITVAL (0);
+WHERE unsigned short InfoDelay INITVAL (1000);
+WHERE unsigned short WarnDelay INITVAL (2000);
+WHERE unsigned short ErrorDelay INITVAL (5000);
 
 WHERE short ConnectTimeout;
 WHERE short HistSize;
 WHERE short PagerContext;
 WHERE short PagerIndexLines;
--- orig-hdrline.c	2002-03-25 03:29:32.000000000 -0800
+++ hdrline.c	2006-07-03 12:39:25.000000000 -0700
@@ -363,11 +363,12 @@
 		len -= 2;
 	      }
 	      else
 		break; /* not enough space */
 	    }
-	    cp++;
+	    if(*cp)
+	      cp++;
 	  }
 	  else
 	  {
 	    *p++ = *cp++;
 	    len--;
--- orig-help.c	2000-10-07 11:06:24.000000000 -0700
+++ help.c	2006-07-06 15:44:00.000000000 -0700
@@ -206,11 +206,11 @@
   if (split)
   {
     print_macro (f, LONG_STRING, &t3);
     fputc ('\n', f);
   }
-  else
+  else if(t3)
   {
     while (*t3)
     {
       n = COLS - col;
 
--- orig-hook.c	2001-06-29 03:06:14.000000000 -0700
+++ hook.c	2006-07-03 12:39:25.000000000 -0700
@@ -287,11 +287,12 @@
       {
 	if (mutt_parse_rc_line (tmp->command, &token, &err) == -1)
 	{
 	  mutt_error ("%s", err.data);
 	  FREE (&token.data);
-	  mutt_sleep (1);	/* pause a moment to let the user see the error */
+	  if (WarnDelay)
+	    usleep (1000UL * WarnDelay);	/* pause a moment to let the user see the error */
 	  current_hook_type = 0;
 	  return;
 	}
       }
     }
@@ -334,11 +335,12 @@
       if ((mutt_pattern_exec (hook->pattern, 0, ctx, hdr) > 0) ^ hook->rx.not)
 	if (mutt_parse_rc_line (hook->command, &token, &err) != 0)
 	{
 	  FREE (&token.data);
 	  mutt_error ("%s", err.data);
-	  mutt_sleep (1);
+	  if (WarnDelay)
+	    usleep (1000UL * WarnDelay);
 	  current_hook_type = 0;
 	  return;
 	}
   }
   FREE (&token.data);
@@ -469,11 +471,12 @@
     {
       if (mutt_parse_rc_line (hook->command, &token, &err) == -1)
       {
 	FREE (&token.data);
 	mutt_error ("%s", err.data);
-	mutt_sleep (1);
+	if (WarnDelay)
+	  usleep (1000UL * WarnDelay);
 
 	return;
       }
     }
   }
--- orig-init.c	2002-07-24 01:41:29.000000000 -0700
+++ init.c	2006-07-03 12:39:25.000000000 -0700
@@ -1251,10 +1251,12 @@
   while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL)
   {
     if (mutt_parse_rc_line (linebuf, &token, err) == -1)
     {
       mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data);
+      if (InfoDelay)
+	usleep (1000UL * InfoDelay);
       if (--rc < -MAXERRS)
         break;
     }
     else
       if (rc < 0)
@@ -1268,10 +1270,12 @@
   if (rc)
   {
     /* the muttrc source keyword */
     snprintf (err->data, err->dsize, rc >= -MAXERRS ? _("source: errors in %s")
       : _("source: reading aborted due too many errors in %s"), rcfile);
+    if (WarnDelay)
+      usleep (1000UL * WarnDelay);
     rc = -1;
   }
   return (rc);
 }
 
--- orig-init.h	2002-07-24 01:41:29.000000000 -0700
+++ init.h	2006-07-03 12:39:25.000000000 -0700
@@ -478,10 +478,19 @@
   ** to sendmail command using the "-f" command line switch, so don't set this
   ** option if you are using that switch in $$sendmail yourself,
   ** or if the sendmail on your machine doesn't support that command
   ** line switch.
   */
+  { "error_delay",	DT_NUM,	 R_NONE, UL &ErrorDelay, 5000 },
+  /*
+  ** .pp
+  ** If set to a value greater than 0, Mutt will sleep for that many
+  ** thousandths of a second after showing an error message.  If set
+  ** to 0, Mutt is allowed to optimize the error message away entirely.
+  ** .pp
+  ** Also see the ``$$info_delay'' and ``$$warn_delay'' variables.
+  */
   { "escape",		DT_STR,	 R_NONE, UL &EscChar, UL "~" },
   /*
   ** .pp
   ** Escape character to use for functions in the builtin editor.
   */
@@ -905,10 +914,20 @@
   ** .dt %|X    .dd pad to the end of the line with character "X"
   ** .de
   ** .pp
   ** See also: ``$$to_chars''.
   */
+  { "info_delay",	DT_NUM,	 R_NONE, UL &InfoDelay, 1000 },
+  /*
+  ** .pp
+  ** If set to a value greater than 0, Mutt will sleep for that many
+  ** thousandths of a second after showing an informational message.
+  ** If set to 0, Mutt is allowed to optimize the informational message
+  ** away entirely.
+  ** .pp
+  ** Also see the ``$$error_delay'' and ``$$warn_delay'' variables.
+  */
   { "ispell",		DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
   /*
   ** .pp
   ** How to invoke ispell (GNU's spell-checking software).
   */
@@ -2329,10 +2348,19 @@
   ** and the external program is interactive.
   ** .pp
   ** When set, Mutt will always ask for a key. When unset, Mutt will wait
   ** for a key only if the external command returned a non-zero status.
   */
+  { "warn_delay",	DT_NUM,	 R_NONE, UL &WarnDelay, 2000 },
+  /*
+  ** .pp
+  ** If set to a value greater than 0, Mutt will sleep for that many
+  ** thousandths of a second after showing a warning message.  If set
+  ** to 0, Mutt is allowed to optimize the warning message away entirely.
+  ** .pp
+  ** Also see the ``$$error_delay'' and ``$$info_delay'' variables.
+  */
   { "weed",		DT_BOOL, R_NONE, OPTWEED, 1 },
   /*
   ** .pp
   ** When set, mutt will weed headers when when displaying, forwarding,
   ** printing, or replying to messages.
--- orig-keymap.c	2001-10-16 07:29:27.000000000 -0700
+++ keymap.c	2006-07-03 12:39:25.000000000 -0700
@@ -516,49 +516,46 @@
 }
 
 void km_init (void)
 {
   memset (Keymaps, 0, sizeof (struct keymap_t *) * MENU_MAX);
+}
 
+void km_init_bind (void)
+{
+  /* basic bindings for each menu */
   create_bindings (OpAttach, MENU_ATTACH);
   create_bindings (OpBrowser, MENU_FOLDER);
   create_bindings (OpCompose, MENU_COMPOSE);
   create_bindings (OpMain, MENU_MAIN);
   create_bindings (OpPager, MENU_PAGER);
   create_bindings (OpPost, MENU_POST);
   create_bindings (OpQuery, MENU_QUERY);
   create_bindings (OpAlias, MENU_ALIAS);
-
-
 #ifdef HAVE_PGP
   create_bindings (OpPgp, MENU_PGP);
 #endif
-
 #ifdef MIXMASTER
   create_bindings (OpMix, MENU_MIX);
-  
   km_bindkey ("<space>", MENU_MIX, OP_GENERIC_SELECT_ENTRY);
   km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV);
   km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT);
 #endif
-  
   /* bindings for the line editor */
   create_bindings (OpEditor, MENU_EDITOR);
-  
   km_bindkey ("<up>", MENU_EDITOR, OP_EDITOR_HISTORY_UP);
   km_bindkey ("<down>", MENU_EDITOR, OP_EDITOR_HISTORY_DOWN);
   km_bindkey ("<left>", MENU_EDITOR, OP_EDITOR_BACKWARD_CHAR);
   km_bindkey ("<right>", MENU_EDITOR, OP_EDITOR_FORWARD_CHAR);
   km_bindkey ("<home>", MENU_EDITOR, OP_EDITOR_BOL);
   km_bindkey ("<end>", MENU_EDITOR, OP_EDITOR_EOL);
   km_bindkey ("<backspace>", MENU_EDITOR, OP_EDITOR_BACKSPACE);
   km_bindkey ("<delete>", MENU_EDITOR, OP_EDITOR_BACKSPACE);
   km_bindkey ("\177", MENU_EDITOR, OP_EDITOR_BACKSPACE);
-  
+
   /* generic menu keymap */
   create_bindings (OpGeneric, MENU_GENERIC);
-  
   km_bindkey ("<home>", MENU_GENERIC, OP_FIRST_ENTRY);
   km_bindkey ("<end>", MENU_GENERIC, OP_LAST_ENTRY);
   km_bindkey ("<pagedown>", MENU_GENERIC, OP_NEXT_PAGE);
   km_bindkey ("<pageup>", MENU_GENERIC, OP_PREV_PAGE);
   km_bindkey ("<right>", MENU_GENERIC, OP_NEXT_PAGE);
@@ -572,24 +569,22 @@
   km_bindkey ("5", MENU_GENERIC, OP_JUMP);
   km_bindkey ("6", MENU_GENERIC, OP_JUMP);
   km_bindkey ("7", MENU_GENERIC, OP_JUMP);
   km_bindkey ("8", MENU_GENERIC, OP_JUMP);
   km_bindkey ("9", MENU_GENERIC, OP_JUMP);
-
   km_bindkey ("<enter>", MENU_GENERIC, OP_GENERIC_SELECT_ENTRY);
 
-  /* Miscellaneous extra bindings */
-  
+  /* index menu keymap */
   km_bindkey (" ", MENU_MAIN, OP_DISPLAY_MESSAGE);
   km_bindkey ("<up>", MENU_MAIN, OP_MAIN_PREV_UNDELETED);
   km_bindkey ("<down>", MENU_MAIN, OP_MAIN_NEXT_UNDELETED);
   km_bindkey ("J", MENU_MAIN, OP_NEXT_ENTRY);
   km_bindkey ("K", MENU_MAIN, OP_PREV_ENTRY);
   km_bindkey ("x", MENU_MAIN, OP_EXIT);
-
   km_bindkey ("<enter>", MENU_MAIN, OP_DISPLAY_MESSAGE);
 
+  /* pager menu keymap */
   km_bindkey ("x", MENU_PAGER, OP_EXIT);
   km_bindkey ("i", MENU_PAGER, OP_EXIT);
   km_bindkey ("<backspace>", MENU_PAGER, OP_PREV_LINE);
   km_bindkey ("<pagedown>", MENU_PAGER, OP_NEXT_PAGE);
   km_bindkey ("<pageup>", MENU_PAGER, OP_PREV_PAGE);
@@ -606,20 +601,22 @@
   km_bindkey ("5", MENU_PAGER, OP_JUMP);
   km_bindkey ("6", MENU_PAGER, OP_JUMP);
   km_bindkey ("7", MENU_PAGER, OP_JUMP);
   km_bindkey ("8", MENU_PAGER, OP_JUMP);
   km_bindkey ("9", MENU_PAGER, OP_JUMP);
-
   km_bindkey ("<enter>", MENU_PAGER, OP_NEXT_LINE);
   
+  /* alias menu keymap */
   km_bindkey ("<return>", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY);
   km_bindkey ("<enter>",  MENU_ALIAS, OP_GENERIC_SELECT_ENTRY);
   km_bindkey ("<space>", MENU_ALIAS, OP_TAG);
 
+  /* attach menu keymap */
   km_bindkey ("<enter>", MENU_ATTACH, OP_VIEW_ATTACH);
-  km_bindkey ("<enter>", MENU_COMPOSE, OP_VIEW_ATTACH);
 
+  /* compose menu keymap */
+  km_bindkey ("<enter>", MENU_COMPOSE, OP_VIEW_ATTACH);
   /* edit-to (default "t") hides generic tag-entry in Compose menu
      This will bind tag-entry to  "T" in the Compose menu */
   km_bindkey ("T", MENU_COMPOSE, OP_TAG);
 }
 
--- orig-keymap.h	2001-09-11 04:20:34.000000000 -0700
+++ keymap.h	2006-07-03 12:39:25.000000000 -0700
@@ -43,10 +43,11 @@
 
 char *km_keyname (int);
 int km_expand_key (char *, size_t, struct keymap_t *);
 struct keymap_t *km_find_func (int, int);
 void km_init (void);
+void km_init_bind (void);
 void km_error_key (int);
 
 enum
 {
   MENU_ALIAS,
--- orig-lib.c	2002-04-29 10:12:18.000000000 -0700
+++ lib.c	2006-07-03 12:39:25.000000000 -0700
@@ -349,11 +349,12 @@
 int safe_open (const char *path, int flags)
 {
   struct stat osb, nsb;
   int fd;
 
-  if ((fd = open (path, flags, 0600)) < 0)
+/* This should differentiate between temporary files and truly-saved files, and be 0600 in the first case and 0666 in the latter */
+  if ((fd = open (path, flags, 0666)) < 0)
     return fd;
 
   /* make sure the file is not symlink */
   if (lstat (path, &osb) < 0 || fstat (fd, &nsb) < 0 ||
       compare_stat(&osb, &nsb) == -1)
--- orig-main.c	2002-07-16 00:28:00.000000000 -0700
+++ main.c	2006-07-03 12:39:25.000000000 -0700
@@ -83,13 +83,13 @@
 static void mutt_usage (void)
 {
   puts (mutt_make_version ());
 
   puts _(
-"usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]\n\
-       mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]\n\
-       mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p\n\
+"usage: mutt [ -nNRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]\n\
+       mutt [ -nNx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]\n\
+       mutt [ -nN ] [ -e <cmd> ] [ -F <file> ] -p\n\
        mutt -v[v]\n\
 \n\
 options:\n\
   -a <file>\tattach a file to the message\n\
   -b <address>\tspecify a blind carbon-copy (BCC) address\n\
@@ -99,10 +99,11 @@
   -F <file>\tspecify an alternate muttrc file\n\
   -H <file>\tspecify a draft file to read header from\n\
   -i <file>\tspecify a file which Mutt should include in the reply\n\
   -m <type>\tspecify a default mailbox type\n\
   -n\t\tcauses Mutt not to read the system Muttrc\n\
+  -N\t\tcauses Mutt not to apply the standard keybindings\n\
   -p\t\trecall a postponed message\n\
   -R\t\topen mailbox in read-only mode\n\
   -s <subj>\tspecify a subject (must be in quotes if it has spaces)\n\
   -v\t\tshow version and compile-time definitions\n\
   -x\t\tsimulate the mailx send mode\n\
@@ -150,15 +151,12 @@
 #ifdef DEBUG
   puts ("+DEBUG");
 #else
   puts ("-DEBUG");
 #endif
-  
 
-  
   puts (
-
 #ifdef HOMESPOOL
 	"+HOMESPOOL  "
 #else
 	"-HOMESPOOL  "
 #endif
@@ -237,13 +235,12 @@
 #ifdef USE_GNU_REGEX
 	"+USE_GNU_REGEX  "
 #else
 	"-USE_GNU_REGEX  "
 #endif
-
-	"\n"
-	
+	);
+  puts (
 #ifdef HAVE_COLOR
 	"+HAVE_COLOR  "
 #else
 	"-HAVE_COLOR  "
 #endif
@@ -283,28 +280,26 @@
 #ifdef HAVE_RESIZETERM
 	"+HAVE_RESIZETERM  "
 #else
 	"-HAVE_RESIZETERM  "
 #endif
-	
-	
 	);
   
-  
   puts (
-	
+
 #ifdef HAVE_PGP
 	"+HAVE_PGP  "
 #else
 	"-HAVE_PGP  "
 #endif
 
 #ifdef BUFFY_SIZE
-	"+BUFFY_SIZE "
+	"+BUFFY_SIZE  "
 #else
-	"-BUFFY_SIZE "
+	"-BUFFY_SIZE  "
 #endif
+
 #ifdef EXACT_ADDRESS
 	"+EXACT_ADDRESS  "
 #else
 	"-EXACT_ADDRESS  "
 #endif
@@ -400,12 +395,10 @@
   exit (0);
 }
 
 static void start_curses (void)
 {
-  km_init (); /* must come before mutt_init */
-
 #ifdef USE_SLANG_CURSES
   SLtt_Ignore_Beep = 1; /* don't do that #*$@^! annoying visual beep! */
   SLsmg_Display_Eight_Bit = 128; /* characters above this are printable */
 #else
   /* should come before initscr() so that ncurses 4.2 doesn't try to install
@@ -436,10 +429,11 @@
 #define M_IGNORE  (1<<0)	/* -z */
 #define M_BUFFY   (1<<1)	/* -Z */
 #define M_NOSYSRC (1<<2)	/* -n */
 #define M_RO      (1<<3)	/* -R */
 #define M_SELECT  (1<<4)	/* -y */
+#define M_NOBIND  (1<<5)	/* -N */
 
 int main (int argc, char **argv)
 {
   char folder[_POSIX_PATH_MAX] = "";
   char *subject = NULL;
@@ -476,31 +470,21 @@
   setlocale (LC_CTYPE, "");
 
   mutt_error = mutt_nocurses_error;
   mutt_message = mutt_nocurses_error;
   SRAND (time (NULL));
-  umask (077);
 
   memset (Options, 0, sizeof (Options));
   memset (QuadOptions, 0, sizeof (QuadOptions));
   
-  while ((i = getopt (argc, argv, "a:b:F:f:c:d:e:H:s:i:hm:npRvxyzZ")) != EOF)
+  while ((i = getopt (argc, argv, "a:b:F:f:c:d:e:H:s:i:hm:nNpRvxyzZ")) != EOF)
     switch (i)
     {
       case 'a':
 	attach = mutt_add_list (attach, optarg);
 	break;
 
-      case 'F':
-	mutt_str_replace (&Muttrc, optarg);
-	break;
-
-      case 'f':
-	strfcpy (folder, optarg, sizeof (folder));
-        explicit_folder = 1;
-	break;
-
       case 'b':
       case 'c':
 	if (!msg)
 	  msg = mutt_new_header ();
 	if (!msg->env)
@@ -522,10 +506,19 @@
 
       case 'e':
 	commands = mutt_add_list (commands, optarg);
 	break;
 
+      case 'f':
+	strfcpy (folder, optarg, sizeof (folder));
+        explicit_folder = 1;
+	break;
+
+      case 'F':
+	mutt_str_replace (&Muttrc, optarg);
+	break;
+
       case 'H':
 	draftFile = optarg;
 	break;
 
       case 'i':
@@ -539,10 +532,14 @@
 
       case 'n':
 	flags |= M_NOSYSRC;
 	break;
 
+      case 'N':
+	flags |= M_NOBIND;
+	break;
+
       case 'p':
 	sendflags |= SENDPOSTPONED;
 	break;
 
       case 'R':
@@ -599,11 +596,16 @@
   }
 
   /* This must come before mutt_init() because curses needs to be started
      before calling the init_pair() function to set the color scheme.  */
   if (!option (OPTNOCURSES))
+  {
+    km_init ();
+    if (!(flags & M_NOBIND))
+      km_init_bind ();
     start_curses ();
+  }
 
   /* set defaults and read init files */
   mutt_init (flags & M_NOSYSRC, commands);
   mutt_free_list (&commands);
 
@@ -839,11 +841,13 @@
        || !explicit_folder)
     {
       mutt_index_menu ();
       if (Context)
 	safe_free ((void **)&Context);
+      mutt_endwin (NULL);
     }
-    mutt_endwin (Errorbuf);
+    else
+      mutt_endwin (Errorbuf);
   }
 
   exit (0);
 }
--- orig-mbox.c	2002-02-27 23:59:24.000000000 -0800
+++ mbox.c	2006-07-03 12:39:25.000000000 -0700
@@ -735,12 +735,15 @@
     if (-1 != i)
     {
       close (i);
       unlink (tempfile);
     }
-    mutt_error _("Could not create temporary file!");
-    mutt_sleep (5);
+    if (ErrorDelay)
+    {
+      mutt_error _("Could not create temporary file!");
+      usleep (1000UL * ErrorDelay);
+    }
     goto bail;
   }
 
   /* find the first deleted/changed message.  we save a lot of time by only
    * rewriting the mailbox from the point where it has actually changed.
@@ -752,12 +755,15 @@
   { 
     /* this means ctx->changed or ctx->deleted was set, but no
      * messages were found to be changed or deleted.  This should
      * never happen, is we presume it is a bug in mutt.
      */
-    mutt_error _("sync: mbox modified, but no modified messages! (report this bug)");
-    mutt_sleep(5); /* the mutt_error /will/ get cleared! */
+    if (ErrorDelay)
+    {
+      mutt_error _("sync: mbox modified, but no modified messages! (report this bug)");
+      usleep(1000UL * ErrorDelay); /* the mutt_error /will/ get cleared! */
+    }
     dprint(1, (debugfile, "mbox_sync_mailbox(): no modified messages.\n"));
     unlink (tempfile);
     goto bail;
   }
 
@@ -801,22 +807,24 @@
       if (ctx->magic == M_MMDF)
       {
 	if (fputs (MMDF_SEP, fp) == EOF)
 	{
 	  mutt_perror (tempfile);
-	  mutt_sleep (5);
+	  if (ErrorDelay)
+	    usleep (1000UL * ErrorDelay);
 	  unlink (tempfile);
 	  goto bail;
 	}
 	  
       }
       else if (ctx->magic == M_KENDRA)
       {
 	if (fputs (KENDRA_SEP, fp) == EOF)
 	{
 	  mutt_perror (tempfile);
-	  mutt_sleep (5);
+	  if (ErrorDelay)
+	    usleep (1000UL * ErrorDelay);
 	  unlink (tempfile);
 	  goto bail;
 	}
       }
 
@@ -827,11 +835,12 @@
       newOffset[i - first].hdr = ftell (fp) + offset;
 
       if (mutt_copy_message (fp, ctx, ctx->hdrs[i], M_CM_UPDATE, CH_FROM | CH_UPDATE | CH_UPDATE_LEN) == -1)
       {
 	mutt_perror (tempfile);
-	mutt_sleep (5);
+	if (ErrorDelay)
+	  usleep (1000UL * ErrorDelay);
 	unlink (tempfile);
 	goto bail;
       }
 
       /* Since messages could have been deleted, the offsets stored in memory
@@ -847,29 +856,32 @@
       {
 	case M_MMDF: 
 	  if(fputs(MMDF_SEP, fp) == EOF) 
 	  {
 	    mutt_perror (tempfile);
-	    mutt_sleep (5);
+	    if (ErrorDelay)
+	      usleep (1000UL * ErrorDelay);
 	    unlink (tempfile);
 	    goto bail; 
 	  }
 	  break;
 	case M_KENDRA:
 	  if(fputs(KENDRA_SEP, fp) == EOF)
 	  {
 	    mutt_perror (tempfile);
-	    mutt_sleep (5);
+	    if (ErrorDelay)
+	      usleep (1000UL * ErrorDelay);
 	    unlink (tempfile);
 	    goto bail;
 	  }
 	  break;
 	default:
 	  if(fputs("\n", fp) == EOF) 
 	  {
 	    mutt_perror (tempfile);
-	    mutt_sleep (5);
+	    if (ErrorDelay)
+	      usleep (1000UL * ErrorDelay);
 	    unlink (tempfile);
 	    goto bail;
 	  }
       }
     }
@@ -879,31 +891,34 @@
   {
     fp = NULL;
     dprint(1, (debugfile, "mbox_sync_mailbox: fclose() returned non-zero.\n"));
     unlink (tempfile);
     mutt_perror (tempfile);
-    mutt_sleep (5);
+    if (ErrorDelay)
+      usleep (1000UL * ErrorDelay);
     goto bail;
   }
   fp = NULL;
 
   /* Save the state of this folder. */
   if (stat (ctx->path, &statbuf) == -1)
   {
     mutt_perror (ctx->path);
-    mutt_sleep (5);
+    if (ErrorDelay)
+      usleep (1000UL * ErrorDelay);
     unlink (tempfile);
     goto bail;
   }
 
   if ((fp = fopen (tempfile, "r")) == NULL)
   {
     mutt_unblock_signals ();
     mx_fastclose_mailbox (ctx);
     dprint (1, (debugfile, "mbox_sync_mailbox: unable to reopen temp copy of mailbox!\n"));
     mutt_perror (tempfile);
-    mutt_sleep (5);
+    if (ErrorDelay)
+      usleep (1000UL * ErrorDelay);
     return (-1);
   }
 
   if (fseek (ctx->fp, offset, SEEK_SET) != 0 ||  /* seek the append location */
       /* do a sanity check to make sure the mailbox looks ok */
@@ -957,12 +972,15 @@
 	      NONULL (Tempdir), NONULL(Username), NONULL(Hostname), getpid ());
     rename (tempfile, savefile);
     mutt_unblock_signals ();
     mx_fastclose_mailbox (ctx);
     mutt_pretty_mailbox (savefile);
-    mutt_error (_("Write failed!  Saved partial mailbox to %s"), savefile);
-    mutt_sleep (5);
+    if (ErrorDelay)
+    {
+      mutt_error (_("Write failed!  Saved partial mailbox to %s"), savefile);
+      usleep (1000UL * ErrorDelay);
+    }
     return (-1);
   }
 
   /* Restore the previous access/modification times */
   utimebuf.actime = statbuf.st_atime;
--- orig-menu.c	2004-02-11 02:07:17.000000000 -0800
+++ menu.c	2006-07-03 12:39:25.000000000 -0700
@@ -25,10 +25,11 @@
 #include "imap.h"
 #endif
 
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 extern int Charset_is_utf8; /* FIXME: bad modularisation */
 
 static void print_enriched_string (int attr, unsigned char *s, int do_color)
 {
@@ -343,11 +344,12 @@
 {
   if (menu->dialog) 
   {
     if (option (OPTMSGERR)) 
     {
-      mutt_sleep (1);
+      if (ErrorDelay)
+	usleep (1000UL * ErrorDelay);
       unset_option (OPTMSGERR);
     }
 
     if (*Errorbuf)
       mutt_clear_error ();
--- orig-mx.c	2002-03-20 01:53:42.000000000 -0800
+++ mx.c	2006-07-03 12:39:25.000000000 -0700
@@ -189,12 +189,15 @@
       return (-1);
     }
 
     prev_sb = sb;
 
-    mutt_message (_("Waiting for fcntl lock... %d"), ++attempt);
-    sleep (1);
+    if (InfoDelay)
+    {
+      mutt_message (_("Waiting for fcntl lock... %d"), ++attempt);
+      usleep (1000UL * InfoDelay);
+    }
   }
 #endif /* USE_FCNTL */
 
 #ifdef USE_FLOCK
   count = 0;
@@ -224,12 +227,15 @@
       break;
     }
 
     prev_sb = sb;
 
-    mutt_message (_("Waiting for flock attempt... %d"), ++attempt);
-    sleep (1);
+    if (InfoDelay)
+    {
+      mutt_message (_("Waiting for flock attempt... %d"), ++attempt);
+      usleep (1000UL * InfoDelay);
+    }
   }
 #endif /* USE_FLOCK */
 
 #ifdef USE_DOTLOCK
   if (r == 0 && dot)
--- orig-pager.c	2002-01-13 00:52:15.000000000 -0800
+++ pager.c	2006-07-03 12:39:25.000000000 -0700
@@ -742,11 +742,13 @@
     lineInfo[n].type = MT_COLOR_ATTACHMENT;
 #else
   else if (check_attachment_marker ((char *) raw) == 0)
     lineInfo[n].type = MT_COLOR_ATTACHMENT;
 #endif
-  else if (mutt_strcmp ("-- \n", buf) == 0 || mutt_strcmp ("-- \r\n", buf) == 0)
+  else if (mutt_strcmp ("-- \n", buf) == 0 || mutt_strcmp ("-- \r\n", buf) == 0
+    || mutt_strncmp ("----------------------------------------", buf, 40) == 0
+    || mutt_strncmp ("________________________________________", buf, 40) == 0)
   {
     i = n + 1;
 
     lineInfo[n].type = MT_COLOR_SIGNATURE;
     while (i < last && check_sig (buf, lineInfo, i - 1) == 0 &&
--- orig-pgpkey.c	2002-01-15 01:04:28.000000000 -0800
+++ pgpkey.c	2006-07-03 12:39:25.000000000 -0700
@@ -678,10 +678,12 @@
   FOREVER
   {
     resp[0] = 0;
     if (mutt_get_field (tag, resp, sizeof (resp), M_CLEAR) != 0)
       return NULL;
+    if (!*resp)
+      return NULL;
 
     if (whatfor)
     {
       if (l)
 	mutt_str_replace (&l->dflt, resp);
--- orig-send.c	2002-01-30 14:50:59.000000000 -0800
+++ send.c	2006-07-03 12:39:25.000000000 -0700
@@ -1194,11 +1194,12 @@
 
     if (option (OPTHDRS))
       process_user_recips (msg->env);
 
     if (! (flags & SENDMAILX) &&
-	! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) &&
+	! (option (OPTAUTOEDIT)) &&
+	! (option (OPTEDITHDRS)) &&
 	! ((flags & SENDREPLY) && option (OPTFASTREPLY)))
     {
       if (edit_envelope (msg->env) == -1)
 	goto cleanup;
     }
--- orig-sendlib.c	2002-05-31 09:59:39.000000000 -0700
+++ sendlib.c	2006-07-03 12:39:25.000000000 -0700
@@ -2352,11 +2352,12 @@
   /* (postponment) save the Fcc: using a special X-Mutt- header so that
    * it can be picked up when the message is recalled 
    */
   if (post && fcc)
     fprintf (msg->fp, "X-Mutt-Fcc: %s\n", fcc);
-  fprintf (msg->fp, "Status: RO\n");
+  if (f.magic != M_MAILDIR)
+    fprintf (msg->fp, "Status: RO\n");
 
 
 
 #ifdef HAVE_PGP
   /* (postponment) if the mail is to be signed or encrypted, save this info */
--- orig-sort.c	2001-12-13 04:10:59.000000000 -0800
+++ sort.c	2006-07-03 12:39:25.000000000 -0700
@@ -234,12 +234,15 @@
     mutt_sort_threads (ctx, init);
   }
   else if ((sortfunc = mutt_get_sort_func (Sort)) == NULL ||
 	   (AuxSort = mutt_get_sort_func (SortAux)) == NULL)
   {
-    mutt_error _("Could not find sorting function! [report this bug]");
-    mutt_sleep (1);
+    if (ErrorDelay)
+    {
+      mutt_error _("Could not find sorting function! [report this bug]");
+      usleep (1000UL * ErrorDelay);
+    }
     return;
   }
   else 
     qsort ((void *) ctx->hdrs, ctx->msgcount, sizeof (HEADER *), sortfunc);
 
