Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / aa / 891758168ab63cff3ae97aeaa4c7b2eeedd38f
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 190F9431FBC\r
6         for <notmuch@notmuchmail.org>; Tue, 16 Sep 2014 15:27:21 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id jvN68Iieepru for <notmuch@notmuchmail.org>;\r
16         Tue, 16 Sep 2014 15:27:12 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id C21AC431FAE\r
19         for <notmuch@notmuchmail.org>; Tue, 16 Sep 2014 15:27:12 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id A3AF5100051;\r
22         Wed, 17 Sep 2014 01:26:57 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: sfischme@uwaterloo.ca, notmuch@notmuchmail.org\r
25 Subject: Re: Better support for helm in the address completion\r
26 In-Reply-To: <87vbonhgwe.fsf@uwaterloo.ca>\r
27 References: <87vbonhgwe.fsf@uwaterloo.ca>\r
28 User-Agent: Notmuch/0.18.1+97~g6c845ef (http://notmuchmail.org) Emacs/24.3.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Wed, 17 Sep 2014 01:26:57 +0300\r
34 Message-ID: <m2vbonxkum.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Tue, 16 Sep 2014 22:27:21 -0000\r
50 \r
51 On Tue, Sep 16 2014, Sebastian Fischmeister <sfischme@uwaterloo.ca> wrote:\r
52 \r
53 > Hi,\r
54 >\r
55 > I noticed that the completing-read in notmuch-address-selection-function\r
56 > was eating the first returned address when using helm. Here's a patch\r
57 > that fixes it. The defaults are as they used to be.\r
58 \r
59 If you don't want to provide patch according to \r
60 \r
61 http://notmuchmail.org/contributing/\r
62 \r
63 (patch format & commit message are important to attract reviewers (who!?;) ))\r
64 \r
65 and additionally explain (to me) why some of those things are changed to\r
66 symbols you can just edit\r
67 \r
68 ~/.emacs.d/notmuch-config.el\r
69 \r
70 and add\r
71 \r
72 (setq notmuch-address-selection-function\r
73       (lambda (prompt collection initial-input)\r
74         (completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history)))\r
75 \r
76 there (or use customize to do that (?)).\r
77 \r
78 If I were smarter when I split this call out from notmuch-address-expand-name\r
79 I would not have called it with (car options) (cdr options) but split\r
80 it in that selection-function but that is how it is now...(*)\r
81 \r
82 Tomi\r
83 \r
84 (*) Especially as I did that just so that I can do this:\r
85 \r
86 (setq notmuch-address-selection-function\r
87       (lambda (prompt collection initial-input)\r
88         (selection-menu "Send To:" (cons initial-input collection) t)))\r
89 \r
90 ;/\r
91 \r
92 \r
93 \r
94 > For helm use:\r
95 >\r
96 > (setq notmuch-address-suggest-initial-match nil)\r
97 >\r
98 > If you don't want to enter a new address in the selection (with helm)\r
99 > use:\r
100 >\r
101 > (setq notmuch-address-require-match t)\r
102 >\r
103 >   Sebastian\r
104 >\r
105 > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
106 > index fa65cd5..d9b66cd 100644\r
107 > --- a/emacs/notmuch-address.el\r
108 > +++ b/emacs/notmuch-address.el\r
109 > @@ -42,11 +42,25 @@ to know how address selection is made by default."\r
110 >    :group 'notmuch-send\r
111 >    :group 'notmuch-external)\r
112 >  \r
113 > +(defcustom notmuch-address-suggest-initial-match t\r
114 > +  "Pass an initial match to the address completing read."\r
115 > +  :type 'boolean\r
116 > +  :group 'notmuch-send)\r
117 > +\r
118 > +(defcustom notmuch-address-require-match nil\r
119 > +  "Require a match in the address selection in `notmuch-address-selection-function'."\r
120 > +  :type 'boolean\r
121 > +  :group 'notmuch-send)\r
122 > +\r
123 >  (defun notmuch-address-selection-function (prompt collection initial-input)\r
124 >    "Call (`completing-read'\r
125 >        PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"\r
126 >    (completing-read\r
127 > -   prompt collection nil nil initial-input 'notmuch-address-history))\r
128 > +   prompt\r
129 > +   (if notmuch-address-suggest-initial-match 'collection (list initial-input collection))\r
130 > +   nil notmuch-address-require-match\r
131 > +   (if notmuch-address-suggest-initial-match 'initial-input nil)\r
132 > +   'notmuch-address-history))\r
133 >  \r
134 >  (defvar notmuch-address-message-alist-member\r
135 >    '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"\r
136 > _______________________________________________\r
137 > notmuch mailing list\r
138 > notmuch@notmuchmail.org\r
139 > http://notmuchmail.org/mailman/listinfo/notmuch\r