summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--overlays/neomutt/commands.patch87
-rw-r--r--overlays/neomutt/default.nix1
2 files changed, 88 insertions, 0 deletions
diff --git a/overlays/neomutt/commands.patch b/overlays/neomutt/commands.patch
new file mode 100644
index 00000000..6c910cfb
--- /dev/null
+++ b/overlays/neomutt/commands.patch
@@ -0,0 +1,87 @@
1commit 763056828abe9716c4dfce754a47d8ecdefb3029
2Author: Ismaël Bouya <ismael.bouya@normalesup.org>
3Date: Mon Feb 10 16:13:33 2020 +0100
4
5 Fix commands that don’t need to have a non-empty mailbox to be valid
6
7 Some commands act on the whole mailbox (tag-pattern, delete-pattern,
8 search), and even though they don’t do anything when the mailbox is
9 empty, there is no reason to fail when it happens. This commit removes
10 the check that the mailbox is non-empty before doing said actions.
11
12diff --git a/index.c b/index.c
13index 0f4b9f99f..0adfc19f1 100644
14--- a/index.c
15+++ b/index.c
16@@ -1642,7 +1642,7 @@ int mutt_index_menu(struct MuttWindow *dlg)
17 case OP_JUMP:
18 {
19 int msg_num = 0;
20- if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
21+ if (!prereq(Context, menu, CHECK_IN_MAILBOX))
22 break;
23 if (isdigit(LastKey))
24 mutt_unget_event(LastKey, 0);
25@@ -1687,7 +1687,7 @@ int mutt_index_menu(struct MuttWindow *dlg)
26
27 case OP_MAIN_DELETE_PATTERN:
28 if (!prereq(Context, menu,
29- CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE | CHECK_READONLY | CHECK_ATTACH))
30+ CHECK_IN_MAILBOX | CHECK_READONLY | CHECK_ATTACH))
31 {
32 break;
33 }
34@@ -1852,12 +1852,17 @@ int mutt_index_menu(struct MuttWindow *dlg)
35 menu->redraw = REDRAW_FULL;
36 break;
37
38- case OP_SEARCH:
39+ // Initiating a search can happen on an empty mailbox, but
40+ // searching for next/previous/... needs to be on a message and
41+ // thus a non-empty mailbox
42 case OP_SEARCH_REVERSE:
43 case OP_SEARCH_NEXT:
44 case OP_SEARCH_OPPOSITE:
45 if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
46 break;
47+ case OP_SEARCH:
48+ if (!prereq(Context, menu, CHECK_IN_MAILBOX))
49+ break;
50 menu->current = mutt_search_command(menu->current, op);
51 if (menu->current == -1)
52 menu->current = menu->oldcurrent;
53@@ -1926,14 +1931,14 @@ int mutt_index_menu(struct MuttWindow *dlg)
54 }
55
56 case OP_MAIN_TAG_PATTERN:
57- if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
58+ if (!prereq(Context, menu, CHECK_IN_MAILBOX))
59 break;
60 mutt_pattern_func(MUTT_TAG, _("Tag messages matching: "));
61 menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
62 break;
63
64 case OP_MAIN_UNDELETE_PATTERN:
65- if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE | CHECK_READONLY))
66+ if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_READONLY))
67 break;
68 /* L10N: CHECK_ACL */
69 /* L10N: Due to the implementation details we do not know whether we
70@@ -1950,7 +1955,7 @@ int mutt_index_menu(struct MuttWindow *dlg)
71 break;
72
73 case OP_MAIN_UNTAG_PATTERN:
74- if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
75+ if (!prereq(Context, menu, CHECK_IN_MAILBOX))
76 break;
77 if (mutt_pattern_func(MUTT_UNTAG, _("Untag messages matching: ")) == 0)
78 menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
79@@ -3189,7 +3194,7 @@ int mutt_index_menu(struct MuttWindow *dlg)
80 }
81
82 case OP_MAIN_COLLAPSE_ALL:
83- if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
84+ if (!prereq(Context, menu, CHECK_IN_MAILBOX))
85 break;
86
87 if ((C_Sort & SORT_MASK) != SORT_THREADS)
diff --git a/overlays/neomutt/default.nix b/overlays/neomutt/default.nix
index ec563e28..0b237342 100644
--- a/overlays/neomutt/default.nix
+++ b/overlays/neomutt/default.nix
@@ -9,6 +9,7 @@ self: super: {
9 rev = version; 9 rev = version;
10 sha256 = "16xr7wdmjw0i72xbnyyh098wx4cr0m8w2cr1szdi1b14p4kpgr67"; 10 sha256 = "16xr7wdmjw0i72xbnyyh098wx4cr0m8w2cr1szdi1b14p4kpgr67";
11 }; 11 };
12 patches = old.patches or [] ++ [ ./commands.patch ];
12 buildInputs = old.buildInputs ++ [ self.gdbm ]; 13 buildInputs = old.buildInputs ++ [ self.gdbm ];
13 configureFlags = old.configureFlags ++ [ "--gdbm" ]; 14 configureFlags = old.configureFlags ++ [ "--gdbm" ];
14 doCheck = false; 15 doCheck = false;