]> granicus.if.org Git - mutt/commitdiff
The attached patch removes some redundant code related to the macro
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 12 Oct 1998 19:53:42 +0000 (19:53 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 12 Oct 1998 19:53:42 +0000 (19:53 +0000)
function stuff. Since each menu calls km_dokey() to get the 'op'
number to execute, the 'menu' argument to km_dokey() _is_ the
CurrentMenu. Hence, there is no need to explicitly save/restore the
CurrentMenu all over the code. The only places it is being captured
now is just before mutt_enter_comamnd() is called. This is to help
the 'exec' command completion code so that it knows which menu to
try and complete the function name from.
(From: Vikas Agnihotri <VikasA@att.com>)

addrbook.c
browser.c
compose.c
curs_main.c
pgpkey.c
postpone.c
query.c
recvattach.c

index 50bd030caf4999cb44754a3fadea6c09fc712b8a..6f494978fee28f57daa4439e109655aa05a188d5 100644 (file)
@@ -125,7 +125,6 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases)
   int t = -1;
   int i, done = 0;
   char helpstr[SHORT_STRING];
-  int savedmenu = CurrentMenu;
 
   if (!aliases)
   {
@@ -140,7 +139,7 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases)
   menu->make_entry = alias_entry;
   menu->search = alias_search;
   menu->tag = alias_tag;
-  menu->menu = CurrentMenu = MENU_ALIAS;
+  menu->menu = MENU_ALIAS;
   menu->title = _("Aliases");
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_ALIAS, AliasHelp);
 
@@ -189,6 +188,5 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases)
     rfc822_write_address (buf, buflen, AliasTable[t]->addr);
   
   mutt_menuDestroy (&menu);
-  CurrentMenu = savedmenu;
   safe_free ((void **) &AliasTable);
 }
index 6b84a7c42ebb47398f7376d1082e71f1f15341cf..adfa2177f290d34a706b612f9a976bc53a38d9cc 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -465,7 +465,6 @@ void mutt_select_file (char *f, size_t flen, int buffy)
   MUTTMENU *menu;
   struct stat st;
   int i, killPrefix = 0;
-  int savedmenu = CurrentMenu;
 
   memset (&state, 0, sizeof (struct browser_state));
 
@@ -516,7 +515,7 @@ void mutt_select_file (char *f, size_t flen, int buffy)
     return;
 
   menu = mutt_new_menu ();
-  menu->menu = CurrentMenu = MENU_FOLDER;
+  menu->menu = MENU_FOLDER;
   menu->make_entry = folder_entry;
   menu->search = select_file_search;
   menu->title = title;
@@ -625,7 +624,6 @@ void mutt_select_file (char *f, size_t flen, int buffy)
 
        destroy_state (&state);
        mutt_menuDestroy (&menu);
-       CurrentMenu = savedmenu;
        return;
 
       case OP_BROWSER_TELL:
@@ -664,7 +662,6 @@ void mutt_select_file (char *f, size_t flen, int buffy)
                mutt_error _("Error scanning directory.");
                destroy_state (&state);
                mutt_menuDestroy (&menu);
-               CurrentMenu = savedmenu;
                return;
              }
            }
@@ -721,7 +718,6 @@ void mutt_select_file (char *f, size_t flen, int buffy)
            {
              mutt_error _("Error scanning directory.");
              mutt_menuDestroy (&menu);
-             CurrentMenu = savedmenu;
              return;
            }
            killPrefix = 0;
@@ -818,7 +814,6 @@ void mutt_select_file (char *f, size_t flen, int buffy)
          strfcpy (f, buf, flen);
          destroy_state (&state);
          mutt_menuDestroy (&menu);
-         CurrentMenu = savedmenu;
          return;
        }
        MAYBE_REDRAW (menu->redraw);
index 263bedc5befa1c75ca64c0f7ce92d5c304d9ec61..89c9d817d7beb2d8ba331a2af14eab27c00d4669 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -438,12 +438,11 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
   /* Sort, SortAux could be changed in mutt_index_menu() */
   int oldSort = Sort, oldSortAux = SortAux;
   struct stat st;
-  int savedmenu = CurrentMenu;
 
   idx = mutt_gen_attach_list (msg->content, idx, &idxlen, &idxmax, 0, 1);
 
   menu = mutt_new_menu ();
-  menu->menu = CurrentMenu = MENU_COMPOSE;
+  menu->menu = MENU_COMPOSE;
   menu->offset = HDR_ATTACH;
   menu->max = idxlen;
   menu->make_entry = snd_entry;
@@ -1109,7 +1108,6 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
   }
 
   mutt_menuDestroy (&menu);
-  CurrentMenu = savedmenu;
 
   if (idxlen)
   {
index 0927d3753e2565df9e256cd85e2a376675800ad2..39310447c7c0bd4da752f049e95aeb2b03c9b9c5 100644 (file)
@@ -255,10 +255,9 @@ int mutt_index_menu (void)
   int do_buffy_notify = 1;
   int close = 0; /* did we OP_QUIT or OP_EXIT out of this menu? */
   int attach_msg = option(OPTATTACHMSG);
-  int savedmenu = CurrentMenu;
 
   menu = mutt_new_menu ();
-  menu->menu = CurrentMenu = MENU_MAIN;
+  menu->menu = MENU_MAIN;
   menu->offset = 1;
   menu->pagelen = LINES - 3;
   menu->make_entry = index_make_entry;
@@ -507,7 +506,7 @@ int mutt_index_menu (void)
        mutt_flushinp ();
        mutt_resize_screen ();
        menu->redraw = REDRAW_FULL;
-       menu->menu = CurrentMenu = MENU_MAIN;
+       menu->menu = MENU_MAIN;
        Signals &= ~S_SIGWINCH;
        menu->top = 0; /* so we scroll the right amount */
        continue;
@@ -972,7 +971,7 @@ int mutt_index_menu (void)
          menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
        }
 
