mirror of https://github.com/djcb/mu.git
mu4e: add example for mu4e-contact-rewrite-function
This commit is contained in:
parent
3c104dfdf4
commit
33804f63d8
|
@ -270,8 +270,8 @@ Set to nil to not have any time-based restriction."
|
||||||
;;; function for mapping a contact onto the canonical one.
|
;;; function for mapping a contact onto the canonical one.
|
||||||
(defun mu4e-contact-identity (contact)
|
(defun mu4e-contact-identity (contact)
|
||||||
"This returns the name and the mail-address of a contact.
|
"This returns the name and the mail-address of a contact.
|
||||||
It's used as an identity function for converting contacts to their
|
It is used as the identity function for converting contacts to
|
||||||
canonical counterpart."
|
their canonical counterpart; useful as an example."
|
||||||
(let ((name (plist-get contact :name))
|
(let ((name (plist-get contact :name))
|
||||||
(mail (plist-get contact :mail)))
|
(mail (plist-get contact :mail)))
|
||||||
(list :name name :mail mail)))
|
(list :name name :mail mail)))
|
||||||
|
@ -279,7 +279,7 @@ canonical counterpart."
|
||||||
(defcustom mu4e-contact-rewrite-function nil
|
(defcustom mu4e-contact-rewrite-function nil
|
||||||
"Function to be used for when processing contacts and rewrite
|
"Function to be used for when processing contacts and rewrite
|
||||||
them, for example you may use this for correcting typo's, changed
|
them, for example you may use this for correcting typo's, changed
|
||||||
names and adapting addresses or names to company policies. As as
|
names and adapting addresses or names to company policies. As an
|
||||||
example of this, see `mu4e-contact-identity'."
|
example of this, see `mu4e-contact-identity'."
|
||||||
:type 'function
|
:type 'function
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
|
|
|
@ -2497,6 +2497,7 @@ guidelines for doing so.
|
||||||
* Extension points::
|
* Extension points::
|
||||||
* Available functions::
|
* Available functions::
|
||||||
* Message functions::
|
* Message functions::
|
||||||
|
* Contact functions::
|
||||||
* Utility functions::
|
* Utility functions::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
@ -2603,6 +2604,31 @@ point. Requires the 'formail' tool from procmail."
|
||||||
@end lisp
|
@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
|
@node Utility functions
|
||||||
@section Utility functions
|
@section Utility functions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue