Re: Address Completion

Subject: Re: Address Completion

Date: Tue, 11 Apr 2017 09:45:11 +0200

To: Tomi Ollila,


From: Jörg Volbers

I've attached a diff which would do the trick. Don't know how to 
contribute 'officially', and I am not much of an elisp guru, so 
that might be a good starter for someone (tm) else.

I guess the problem is not restricted to ivy-mode; other 
completing interfaces like ido might pose the same problem. So it 
could be useful to generalize the approach and introduce a 
function which checks different conditions, instead of checking 
within the let construct. But there's some other stuff to do now 
for me right now. :-)


Tomi Ollila <> writes:

> On Mon, Apr 10 2017, Jörg Volbers <> wrote: 
>> Hello, 
>> If I press <TAB> looking for an address while writing mail, 
>> vanilla notmuch offers me one preselected candidate. Since I 
>> use  ivy-mode, this canididate narrows down the list of all 
>> candidates,  forcing me to delete the initial input (C-a C-k) 
>> before I can  select among this list. 
> Do you use 'internal completion or separate command to find 
> completions ? 
> If internal, the first choice would be to install `company' 
> package from ELPA (I don't know how it works with separate 
> command -- which I use, with selection-menu). Company-mode 
> provides nice popup where to choose completions from. 
> If that is not an option, someone(tm) could provide a patch 
> which, based on (fboundp 'ivy-read) uses either ivy-read or 
> completing-read, with their specific options for completion 
> (what I saw about ivy-read that looks pretty good). OTOH, if 
> someone(tm) can show (completing-read ...) which works good as 
> is, or when wrapped with ivy, such patches might just be 
> tolerated(tm). 
> FWIW, I've used the following code in my notmuch setup like 
> forever...: 
> require 'selection-menu) (setq 
> notmuch-address-selection-function 
>       (lambda (prompt collection initial-input) 
>         (selection-menu "Send To:" (cons initial-input 
>         collection) t))) 
> Tomi 
>> I currently override this behavior by setting 
>> notmuch-address-selection-function to my own function: 
>>  (defun jv-notmuch--address-selection (prompt collection 
>>  initial-input)  
>>    (completing-read  
>>      prompt collection nil nil orig 'notmuch-address-history))  
>>  (setq notmuch-address-selection-function 
>>  #'jv-notmuch--address-selection)  
>> This works as intended. 
>> Now my question: Is this something specific to ivy-mode, and 
>> would  it be possible to add an option which simulates the 
>> above behavior  (basically, using the pre-set variable 'orig' 
>> instead of  (car-options) in notmuch-address-expand-name), so 
>> that I do not  need to insert my own function which adds no 
>> functionality? 
>> Thanks (also for CC me via PM) 
>> And by the way, notmuch really is great, thank you for this 
>> software! 
>> Jörg 
>> -- 
>> _______________________________________________ notmuch mailing 
>> list 

diff (application/octet-stream)
signature.asc (application/pgp-signature)