Updates to mu4e-contacts.el
* mu4e/mu4e-contacts.el (mu4e-personal-address-p): Fix docstring error (return nil *only if* the address does not match any of the personal addresses, not the other way around). Unwrap unnecessary (if COND t nil) to just COND because its caller `seq-find' only distinguishes between nil and non-nil. (mu4e-personal-address): Add space in defun between name and args. Ensure double space after a sentence ends. Convert a duplicated call of (mu4e-server-properties) into using when-let and reusing its result.
This commit is contained in:
@ -130,28 +130,28 @@ predicate function. A value of nil keeps all the addresses."
|
|||||||
"Set with the full contact addresses for autocompletion.")
|
"Set with the full contact addresses for autocompletion.")
|
||||||
|
|
||||||
;;; user mail address
|
;;; user mail address
|
||||||
(defun mu4e-personal-addresses(&optional no-regexp)
|
(defun mu4e-personal-addresses (&optional no-regexp)
|
||||||
"Get the list user's personal addresses, as passed to mu init.
|
"Get the list user's personal addresses, as passed to mu init.
|
||||||
The address are either plain e-mail address or /regular
|
The address are either plain e-mail address or /regular
|
||||||
expressions/. When NO-REGEXP is non-nil, do not include regexp
|
expressions/. When NO-REGEXP is non-nil, do not include regexp
|
||||||
address patterns (if any)."
|
address patterns (if any)."
|
||||||
(seq-remove
|
(seq-remove
|
||||||
(lambda(addr) (and no-regexp (string-match-p "^/.*/" addr)))
|
(lambda (addr) (and no-regexp (string-match-p "^/.*/" addr)))
|
||||||
(when (mu4e-server-properties)
|
(when-let ((props (mu4e-server-properties)))
|
||||||
(plist-get (mu4e-server-properties) :personal-addresses))))
|
(plist-get props :personal-addresses))))
|
||||||
|
|
||||||
(defun mu4e-personal-address-p (addr)
|
(defun mu4e-personal-address-p (addr)
|
||||||
"Is ADDR a personal address?
|
"Is ADDR a personal address?
|
||||||
Evaluate to nil if ADDR matches any of the personal addresses.
|
Evaluate to nil if ADDR does not match any of the personal
|
||||||
Uses (mu4e-personal-addresses) for the addresses with both the plain
|
addresses. Uses \\=(mu4e-personal-addresses) for the addresses
|
||||||
addresses and /regular expressions/."
|
with both the plain addresses and /regular expressions/."
|
||||||
(when addr
|
(when addr
|
||||||
(seq-find
|
(seq-find
|
||||||
(lambda (m)
|
(lambda (m)
|
||||||
(if (string-match "/\\(.*\\)/" m)
|
(if (string-match "/\\(.*\\)/" m)
|
||||||
(let ((rx (match-string 1 m))
|
(let ((rx (match-string 1 m))
|
||||||
(case-fold-search t))
|
(case-fold-search t))
|
||||||
(if (string-match rx addr) t nil))
|
(string-match rx addr))
|
||||||
(eq t (compare-strings addr nil nil m nil nil 'case-insensitive))))
|
(eq t (compare-strings addr nil nil m nil nil 'case-insensitive))))
|
||||||
(mu4e-personal-addresses))))
|
(mu4e-personal-addresses))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user