From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Newsgroups: gmane.emacs.devel
Subject: Re: RFC: Adding BBDB to Emacs core
Date: Mon, 16 Apr 2018 23:37:17 -0400
Message-ID: <m3bmei4i6q.fsf@fitzsim.org>
References: <m3zi265o49.fsf@fitzsim.org> <ygfvacuugb7.fsf@fastmail.com>
	<87lgdpphmm.fsf@ericabrahamsen.net> <ygfo9il1k4i.fsf@fastmail.com>
	<CAM9Zgm0yQjL+tOg1cRfyfshb4oQGFMJNJ5057K58S1Fj+bJsgw@mail.gmail.com>
	<m21sffn2tl.fsf@newartisans.com> <m3o9ij42zk.fsf@fitzsim.org>
	<jwvwox7huo4.fsf-monnier+gmane.emacs.devel@gnu.org>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: blaine.gmane.org 1523936163 24234 195.159.176.226 (17 Apr 2018 03:36:03 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 17 Apr 2018 03:36:03 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Cc: emacs-devel@gnu.org
To: Stefan Monnier <monnier@iro.umontreal.ca>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 17 05:35:59 2018
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
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 <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1f8HPS-0006Bb-Hf
	for ged-emacs-devel@m.gmane.org; Tue, 17 Apr 2018 05:35:58 +0200
Original-Received: from localhost ([::1]:36828 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1f8HRX-0000uj-I1
	for ged-emacs-devel@m.gmane.org; Mon, 16 Apr 2018 23:38:07 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58029)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <fitzsim@fitzsim.org>) id 1f8HQs-0000u6-6C
	for emacs-devel@gnu.org; Mon, 16 Apr 2018 23:37:28 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <fitzsim@fitzsim.org>) id 1f8HQo-0003WW-6q
	for emacs-devel@gnu.org; Mon, 16 Apr 2018 23:37:26 -0400
Original-Received: from mail-it0-x236.google.com ([2607:f8b0:4001:c0b::236]:38785)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <fitzsim@fitzsim.org>) id 1f8HQn-0003Sh-Vh
	for emacs-devel@gnu.org; Mon, 16 Apr 2018 23:37:22 -0400
Original-Received: by mail-it0-x236.google.com with SMTP id 19-v6so14395272itw.3
	for <emacs-devel@gnu.org>; Mon, 16 Apr 2018 20:37:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=fitzsim-org.20150623.gappssmtp.com; s=20150623;
	h=from:to:cc:subject:references:date:in-reply-to:message-id
	:user-agent:mime-version;
	bh=VRxX9Vq0GtWIe6Lw6oJ32RLChGpiZXPxhTUck0zEP2I=;
	b=KD/gfcD+TuE84205Dv5ctquq0Qs6DInud6/tW+HjgYbbRX53W9hSEdDAhx98ORBlYH
	51CIgEkwbieTNKnxHkGC8DHxeH55yqSrqzpJnlmHVko5RToQz954vLTBm5gNRvkprMbP
	vsxr+XRv0TqIoFHnCKBl4KHGcqim/zWwQFQR+sOiMylR8NhIDjyV+u0gpXg0zUILMXDd
	PfzDejzmXJqZlzW8xlcQfRIfBVB6NRLjMJ0XCWs0ZNIPUfsus/GVmVWqUUSydfrIRgYx
	rvFFPgddBZNGNkXJxux/r1RJFaiCEmGrULnFfD0EQlmlNsUlQIAxvdbFmbaHf9yZd5jT
	R5dA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
	:message-id:user-agent:mime-version;
	bh=VRxX9Vq0GtWIe6Lw6oJ32RLChGpiZXPxhTUck0zEP2I=;
	b=geArJ6PMIzCHrQrMFpB8Tk8TJsfXnCbhbZhPMTnjcQ8tdj7dKiEBUh4yN8mfV9jIAt
	jRUuf5g9fwBgRY2pkHE5DkMPgjky88g1nEMQYMSWt7s+rk78t0zIeyV30RBYW8SbN4DK
	V3TuUw3MRw1MDn4Fbn2VbZwiMBWixT89bb4zJc5PzjCflc/R6MAQ7UzpA3RTBPXoykob
	RFr6O6pOmjNYdWLdxp+SmU9RLy2TVX5PBLSM9OT/zMQi46JNYqiCisGw4HPztuuWyit4
	OrU4zcqd/ggqof9Mjmc7mhl6xKdXHSFFzkrOO27ofXuN7w4N0cydWG5PdApDdBzlxzmD
	uf0A==
X-Gm-Message-State: ALQs6tDOsH0nn2EN3GUKzUT5v+A9xHywVqBHfrzTZfmDVfaDnejVImyI
	R3h12KOkA08uijJNGx+VkhoIRLU6
