unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* emacs: address completion: 6 matches but no match
@ 2025-01-02 17:17 Bruno BARBIER
  0 siblings, 0 replies; only message in thread
From: Bruno BARBIER @ 2025-01-02 17:17 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-05 21:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-02 17:17 emacs: address completion: 6 matches but no match Bruno BARBIER

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).