From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +NUyJ1B7qF92AgAA0tVLHw (envelope-from ) for ; Sun, 08 Nov 2020 23:12:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id tY8EI1B7qF/eHwAA1q6Kng (envelope-from ) for ; Sun, 08 Nov 2020 23:12:16 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C8C4394043A for ; Sun, 8 Nov 2020 23:12:11 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 746CE28BE1; Sun, 8 Nov 2020 18:11:57 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id 72D22270DC for ; Sun, 8 Nov 2020 18:11:53 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 001A5160EA for ; Mon, 9 Nov 2020 00:11:50 +0100 (CET) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id WLBIor-S6MgJ for ; Mon, 9 Nov 2020 00:11:50 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id BC069160CB for ; Mon, 9 Nov 2020 00:11:50 +0100 (CET) From: Jonas Bernoulli 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 Message-Id: <20201108231150.5419-1-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 MIME-Version: 1.0 Message-ID-Hash: RCPYN4HXKJO4TJRLARS4G6B7Y4YHUQQH X-Message-ID-Hash: RCPYN4HXKJO4TJRLARS4G6B7Y4YHUQQH X-MailFrom: jonas@bernoul.li X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.01 X-TUID: W2SvW20WkAZf 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