--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 190F9431FBC\r
+ for <notmuch@notmuchmail.org>; Tue, 16 Sep 2014 15:27:21 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 jvN68Iieepru for <notmuch@notmuchmail.org>;\r
+ Tue, 16 Sep 2014 15:27:12 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id C21AC431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 16 Sep 2014 15:27:12 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id A3AF5100051;\r
+ Wed, 17 Sep 2014 01:26:57 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: sfischme@uwaterloo.ca, notmuch@notmuchmail.org\r
+Subject: Re: Better support for helm in the address completion\r
+In-Reply-To: <87vbonhgwe.fsf@uwaterloo.ca>\r
+References: <87vbonhgwe.fsf@uwaterloo.ca>\r
+User-Agent: Notmuch/0.18.1+97~g6c845ef (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Wed, 17 Sep 2014 01:26:57 +0300\r
+Message-ID: <m2vbonxkum.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Tue, 16 Sep 2014 22:27:21 -0000\r
+\r
+On Tue, Sep 16 2014, Sebastian Fischmeister <sfischme@uwaterloo.ca> wrote:\r
+\r
+> Hi,\r
+>\r
+> I noticed that the completing-read in notmuch-address-selection-function\r
+> was eating the first returned address when using helm. Here's a patch\r
+> that fixes it. The defaults are as they used to be.\r
+\r
+If you don't want to provide patch according to \r
+\r
+http://notmuchmail.org/contributing/\r
+\r
+(patch format & commit message are important to attract reviewers (who!?;) ))\r
+\r
+and additionally explain (to me) why some of those things are changed to\r
+symbols you can just edit\r
+\r
+~/.emacs.d/notmuch-config.el\r
+\r
+and add\r
+\r
+(setq notmuch-address-selection-function\r
+ (lambda (prompt collection initial-input)\r
+ (completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history)))\r
+\r
+there (or use customize to do that (?)).\r
+\r
+If I were smarter when I split this call out from notmuch-address-expand-name\r
+I would not have called it with (car options) (cdr options) but split\r
+it in that selection-function but that is how it is now...(*)\r
+\r
+Tomi\r
+\r
+(*) Especially as I did that just so that I can do this:\r
+\r
+(setq notmuch-address-selection-function\r
+ (lambda (prompt collection initial-input)\r
+ (selection-menu "Send To:" (cons initial-input collection) t)))\r
+\r
+;/\r
+\r
+\r
+\r
+> For helm use:\r
+>\r
+> (setq notmuch-address-suggest-initial-match nil)\r
+>\r
+> If you don't want to enter a new address in the selection (with helm)\r
+> use:\r
+>\r
+> (setq notmuch-address-require-match t)\r
+>\r
+> Sebastian\r
+>\r
+> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+> index fa65cd5..d9b66cd 100644\r
+> --- a/emacs/notmuch-address.el\r
+> +++ b/emacs/notmuch-address.el\r
+> @@ -42,11 +42,25 @@ to know how address selection is made by default."\r
+> :group 'notmuch-send\r
+> :group 'notmuch-external)\r
+> \r
+> +(defcustom notmuch-address-suggest-initial-match t\r
+> + "Pass an initial match to the address completing read."\r
+> + :type 'boolean\r
+> + :group 'notmuch-send)\r
+> +\r
+> +(defcustom notmuch-address-require-match nil\r
+> + "Require a match in the address selection in `notmuch-address-selection-function'."\r
+> + :type 'boolean\r
+> + :group 'notmuch-send)\r
+> +\r
+> (defun notmuch-address-selection-function (prompt collection initial-input)\r
+> "Call (`completing-read'\r
+> PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"\r
+> (completing-read\r
+> - prompt collection nil nil initial-input 'notmuch-address-history))\r
+> + prompt\r
+> + (if notmuch-address-suggest-initial-match 'collection (list initial-input collection))\r
+> + nil notmuch-address-require-match\r
+> + (if notmuch-address-suggest-initial-match 'initial-input nil)\r
+> + 'notmuch-address-history))\r
+> \r
+> (defvar notmuch-address-message-alist-member\r
+> '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r