OPS | 1 + curs_main.c | 26 ++++++++++++++++++++++++++ doc/manual.xml.head | 21 +++++++++++++++++++++ functions.h | 1 + globals.h | 1 + init.h | 8 ++++++++ 6 files changed, 58 insertions(+), 0 deletions(-)
# HG changeset patch # User David Champion <[email protected]> # Date 1472600377 25200 # Tue Aug 30 16:39:37 2016 -0700 # Node ID 788059e7b1182f283c6d21139beaf9dd0d587035 # Parent d2a36497a89c8af5de751bea6dd1e20932b5604a 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. diff --git a/OPS b/OPS --- a/OPS +++ b/OPS @@ -132,6 +132,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 --git a/curs_main.c b/curs_main.c --- a/curs_main.c +++ b/curs_main.c @@ -2197,6 +2197,32 @@ } break; + + case OP_MARK_MSG: + + 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 --git a/doc/manual.xml.head b/doc/manual.xml.head --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -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 --git a/functions.h b/functions.h --- a/functions.h +++ b/functions.h @@ -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 --git a/globals.h b/globals.h --- a/globals.h +++ b/globals.h @@ -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 --git a/init.h b/init.h --- a/init.h +++ b/init.h @@ -1412,6 +1412,14 @@ ** from your spool mailbox to your $$mbox mailbox, or as a result of ** a ``$mbox-hook'' command. */ + /* this absurd location avoids conflict with ats.mark_old patch */ + { "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. + */ { "mail_check", DT_NUM, R_NONE, UL &BuffyTimeout, 5 }, /* ** .pp
