Commit graph

13 commits

Author SHA1 Message Date
Chunyang Xu
0cf457b73b emacs: Fix packaging
Refer to (info "(elisp) Library Headers") for package conventions.
2016-04-16 08:24:42 -03:00
Michal Sojka
4acbc1f7d3 Emacs: Add address completion based on company-mode
When company-mode is available (Emacs >= 24), address completion
candidates are shown in a nice popup box. This is triggered either by
pressing TAB or by waiting a while during typing an address. The
completion is based entirely on the asynchronous address harvesting
from notmuch-address.el so the GUI is theoretically not blocked for
long time.

The completion works similarly as the TAB-initiated completion from
notmuch-address.el, i.e. quick harvest based on user input is executed
first and only after full harvesting is finished, in-memory cached data
is used.

[Improved by David Bremner]
2015-10-27 08:01:15 -03:00
Michal Sojka
89f78d38c1 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]
2015-10-27 08:01:05 -03:00
David Bremner
0e671478c6 emacs: replace use of notmuch-address-message-insinuate
This allows e.g. Gnus users to load this file without changing
message-mode behaviour.

This will disable completion for those that did not customize the
variable but relied on the existence of a file named "notmuch-addresses"
in their path. In the next commit the default behaviour will change to
use a "workalike" internal completion mechanism.
2015-10-27 08:00:49 -03:00
Michal Sojka
2a0a13a433 Emacs: Display a message when generating address completion candidates
The TAB-initiated address completion generates completion candidates
synchronously, blocking the UI. Since this can take long time, it is
better to let the use know what's happening.
2015-01-18 11:01:26 +01:00
Tomi Ollila
72dcfede51 emacs/notmuch-address.el: add notmuch-address-selection-function
Added a customizable variable notmuch-address-selection-function
and the function with the same name to provide a way for user to
change the function called to do address selection.

By default the functionality is exactly the same as it has been so
far; completing-read is called with the same parameters as before.

Setting equivalent lambda expression in place of using
notmuch-address-selection-function function is done as follows:

(setq notmuch-address-selection-function
   (lambda (prompt collection initial-input)
     (completing-read prompt collection nil nil initial-input)))

For example drop-in replacement with ido-completing-read can be done
easily as an one alternative to the default.
2013-05-13 21:05:29 -03:00
David Bremner
661dcf87ae Revert "emacs: functions to import sender or recipient into BBDB"
This reverts commit 238bf4cb09.

This commit was causing a build failure.

Bad me for not checking before pushing.
2013-04-06 16:11:02 -03:00
Daniel Bergey
238bf4cb09 emacs: functions to import sender or recipient into BBDB
From a show buffer, notmuch-bbdb/snarf-from imports the sender into
bbdb.  notmuch-bbdb/snarf-to imports all recipients.  Newly imported
contacts are reported in the minibuffer / Messages buffer.

Both functions use the BBDB parser to recognize email address formats.
2013-04-06 08:36:54 -03:00
Pieter Praet
046f5dded2 emacs: globally replace non-branching "(if (not ..." with "(unless ..."
Less code, same results, without sacrificing readability.
2012-01-21 08:17:56 -04:00
Pieter Praet
643ce61c1b emacs: logically group def{custom,face}s
To allow for expansion whilst keeping everything tidy and organized,
move all defcustom/defface variables to the following subgroups,
defined in notmuch-lib.el:

- Hello
- Search
- Show
- Send
- Crypto
- Hooks
- External Commands
- Appearance

As an added benefit, defcustom keyword args are now consistently
ordered as they appear @ defcustom's docstring (OCD much?).

Proper defgroup docstrings and various other improvements
by courtesy of Austin Clements.
2012-01-19 09:27:02 -04:00
David Edmondson
0fc424a1f0 emacs: Don't prompt the user to choose from zero matching addresses.
If the address matching function generates no matches, don't prompt
the user to choose between them (!). Instead, generate a message to
report that there were no matches.
2011-12-22 06:54:56 -04:00
David Edmondson
b66ff567f6 emacs: Tell the user how many addresses matched when completing
When completing an address, tell the user how many addresses in the
database matched the query.

Edited-by: Carl Worth <cworth@cworth.org>: Removed a stray numeric
literal that was causing a compiler warning.
2010-04-26 10:58:42 -07:00
David Edmondson
bae184f5fc emacs: Add notmuch-address.el for address completion using notmuch
A tool `notmuch-addresses' is required to produce addresses which
match a query string. An example of a suitable script can be found in
the git repository at
    http://jkr.acm.jhu.edu/git/notmuch_addresses.git
There are no doubt others.
2010-04-23 17:31:46 -07:00