]> granicus.if.org Git - neomutt/commitdiff
notifications
authorRichard Russon <rich@flatcap.org>
Wed, 27 Jun 2018 01:31:17 +0000 (02:31 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 23 Jul 2018 15:00:57 +0000 (16:00 +0100)
browser.c
commands.c
curs_main.c
init.h
main.c
mutt_logging.c
notmuch/mutt_notmuch.c
pager.c
recvattach.c

index 9c8be2c9c92c606cbac0eb85eec3b7bac1251d6b..fddff3809e868a038948d3677ab6b0fcfe071d0f 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -1639,7 +1639,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
 
 #ifdef USE_IMAP
       case OP_BROWSER_TOGGLE_LSUB:
-        ImapListSubscribed = !ImapListSubscribed;
+        bool_str_toggle(Config, "imap_list_subscribed", NULL);
 
         mutt_unget_event(0, OP_CHECK_NEW);
         break;
@@ -1830,77 +1830,56 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
         break;
 
       case OP_ENTER_MASK:
-
+      {
         mutt_str_strfcpy(buf, NONULL(Mask ? Mask->pattern : NULL), sizeof(buf));
-        if (mutt_get_field(_("File Mask: "), buf, sizeof(buf), 0) == 0)
-        {
-          regex_t *rx = mutt_mem_malloc(sizeof(regex_t));
-          char *s = buf;
-          int not = 0, err;
+        if (mutt_get_field(_("File Mask: "), buf, sizeof(buf), 0) != 0)
+          break;
 
-          buffy = 0;
-          /* assume that the user wants to see everything */
-          if (!buf[0])
-            mutt_str_strfcpy(buf, ".", sizeof(buf));
-          SKIPWS(s);
-          if (*s == '!')
-          {
-            s++;
-            SKIPWS(s);
-            not = 1;
-          }
+        buffy = 0;
+        /* assume that the user wants to see everything */
+        if (!buf[0])
+          mutt_str_strfcpy(buf, ".", sizeof(buf));
 
-          err = REGCOMP(rx, s, REG_NOSUB);
-          if (err != 0)
+        struct Buffer errmsg = { 0 };
+        int rc = cs_str_string_set(Config, "mask", buf, NULL);
+        if (CSR_RESULT(rc) != CSR_SUCCESS)
+        {
+          if (!mutt_buffer_is_empty(&errmsg))
           {
-            regerror(err, rx, buf, sizeof(buf));
-            FREE(&rx);
-            mutt_error("%s", buf);
+            mutt_error("%s", errmsg.data);
+            FREE(&errmsg.data);
           }
-          else
-          {
-            if (Mask && Mask->regex)
-            {
-              regfree(Mask->regex);
-              FREE(&Mask->regex);
-            }
-            else
-            {
-              Mask = mutt_mem_calloc(1, sizeof(struct Regex));
-            }
-            mutt_str_replace(&Mask->pattern, buf);
-            Mask->regex = rx;
-            Mask->not = not;
+          break;
+        }
 
-            destroy_state(&state);
+        destroy_state(&state);
 #ifdef USE_IMAP
-            if (state.imap_browse)
-            {
-              init_state(&state, NULL);
-              state.imap_browse = true;
-              imap_browse(LastDir, &state);
-              browser_sort(&state);
-              menu->data = state.entry;
-              init_menu(&state, menu, title, sizeof(title), buffy);
-            }
-            else
+        if (state.imap_browse)
+        {
+          init_state(&state, NULL);
+          state.imap_browse = true;
+          imap_browse(LastDir, &state);
+          browser_sort(&state);
+          menu->data = state.entry;
+          init_menu(&state, menu, title, sizeof(title), buffy);
+        }
+        else
 #endif
-                if (examine_directory(menu, &state, LastDir, NULL) == 0)
-              init_menu(&state, menu, title, sizeof(title), buffy);
-            else
-            {
-              mutt_error(_("Error scanning directory."));
-              goto bail;
-            }
-            kill_prefix = 0;
-            if (state.entrylen == 0)
-            {
-              mutt_error(_("No files match the file mask"));
-              break;
-            }
-          }
+            if (examine_directory(menu, &state, LastDir, NULL) == 0)
+          init_menu(&state, menu, title, sizeof(title), buffy);
+        else
+        {
+          mutt_error(_("Error scanning directory."));
+          goto bail;
+        }
+        kill_prefix = 0;
+        if (state.entrylen == 0)
+        {
+          mutt_error(_("No files match the file mask"));
+          break;
         }
         break;
+      }
 
       case OP_SORT:
       case OP_SORT_REVERSE:
@@ -1961,7 +1940,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           browser_highlight_default(&state, menu);
           menu->redraw = REDRAW_FULL;
         }
-        SortBrowser = sort;
+        cs_str_native_set(Config, "sort_browser", sort, NULL);
         break;
       }
 
@@ -2080,10 +2059,9 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
         if (OptNews)
         {
           struct FolderFile *ff = &state.entry[menu->current];
-          int rc;
           struct NntpData *nntp_data = NULL;
 
-          rc = nntp_newsrc_parse(CurrentNewsSrv);
+          int rc = nntp_newsrc_parse(CurrentNewsSrv);
           if (rc < 0)
             break;
 
@@ -2149,7 +2127,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           regex_t rx;
           memset(&rx, 0, sizeof(rx));
           char *s = buf;
-          int rc, j = menu->current;
+          int j = menu->current;
 
           if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN)
           {
@@ -2183,7 +2161,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
             break;
           }
 
