mu4e: add actions for archive-url in view/headers

This commit is contained in:
Dirk-Jan C. Binnema
2023-05-10 18:40:02 +03:00
parent d07247b2dd
commit fbb68b80ee
3 changed files with 21 additions and 15 deletions

View File

@ -1,6 +1,6 @@
;;; mu4e-actions.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*- ;;; mu4e-actions.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;; Copyright (C) 2011-2022 Dirk-Jan C. Binnema ;; Copyright (C) 2011-2023 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -34,6 +34,7 @@
(require 'mu4e-message) (require 'mu4e-message)
(require 'mu4e-search) (require 'mu4e-search)
(require 'mu4e-contacts) (require 'mu4e-contacts)
(require 'mu4e-lists)
;;; Count lines ;;; Count lines
@ -249,21 +250,26 @@ the message."
msgid (and (eq major-mode 'mu4e-view-mode) msgid (and (eq major-mode 'mu4e-view-mode)
(not (eq mu4e-split-view 'single-window)))))))) (not (eq mu4e-split-view 'single-window))))))))
(defun mu4e-actions-browse-list-archive (msg)
;;; Mailing list URLS
(defun mu4e-action-browse-list-archive (msg)
"Browse the archive for a mailing list message MSG. "Browse the archive for a mailing list message MSG.
See `mu4e-list-archives-resolve'." See `mu4e-mailing-list-archive-url'."
(interactive (list (mu4e-message-at-point))) (interactive (list (mu4e-message-at-point)))
(when-let ((url (mu4e-list-archives-resolve msg))) (if-let ((url (mu4e-mailing-list-archive-url msg)))
(browse-url url))) (browse-url url)
(mu4e-warn "No archive available for this message")))
(defun mu4e-actions-kill-list-archive (msg) (defun mu4e-action-copy-list-archive-url (msg)
"Kill the archive url for a mailing list message MSG. "Copy the archive url for a mailing list message MSG.
See `mu4e-list-archives-resolve'." See `mu4e-mailing-list-archive-url'."
(interactive (list (mu4e-message-at-point))) (interactive (list (mu4e-message-at-point)))
(let ((url (mu4e-list-archives-resolve msg))) (let ((url (mu4e-mailing-list-archive-url msg)))
(if (stringp url) (kill-new url) (if (stringp url)
(user-error "Cannot get url for this message")))) (kill-new url)
(mu4e-warn "Cannot get archive URL for this message"))))
;;; _ ;;;
(provide 'mu4e-actions) (provide 'mu4e-actions)
;;; mu4e-actions.el ends here ;;; mu4e-actions.el ends here

View File

@ -239,7 +239,7 @@ Must have the same length as `mu4e-headers-thread-connection-prefix'.")
(defcustom mu4e-headers-actions (defcustom mu4e-headers-actions
'( ("capture message" . mu4e-action-capture-message) '( ("capture message" . mu4e-action-capture-message)
("browse online archive" . mu4e-actions-browse-list-archive) ("browse online archive" . mu4e-action-browse-list-archive)
("show this thread" . mu4e-action-show-thread)) ("show this thread" . mu4e-action-show-thread))
"List of actions to perform on messages in the headers list. "List of actions to perform on messages in the headers list.
The actions are cons-cells of the form (NAME . FUNC) where: The actions are cons-cells of the form (NAME . FUNC) where:

View File

@ -1,6 +1,6 @@
;;; mu4e-view.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*- ;;; mu4e-view.el -- part of mu4e, the mu mail user agent -*- lexical-binding: t -*-
;; Copyright (C) 2021-2022 Dirk-Jan C. Binnema ;; Copyright (C) 2021-2023 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -75,7 +75,7 @@ etc., see the gnus documentation for details."
(defcustom mu4e-view-actions (defcustom mu4e-view-actions
(delq nil `(("capture message" . mu4e-action-capture-message) (delq nil `(("capture message" . mu4e-action-capture-message)
("view in browser" . mu4e-action-view-in-browser) ("view in browser" . mu4e-action-view-in-browser)
("browse online archive" . mu4e-actions-browse-list-archive) ("browse online archive" . mu4e-action-browse-list-archive)
,(when (fboundp 'xwidget-webkit-browse-url) ,(when (fboundp 'xwidget-webkit-browse-url)
'("xview in xwidget" . mu4e-action-view-in-xwidget)) '("xview in xwidget" . mu4e-action-view-in-xwidget))
("show this thread" . mu4e-action-show-thread))) ("show this thread" . mu4e-action-show-thread)))