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: Thu, 08 Dec 2022 23:34:39 +0100 Message-ID: References: <87a64q7p25.fsf@ericabrahamsen.net> <878rka1y4n.fsf@ericabrahamsen.net> <9cad334f4f42725f2e244c8c81528856@condition-alpha.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9084"; 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 Thu Dec 08 23:35:34 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 1p3PUL-00025D-II for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 23:35:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3PU7-0002vE-JL; Thu, 08 Dec 2022 17:35:19 -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 1p3PTt-0002uA-Cx for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 17:35:05 -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 1p3PTq-0000Rr-Ng for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 17:35:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3PTq-0006nf-JN for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 17:35: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: Thu, 08 Dec 2022 22:35: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.167053888426122 (code B ref 59314); Thu, 08 Dec 2022 22:35:02 +0000 Original-Received: (at 59314) by debbugs.gnu.org; 8 Dec 2022 22:34:44 +0000 Original-Received: from localhost ([127.0.0.1]:59557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3PTX-0006nG-Ec for submit@debbugs.gnu.org; Thu, 08 Dec 2022 17:34:43 -0500 Original-Received: from smtprelay02.ispgateway.de ([80.67.18.14]:49241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3PTV-0006nA-Qr for 59314@debbugs.gnu.org; Thu, 08 Dec 2022 17:34:42 -0500 Original-Received: from [46.244.216.143] (helo=condition-alpha.com) by smtprelay02.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p3PTe-0003ZI-DL; Thu, 08 Dec 2022 23:34:50 +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:250343 Archived-At: Thomas Fitzsimmons writes: > [...] >> 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. > > To be clear, I wasn't going to push a patch to remove that, at least not > yet. It's not making anything worse, so might as well leave it as-is. I see. Please kindly ignore yesterday's path then, please. >> [...] > I'm trying to get message--name-table's EUDC support working. I only > wanted to remove eudc-capf-complete from the debugging equation, because > message--name-table existed way before eudc-capf-complete was > introduced. > > I want to understand why it doesn't work (why it results in the " <..." > expansion). I haven't delved deep enough into the completion-at-point > to figure that out. I was hoping with your experience writing > eudc-capf-complete that you'd know what was wrong with > message--name-table's EUDC support. I'll look into `message--name-table` and will find out what breaks with the " <" prefix. Please allow until Friday USA time (assuming you're there?); it's late already over here (Europe). > I don't think completion-styles should have any bearing on this. > message--name-table's EUDC support has to be made to work with the > default completion-styles setting. Do you know how to do that? The thing is, they do have a bearing, and there is no way to avoid that. `completion-at-point` filters the candidates returned by the `completion-at-point-functions`, and it uses the completion style (set by either `completion-styles`, or via a completion category signalled in a completion table) for this. When the completion table does not signal a completion style, `completion-at-point` uses the value of `completion-styles` to filter the candidates. Only matching candidates will be presented in any UI. The default value of `completion-styles` is '(basic partial-completion emacs22). Which - according to the manual [1] - effects the following: ---------------------------- Begin Quote ----------------------------- basic A matching completion alternative must have the same beginning as the text in the minibuffer before point. Furthermore, if there is any text in the minibuffer after point, the rest of the completion alternative must contain that text as a substring. partial-completion This aggressive completion style divides the minibuffer text into words separated by hyphens or spaces, and completes each word separately. (For example, when completing command names, =E2=80=98em-l-m= =E2=80=99 completes to =E2=80=98emacs-lisp-mode=E2=80=99.) Furthermore, a =E2=80=98*=E2=80=99 in the minibuffer text is treated as = a wildcard=E2=80=94it matches any string of characters at the corresponding position in the completion alternative. emacs22 This completion style is similar to basic, except that it ignores the text in the minibuffer after point. It is so-named because it corresponds to the completion behavior in Emacs 22. ----------------------------- End Quote ------------------------------ [1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Completion-St= yles.html I.e. the default setting of `completion-styles` will match for candidates that have the search string at their beginning only. Example: when the text before point is "foo", the candidates "foo", "foox", and "foobar" will be shown, but not the candidate "barfoo". Clearly, this is fairly useless for email address completion. Thus, the function `message--name-table` in message.el begins like this: ---------------------------- Begin Quote ----------------------------- (defun message--name-table (orig-string) (let ((orig-words (split-string orig-string "[ \t]+")) eudc-responses bbdb-responses) (lambda (string pred action) (pcase action ('metadata '(metadata (category . email))) [...] ----------------------------- End Quote ------------------------------ In the last quoted line, it return the list '(metadata (category . email)) in response to the 'metadata action. When message.el is loaded, the init code there does this: ---------------------------- Begin Quote ----------------------------- (add-to-list 'completion-category-defaults '(email (styles substring partial-completi= on))) ----------------------------- End Quote ------------------------------ This defines the 'email completion category to imply the completion styles '(substring partial-completion). Thus, whenever `message--name-table` comes into play, these completion styles will be in effect. Long story, short conclusion: you can't do meaningful email address completion with the default value of `completion styles`. Cheers, --alexander