-          rc = nntp_newsrc_parse(nserv);
+          int rc = nntp_newsrc_parse(nserv);
           if (rc < 0)
             break;
 
index 04cf2902f483bdd7c86c5a1a71d6d70d7806de68..3369fb36dd839e2170cd2f153016ebcab0c0d9b9 100644 (file)
@@ -648,7 +648,7 @@ int mutt_select_sort(int reverse)
   if (reverse)
     new_sort |= SORT_REVERSE;
 
-  Sort = new_sort;
+  cs_str_native_set(Config, "sort", new_sort, NULL);
   return (Sort != method) ? 0 : -1; /* no need to resort if it's the same */
 }
 
index 6d8a32e2946fbe8638093367843716a2699c33ff..d06f4d104d431da3393e159701ef1b4731172252 100644 (file)
@@ -2133,7 +2133,7 @@ int mutt_index_menu(void)
          * again while reading the message.
          */
         if (op == OP_DISPLAY_HEADERS)
-          Weed = !Weed;
+          bool_str_toggle(Config, "weed", NULL);
 
         OptNeedResort = false;
 
@@ -3343,7 +3343,7 @@ int mutt_index_menu(void)
         break;
 
       case OP_SIDEBAR_TOGGLE_VISIBLE:
-        SidebarVisible = !SidebarVisible;
+        bool_str_toggle(Config, "sidebar_visible", NULL);
         mutt_window_reflow();
         break;
 
diff --git a/init.h b/init.h
index 1a4d6311ecff94047a18578ad1e30990343518e0..7f5364caec7be6ababd698b5ca2b7dcc2996b38f 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1812,7 +1812,7 @@ struct ConfigDef MuttVars[] = {
   ** .pp
   ** Also see the $$smart_wrap variable.
   */
-  { "mask", DT_REGEX|DT_REGEX_MATCH_CASE|DT_REGEX_ALLOW_NOT, R_NONE, &Mask, IP "!^\\.[^.]" },
+  { "mask", DT_REGEX|DT_REGEX_MATCH_CASE|DT_REGEX_ALLOW_NOT|DT_REGEX_NOSUB, R_NONE, &Mask, IP "!^\\.[^.]" },
   /*
   ** .pp
   ** A regular expression used in the file browser, optionally preceded by
diff --git a/main.c b/main.c
index dbe41e05dfd04a326ae50609019281533433af14..8e235791deef6aa100edb70fd7e7524f5834575d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -915,7 +915,7 @@ int main(int argc, char *argv[], char *envp[])
           if (mutt_str_strncasecmp("X-Mutt-Resume-Draft:", np->data, 20) == 0)
           {
             if (ResumeEditedDraftFiles)
-              ResumeDraftFiles = true;
+              cs_str_native_set(Config, "resume_draft_files", true, NULL);
 
             STAILQ_REMOVE(&msg->env->userhdrs, np, ListNode, entries);
             FREE(&np->data);
index 977a407bc24b577901cd9adaae5b3cc7a3072c59..251632412a63373941f1045f76f9dc1d9ff86775 100644 (file)
@@ -292,7 +292,7 @@ int mutt_log_set_level(int level, bool verbose)
   if (log_file_set_level(level, verbose) != 0)
     return -1;
 
-  DebugLevel = level;
+  cs_str_native_set(Config, "debug_level", level, NULL);
   return 0;
 }
 
index e5e176f0a4e3df4960c2ddd55172d78ac9003f68..29d8bf652130ddff6b0fde93063b21b60f460ea3 100644 (file)
@@ -353,7 +353,7 @@ static bool query_window_check_timebase(const char *timebase)
 static void query_window_reset(void)
 {
   mutt_debug(2, "entering\n");
-  NmQueryWindowCurrentPosition = 0;
+  cs_str_native_set(Config, "nm_query_window_current_position", 0, NULL);
 }
 
 /**
diff --git a/pager.c b/pager.c
index 4fa8abec376a62da83cf59cf9bdda965bfb8a6ad..9a62bc4eba9f4731a9425367526f1cb708fb3dce 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2373,7 +2373,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
         if (query_quadoption(Quit, _("Quit NeoMutt?")) == MUTT_YES)
         {
           /* avoid prompting again in the index menu */
-          Quit = MUTT_YES;
+          cs_str_native_set(Config, "quit", MUTT_YES, NULL);
           ch = -1;
         }
         break;
@@ -3320,7 +3320,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
         break;
 
       case OP_SIDEBAR_TOGGLE_VISIBLE:
-        SidebarVisible = !SidebarVisible;
+        bool_str_toggle(Config, "sidebar_visible", NULL);
         mutt_window_reflow();
         break;
 #endif
index 1214b616463a3ddb51466b33c1440256bb00c362..bd92e34635575bf3f680257be1e4f50b892db35f 100644 (file)
@@ -1067,7 +1067,7 @@ int mutt_attach_display_loop(struct Menu *menu, int op, struct Header *hdr,
     switch (op)
     {
       case OP_DISPLAY_HEADERS:
-        Weed = !Weed;
+        bool_str_toggle(Config, "weed", NULL);
         /* fallthrough */
 
       case OP_VIEW_ATTACH: