From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Completion functions in message-mode Date: Fri, 13 Apr 2018 19:33:27 -0700 Message-ID: <87d0z2qzyg.fsf@ericabrahamsen.net> References: <20180323044822.32467.63948@vcs0.savannah.gnu.org> <20180323044823.1A70C20BDE@vcs0.savannah.gnu.org> <877eq3732w.fsf@ericabrahamsen.net> <87h8oer459.fsf_-_@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1523673108 5758 195.159.176.226 (14 Apr 2018 02:31:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 14 Apr 2018 02:31:48 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 14 04:31:44 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7Aye-0001OZ-DN for ged-emacs-devel@m.gmane.org; Sat, 14 Apr 2018 04:31:44 +0200 Original-Received: from localhost ([::1]:48189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7B0l-00086s-0N for ged-emacs-devel@m.gmane.org; Fri, 13 Apr 2018 22:33:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7B0W-00085y-Ff for emacs-devel@gnu.org; Fri, 13 Apr 2018 22:33:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f7B0T-00072N-8f for emacs-devel@gnu.org; Fri, 13 Apr 2018 22:33:40 -0400 Original-Received: from [195.159.176.226] (port=50702 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f7B0T-00071V-2E for emacs-devel@gnu.org; Fri, 13 Apr 2018 22:33:37 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1f7AyJ-0000yX-7Q for emacs-devel@gnu.org; Sat, 14 Apr 2018 04:31:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:uQhFaTtZzg6ndDVw9JjOcficzo4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:224576 Archived-At: Stefan Monnier writes: >> message-mode adds message-expand-group and message-tab-body-function to >> `completion-at-point-functions'. Both of these functions check if >> they're in an appropriate location, and bail if not, allowing other >> functions to do their thing. > > I think it's OK for Gnus to keep using message-completion-alist, but > message-expand-name should use a completion table which can be extended, > so EUDC, BBDB, ecomplete, and YouNameIt can add themselves to it. > >> Packages such as EUDC and BBDB put their own functions in >> `completion-at-point-functions' (in the message-mode hook). > > That doesn't sound right: the code which decides if we're inside > a message header, and which header contains email addresses, and how > they're separated (i.e. the code which knows about the format of > messages) should squarely belong to message-mode and not to > BBDB/EUDC/... > > Instead these backends should only provide completion tables that > provide user names, email addresses, or such data. > > I.e. the completion-at-point-function should come from message.el and > the completion-tables it returns should come from BBDB/EUDC/... Good! Thanks, that's the direction I needed. My next question is, how does one "extend" a completion table? Specifically: if c-a-p expects to receive (START END COLLECTION), should the message-mode capf function marshal collections from various backends, and offer them up as part of that one return value? So say we add a message-name-completion-functions option, each backend adds its function there, and message-mode calls all those functions, gathers the results, and returns them to `completion-at-point'? Almost there, Eric