summaryrefslogtreecommitdiff
path: root/mu4e
diff options
context:
space:
mode:
authordjcb <djcb@djcbsoftware.nl>2014-04-06 17:51:12 +0100
committerdjcb <djcb@djcbsoftware.nl>2014-04-06 17:51:12 +0100
commit8b775ab238a35bc507b1231d58df0c68aad992c0 (patch)
tree519e3367018b7278c359af49eb53ab43e6a607da /mu4e
parentd2915b7bb97ecf7f79f4b5f738dffe1dcf40a994 (diff)
* mu4e: update the contact-rewriting code a bit:
- make the default nil rather than a dummy (identity) function, for speed - don't use 'canonical' but the 'rewrite' which is a bit more general
Diffstat (limited to 'mu4e')
-rw-r--r--mu4e/mu4e-utils.el22
-rw-r--r--mu4e/mu4e-vars.el23
2 files changed, 24 insertions, 21 deletions
diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el
index d8d55b1..87d79cb 100644
--- a/mu4e/mu4e-utils.el
+++ b/mu4e/mu4e-utils.el
@@ -604,20 +604,6 @@ process."
(replace-regexp-in-string "\"" "\\\\\"" ph)))
(t (format "\"%s\"" ph)))))
-;;; names and mail-addresses can be mapped onto their canonical counterpart.
-;;; use the customizeable function mu4e-canonical-contact-function to do that.
-;;; below the identity function for mapping a contact onto the canonical one.
-(defun mu4e-canonical-contact-identity (contact)
- "This returns the name and the mail-address of a contact.
-It's used as an identity function for converting contacts to their
-canonical counterpart."
- (let ((name (plist-get contact :name))
- (mail (plist-get contact :mail))
- )
- (list :name name :mail mail)
- )
- )
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; start and stopping
(defun mu4e~fill-contacts (contacts)
@@ -642,9 +628,11 @@ This is used by the completion function in mu4e-compose."
(< tstamp1 tstamp2)
(< freq1 freq2)))))))
(dolist (contact contacts)
- (let* ((canonicalcontact (funcall mu4e-canonical-contact-function contact))
- (name (plist-get canonicalcontact :name))
- (mail (plist-get canonicalcontact :mail)))
+ (let* ((contact
+ (if mu4e-contact-rewrite-function
+ (funcall mu4e-contact-rewrite-function contact) contact))
+ (name (plist-get contact :name))
+ (mail (plist-get contact :mail)))
(when mail
(unless ;; ignore some address ('noreply' etc.)
(and mu4e-compose-complete-ignore-address-regexp
diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el
index 57056be..2e9962b 100644
--- a/mu4e/mu4e-vars.el
+++ b/mu4e/mu4e-vars.el
@@ -249,13 +249,28 @@ Set to nil to not have any time-based restriction."
:type 'string
:group 'mu4e-compose)
-(defcustom mu4e-canonical-contact-function 'mu4e-canonical-contact-identity
- "Function to be used for processing every contact and convert it to the
-canonical counterpart, you may use this for correcting typo's, changed
-names and adapting addresses or names to company policies."
+
+;;; names and mail-addresses can be mapped onto their canonical
+;;; counterpart. use the customizeable function
+;;; mu4e-canonical-contact-function to do that. below the identity
+;;; function for mapping a contact onto the canonical one.
+(defun mu4e-contact-identity (contact)
+ "This returns the name and the mail-address of a contact.
+It's used as an identity function for converting contacts to their
+canonical counterpart."
+ (let ((name (plist-get contact :name))
+ (mail (plist-get contact :mail)))
+ (list :name name :mail mail)))
+
+(defcustom mu4e-contact-rewrite-function nil
+ "Function to be used for when processing contacts and rewrite
+them, for example you may use this for correcting typo's, changed
+names and adapting addresses or names to company policies. As as
+example of this, see `mu4e-contact-identity'."
:type 'function
:group 'mu4e-compose)
+
(defcustom mu4e-compose-complete-ignore-address-regexp "no-?reply"
"Ignore any e-mail addresses for completion if they match this regexp."
:type 'string