mu4e: add mu4e-copy-thing-at-point

Copy the thing (url or email) at point, similar to the feature in the
pre-gnus view. Bind to 'c' in the message-view.
This commit is contained in:
Dirk-Jan C. Binnema 2022-07-13 23:35:16 +03:00
parent ed93ff4968
commit 46476fc001
2 changed files with 15 additions and 2 deletions

View File

@ -453,6 +453,17 @@ http://cr.yp.to/proto/maildir.html."
;;; Misc
(defun mu4e-copy-thing-at-point ()
"Copy e-mail address or URL at point to the kill ring.
If there is not e-mail address at point, do nothing."
(interactive)
(let* ((thing (and (thing-at-point 'email)
(string-trim (thing-at-point 'email 'no-props) "<" ">")))
(thing (or thing (thing-at-point 'url 'no-props))))
(when thing
(kill-new thing)
(mu4e-message "Copied '%s' to kill-ring" thing))))
(defun mu4e-display-size (size)
"Get a human-friendly string representation of SIZE (in bytes)."
(cond

View File

@ -949,9 +949,11 @@ This is useful for advising some Gnus-functionality that does not work in mu4e."
;; misc
(define-key map "M" #'mu4e-view-massage)
(define-key map "w" 'visual-line-mode)
(define-key map "w" #'visual-line-mode)
(define-key map "h" #'mu4e-view-toggle-html)
(define-key map (kbd "M-q") 'article-fill-long-lines)
(define-key map (kbd "M-q") #'article-fill-long-lines)
(define-key map "c" #'mu4e-copy-thing-at-point)
;; next 3 only warn user when attempt in the message view
(define-key map "u" #'mu4e-view-unmark)