From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Adolf Newsgroups: gmane.emacs.bugs Subject: bug#59314: 29.0.50; EUDC and message-mode header completion Date: Wed, 07 Dec 2022 23:10:06 +0100 Message-ID: References: <87a64q7p25.fsf@ericabrahamsen.net> <878rka1y4n.fsf@ericabrahamsen.net> <9cad334f4f42725f2e244c8c81528856@condition-alpha.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36834"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eric Abrahamsen , 59314@debbugs.gnu.org To: Thomas Fitzsimmons Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 07 23:11:36 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p32db-0009OA-Ra for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Dec 2022 23:11:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p32dC-0002xC-EU; Wed, 07 Dec 2022 17:11:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p32d6-0002vy-Kx for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 17:11:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p32d5-00046L-5n for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 17:11:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p32d4-0003vc-IW for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 17:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alexander Adolf Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Dec 2022 22:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59314 X-GNU-PR-Package: emacs Original-Received: via spool by 59314-submit@debbugs.gnu.org id=B59314.167045101415090 (code B ref 59314); Wed, 07 Dec 2022 22:11:02 +0000 Original-Received: (at 59314) by debbugs.gnu.org; 7 Dec 2022 22:10:14 +0000 Original-Received: from localhost ([127.0.0.1]:52487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p32cI-0003vK-18 for submit@debbugs.gnu.org; Wed, 07 Dec 2022 17:10:14 -0500 Original-Received: from smtprelay04.ispgateway.de ([80.67.18.16]:44788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p32cE-0003vC-5k for 59314@debbugs.gnu.org; Wed, 07 Dec 2022 17:10:13 -0500 Original-Received: from [46.244.206.168] (helo=condition-alpha.com) by smtprelay04.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p32cT-0001jw-V5; Wed, 07 Dec 2022 23:10:26 +0100 In-Reply-To: X-Df-Sender: YWxleGFuZGVyLmFkb2xmQGNvbmRpdGlvbi1hbHBoYS5jb20= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250221 Archived-At: --=-=-= Content-Type: text/plain Thomas Fitzsimmons writes: > [...] > If I remove this line from message.el: > > (add-hook 'completion-at-point-functions #'eudc-capf-complete -1 t) > > and rebuild Emacs, then my recipe works, via: > > message-tab -...-> message-expand-name -> eudc-expand-inline > > The EUDC multi-selector UI is invoked allowing me to choose between > emacs-ert-test-3 and emacs-ert-test-4, and the full name and email > address is inserted correctly. This is with completion-styles left at > its default value. > > So that's one code path validated, phew. > [...] There are two ends to this, I think. For one, you are no longer adding `eudc-capf-complete` to `completion-at-point-functions` in message mode. This seems fine given that we are not there yet to make `eudc-capf-complete` the default thing to happen in 29. OTOH, `eudc-capf-complete` is now just sitting there for people to use it. The docstring, and the NEWS entry advertise it for adding to `completion-at-point-functions`. If & when someone does that, it won't work as expected, as you & I just figured, because `completion-styles` has a default value aimed at single-word replacements (such as for programming language keywords, or prose words from a dictionary), but not for more complex, multi-word replacements (such as email addresses). The `substring` entry is needed for this use-case. To make this work, I am hence attaching a patch (relative to the tip of master as of this writing), which sets `completion-style` from `eudc-capf-complete`. The modification is done when the user has not modified its value (assuming that a sensible value will have been set by the user). If you need a patch on top of the 29 branch, please don't hesitate to drop me a note. Hoping to have helped, and looking forward to your thoughts, --alexander --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Set-completion-style-for-email-addresses-when-EUDC-c.patch >From a7c5eed95321c77d4e5069a508b4b16094f4a68d Mon Sep 17 00:00:00 2001 From: Alexander Adolf Date: Wed, 7 Dec 2022 23:07:11 +0100 Subject: [PATCH] Set completion-style for email addresses when EUDC contributes to CAPF * lisp/net/eudc-capf.el (eudc-capf-complete): when the user has not modified 'completion-styles', set it to a value better suited for email address completion than the default setting (bug#59314) --- lisp/net/eudc-capf.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/net/eudc-capf.el b/lisp/net/eudc-capf.el index e2bbd5b28b..5bd2c92441 100644 --- a/lisp/net/eudc-capf.el +++ b/lisp/net/eudc-capf.el @@ -104,7 +104,16 @@ eudc-capf-complete (if (and (seq-some #'derived-mode-p eudc-capf-modes) (let ((mail-abbrev-mode-regexp message-email-recipient-header-regexp)) (mail-abbrev-in-expansion-header-p))) - (eudc-capf-message-expand-name))) + (progn + ;; FIXME: `completion-styles' is set to a value which seems + ;; better suited for email address completion if and when it + ;; has not been modified from it's default value (which is not + ;; well suited for this purpose). This is needed until + ;; `message.el' will be updated to use completion categories. + (when (equal completion-styles + (eval (car (get 'completion-styles 'standard-value)))) + (setq-local completion-styles '(substring partial-completion))) + (eudc-capf-message-expand-name)))) ;;;###autoload (defun eudc-capf-message-expand-name () -- 2.38.1 --=-=-=--