From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Fitzsimmons Newsgroups: gmane.emacs.bugs Subject: bug#59314: 29.0.50; EUDC and message-mode header completion Date: Thu, 08 Dec 2022 17:58:56 -0500 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="13064"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eric Abrahamsen , 59314@debbugs.gnu.org To: Alexander Adolf Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 09 00:00:29 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 1p3PsS-000338-0a for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 00:00:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3PsA-000222-II; Thu, 08 Dec 2022 18:00: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 1p3Ps4-00021V-KI for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 18:00:07 -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 1p3Ps3-00022i-Rr for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 18:00:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3Ps3-000726-1O for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 18:00:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Fitzsimmons Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 23:00: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.167054034626996 (code B ref 59314); Thu, 08 Dec 2022 23:00:02 +0000 Original-Received: (at 59314) by debbugs.gnu.org; 8 Dec 2022 22:59:06 +0000 Original-Received: from localhost ([127.0.0.1]:59666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Pr8-00071M-98 for submit@debbugs.gnu.org; Thu, 08 Dec 2022 17:59:06 -0500 Original-Received: from mail.fitzsim.org ([69.165.165.189]:47994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Pr5-00070y-Nj for 59314@debbugs.gnu.org; Thu, 08 Dec 2022 17:59:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fitzsim.org ; s=20220430; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DsONN/bCR/9QTM86n4WdYiiMrGApNf8b4232phTxLsc=; b=gapA9B/E5KpjibVShi3mydLWYx KQrqL7IJQGSWUpYv9mVrrROQ2dgL7B9nfy1HmRa/P6k1GmkHNKzo2EMP0w3cuisX27yhiOOqmIeKH kyVVS51kn8Jb728ZwFthx3WSWxQ65fHoPWBF2/3Tlg1Mm09M6JNOc/qiqfshmOVDzR/9a3vPVYfvw VhEiHcE4MT9GyL4iss4ipFunoR6b2nmh2wm6ESurjBZPtQH4MWFaEa5P84w9SpGssqrx1z3t4q+jn X61hb2wa91ogF5ekQPzcEShm5eYDwQFaIq+hiEEV0id2uTRZuoMXO1D0GEoSEm1x2Kj+vUVKJMLyn qe1dgosg==; Original-Received: from [192.168.1.1] (helo=localhost.localdomain) by mail.fitzsim.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1p3Pqy-0004No-I1; Thu, 08 Dec 2022 17:58:57 -0500 In-Reply-To: (Alexander Adolf's message of "Thu, 08 Dec 2022 23:34:39 +0100") 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:250345 Archived-At: Alexander Adolf writes: > 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). Sure, thank you, please take your time. I haven't digested the diagram you posted yet, but I'll have a look when I get a chance. >> 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 a= s 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-= Styles.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-comple= tion))) > ----------------------------- 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. I see, hmm. That's quite complicated. Nice analysis, thank you. > Long story, short conclusion: you can't do meaningful email address > completion with the default value of `completion styles`. OK, but then (to lengthen the conclusion) message--name-table ignores the default value of 'completion-styles' (or if it doesn't, it should), and so the default global value of 'completion-styles' should not have any bearing on any of these tests we're doing. Is that correct? Thanks, Thomas