[PATCH] emacs: do not change users' mail agent configuration

Łukasz Stelmach stlman at poczta.fm
Fri Dec 12 10:54:26 PST 2014


`mail-user-agent' is defined with defcustom and may be customised
by users. It should not be set to arbitrary values in modules.

To make use of that configuration value call `compose-mail' which
starts user's preferred mail composition package as selected with
the variable `mail-user-agent' instead of notmuch's hardcoded
`message-mail'.
---
 NEWS                 | 10 ++++++++++
 emacs/notmuch-mua.el |  2 +-
 emacs/notmuch.el     |  2 --
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 44e8d05..cf5b3c3 100644
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,16 @@ Added `notmuch address` subcommand
 Emacs Interface
 ---------------
 
+Fixed `mail-user-agent` handling
+
+  The value of the mail-user-agent variable is not forcibly set to
+  `notmuch-user-agent`, regardles of how a user has customised it,
+  everytime notmuch.el is loaded. This way, someone who used for example
+  Gnus has her MUA and notmuch just as a search engine, doesn't have her
+  configuration broken everytime notmuch.el is loaded. The user can now
+  use her favourite mail composing package when replying messages in
+  notmuch too.
+
 Use the `j` key to access saved searches from anywhere in notmuch
 
   `j` is now globally bound to `notmuch-jump`, which provides fast,
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2c58886..f02c7b5 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -263,7 +263,7 @@ OTHER-ARGS are passed through to `message-mail'."
     (push (cons 'From (concat
 		       (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))
 
-  (apply #'message-mail to subject other-headers other-args)
+  (apply #'compose-mail to subject other-headers other-args)
   (message-sort-headers)
   (message-hide-headers)
   (set-buffer-modified-p nil)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..80cab57 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1037,8 +1037,6 @@ notmuch buffers exist, run `notmuch'."
 	  (switch-to-buffer first))
       (notmuch))))
 
-(setq mail-user-agent 'notmuch-user-agent)
-
 (provide 'notmuch)
 
 ;; After provide to avoid loops if notmuch was require'd via notmuch-init-file.
-- 
2.0.4



More information about the notmuch mailing list