From: Tomi Ollila Date: Tue, 16 Sep 2014 22:26:57 +0000 (+0300) Subject: Re: Better support for helm in the address completion X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1348ba0151cbf210bbf87669882bb1f304cf7bbb;p=notmuch-archives.git Re: Better support for helm in the address completion --- diff --git a/aa/891758168ab63cff3ae97aeaa4c7b2eeedd38f b/aa/891758168ab63cff3ae97aeaa4c7b2eeedd38f new file mode 100644 index 000000000..15616300f --- /dev/null +++ b/aa/891758168ab63cff3ae97aeaa4c7b2eeedd38f @@ -0,0 +1,139 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 190F9431FBC + for ; Tue, 16 Sep 2014 15:27:21 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id jvN68Iieepru for ; + Tue, 16 Sep 2014 15:27:12 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id C21AC431FAE + for ; Tue, 16 Sep 2014 15:27:12 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id A3AF5100051; + Wed, 17 Sep 2014 01:26:57 +0300 (EEST) +From: Tomi Ollila +To: sfischme@uwaterloo.ca, notmuch@notmuchmail.org +Subject: Re: Better support for helm in the address completion +In-Reply-To: <87vbonhgwe.fsf@uwaterloo.ca> +References: <87vbonhgwe.fsf@uwaterloo.ca> +User-Agent: Notmuch/0.18.1+97~g6c845ef (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 16 Sep 2014 22:27:21 -0000 + +On Tue, Sep 16 2014, Sebastian Fischmeister wrote: + +> Hi, +> +> I noticed that the completing-read in notmuch-address-selection-function +> was eating the first returned address when using helm. Here's a patch +> that fixes it. The defaults are as they used to be. + +If you don't want to provide patch according to + +http://notmuchmail.org/contributing/ + +(patch format & commit message are important to attract reviewers (who!?;) )) + +and additionally explain (to me) why some of those things are changed to +symbols you can just edit + +~/.emacs.d/notmuch-config.el + +and add + +(setq notmuch-address-selection-function + (lambda (prompt collection initial-input) + (completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history))) + +there (or use customize to do that (?)). + +If I were smarter when I split this call out from notmuch-address-expand-name +I would not have called it with (car options) (cdr options) but split +it in that selection-function but that is how it is now...(*) + +Tomi + +(*) Especially as I did that just so that I can do this: + +(setq notmuch-address-selection-function + (lambda (prompt collection initial-input) + (selection-menu "Send To:" (cons initial-input collection) t))) + +;/ + + + +> For helm use: +> +> (setq notmuch-address-suggest-initial-match nil) +> +> If you don't want to enter a new address in the selection (with helm) +> use: +> +> (setq notmuch-address-require-match t) +> +> Sebastian +> +> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el +> index fa65cd5..d9b66cd 100644 +> --- a/emacs/notmuch-address.el +> +++ b/emacs/notmuch-address.el +> @@ -42,11 +42,25 @@ to know how address selection is made by default." +> :group 'notmuch-send +> :group 'notmuch-external) +> +> +(defcustom notmuch-address-suggest-initial-match t +> + "Pass an initial match to the address completing read." +> + :type 'boolean +> + :group 'notmuch-send) +> + +> +(defcustom notmuch-address-require-match nil +> + "Require a match in the address selection in `notmuch-address-selection-function'." +> + :type 'boolean +> + :group 'notmuch-send) +> + +> (defun notmuch-address-selection-function (prompt collection initial-input) +> "Call (`completing-read' +> PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)" +> (completing-read +> - prompt collection nil nil initial-input 'notmuch-address-history)) +> + prompt +> + (if notmuch-address-suggest-initial-match 'collection (list initial-input collection)) +> + nil notmuch-address-require-match +> + (if notmuch-address-suggest-initial-match 'initial-input nil) +> + 'notmuch-address-history)) +> +> (defvar notmuch-address-message-alist-member +> '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):" +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch