Skip to content

Instantly share code, notes, and snippets.



Last active Jun 30, 2020
What would you like to do?
Mu4e action to find a message in mailing list archives
;; If you subscribed to mailing list(s) in or
;; and using mu4e as your mailing app, very often you need to
;; find a message in or
;; For example, when you don't have the context of a particular thread
;; and all prior messages got deleted locally.
;; This mu4e action allows you
;; to quickly find selected email post in the archive
;; and open in the browser
(defun mu4e-action-find-in-mailing-list (msg)
"Find message in mailing-list archives"
(let* ((mlist (mu4e-message-field msg :mailing-list))
(msg-id (mu4e-message-field msg :message-id))
(pcase mlist
((pred (lambda (x) (string-suffix-p "" x)))
"&submit=" (url-hexify-string "Search!")
(replace-regexp-in-string "\.gnu\.org" "" mlist))))
;; google.groups
((pred (lambda (x) (string-suffix-p "" x)))
(replace-regexp-in-string "\.googlegroups\.com" "" mlist)
(url-hexify-string (concat "\"" msg-id "\"")))))))
(when url
(message "opening url: " url)
(browse-url url))))
(add-to-list 'mu4e-view-actions '("Find in mailing-list" . mu4e-action-find-in-mailing-list))
(add-to-list 'mu4e-headers-actions '("Find in mailing-list" . mu4e-action-find-in-mailing-list))

This comment has been minimized.

Copy link
Owner Author

@agzam agzam commented Jan 5, 2020

Basically, the idea is to retrieve message-id and mailing-list id from the message and based on those, attempt to find the message in the archives. It can probably be adapted to be used with other clients like notmuch and gnus and other mailing lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment