changeset: 6859:022b604bc46d
user: David Champion <[email protected]>
date: Thu Nov 17 15:57:42 2016 -0800
link: http://dev.mutt.org/hg/mutt/rev/022b604bc46d
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.
diffs (119 lines):
diff -r 3c6d322912e3 -r 022b604bc46d OPS
--- a/OPS Thu Nov 17 15:07:14 2016 -0800
+++ b/OPS Thu Nov 17 15:57:42 2016 -0800
@@ -131,6 +131,7 @@
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"
diff -r 3c6d322912e3 -r 022b604bc46d curs_main.c
--- a/curs_main.c Thu Nov 17 15:07:14 2016 -0800
+++ b/curs_main.c Thu Nov 17 15:57:42 2016 -0800
@@ -2204,6 +2204,34 @@
}
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;
diff -r 3c6d322912e3 -r 022b604bc46d doc/manual.xml.head
--- a/doc/manual.xml.head Thu Nov 17 15:07:14 2016 -0800
+++ b/doc/manual.xml.head Thu Nov 17 15:57:42 2016 -0800
@@ -5492,6 +5492,27 @@
</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>
diff -r 3c6d322912e3 -r 022b604bc46d functions.h
--- a/functions.h Thu Nov 17 15:07:14 2016 -0800
+++ b/functions.h Thu Nov 17 15:57:42 2016 -0800
@@ -65,6 +65,7 @@
{ "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 },
diff -r 3c6d322912e3 -r 022b604bc46d globals.h
--- a/globals.h Thu Nov 17 15:07:14 2016 -0800
+++ b/globals.h Thu Nov 17 15:57:42 2016 -0800
@@ -78,6 +78,7 @@
WHERE char *HeaderCachePageSize;
#endif /* HAVE_GDBM || HAVE_DB4 */
#endif /* USE_HCACHE */
+WHERE char *MarkMacroPrefix;
WHERE char *MhFlagged;
WHERE char *MhReplied;
WHERE char *MhUnseen;
diff -r 3c6d322912e3 -r 022b604bc46d init.h
--- a/init.h Thu Nov 17 15:07:14 2016 -0800
+++ b/init.h Thu Nov 17 15:57:42 2016 -0800
@@ -1490,6 +1490,13 @@
** 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