Mu4e: Improve mail list matching

This commit is contained in:
TEC 2021-10-02 00:28:03 +08:00
parent 3b070aaaef
commit 1ad02baf0f
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 16 additions and 5 deletions

View File

@ -4900,11 +4900,22 @@ current message on https://list.orgmode.org.
(after! mu4e
(defun +mu4e-ml-message-link (msg)
"Copy the link to MSG on the mailing list archives."
(let ((msg-url
(cond
((string= "emacs-orgmode.gnu.org" (mu4e-message-field msg :mailing-list))
(format "https://list.orgmode.org/%s" (mu4e-message-field msg :message-id)))
(t (user-error "Mailing list %s not supported" (mu4e-message-field msg :mailing-list))))))
(let* ((list-addr (or (mu4e-message-field msg :mailing-list)
(cdar (mu4e-message-field-raw msg :list-post))
(thread-last (append (mu4e-message-field msg :to)
(mu4e-message-field msg :cc))
(mapcar #'last)
(mapcar #'cdr)
(mapcar (lambda (addr)
(when (string-match-p "emacs.*@gnu\\.org$" addr)
(replace-regexp-in-string "@" "." addr))))
(delq nil)
(car))))
(msg-url
(cond
((string= "emacs-orgmode.gnu.org" list-addr)
(format "https://list.orgmode.org/%s" (mu4e-message-field msg :message-id)))
(t (user-error "Mailing list %s not supported" list-addr)))))
(message "Link %s copied to clipboard" (gui-select-text msg-url))
msg-url))