modify-labels:
- add or remove notmuch tags; [+]<tag> to add, -<tag> to remove
- default key: `
+ - note: TAB completion of tag names is available
- example: "+AAA +BBB -CCC"
modify-labels-then-hide:
- same as <modify-labels> but message is marked by <quasi-delete>
- not mapped to any key
+ - note: TAB completion of tag names is available
- example (add "archive" notmuch tag and remove message from screen):
macro index A "<modify-labels-then-hide>+archive -inbox\n<sync-mailbox>"
CHECK_MSGCOUNT;
CHECK_VISIBLE;
*buf = '\0';
- if (mutt_get_field ("Add/remove labels: ", buf, sizeof (buf), 0) || !*buf)
+ if (mutt_get_field ("Add/remove labels: ", buf, sizeof (buf), M_NM_TAG) || !*buf)
{
mutt_message _("No label specified, aborting.");
break;
replace_part (state, 0, buf);
}
+ else if (flags & M_NM_TAG)
+ {
+ my_wcstombs (buf, buflen, state->wbuf, state->curpos);
+ i = strlen (buf);
+ if (!mutt_nm_tag_complete(buf, buflen, i, state->tabs))
+ BEEP ();
+
+ replace_part (state, 0, buf);
+ }
+
#endif
else
goto self_insert;
return 1;
}
+/* Complete the nearest "+" or "-" -prefixed string previous to pos. */
+int mutt_nm_tag_complete (char *buffer, size_t len, int pos, int numtabs)
+{
+ char *pt = buffer;
+ int spaces;
+ const char *first_plus = NULL;
+ const char *first_minus = NULL;
+
+ SKIPWS (buffer);
+ spaces = buffer - pt;
+
+ first_plus = rstrnstr((char *)buffer, pos, "+");
+ first_minus = rstrnstr((char *)buffer, pos, "-");
+ pt = (char *)MAX(first_plus, first_minus);
+
+ if (pt != NULL) {
+ pt++;
+
+ if (numtabs == 1)
+ {
+ /* First TAB. Collect all the matches */
+ complete_all_nm_tags(pt);
/* All matches are stored. Longest non-ambiguous string is ""
* i.e. don't change 'buffer'. Fake successful return this time.
#define M_PATTERN (1<<7) /* pattern mode - only used for history classes */
#if USE_NOTMUCH
#define M_NM_QUERY (1<<8) /* Notmuch query mode. */
+#define M_NM_TAG (1<<9) /* Notmuch tag +/- mode. */
#endif
/* flags for mutt_get_token() */
int mutt_var_value_complete (char *, size_t, int);
#if USE_NOTMUCH
int mutt_nm_query_complete (char *buffer, size_t len, int pos, int numtabs);
+int mutt_nm_tag_complete (char *buffer, size_t len, int pos, int numtabs);
#endif
int mutt_complete (char *, size_t);
int mutt_compose_attachment (BODY *a);