Skip to content

Instantly share code, notes, and snippets.

@ElDeveloper
Created July 12, 2016 05:34
Show Gist options
  • Save ElDeveloper/02e578ba06553b78736238b9a886b784 to your computer and use it in GitHub Desktop.
Save ElDeveloper/02e578ba06553b78736238b9a886b784 to your computer and use it in GitHub Desktop.
From 7a739217c774298b8b4f2c1b59d1fb7369f1d508 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yoshiki=20V=C3=A1zquez=20Baeza?= <[email protected]>
Date: Mon, 11 Jul 2016 22:33:44 -0700
Subject: [PATCH] Add documentation for new-mail
---
README.new-mail | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
doc/muttrc.new-mail | 29 +++--------------------------
doc/vimrc.new-mail | 15 ++-------------
3 files changed, 53 insertions(+), 39 deletions(-)
create mode 100644 README.new-mail
diff --git a/README.new-mail b/README.new-mail
new file mode 100644
index 0000000..3759fdb
--- /dev/null
+++ b/README.new-mail
@@ -0,0 +1,48 @@
+new-mail-command Patch
+======================
+
+ Configure a custom command to be executed when a new email is received.
+
+Patch
+-----
+
+ To check if Mutt supports "new-mail-command", look for
+ "new-mail" in the mutt version.
+
+ Dependencies
+ * mutt-1.6.1
+
+Introduction
+------------
+
+ This patch enables the new_mail_command setting, which can be used to execute a custom script (e.g., a notification handler) upon receiving a new mail.
+
+ For example in Linux you can use (most distributions already provide notify-send):
+
+```
+ set new_command="notify-send --icon='/home/santiago/Pictures/mutt.png' 'New Email in %f' '%n new messages, %u unread.' &"
+```
+
+ And in OS X you will need to install a command line interface for Notification Center, for example [terminal-notifier](https://github.com/julienXX/terminal-notifier):
+
+```
+ set new_mail_command="terminal-notifier -title '%v' -subtitle 'New Mail in %f' -message '%n new messages, %u unread.' -activate 'com.apple.Terminal'"
+```
+
+See Also
+--------
+
+ * NeoMutt project
+
+Known Bugs
+----------
+
+ * Notifies about spurious *new* e-mail when an email is saved, see [#20](https://github.com/neomutt/neomutt/issues/20).
+ * Will not notify about new e-mail if the pager is open, see [#19](https://github.com/neomutt/neomutt/issues/19)
+
+Credits
+-------
+
+ * Santiago Torres-Arias <[email protected]>
+ * Yoshiki Vazquez-Baeza <[email protected]>
+ * Richard Russon <[email protected]>
diff --git a/doc/muttrc.new-mail b/doc/muttrc.new-mail
index 412c544..5f87981 100644
--- a/doc/muttrc.new-mail
+++ b/doc/muttrc.new-mail
@@ -1,34 +1,11 @@
-# This is a complete list of FEATURE-NAME configuration.
+# This is a complete list of new-mail-command-related configuration.
# --------------------------------------------------------------------------
# VARIABLES - shown with their default values
# --------------------------------------------------------------------------
-# DESCRIPTION
-set VARIABLE = "DEFAULT_VALUE"
-
-# --------------------------------------------------------------------------
-# COMMANDS - shown with an example arguments
-# --------------------------------------------------------------------------
-
-# DESCRIPTION
-COMMAND_NAME 'ARGUMENTS'
-
-# --------------------------------------------------------------------------
-# FUNCTIONS - shown with an example mapping
-# --------------------------------------------------------------------------
-
-# DESCRIPTON
-bind index,pager KEY FUNCTION-NAME
-
-# --------------------------------------------------------------------------
-# COLORS - some unpleasant examples are given
-# --------------------------------------------------------------------------
-# Note: All color operations are of the form:
-# color OBJECT FOREGROUND BACKGROUND
-
-# DESCRIPTON
-color COLOR_NAME cyan black
+# Set the command you want mutt to execute upon the reception of a new email
+set new_mail_command = ""
# --------------------------------------------------------------------------
diff --git a/doc/vimrc.new-mail b/doc/vimrc.new-mail
index 1d96d30..3eaaf05 100644
--- a/doc/vimrc.new-mail
+++ b/doc/vimrc.new-mail
@@ -1,15 +1,4 @@
-" Vim syntax file for the mutt FEATURE-NAME patch
-
-syntax keyword muttrcVarBool skipwhite contained VARIABLE_NAME nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syntax keyword muttrcVarNum skipwhite contained VARIABLE_NAME nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syntax keyword muttrcVarStr contained skipwhite VARIABLE_NAME nextgroup=muttrcVarEqualsIdxFmt
-
-syntax keyword muttrcCommand COMMAND_NAME
-
-syntax match muttrcFunction contained "\<FUNCTION-NAME\>"
-
-syntax keyword muttrcColorField contained COLOR_NAME
+" Vim syntax file for the mutt new_mail_command patch
+syntax keyword muttrcVarStr contained skipwhite new_mail_command nextgroup=muttrcVarEqualsIdxFmt
" vim: syntax=vim
--
2.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment