unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Thomas Jost <schnouki@schnouki.net>
To: Carl Worth <cworth@cworth.org>,
	Stewart Smith <stewart@flamingspork.com>,
	notmuch <notmuch@notmuchmail.org>
Subject: [PATCH v2 2/4] emacs: Allow the user to choose the "From" address when composing a new message
Date: Thu, 26 May 2011 10:41:31 +0200	[thread overview]
Message-ID: <1306399293-22215-2-git-send-email-schnouki@schnouki.net> (raw)
In-Reply-To: <1306399293-22215-1-git-send-email-schnouki@schnouki.net>

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

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index e58dd24..ab06d3a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -298,7 +298,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
     (define-key map "=" 'notmuch-hello-update)
     (define-key map "G" 'notmuch-hello-poll-and-update)
     (define-key map (kbd "<C-tab>") 'widget-backward)
-    (define-key map "m" 'notmuch-mua-mail)
+    (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "s" 'notmuch-hello-goto-search)
     map)
   "Keymap for \"notmuch hello\" buffers.")
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2baf6bd..74c9fc1 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -166,6 +166,17 @@ 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-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 825988c..48d2926 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -847,7 +847,7 @@ function is used. "
 	(define-key map (kbd "<backtab>") 'notmuch-show-previous-button)
 	(define-key map (kbd "TAB") 'notmuch-show-next-button)
 	(define-key map "s" 'notmuch-search)
-	(define-key map "m" 'notmuch-mua-mail)
+	(define-key map "m" 'notmuch-mua-new-mail)
 	(define-key map "f" 'notmuch-show-forward-message)
 	(define-key map "r" 'notmuch-show-reply)
 	(define-key map "|" 'notmuch-show-pipe-message)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 1d683f8..21e0314 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -204,7 +204,7 @@ For a mouse binding, return nil."
     (define-key map "p" 'notmuch-search-previous-thread)
     (define-key map "n" 'notmuch-search-next-thread)
     (define-key map "r" 'notmuch-search-reply-to-thread)
-    (define-key map "m" 'notmuch-mua-mail)
+    (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "s" 'notmuch-search)
     (define-key map "o" 'notmuch-search-toggle-order)
     (define-key map "c" 'notmuch-search-stash-map)
-- 
1.7.5.1

  reply	other threads:[~2011-05-26  8:41 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16  9:29 Multiple sender identities (composing) Stewart Smith
2011-05-16  9:52 ` Thomas Jost
2011-05-16 13:52   ` Stewart Smith
2011-05-16 16:52     ` Jameson Graef Rollins
2011-05-16 18:03       ` Thomas Jost
2011-05-16 18:43         ` Jameson Graef Rollins
2011-05-16 22:36       ` green
2011-05-17  4:38       ` Mueen Nawaz
2011-05-24 21:54 ` Carl Worth
2011-05-24 22:02   ` [PATCH] emacs: Allow user to choose "From" address when composing a new message Carl Worth
2011-05-25 13:21     ` Thomas Jost
2011-05-25 13:22       ` [PATCH 1/4] emacs: Allow the user choose the "From" address when composing a new message from notmuch-show-mode too Thomas Jost
2011-05-25 13:22         ` [PATCH 2/4] emacs: Move the "prompt for sender" code to a new function Thomas Jost
2011-05-25 13:22         ` [PATCH 3/4] emacs: Allow the user to choose the "From" address when forwarding a message Thomas Jost
2011-05-25 13:22         ` [PATCH 4/4] emacs: Allow the user to choose the "From" address when replying to " Thomas Jost
2011-05-25 22:17       ` [PATCH] emacs: Allow user to choose "From" address when composing a new message Carl Worth
2011-05-26  8:39         ` Thomas Jost
2011-05-26  8:41           ` [PATCH v2 1/4] emacs: Helpers needed for the user to be able to choose the " Thomas Jost
2011-05-26  8:41             ` Thomas Jost [this message]
2011-05-26  8:41             ` [PATCH v2 3/4] emacs: Allow the user to choose the "From" address when forwarding a message Thomas Jost
2011-05-26  8:41             ` [PATCH v2 4/4] emacs: Allow the user to choose the "From" address when replying to " Thomas Jost
2011-05-26 15:35           ` [PATCH] emacs: Allow user to choose "From" address when composing a new message Jameson Graef Rollins
2011-05-26 17:22             ` [PATCH] emacs: Add a customization allowing to always prompt for the " Thomas Jost
2011-05-26 17:46               ` Jameson Graef Rollins
2011-05-26 21:11               ` Carl Worth
2011-05-26 21:37                 ` Jameson Graef Rollins
2011-05-26 22:33                   ` Jameson Graef Rollins
2011-05-27  9:14                     ` [PATCH 1/2] emacs: Don't always prompt for the "From" address when replying Thomas Jost
2011-05-27  9:15                       ` [PATCH 2/2] emacs: Cleaner interface when prompting for sender address Thomas Jost
2011-05-27 10:37                         ` Jameson Graef Rollins
2011-05-27 10:36                       ` [PATCH 1/2] emacs: Don't always prompt for the "From" address when replying Jameson Graef Rollins
2011-05-29 22:38   ` Multiple sender identities (composing) Stewart Smith
2011-06-01  5:53 ` Brian May
2011-06-01  6:42   ` Thomas Jost
2011-06-02  1:49     ` Brian May

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306399293-22215-2-git-send-email-schnouki@schnouki.net \
    --to=schnouki@schnouki.net \
    --cc=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    --cc=stewart@flamingspork.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).