emacs: address completion: 6 matches but no match

Subject: emacs: address completion: 6 matches but no match

Date: Thu, 02 Jan 2025 18:17:41 +0100

To: notmuch@notmuchmail.org

Cc:

From: Bruno BARBIER


Hello,

Thank you so much for notmuch and its integration with Emacs!

I discovered a small glitch when completing email addresses.

I'm using the raw completion of Emacs (not company or an other
package). The variable 'notmuch-address-command' is the default one
(i.e. internal).  My completion style is partial-completion.

Now, here is the case where it doesn't work for me.  If I enter "AAA",
and I hit completion, I'm getting several choices: xxxAAAyyy, hhAAAhh,
etc. (that's what I want).  So, notmuch offers me to pick the one I
want using completing-read.  But, here is the problem: there is no
possible match!

Indeed, because I'm using partial-completion, the input "AAA" actually
doesn't match any of the possible completion (as they all have a
prefix, see the documentation of 'completion-styles-alist').

My workaround is to configure 'notmuch-address-selection-function',
prepending a "*" to the initial-input.

#+begin_src elisp
   (defun my-notmuch-address-selection (prompt collection initial-input)
      (notmuch-address-selection-function 
       prompt collection 
       (concat "*" initial-input)))
   (setq notmuch-address-selection-function #'my-notmuch-address-selection)
#+end_src

I'm fine with this solution.

Maybe that would great if notmuch could detect and warn that something
is wrong when the initial input doesn't match any of the addresses
that notmuch selected.

Best regards,

Bruno
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: