[PATCH 2/4] emacs: Support a message-mode switch function in notmuch-mua
Thomas Jost
schnouki at schnouki.net
Mon Oct 3 05:03:56 PDT 2011
---
emacs/notmuch-mua.el | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 8824b08..68c344e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -31,6 +31,14 @@
:group 'notmuch
:type 'hook)
+(defcustom notmuch-mua-switch-function nil
+ "Function used to switch to and display a new mail buffer."
+ :group 'notmuch
+ :type 'function
+ :options '(nil
+ switch-to-buffer-other-frame
+ switch-to-buffer-other-window))
+
(defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full
"Function used to generate a `User-Agent:' string. If this is
`nil' then no `User-Agent:' will be generated."
@@ -99,7 +107,8 @@ list."
((same-window-regexps '("\\*mail .*")))
(notmuch-mua-mail (mail-header 'to headers)
(mail-header 'subject headers)
- (message-headers-to-generate headers t '(to subject))))
+ (message-headers-to-generate headers t '(to subject))
+ nil notmuch-mua-switch-function))
;; insert the message body - but put it in front of the signature
;; if one is present
(goto-char (point-max))
@@ -112,6 +121,8 @@ list."
(message-goto-body))
(defun notmuch-mua-forward-message ()
+ (when notmuch-mua-switch-function
+ (funcall notmuch-mua-switch-function (current-buffer)))
(message-forward)
(when notmuch-mua-user-agent-function
@@ -199,7 +210,7 @@ the From: address first."
(let ((other-headers
(when (or prompt-for-sender notmuch-always-prompt-for-sender)
(list (cons 'from (notmuch-mua-prompt-for-sender))))))
- (notmuch-mua-mail nil nil other-headers)))
+ (notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))
(defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
"Invoke the notmuch message forwarding window.
--
1.7.6.4
More information about the notmuch
mailing list