Quantcast

Address Completion

classic Classic list List threaded Threaded
3 messages Options
Jörg Volbers Jörg Volbers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Address Completion

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.

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


--
http://www.joergvolbers.de
https://fu-berlin.academia.edu/jvolbers

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (497 bytes) Download Attachment
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Address Completion

On Mon, Apr 10 2017, Jörg Volbers <[hidden email]> 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
>
>
> --
> http://www.joergvolbers.de
> https://fu-berlin.academia.edu/jvolbers
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Jörg Volbers Jörg Volbers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Address Completion

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. :-)

Jörg


Tomi Ollila <[hidden email]> writes:

> On Mon, Apr 10 2017, Jörg Volbers <[hidden email]> 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
>>  
>> --  http://www.joergvolbers.de 
>> https://fu-berlin.academia.edu/jvolbers 
>> _______________________________________________ notmuch mailing
>> list [hidden email]
>> https://notmuchmail.org/mailman/listinfo/notmuch 
--
http://www.joergvolbers.de
https://fu-berlin.academia.edu/jvolbers

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

diff (1K) Download Attachment
signature.asc (497 bytes) Download Attachment
Loading...