Fixed running the hooks for `mail-check`. Command (or variable?)
substition prevented the hooks from running completely beforehand, so I
moved them to a separate function with the option remaining to call a
custom script for them through environment variables.
Ideally the env vars (`MBSYNC_PRE` and `MBSYNC_POST`) should only point
to a single script each, as more involved commands will presumably fail
to execute correctly when whitespace substition is involved.
See more explanation here:
https://unix.stackexchange.com/a/444949
Added `mail-searchcontacts` script, which uses notmuch to search for all
contacts of the mail database.
Can be invoked without any arguments to list *all* contacts of the
dataase in descending order of message count.
Otherwise, it will filter known contacts, first by prioritizing the
'from:' field, and otherwise by searching through the whole database for
the keywords passed in.
It will also re-format the results so that the list consists of
tab-delineated 'mail name' rows. If there is no name, the row will only
contain the bare e-mail address. This format is best accepted by aerc,
for which the script is written.
aerc uses the contacts script for its address completion in editing
e-mail headers.
Renamed `checkmail` to `mail-check` to fit the naming scheme of
`mail-[action]` for mail scripts, to better be able to group them in the
shell.