mirror of https://github.com/djcb/mu.git
* 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
This commit is contained in:
parent
d2915b7bb9
commit
8b775ab238
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue