[PATCH 21/25] emacs: Cleaner interface when prompting for sender address
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 28 May 2011 21:51:56 +0000 (14:51 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:27 +0000 (09:38 -0800)
e6/c54918f8d3929bb6e9a17b802978bde9fc2999 [new file with mode: 0644]

diff --git a/e6/c54918f8d3929bb6e9a17b802978bde9fc2999 b/e6/c54918f8d3929bb6e9a17b802978bde9fc2999
new file mode 100644 (file)
index 0000000..4f6e175
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <jrollins@servo.finestructure.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 5B6AF431FD0\r
+       for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.921\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5\r
+       tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]\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 XNP4kLu6ioJl for <notmuch@notmuchmail.org>;\r
+       Sat, 28 May 2011 14:52:27 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id 60E48429E3D\r
+       for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:16 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id DCA492E50E83;\r
+       Sat, 28 May 2011 14:45:48 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com\r
+       [98.149.172.122]) (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id EC6272E50ED3;\r
+       Sat, 28 May 2011 14:45:45 -0700 (PDT)\r
+Received: by servo.finestructure.net (Postfix, from userid 1000)\r
+       id 560F691C; Sat, 28 May 2011 14:52:05 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 21/25] emacs: Cleaner interface when prompting for sender\r
+       address\r
+Date: Sat, 28 May 2011 14:51:56 -0700\r
+Message-Id: <1306619520-25730-22-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.4.4\r
+In-Reply-To: <1306619520-25730-21-git-send-email-jrollins@finestructure.net>\r
+References: <1306619520-25730-1-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-2-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-3-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-4-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-5-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-6-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-7-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-8-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-9-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-10-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-11-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-12-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-13-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-14-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-15-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-16-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-17-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-18-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-19-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-20-git-send-email-jrollins@finestructure.net>\r
+       <1306619520-25730-21-git-send-email-jrollins@finestructure.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: Sat, 28 May 2011 21:52:28 -0000\r
+\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+\r
+Most of the time, every entry in the list of identities has the same user name\r
+part. It can then be filled in automatically, and the user can only be prompted\r
+for the email address, which makes the interface much cleaner.\r
+---\r
+ emacs/notmuch-mua.el |   33 +++++++++++++++++++++++----------\r
+ 1 files changed, 23 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 556d2bf..274c5da 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -162,20 +162,33 @@ the From: header is already filled in by notmuch."\r
+   :group 'notmuch\r
+   :type 'boolean)\r
\r
+-(defun notmuch-mua-sender-collection ()\r
+-  (if notmuch-identities\r
+-      notmuch-identities\r
+-    (mapcar (lambda (address)\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
++  (let (name addresses one-name-only)\r
++    ;; If notmuch-identities is non-nil, check if there is a fixed user name.\r
++    (if notmuch-identities\r
++      (let ((components (mapcar 'mail-extract-address-components notmuch-identities)))\r
++        (setq name          (caar components)\r
++              addresses     (mapcar 'cadr components)\r
++              one-name-only (eval\r
++                             (cons 'and\r
++                                   (mapcar (lambda (identity)\r
++                                             (string-equal name (car identity)))\r
++                                           components)))))\r
++      ;; If notmuch-identities is nil, use values from the notmuch configuration file.\r
++      (setq name          (notmuch-user-name)\r
++          addresses     (cons (notmuch-user-primary-email) (notmuch-user-other-email))\r
++          one-name-only t))\r
++    ;; Now prompt the user, either for an email address only or for a full identity.\r
++    (if one-name-only\r
++      (let ((address\r
++             (ido-completing-read (concat "Sender address for " name ": ") addresses\r
++                                  nil nil nil 'notmuch-mua-sender-history (car addresses))))\r
++        (concat name " <" address ">"))\r
++      (ido-completing-read "Send mail From: " notmuch-identities\r
++                         nil nil nil 'notmuch-mua-sender-history (car notmuch-identities)))))\r
\r
+ (defun notmuch-mua-new-mail (&optional prompt-for-sender)\r
+   "Invoke the notmuch mail composition window.\r
+-- \r
+1.7.4.4\r
+\r