unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Address completion in Emacs
@ 2014-12-12  8:22 Lele Gaifax
  2014-12-12 12:14 ` David Edmondson
  2014-12-14 17:27 ` Tomi Ollila
  0 siblings, 2 replies; 9+ messages in thread
From: Lele Gaifax @ 2014-12-12  8:22 UTC (permalink / raw)
  To: notmuch

Hi all,

Yesterday I tweaked my Emacs configuration to use "ido-completing-read"
to select the right address in the minibuffer, and noticed what seems a
glitch in the related code.

To accomplish the goal, I implemented my own selection function

  (defun esk-notmuch-address-selection-function (prompt addresses first)
    "Use `ido-completing-read' to select one of the addresses."
    (ido-completing-read prompt (cons first addresses)
                         nil nil nil 'notmuch-address-history))

and then assigned it to `notmuch-address-selection-function':

  (setq notmuch-address-selection-function 'esk-notmuch-address-selection-function)

As you can see, I had to `cons' the two arguments, because the caller of
that function does something similar to the following (where `orig' is
the text entered before TAB-completion):

  (options (notmuch-address-options orig))
  (num-options (length options))
  (chosen (funcall notmuch-address-selection-function
              (format "Address (%s matches): " num-options)
              (cdr options) (car options)))

and the standard `notmuch-address-selection-function' is defined like:

  (defun notmuch-address-selection-function (prompt collection initial-input)
    "Call (`completing-read'
        PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
    (completing-read
     prompt collection nil nil initial-input 'notmuch-address-history))

where that `initial-input' is not what I initially thought, the text
entered by the user, but rather the first completion candidate.

Wouldn't it be more "correct" to pass the unchanged `options' list and
the "real" `orig' text as `initial-input' to the customizable function
instead?

I understand that it may be undesiderable to break existing
configurations by rectifying the arguments in that way, and in such case
could we change the `initial-input' argument name to better reflect the
fact that it actually contains one possible candidate instead?

Thanks in advance for any clarification,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Address Completion in Emacs
@ 2023-12-08 13:26 David Wen Riccardi-Zhu
  2023-12-08 16:40 ` Sandra Snan
  0 siblings, 1 reply; 9+ messages in thread
From: David Wen Riccardi-Zhu @ 2023-12-08 13:26 UTC (permalink / raw)
  To: notmuch

Hello,

I had working address completion in Emacs with company-mode, but
recently switched to corfu. Has anyone been able to get address
completion to work with it?

Alternatively, I'm wondering how the internal completion style works. Is
there a function I can call to get internal address completion to kick
in?

Lastly, is it possible to remove addresses from the list of candidates?
I have a few addresses that were consistently recommended even though
they had typos in them.

I have this in my config:

(setq notmuch-address-command 'internal
  notmuch-address-internal-completion '(sent nil)
  notmuch-address-save-filename "~/org/contacts/notmuch-contacts"
  ;; ... 
)

Can I manually clean up my notmuch-contacts file? 

If yes, is it possible to add newlines to the file, to make it easier to
search and edit?

Thank you!

David

-- 
dwrz|朱为文\r

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-12-09  8:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-12  8:22 Address completion in Emacs Lele Gaifax
2014-12-12 12:14 ` David Edmondson
2014-12-12 12:45   ` Lele Gaifax
2014-12-12 13:08     ` David Edmondson
2014-12-14 17:27 ` Tomi Ollila
  -- strict thread matches above, loose matches on Subject: below --
2023-12-08 13:26 Address Completion " David Wen Riccardi-Zhu
2023-12-08 16:40 ` Sandra Snan
2023-12-09  2:05   ` David Wen Riccardi-Zhu
2023-12-09  8:26     ` Keith Amidon

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