mu4e: add example for mu4e-contact-rewrite-function

This commit is contained in:
djcb
2015-03-15 13:45:28 +02:00
parent 3c104dfdf4
commit 33804f63d8
2 changed files with 29 additions and 3 deletions

View File

@ -2497,6 +2497,7 @@ guidelines for doing so.
* Extension points::
* Available functions::
* Message functions::
* Contact functions::
* Utility functions::
@end menu
@ -2603,6 +2604,31 @@ point. Requires the 'formail' tool from procmail."
@end lisp
@node Contact functions
@section Contact functions
It can be useful to rewrite the contact information that @t{mu4e}
provides, for example to convert them to some standardized format, or
to fix spelling errors.
You can do this by setting @code{mu4e-contact-rewrite-function} to
your function, for example:
@lisp
(defun my-rewrite-function (contact)
(let* ((name (plist-get contact :name))
(mail (plist-get contact :mail))
(actual-name
(cond
((string= name "jonh smiht") "John Smith")
;; other replacements
(t name))))
(list :name actual-name :mail mail)))
(setq mu4e-contact-rewrite-function 'my-rewrite-function)
@end lisp
This function is called for each of your contacts.
@node Utility functions
@section Utility functions