emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Proposal] New EUDC backend for macOS address book


From: Thomas Fitzsimmons
Subject: Re: [Proposal] New EUDC backend for macOS address book
Date: Mon, 27 Apr 2020 12:10:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Alexander,

Alexander Adolf <address@hidden> writes:

> Dear Emacs Developers,
>
> I am in the process of migrating my email workflow to `notmuch-mode'
> within Emacs. While `notmuch-mode' provides a completion backend for
> `company-mode' to get auto-completion for email addresses from your
> notmuch email archive, I was looking for a way to give me
> auto-completion for email addresses from my macOS address book, too.
>
> My research lead me to EUDC [1], and its `eudcb-mab.el', but which
> didn't work out of the box for me. Looking at the code, it turns out
> that `eudcb-mab.el' accesses the SQLite file used by macOS address book
> to store a local copy of the contacts, and reverse-engineers its
> contents. This is however not documented by Apple as an "official" way
> of accessing that data, and in fact Apple had recently changed the file
> name of the SQLite. This broke `eudcb-mab.el' for me, as it was still
> looking for the old file name. Also, since it is an undocumented file,
> Apple may choose to not only change the file name, but also its inner
> structure at any point.

Thanks for working on this, and for the background information.

It sounds like the AppleScript-based approach is superior and the way
forward.  However, I'd still like to know more about how eudcb-mab.el
failed, so that we can discuss backward compatibility.  Was the
incorrect file path the only issue preventing eudcb-mab.el from working
for you?

> On the other hand, there is an Apple officially documented, and endorsed
> way of accessing the macOS address book contacts, and this is via
> AppleScript [2]. Being a published and documented API, it can probably
> be expected to remain stable, and invariant towards any redesigns of the
> macOS address book app that Apple may choose to undertake in the
> foreseeable future.

OK.

> I hence set out to write a new backend for EUDC to get access to macOS
> address book contacts via AppleScript. The result is
> `eudcb-macos-contacts.el', which is enclosed with this message, and
> which I would kindly like to propose for inclusion as part of EUDC (and
> replacing the existing `eudcb-mab.el').

Do you have a sense for how far back the AppleScript method will work?
i.e., would it work on all systems on which eudcb-mab.el currently
works?  Do you think we should maintain eudcb-mab and
eudcb-macos-contacts in parallel, at least for a few releases, and
recommend eudcb-macos-contacts to existing eudcb-mab users?

> Yes, I have duly signed the copyright assignment (rt.gnu.org #1503473).

Great!

> In my implementation, I found that - interestingly - there is an elisp
> function in Emacs core, cunningly called `do_applescript()', and which
> is intended to execute AppleScript on the macOS platform from within
> Emacs. Unfortunately, I did find some oddities with it (see debbugs
> #39890 [3]), but couldn't discern whether the cause was in
> `do_applescript()' itself (so a fix could have been proposed), or in the
> Apple library code it builds upon. I hence decided to instead use
> `call-process()' to invoke the osascript [4] command line utility, which
> ships as part of every macOS. This does work reliably for me, and yields
> a more graceful overall behaviour of Emacs during large queries (again
> see debbugs #39890 [3]).
>
> [3] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39890

Thanks for the detailed bug report.  I hope someone with access to a
system to test AppleScript and/or the required expertise will comment
there.

Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]