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 A6630431FB6
\r
6 for <notmuch@notmuchmail.org>; Sun, 14 Dec 2014 09:27:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 2IOBovwdyWoF for <notmuch@notmuchmail.org>;
\r
16 Sun, 14 Dec 2014 09:27:38 -0800 (PST)
\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 2AE8F431FAF
\r
19 for <notmuch@notmuchmail.org>; Sun, 14 Dec 2014 09:27:38 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id D39D8100033;
\r
22 Sun, 14 Dec 2014 19:27:08 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Lele Gaifax <lele@metapensiero.it>, notmuch@notmuchmail.org
\r
25 Subject: Re: Address completion in Emacs
\r
26 In-Reply-To: <87d27p9t0f.fsf@nautilus.nautilus>
\r
27 References: <87d27p9t0f.fsf@nautilus.nautilus>
\r
28 User-Agent: Notmuch/0.19+6~g8725b09 (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: Sun, 14 Dec 2014 19:27:08 +0200
\r
34 Message-ID: <m2iohedtw3.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain; charset=utf-8
\r
37 Content-Transfer-Encoding: quoted-printable
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sun, 14 Dec 2014 17:27:41 -0000
\r
52 On Fri, Dec 12 2014, Lele Gaifax wrote:
\r
56 > Yesterday I tweaked my Emacs configuration to use "ido-completing-read"
\r
57 > to select the right address in the minibuffer, and noticed what seems a
\r
58 > glitch in the related code.
\r
60 > To accomplish the goal, I implemented my own selection function
\r
62 > (defun esk-notmuch-address-selection-function (prompt addresses first)
\r
63 > "Use `ido-completing-read' to select one of the addresses."
\r
64 > (ido-completing-read prompt (cons first addresses)
\r
65 > nil nil nil 'notmuch-address-history))
\r
67 > and then assigned it to `notmuch-address-selection-function':
\r
69 > (setq notmuch-address-selection-function 'esk-notmuch-address-selection=
\r
72 > As you can see, I had to `cons' the two arguments, because the caller of
\r
73 > that function does something similar to the following (where `orig' is
\r
74 > the text entered before TAB-completion):
\r
76 > (options (notmuch-address-options orig))
\r
77 > (num-options (length options))
\r
78 > (chosen (funcall notmuch-address-selection-function
\r
79 > (format "Address (%s matches): " num-options)
\r
80 > (cdr options) (car options)))
\r
82 > and the standard `notmuch-address-selection-function' is defined like:
\r
84 > (defun notmuch-address-selection-function (prompt collection initial-in=
\r
86 > "Call (`completing-read'
\r
87 > PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
\r
89 > prompt collection nil nil initial-input 'notmuch-address-history))
\r
91 > where that `initial-input' is not what I initially thought, the text
\r
92 > entered by the user, but rather the first completion candidate.
\r
94 > Wouldn't it be more "correct" to pass the unchanged `options' list and
\r
95 > the "real" `orig' text as `initial-input' to the customizable function
\r
98 I think I am to be blamed why that is like this -- initially there were
\r
99 no notmuch-address-selection-function ... I added as I needed it, in
\r
101 Stashed: id:1365001734-3160-1-git-send-email-tomi.ollila@iki.fi
\r
102 Stashed: http://mid.gmane.org/1365001734-3160-1-git-send-email-tomi.ollila@=
\r
105 and I was not smart enough to do the splitting in "standard
\r
106 notmuch-address-selection-function".=20=20
\r
108 Later, someone(*) provided patch which would make the "standard" interface
\r
109 work better with ido-completing-read -- unfortunately that made the
\r
110 default, original interface which uses completing-read borken.
\r
112 Personally I'd like to see leaner interface there, but that is incompatible
\r
113 change and in this particular case I don't see compelling reason to do that=
\r
116 (*) cannot remember who and when, and I am writing this mail on a Mac and
\r
117 the use is painful enough now (keybindings, focus behaviour, etc...);/
\r
120 > I understand that it may be undesiderable to break existing
\r
121 > configurations by rectifying the arguments in that way, and in such case
\r
122 > could we change the `initial-input' argument name to better reflect the
\r
123 > fact that it actually contains one possible candidate instead?
\r
125 Naming change would indeed be a good idea... (probably?!)=20=20
\r
128 > Thanks in advance for any clarification,
\r
134 > nickname: Lele Gaifax | Quando vivr=C3=B2 di quello che ho pensato ieri
\r
135 > real: Emanuele Gaifas | comincer=C3=B2 ad aver paura di chi mi copia.
\r
136 > lele@metapensiero.it | -- Fortunato Depero, 1929.
\r
138 > _______________________________________________
\r
139 > notmuch mailing list
\r
140 > notmuch@notmuchmail.org
\r
141 > http://notmuchmail.org/mailman/listinfo/notmuch
\r