Commit fdeb4c48 authored by David Champion's avatar David Champion

Adds <mark-message> binding to create "hotkeys" for messages.

<mark-message>foo<enter> will create a new macro "'foo" which will
return to the current message by searching for that message's
message id.  The initial character of the macro is defined by
$mark_macro_prefix, and defaults to "'" for verisimilitude vs. vi.

Pushed by Kevin McCarthy with a minor fix.
parent 2f4d02d9
......@@ -131,6 +131,7 @@ OP_MAIN_SYNC_FOLDER "save changes to mailbox"
OP_MAIN_TAG_PATTERN "tag messages matching a pattern"
OP_MAIN_UNDELETE_PATTERN "undelete messages matching a pattern"
OP_MAIN_UNTAG_PATTERN "untag messages matching a pattern"
OP_MARK_MSG "create a hot-key macro for the current message"
OP_MIDDLE_PAGE "move to the middle of the page"
OP_NEXT_ENTRY "move to the next entry"
OP_NEXT_LINE "scroll down one line"
......
......@@ -2204,6 +2204,34 @@ int mutt_index_menu (void)
}
break;
case OP_MARK_MSG:
CHECK_MSGCOUNT;
CHECK_VISIBLE;
if (CURHDR->env->message_id)
{
char str[STRING], macro[STRING];
char buf[128];
buf[0] = '\0';
if (!mutt_get_field ("Enter macro stroke: ", buf, sizeof(buf),
MUTT_CLEAR) && buf[0])
{
snprintf(str, sizeof(str), "%s%s", MarkMacroPrefix, buf);
snprintf(macro, sizeof(macro),
"<search>~i \"%s\"\n", CURHDR->env->message_id);
km_bind(str, MENU_GENERIC, OP_MACRO, macro, "Message hotkey");
snprintf(buf, sizeof(buf), _("Message bound to %s."), str);
mutt_message(buf);
dprint (1, (debugfile, "Mark: %s => %s\n", str, macro));
}
}
else
mutt_error _("No message ID to macro.");
break;
case OP_RECALL_MESSAGE:
CHECK_ATTACH;
......
......@@ -5492,6 +5492,27 @@ dates shown in the main index.
</sect1>
<sect1 id="markmsg">
<title>Marking Messages</title>
<para>
There are times that it's useful to ask Mutt to "remember" which message
you're currently looking at, while you move elsewhere in your mailbox.
You can do this with the <quote>mark-message</quote> operator, which
is bound to the <quote>~</quote> key by default. Press this key to
enter an identifier for the marked message. When you want to return to
this message, press <quote>'</quote> and the name that you previously
entered.
</para>
<para>
(Message marking is really just a shortcut for defining a macro
that returns you to the current message by searching for its
Message-ID. You can choose a different prefix by setting the <link
linkend="mark-macro-prefix">$mark_macro_prefix</link> variable.)
</para>
</sect1>
<sect1 id="tags">
<title>Using Tags</title>
......
......@@ -65,6 +65,7 @@ const struct binding_t OpGeneric[] = { /* map: generic */
{ "previous-line", OP_PREV_LINE, "<" },
{ "half-up", OP_HALF_UP, "[" },
{ "half-down", OP_HALF_DOWN, "]" },
{ "mark-message", OP_MARK_MSG, "~" },
{ "help", OP_HELP, "?" },
{ "tag-prefix", OP_TAG_PREFIX, ";" },
{ "tag-prefix-cond", OP_TAG_PREFIX_COND, NULL },
......
......@@ -78,6 +78,7 @@ WHERE char *HeaderCache;
WHERE char *HeaderCachePageSize;
#endif /* HAVE_GDBM || HAVE_DB4 */
#endif /* USE_HCACHE */
WHERE char *MarkMacroPrefix;
WHERE char *MhFlagged;
WHERE char *MhReplied;
WHERE char *MhUnseen;
......
......@@ -1490,6 +1490,13 @@ struct option_t MuttVars[] = {
** slow down polling for new messages in large folders, since mutt has
** to scan all cur messages.
*/
{ "mark_macro_prefix",DT_STR, R_NONE, UL &MarkMacroPrefix, UL "'" },
/*
** .pp
** Prefix for macros created using mark-message. A new macro
** automatically generated with \fI<mark-message>a\fP will be composed
** from this prefix and the letter \fIa\fP.
*/
{ "mark_old", DT_BOOL, R_BOTH, OPTMARKOLD, 1 },
/*
** .pp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment