And I forgot to attach the patch ...
On (Jan-28-15|10:25), Kevin J. McCarthy wrote:
> David Champion wrote:
> > * On 27 Jan 2015, Yoshiki Vazquez Baeza wrote:
> > > Hello,
> > >
> > > This patch adds a new setting that you can configure to execute a
> > > command every time new mail is found in your current mailbox.
> >
> > I've had a couple of patches in progress for a while that are related.
> > I wanted to mention it mainly because I've already done most of that
> > work, and it should not be seen as a comment on your code -- just two
> > different but related approaches to the same problem, which can coexist.
> > I wanted to propose it for discussion, but now that your patch is here
> > the discussion has begun without the code. :) So this message is for
> > Yoshiki to respond to, but also for general community response to a
> > design idea for mail notification.
>
> Hi David,
>
> I just wanted to add my voice of support for the idea. I think these
> two patches could integrate well with each other, and would personally
> vote for committing them at the same time, with some kind of shared
> notification syntax.
>
> I don't want to speak for Yoshiki or Santiago, but I would guess it
> would be helpful to give some pointers as to where to integrate, or
> perhaps do the integration but give them credit in the patch.
>
> -Kevin
# HG changeset patch
# User Yoshiki Vazquez Baeza
# Date 1422483480 25200
# Wed Jan 28 15:18:00 2015 -0700
# Node ID a6a3c6eed5dc598ba76c031d59f0be5f392e05b9
# Parent ec93761e3e129e7ff7d81c892a69c5b2a89a832d
Add setting to execute a command when receiving new mail
diff -r ec93761e3e12 -r a6a3c6eed5dc curs_main.c
--- a/curs_main.c Fri Jan 23 10:33:32 2015 -0800
+++ b/curs_main.c Wed Jan 28 15:18:00 2015 -0700
@@ -575,6 +575,12 @@
mutt_message _("New mail in this mailbox.");
if (option (OPTBEEPNEW))
beep ();
+ if (NewMailCmd)
+ {
+ char cmd[LONG_STRING];
+ menu_status_line(cmd, sizeof(cmd), menu, NONULL(NewMailCmd));
+ mutt_system(cmd);
+ }
} else if (check == M_FLAGS)
mutt_message _("Mailbox was externally modified.");
@@ -596,8 +602,17 @@
menu->redraw |= REDRAW_STATUS;
if (do_buffy_notify)
{
- if (mutt_buffy_notify () && option (OPTBEEPNEW))
- beep ();
+ if (mutt_buffy_notify ())
+ {
+ if (option (OPTBEEPNEW))
+ beep ();
+ if (NewMailCmd)
+ {
+ char cmd[LONG_STRING];
+ menu_status_line(cmd, sizeof(cmd), menu, NONULL(NewMailCmd));
+ mutt_system(cmd);
+ }
+ }
}
else
do_buffy_notify = 1;
diff -r ec93761e3e12 -r a6a3c6eed5dc doc/manual.xml.head
--- a/doc/manual.xml.head Fri Jan 23 10:33:32 2015 -0800
+++ b/doc/manual.xml.head Wed Jan 28 15:18:00 2015 -0700
@@ -5888,7 +5888,10 @@
<link linkend="maildir-trash">$maildir_trash</link>). For MH folders, a
mailbox is considered having new mail if there's at least one message in
the <quote>unseen</quote> sequence as specified by <link
-linkend="mh-seq-unseen">$mh_seq_unseen</link>.
+linkend="mh-seq-unseen">$mh_seq_unseen</link>. Optionally, <link
+linkend="new_mail_command">$new_mail_command</link> can be configured to
+execute an external program every time new mail is detected in the current
+inbox.
</para>
<para>
diff -r ec93761e3e12 -r a6a3c6eed5dc globals.h
--- a/globals.h Fri Jan 23 10:33:32 2015 -0800
+++ b/globals.h Wed Jan 28 15:18:00 2015 -0700
@@ -111,6 +111,7 @@
WHERE char *PostponeEncryptAs;
WHERE char *Prefix;
WHERE char *PrintCmd;
+WHERE char *NewMailCmd;
WHERE char *QueryCmd;
WHERE char *QueryFormat;
WHERE char *Realname;
diff -r ec93761e3e12 -r a6a3c6eed5dc init.h
--- a/init.h Fri Jan 23 10:33:32 2015 -0800
+++ b/init.h Wed Jan 28 15:18:00 2015 -0700
@@ -290,6 +290,13 @@
{ "beep", DT_BOOL, R_NONE, OPTBEEP, 1 },
/*
** .pp
+ ** If \fIset\fP, Mutt will call this command after a new message is received.
+ ** See the $$status_format documentation for the values that can be formatted
+ ** into this command.
+ */
+ { "new_mail_command", DT_PATH, R_NONE, UL &NewMailCmd, UL NULL },
+ /*
+ ** .pp
** When this variable is \fIset\fP, mutt will beep when an error occurs.
*/
{ "beep_new", DT_BOOL, R_NONE, OPTBEEPNEW, 0 },