]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-mua.el
emacs: Allow the user to choose the "From" address when forwarding a message
[notmuch] / emacs / notmuch-mua.el
index dee2279a0e860c70508df66d72d23be4b3b37684..7b0aa3154109608f3f11459f11437872e3edce51 100644 (file)
@@ -161,6 +161,31 @@ name and addresses configured in the notmuch configuration file."
     (ido-completing-read "Send mail From: " collection
                         nil 'confirm nil 'notmuch-mua-sender-history (car collection))))
 
+(defun notmuch-mua-new-mail (&optional prompt-for-sender)
+  "Invoke the notmuch mail composition window.
+
+If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
+the From: address first."
+  (interactive "P")
+  (let ((other-headers
+        (when prompt-for-sender
+          (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))