From: Jonas Bernoulli <jonas@bernoul.li>
To: notmuch@notmuchmail.org
Subject: [PATCH 0/3] emacs: allow opting out of notmuch's address completion
Date: Mon, 9 Nov 2020 00:11:47 +0100 [thread overview]
Message-ID: <20201108231150.5419-1-jonas@bernoul.li> (raw)
Hello
Notmuch's address completion didn't work well for me. I read the
respective code and found some issues, some of which are difficult
to address.
I wrote my own implementation, which might eventually be suitable as
a replacement for the current implementation, but it is not ready yet.
In a first step I would like to make it possible to use notmuch and
some other address completion mechanism without having to advice a
notmuch-address.el function to prevent it making destructive changes.
The second commit in this series does that. Here is the hack I am
currently using instead:
,----
| ;;; Counteract notmuch-address.el
|
| (defun notmuch-address-setup--noop (_fn)
| "Prevent modification of `message-completion-alist'.")
| (advice-add 'notmuch-address-setup :around
| 'notmuch-address-setup--noop)
`----
You can find my implementation (named notmuch-addr.el because it is
like notmuch-address.el, but "smaller") here:
,----
| https://git.sr.ht/~tarsius/notmuch-addr
`----
The main reason I am not trying to improve that until it can serve as
a replacement for notmuch-address.el is that it depends on Emacs 27.1,
which was just released. (Aside from that it also omits features that
*I* don't need.)
The main reason I am listing defects of notmuch-address.el below is
that by the time we can fix all of them (when we drop support for
Emacs releases before 27.1) I will have forgotten about them, so it
seem like a good idea to document them.
* Emacs' address completion API used to be rather wacky and that was
not fixed until version 27.1. "Callers" didn't merely have to
provide a list of completion candidate, instead they actually had to
perform completion themselves. Starting with 27.1 the completion-
at-point API is respected but there are kludges to support the old
style as well, see https://git.savannah.gnu.org/cgit/emacs.git/com
mit/?id=47a767c24e9cc4323432e29103b0a2cc46f8f3e4.
Using capf API has the advantage that many things don't have to be
re-implemented. For example `company-mode' just works. Notmuch
currently has to implement support explicitly in notmuch-company.el.
* Some essentially random completion candidate is used as the "initial
input". The last commit in this series (which see) fixes that.
* The special cases when there is not matching candidate or just a
single match are handled specifically, which IMO is an optimization
that makes things worse. That should also be an easy fix, but since
it might also be a controversial change, I did not implement it.
* Completion candidates are pre-filered based on the text that was
already at-point before at-point completion was invoked, which makes
it possible to choose candidates that that initial text does not
match. IMO that's another optimization that badly back fires.
I was surprised to learn that notmuch shared this feature/defect
with the current default address implementation in Emacs 27.1.
The initial commit of my implementation also shares this defect;
but only so that I can use the second commit to demonstrate how
that can be fixed.
Cheers,
Jonas
Jonas Bernoulli (3):
emacs: notmuch-address-setup: cosmetics
emacs: allow opting out of notmuch's address completion
emacs: notmuch-address-expand-name: use the actual initial-input
emacs/notmuch-address.el | 57 ++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 28 deletions(-)
--
2.29.1
next reply other threads:[~2020-11-08 23:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 23:11 Jonas Bernoulli [this message]
2020-11-08 23:11 ` [PATCH 1/3] emacs: notmuch-address-setup: cosmetics Jonas Bernoulli
2020-11-08 23:11 ` [PATCH 2/3] emacs: allow opting out of notmuch's address completion Jonas Bernoulli
2020-11-08 23:11 ` [PATCH 3/3] emacs: notmuch-address-expand-name: use the actual initial-input Jonas Bernoulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201108231150.5419-1-jonas@bernoul.li \
--to=jonas@bernoul.li \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).