X-Google-Smtp-Source: AIpwx48ZkQanHL5xCojzIa1Her+6Szb1MxW9njmVt1J70VyIFFSrpW92+T7OXsTzL3nFBDzZtzGWRw==
X-Received: by 2002:a24:1a13:: with SMTP id 19-v6mr811576iti.142.1523936240872;
	Mon, 16 Apr 2018 20:37:20 -0700 (PDT)
Original-Received: from hp-dv5t (69-165-165-189.dsl.teksavvy.com. [69.165.165.189])
	by smtp.gmail.com with ESMTPSA id
	l22-v6sm5332283ita.8.2018.04.16.20.37.19
	(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
	Mon, 16 Apr 2018 20:37:19 -0700 (PDT)
In-Reply-To: <jwvwox7huo4.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan
	Monnier's message of "Mon, 16 Apr 2018 14:36:06 -0400")
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4001:c0b::236
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel/>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: "Emacs-devel" <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.devel:224698
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/224698>

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Before deciding on this, I think we'd need a clear picture of the ways
> in which BBDB is needed/used by EUDC.

OK, I'll try to provide that.

> I see you saying things like "EUDC requiring something not in the tree",
> but I don't see anything in EUDC that really requires BBDB, instead
> I just see glue code that lets you use BBDB when it's available,

When I say "require" there, I mean in the sense that to properly
byte-compile lisp/net/eudcb-bbdb.el and lisp/net/eudc-export.el, which
are part of EUDC, BBDB packages are require'd.

On master there are workarounds in place to stub out or ignore the
missing dependencies.  One aspect of the BBDB inclusion proposal is that
I'm trying to get rid of those workarounds (in EUDC first and eventually
in Org and Gnus).  See for example, these commits on the
scratch/eudc-bbdb-3 branch:

06c3557  EUDC: Require bbdb and bbdb-com without ignoring errors
f1ab95d  EUDC: Require bbdb, bbdb-com without NOERROR
262dce0  EUDC: Remove external BBDB function declarations
e355a65  EUDC: Remove inline requires of bbdb in BBDB backend

And yes, to actually use the BBDB backend of EUDC at runtime, the BBDB
package needs to be loaded.  On the branch, I've enabled the BBDB
backend by default in EUDC, which eliminates a configuration step for
email completion (see below):

193f9d5  EUDC: Enable BBDB backend by default

> just like there's code that lets you use LDAP when it's available (but
> there's clearly no corresponding push to try and add LDAP directly
> into Emacs).

The Elisp part of Emacs's LDAP support, lisp/net/ldap.el, is already in
core.  So EUDC's LDAP backend, lisp/net/eudcb-ldap.el, can just (require
'ldap) directly during byte-compilation.

ldap.el internally requires the ldapsearch command line utility, which
is provided on free operating systems as part of OpenLDAP packages.

I actually would prefer ldap.el to be a pure Elisp LDAP client (and thus
eliminate the OpenLDAP dependency) so that it could run with minimal
configuration even on non-free operating systems, but I haven't looked
at whether that would be practical to implement.

> Could you give us a clear description of how BBDB is used by EUDC?
> I'm thinking of a list of BBDB functions/variables that are used by
> EUDC, along with a description of what they are used for (not what they
> do themselves, but what EUDC uses them for).

The main function used is bbdb-search.  Here's a backtrace of EUDC
expanding a contact:

  eval((bbdb-search records "Examp"))
  eudc-bbdb-query-internal(((firstname . "Examp")) (firstname lastname net))
  eudc-query(((firstname . "Examp")) (firstname lastname net))
  eudc-expand-inline()
  funcall-interactively(eudc-expand-inline)

eudc-expand-inline uses bbdb-search to search for contacts in the BBDB
database using a search string, and return a list of contact records to
it.  Then from those records, EUDC creates strings in the format
"[first-name] [last-name] <email-address>" (the output format is a
configurable property of EUDC); if there is only one result, it is
inserted at point; if there are multiple results, EUDC allows the user
to interactively select the one to insert at point.

> Also good would be to describe concrete ways in which having BBDB in
> Emacs itself would improve the user's experience (presumably for users
> which don't already use BBDB).

OK, assuming the user wants to use Gnus, and they want to store contact
information they come across in Gnus locally, then BBDB would be the
recommended, "Emacs core endorsed" way of doing that, and the key
bindings, configuration etc. would all default to using BBDB.

Then EUDC would have the BBDB backend enabled by default (as shown on
the branch), and Gnus would have default keybindings for
`eudc-expand-inline' when point is in To: or Cc:.

Then without any setup, the user could snarf an address from within an
email via a keypress, then complete that contact's name and address when
composing a new email by pressing TAB.

If Gnus defaults to using `eudc-expand-inline`, then the user can also
get LDAP completion support just by adding an ldap entry to
`eudc-server-hotlist'.

I think that level of default integration would be hard to achieve and
maintain without having BBDB available in core.

Thomas