Johan Pretorius <
jpret...@polymorph.co.za> writes:
Hi Johan,
> I'd like the autocompletion to select the appropriate email address -
> I guess the easiest way to do so, would be to base it on the context I
> have selected.
>
> For example, if I am sending email from
al...@work.com to Bob, I'd
> like the mail to go to
b...@bobsjob.com. Whereas if I'm sending email
> from
al...@gmail.com, I'd like the mail to go to
b...@home.com
>
> Since I already have
al...@work.com and
al...@gmail.com configured in
> mu4e contexts, it seems that what is needed is to make autocompletion
> respect the context.
>
> What do I need to do, to make mu4e email address autocompletion
> respect the context?
Technically, I think you could define an :around advice for
mu4e~compose-complete-handler which would let-bind mu4e--contacts-set
(or mu4e--contacts-hash if you're using a released mu4e version) to
either only personal or work emails.
The actual challenge is how you would do that classification. I mean,
the addresses offered for completion by mu4e--contacts-set are the
thousands of contacts you've ever communicated with. You'd need to
classify them somehow which might only be feasible if you could find a
pattern, e.g., at work you only communicate with contacts @
foo.com and
@
bar.com and a handful of others you can easily enumerate.
Another idea would be to compile the list of suitable receivers in terms
of a search
from:al...@work.com and then collecting all To/Cc values
from the result. However, that will probably be too slow to do with
mu4e. Maybe it's doable by shelling out, e.g.,
mu find --fields="t, c"
from:ts...@gnu.org | tr , '\n' | \
sed -e 's/^[[:space:]]//' | sort | uniq
compiles a list of all To: and Cc: values I've used when sending mail
with this address.
Bye,
Tassilo