[PATCH v2 3/4] emacs: Allow the user to choose the "From" address when forwarding a message

Thomas Jost schnouki at schnouki.net
Thu May 26 01:41:32 PDT 2011


When pressing C-u f, the user will be prompted for the identity to use.
---
 emacs/notmuch-mua.el  |   14 ++++++++++++++
 emacs/notmuch-show.el |    6 +++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 74c9fc1..1b777d9 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -177,6 +177,20 @@ the From: address first."
 	   (list (cons 'from (notmuch-mua-prompt-for-sender))))))
     (notmuch-mua-mail nil nil other-headers)))
 
+(defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
+  "Invoke the notmuch message forwarding window.
+
+If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
+the From: address first."
+  (interactive "P")
+  (if prompt-for-sender
+      (let* ((sender (notmuch-mua-prompt-for-sender))
+	     (address-components (mail-extract-address-components sender))
+	     (user-full-name (car address-components))
+	     (user-mail-address (cadr address-components)))
+	(notmuch-mua-forward-message))
+    (notmuch-mua-forward-message)))
+
 (defun notmuch-mua-send-and-exit (&optional arg)
   (interactive "P")
   (message-send-and-exit arg))
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 48d2926..7e493e9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1158,11 +1158,11 @@ any effects from previous calls to
   (interactive)
   (notmuch-mua-reply (notmuch-show-get-message-id)))
 
-(defun notmuch-show-forward-message ()
+(defun notmuch-show-forward-message (&optional prompt-for-sender)
   "Forward the current message."
-  (interactive)
+  (interactive "P")
   (with-current-notmuch-show-message
-   (notmuch-mua-forward-message)))
+   (notmuch-mua-new-forward-message prompt-for-sender)))
 
 (defun notmuch-show-next-message ()
   "Show the next message."
-- 
1.7.5.1



More information about the notmuch mailing list