[PATCH 2/4] emacs: Move the "prompt for sender" code to a new function.
authorThomas Jost <schnouki@schnouki.net>
Wed, 25 May 2011 13:22:38 +0000 (15:22 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:20 +0000 (09:38 -0800)
5f/140313c4cc87a2dd6c2fb738e01c19680c8c7a [new file with mode: 0644]

diff --git a/5f/140313c4cc87a2dd6c2fb738e01c19680c8c7a b/5f/140313c4cc87a2dd6c2fb738e01c19680c8c7a
new file mode 100644 (file)
index 0000000..eb8e79e
--- /dev/null
@@ -0,0 +1,97 @@
+Return-Path: <schnouki@schnouki.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 53929429E2A\r
+       for <notmuch@notmuchmail.org>; Wed, 25 May 2011 06:23:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id DNkLjAZBaxZr for <notmuch@notmuchmail.org>;\r
+       Wed, 25 May 2011 06:23:03 -0700 (PDT)\r
+Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
+       by olra.theworths.org (Postfix) with ESMTP id 05828429E25\r
+       for <notmuch@notmuchmail.org>; Wed, 25 May 2011 06:23:03 -0700 (PDT)\r
+Received: from localhost.localdomain (thor.loria.fr [152.81.12.250])\r
+       by ks3536.kimsufi.com (Postfix) with ESMTPSA id 5B8C86A06AD;\r
+       Wed, 25 May 2011 15:23:02 +0200 (CEST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
+       s=key-schnouki; t=1306329782;\r
+       bh=KjrheITkPEpwwgePerUJgm7T1mq00vUBtbxJzG9cc+c=;\r
+       h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
+       b=d3ms/MR2k5LOGTtPGRDkwuCLi2G8rB81nsTznOJGaZkV+k25uwchzEmciZbppU1eA\r
+       nWksV0mPh/51cIvG9usQ3NrS9hnxBDSUc1nZGCdIZ1MlWj8ojBMHqebWLgA/vJ9fIA\r
+       FuaMC1KcKKhuJ/ioY1DM5xA7s2w74p2fNiMaTlW0=\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] emacs: Move the "prompt for sender" code to a new\r
+       function.\r
+Date: Wed, 25 May 2011 15:22:38 +0200\r
+Message-Id: <1306329760-16665-2-git-send-email-schnouki@schnouki.net>\r
+X-Mailer: git-send-email 1.7.5.1\r
+In-Reply-To: <1306329760-16665-1-git-send-email-schnouki@schnouki.net>\r
+References: <87lixu7w71.fsf@thor.loria.fr>\r
+       <1306329760-16665-1-git-send-email-schnouki@schnouki.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 25 May 2011 13:23:04 -0000\r
+\r
+This allows the code to be reused in different functions without duplicating it.\r
+---\r
+ emacs/notmuch-mua.el |   15 +++++++++------\r
+ 1 files changed, 9 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index cd4d75d..0bde02c 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -157,21 +157,24 @@ name and addresses configured in the notmuch configuration file."\r
+             (concat (notmuch-user-name) " <" address ">"))\r
+           (cons (notmuch-user-primary-email) (notmuch-user-other-email)))))\r
\r
++(defvar notmuch-mua-sender-history nil)\r
++\r
++(defun notmuch-mua-prompt-for-sender ()\r
++  (interactive)\r
++  (let ((collection (notmuch-mua-sender-collection)))\r
++    (ido-completing-read "Send mail From: " collection\r
++                       nil 'confirm nil 'notmuch-mua-sender-history (car collection))))\r
++\r
+ (defun notmuch-mua-new-mail-from (&optional sender)\r
+   (if sender\r
+       (notmuch-mua-mail nil nil (list (cons 'from sender)))\r
+     (notmuch-mua-mail)))\r
\r
+-(defvar notmuch-mua-sender-history nil)\r
+-\r
+ (defun notmuch-mua-new-mail (&optional prompt-for-sender)\r
+   "Begin composing a new email with notmuch."\r
+   (interactive "P")\r
+   (if prompt-for-sender\r
+-      (let* ((collection (notmuch-mua-sender-collection))\r
+-           (sender (ido-completing-read "Send mail From: " collection\r
+-                                        nil 'confirm nil 'notmuch-mua-sender-history (car collection))))\r
+-      (notmuch-mua-new-mail-from sender))\r
++      (notmuch-mua-new-mail-from (notmuch-mua-prompt-for-sender))\r
+     (notmuch-mua-mail)))\r
\r
+ (defun notmuch-mua-new-mail-prompt-for-sender ()\r
+-- \r
+1.7.5.1\r
+\r