* 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:
@ -604,20 +604,6 @@ process."
|
|||||||
(replace-regexp-in-string "\"" "\\\\\"" ph)))
|
(replace-regexp-in-string "\"" "\\\\\"" ph)))
|
||||||
(t (format "\"%s\"" 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
|
;; start and stopping
|
||||||
(defun mu4e~fill-contacts (contacts)
|
(defun mu4e~fill-contacts (contacts)
|
||||||
@ -642,9 +628,11 @@ This is used by the completion function in mu4e-compose."
|
|||||||
(< tstamp1 tstamp2)
|
(< tstamp1 tstamp2)
|
||||||
(< freq1 freq2)))))))
|
(< freq1 freq2)))))))
|
||||||
(dolist (contact contacts)
|
(dolist (contact contacts)
|
||||||
(let* ((canonicalcontact (funcall mu4e-canonical-contact-function contact))
|
(let* ((contact
|
||||||
(name (plist-get canonicalcontact :name))
|
(if mu4e-contact-rewrite-function
|
||||||
(mail (plist-get canonicalcontact :mail)))
|
(funcall mu4e-contact-rewrite-function contact) contact))
|
||||||
|
(name (plist-get contact :name))
|
||||||
|
(mail (plist-get contact :mail)))
|
||||||
(when mail
|
(when mail
|
||||||
(unless ;; ignore some address ('noreply' etc.)
|
(unless ;; ignore some address ('noreply' etc.)
|
||||||
(and mu4e-compose-complete-ignore-address-regexp
|
(and mu4e-compose-complete-ignore-address-regexp
|
||||||
|
|||||||
@ -249,13 +249,28 @@ Set to nil to not have any time-based restriction."
|
|||||||
:type 'string
|
:type 'string
|
||||||
:group 'mu4e-compose)
|
: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
|
;;; names and mail-addresses can be mapped onto their canonical
|
||||||
canonical counterpart, you may use this for correcting typo's, changed
|
;;; counterpart. use the customizeable function
|
||||||
names and adapting addresses or names to company policies."
|
;;; 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
|
:type 'function
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
|
|
||||||
|
|
||||||
(defcustom mu4e-compose-complete-ignore-address-regexp "no-?reply"
|
(defcustom mu4e-compose-complete-ignore-address-regexp "no-?reply"
|
||||||
"Ignore any e-mail addresses for completion if they match this regexp."
|
"Ignore any e-mail addresses for completion if they match this regexp."
|
||||||
:type 'string
|
:type 'string
|
||||||
|
|||||||
Reference in New Issue
Block a user