]> rtime.felk.cvut.cz Git - notmuch.git/commit
Emacs: Add address completion mechanism implemented in elisp
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 26 Oct 2015 23:22:48 +0000 (00:22 +0100)
committerDavid Bremner <david@tethera.net>
Tue, 27 Oct 2015 11:01:05 +0000 (08:01 -0300)
commit89f78d38c1f7c9416e5bd9521dd694bb4f90572f
treeefa990e21d1d0f532382e24158349b85d6cd2b07
parent0e671478c6f37018973392f049979da5e1a8ff99
Emacs: Add address completion mechanism implemented in elisp

Currently, notmuch has an address completion mechanism that requires
external command to provide completion candidates. This commit adds a
completion mechanism inspired by https://github.com/tjim/nevermore,
which is implemented in Emacs lisp only.

The preexisting address completion mechanism, activated by pressing
TAB on To/Cc lines, is extended to use the new mechanism when
notmuch-address-command to 'internal, which is the new default.

The core of the new mechanism is the function notmuch-address-harvest,
which collects the completion candidates from the notmuch database and
stores them in notmuch-address-completions variable. The address
harvesting can run either synchronously (same as with the previous
mechanism) or asynchronously. When the user presses TAB for the first
time, synchronous harvesting limited to user entered text is performed.
If the entered text is reasonably long, this operation is relatively
fast. Then, asynchronous harvesting over the full database is triggered.
This operation may take long time (minutes on rotating disk). After it
finishes, no harvesting is normally performed again and subsequent
completion requests use the harvested data cached in memory. Completion
cache is updated after 24 hours.

Note that this commit restores (different) completion functionality for
users when the user used external command named "notmuch-addresses",
i.e. the old default.  The result will be that the user will use
the new mechanism instead of this command. I believe that many users may
not even recognize this because the new mechanism works the same as
http://commonmeasure.org/~jkr/git/notmuch_addresses.git and perhaps also
as other commands suggested at
http://notmuchmail.org/emacstips/#address_completion.

[This feature was significantly improved by David Bremner and Mark Walters]
emacs/notmuch-address.el
emacs/notmuch-lib.el