[PATCH] new search_regex pager parameter
I've create a patch that introduces a search_regex pager setting. This
allows one to initialize the search string via a message-hook when
entering the mutt pager. Here is an example of how to use it:
message-hook '~s "^CR "' 'set search_regex="^=== "'
# HG changeset patch
# User Will Fiveash <will.fiveash@xxxxxxxxxx>
# Date 1287100788 18000
# Branch HEAD
# Node ID bcb7f904515ed09ccc7ac9cbe05cf814d02c3484
# Parent 6eec86da3108932029df4d7d6b5eadb89c2add6b
new search_regex pager variable
diff -r 6eec86da3108 -r bcb7f904515e globals.h
--- a/globals.h Thu Oct 14 18:59:48 2010 -0500
+++ b/globals.h Thu Oct 14 18:59:48 2010 -0500
@@ -114,6 +114,7 @@
WHERE char *QueryFormat;
WHERE char *Realname;
WHERE short SearchContext;
+WHERE char *SearchRegex;
WHERE char *SendCharset;
WHERE char *Sendmail;
WHERE char *Shell;
diff -r 6eec86da3108 -r bcb7f904515e init.h
--- a/init.h Thu Oct 14 18:59:48 2010 -0500
+++ b/init.h Thu Oct 14 18:59:48 2010 -0500
@@ -2450,6 +2450,11 @@
** For the pager, this variable specifies the number of lines shown
** before search results. By default, search results will be top-aligned.
*/
+ { "search_regex", DT_STR, R_NONE, UL &SearchRegex, UL "" },
+ /*
+ ** .pp
+ ** For the pager, this variable specifies an initial search regex.
+ */
{ "send_charset", DT_STR, R_NONE, UL &SendCharset, UL
"us-ascii:iso-8859-1:utf-8" },
/*
** .pp
diff -r 6eec86da3108 -r bcb7f904515e pager.c
--- a/pager.c Thu Oct 14 18:59:48 2010 -0500
+++ b/pager.c Thu Oct 14 18:59:48 2010 -0500
@@ -1600,6 +1600,9 @@
/* Initialize variables */
+ if (SearchRegex != NULL)
+ strfcpy (searchbuf, SearchRegex, sizeof (searchbuf));
+
if (IsHeader (extra) && !extra->hdr->read)
{
Context->msgnotreadyet = extra->hdr->msgno;