OP_MAIN_CHANGE_VFOLDER "open a different virtual folder"
OP_MAIN_VFOLDER_FROM_QUERY "generate virtual folder from query"
OP_MAIN_MODIFY_LABELS "modify (notmuch) tags"
+OP_MAIN_MODIFY_LABELS_THEN_HIDE "modify labeld and then hide message"
- default key: `
- example: "+AAA +BBB -CCC"
+ modify-labels-then-hide:
+ - same as <modify-labels> but message is marked by <quasi-delete>
+ - not mapped to any key
+ - example (add "archive" notmuch tag and remove message from screen):
+
+ macro index A "<modify-labels-then-hide>archive\n<sync-mailbox>"
+
+ quasi-delete:
+ - delete message from mutt (usualy after <sync-mailbox> function), but
+ don't touch message on disk
+
* muttrc:
#ifdef USE_NOTMUCH
case OP_MAIN_MODIFY_LABELS:
+ case OP_MAIN_MODIFY_LABELS_THEN_HIDE:
+ {
if (Context->magic != M_NOTMUCH) {
mutt_message _("No virtual folder, aborting.");
break;
}
CHECK_MSGCOUNT;
CHECK_VISIBLE;
- buf[0] = '\0';
- if (mutt_get_field ("Add/remove labels: ", buf, sizeof (buf), 0) != 0 || !buf[0])
- {
- mutt_message _("No labels, aborting.");
+ *buf = '\0';
+ if (mutt_get_field ("Add/remove labels: ", buf, sizeof (buf), 0) || !*buf)
+ {
+ mutt_message _("No label specified, aborting.");
break;
}
if (tag && !option (OPTAUTOTAG))
if (Context->hdrs[Context->v2r[j]]->tagged) {
if (!Context->quiet)
mutt_progress_update(&progress, ++px, -1);
- nm_modify_message_tags(Context, Context->hdrs[Context->v2r[j]], buf, sizeof (buf));
+ nm_modify_message_tags(Context, Context->hdrs[Context->v2r[j]], buf);
+ if (op == OP_MAIN_MODIFY_LABELS_THEN_HIDE)
+ {
+ Context->hdrs[Context->v2r[j]]->quasi_deleted = TRUE;
+ Context->changed = TRUE;
+ }
}
}
nm_longrun_done(Context);
}
else
{
- if (nm_modify_message_tags(Context, CURHDR, buf, sizeof (buf))) {
+ if (nm_modify_message_tags(Context, CURHDR, buf)) {
mutt_message _("Failed to modify labels, aborting.");
break;
}
+ if (op == OP_MAIN_MODIFY_LABELS_THEN_HIDE)
+ {
+ CURHDR->quasi_deleted = TRUE;
+ Context->changed = TRUE;
+ }
if (option (OPTRESOLVE))
{
if ((menu->current = ci_next_undeleted (menu->current)) == -1)
}
menu->redraw |= REDRAW_STATUS;
break;
+ }
case OP_MAIN_VFOLDER_FROM_QUERY:
buf[0] = '\0';
{ "change-vfolder", OP_MAIN_CHANGE_VFOLDER, "X" },
{ "vfolder-from-query", OP_MAIN_VFOLDER_FROM_QUERY, "\033X" },
{ "modify-labels", OP_MAIN_MODIFY_LABELS, "`" },
+ { "modify-labels-then-hide", OP_MAIN_MODIFY_LABELS_THEN_HIDE, NULL },
#endif
{ NULL, 0, NULL }
};
{ "change-vfolder", OP_MAIN_CHANGE_VFOLDER, "X" },
{ "vfolder-from-query", OP_MAIN_VFOLDER_FROM_QUERY, "\033X" },
{ "modify-labels", OP_MAIN_MODIFY_LABELS, "`" },
+ { "modify-labels-then-hide", OP_MAIN_MODIFY_LABELS_THEN_HIDE, NULL },
#endif
{ NULL, 0, NULL }
return id && db ? notmuch_database_find_message(db, id) : NULL;
}
-int nm_modify_message_tags(CONTEXT *ctx, HEADER *hdr, char *buf0, size_t bufsz)
+int nm_modify_message_tags(CONTEXT *ctx, HEADER *hdr, char *buf0)
{
notmuch_database_t *db = NULL;
notmuch_message_t *msg = NULL;
int nm_get_count(char *path, unsigned *all, unsigned *new);
int nm_update_filename(CONTEXT *ctx, const char *old, const char *new);
char *nm_uri_from_query(CONTEXT *ctx, char *buf, size_t bufsz);
-int nm_modify_message_tags(CONTEXT *ctx, HEADER *hdr, char *buf, size_t bufsz);
+int nm_modify_message_tags(CONTEXT *ctx, HEADER *hdr, char *tags);
void nm_longrun_init(CONTEXT *cxt, int writable);
void nm_longrun_done(CONTEXT *cxt);