-       menu->menu = CurrentMenu = MENU_PAGER;
+       menu->menu = MENU_PAGER;
        menu->oldcurrent = menu->current;
        continue;
 
@@ -1722,7 +1721,7 @@ int mutt_index_menu (void)
 
     if (menu->menu == MENU_PAGER)
     {
-      menu->menu = CurrentMenu = MENU_MAIN;
+      menu->menu = MENU_MAIN;
       menu->redraw = REDRAW_FULL;
       set_option (OPTWEED); /* turn header weeding back on. */
     }
@@ -1731,7 +1730,6 @@ int mutt_index_menu (void)
   }
 
   mutt_menuDestroy (&menu);
-  CurrentMenu = savedmenu;
   return (close);
 }
 
index 13448b4cfc669342a3b1f4797cf9631562aaab8c..42e19e6760e5cdeff36065d96ef35094394ecc7f 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -123,7 +123,6 @@ static KEYINFO *pgp_select_key (struct pgp_vinfo *pgp,
   FILE *fp, *devnull;
   pid_t thepid;
   KEYINFO *info;
-  int savedmenu = CurrentMenu;
   
   
   for (i = 0, l = keys; l; l = l->next)
@@ -185,7 +184,7 @@ static KEYINFO *pgp_select_key (struct pgp_vinfo *pgp,
   menu->max = keymax;
   menu->make_entry = pgp_entry;
   menu->search = pgp_search;
-  menu->menu = CurrentMenu = MENU_PGP;
+  menu->menu = MENU_PGP;
   menu->help = helpstr;
   menu->data = KeyTable;
 
@@ -283,7 +282,6 @@ static KEYINFO *pgp_select_key (struct pgp_vinfo *pgp,
   }
 
   mutt_menuDestroy (&menu);
-  CurrentMenu = savedmenu;
   safe_free ((void **) &KeyTable);
 
   return (info);
index 027e2b052dea91104e668bbd8d4385ceb722ed95..4b8cfb7278af802ab6b434b8e8707c0d725c81e3 100644 (file)
@@ -103,11 +103,10 @@ static HEADER *select_msg (void)
   MUTTMENU *menu;
   int i, done=0, r=-1;
   char helpstr[SHORT_STRING];
-  int savedmenu = CurrentMenu;
 
   menu = mutt_new_menu ();
   menu->make_entry = post_entry;
-  menu->menu = CurrentMenu = MENU_POST;
+  menu->menu = MENU_POST;
   menu->max = PostContext->msgcount;
   menu->title = _("Postponed Messages");
   menu->data = PostContext;
@@ -149,7 +148,6 @@ static HEADER *select_msg (void)
   }
 
   mutt_menuDestroy (&menu);
-  CurrentMenu = savedmenu;
   return (r > -1 ? PostContext->hdrs[r] : NULL);
 }
 
diff --git a/query.c b/query.c
index 0ca596be7e822b416de28f7a802c7077fed2533b..44296a2f25461679542a3104c0d62d9025728f67 100644 (file)
--- a/query.c
+++ b/query.c
@@ -240,7 +240,6 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf)
   int op;
   char helpstr[SHORT_STRING];
   char title[STRING];
-  int savedmenu = CurrentMenu;
 
   snprintf (title, sizeof (title), _("Query")); /* FIXME */
 
@@ -248,7 +247,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf)
   menu->make_entry = query_entry;
   menu->search = query_search;
   menu->tag = query_tag;
-  menu->menu = CurrentMenu = MENU_QUERY;
+  menu->menu = MENU_QUERY;
   menu->title = title;
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_QUERY, QueryHelp);
 
@@ -464,5 +463,4 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf)
   }
 
   mutt_menuDestroy (&menu);
-  CurrentMenu = savedmenu;
 }
index 91f6b5372e94aaf9539aeffc3c67c99376c3d7b0..a20fc6119c5b70ec6793fb707fea886205ff2e59 100644 (file)
@@ -809,7 +809,6 @@ void mutt_view_attachments (HEADER *hdr)
   short idxmax = 0;
   int flags = 0;
   int op;
-  int savedmenu = CurrentMenu;
   
   /* make sure we have parsed this message */
   mutt_parse_mime_message (Context, hdr);
@@ -848,7 +847,7 @@ void mutt_view_attachments (HEADER *hdr)
   menu->max = idxlen;
   menu->make_entry = attach_entry;
   menu->tag = mutt_tag_attach;
-  menu->menu = CurrentMenu = MENU_ATTACH;
+  menu->menu = MENU_ATTACH;
   menu->title = _("Attachments");
   menu->data = idx;
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_ATTACH, AttachHelp);
@@ -1044,7 +1043,6 @@ void mutt_view_attachments (HEADER *hdr)
 
 
        mutt_menuDestroy  (&menu);
-       CurrentMenu = savedmenu;
        return;
     }
   }