emacs: Allow the user to choose the "From" address when forwarding a message
authorThomas Jost <schnouki@schnouki.net>
Thu, 26 May 2011 08:41:32 +0000 (10:41 +0200)
committerCarl Worth <cworth@cworth.org>
Thu, 26 May 2011 17:34:45 +0000 (10:34 -0700)
When pressing C-u f, the user will be prompted for the identity to use.

emacs/notmuch-mua.el
emacs/notmuch-show.el

index c792732ba5530b8db856cb77393c18600de0702a..7b0aa3154109608f3f11459f11437872e3edce51 100644 (file)
@@ -172,6 +172,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))
index 93c5e53b2d235e0ead9b321011149183422216d1..add273ce154b42968039100f6e099536595396f2 100644 (file)
@@ -1103,11 +1103,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."