In case anyone is interested I've attached a small patch that provides a
search_regex pager variable which can be set via message-hook to
initialize the search expression when entering pager mode.  For example
when I get mail from [email protected] which uses " --" to delimit each
article summary in the mail body I use the following in my ~/.muttrc to
set the initial search regex so I can just hit 'n' to search for "^ --".

message-hook '~h "^from: .*<newsbites@sans\.org>$"' 'set search_regex="^ --"'

-- 
Will Fiveash
# HG changeset patch
# User Will Fiveash <[email protected]>
# Date 1323109240 21600
# Branch HEAD
# Node ID d67edad6b8398f60081ae5c1a8c9f9b4b217c8c8
# Parent  2903091ac6f3e43a5fdb8580498c1414dbe21a9b
new search_regex pager variable

diff --git a/globals.h b/globals.h
--- a/globals.h
+++ b/globals.h
@@ -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 --git a/init.h b/init.h
--- a/init.h
+++ b/init.h
@@ -2471,6 +2471,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 --git a/pager.c b/pager.c
--- a/pager.c
+++ b/pager.c
@@ -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;

Attachment: pgpdLLVC0OpeB.pgp
Description: PGP signature

Reply via email to