X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.el;h=732ce53d12516ea61cefb94c1c40a430c1e35640;hp=82471b57dc9b4cabb7271e73b61e4a80a4ada3a9;hb=4e76865c0d842fb7bf85fffee1d383062c3a7160;hpb=b20bc7028dbc413d270122d187e6afffbee008e5 diff --git a/notmuch.el b/notmuch.el index 82471b57..732ce53d 100644 --- a/notmuch.el +++ b/notmuch.el @@ -51,6 +51,22 @@ (require 'mm-view) (require 'message) +(defvar notmuch-show-stash-map + (let ((map (make-sparse-keymap))) + (define-key map "c" 'notmuch-show-stash-cc) + (define-key map "d" 'notmuch-show-stash-date) + (define-key map "F" 'notmuch-show-stash-filename) + (define-key map "f" 'notmuch-show-stash-from) + (define-key map "i" 'notmuch-show-stash-message-id) + (define-key map "s" 'notmuch-show-stash-subject) + (define-key map "T" 'notmuch-show-stash-tags) + (define-key map "t" 'notmuch-show-stash-to) + map) + "Submap for stash commands" + ) + +(fset 'notmuch-show-stash-map notmuch-show-stash-map) + (defvar notmuch-show-mode-map (let ((map (make-sparse-keymap))) (define-key map "?" 'notmuch-help) @@ -67,6 +83,7 @@ (define-key map "w" 'notmuch-show-save-attachments) (define-key map "V" 'notmuch-show-view-raw-message) (define-key map "v" 'notmuch-show-view-all-mime-parts) + (define-key map "c" 'notmuch-show-stash-map) (define-key map "b" 'notmuch-show-toggle-current-body) (define-key map "h" 'notmuch-show-toggle-current-header) (define-key map "-" 'notmuch-show-remove-tag) @@ -1090,6 +1107,50 @@ All currently available key bindings: :options '(hl-line-mode) :group 'notmuch) +(defun notmuch-show-do-stash (text) + (kill-new text) + (message (concat "Saved: " text))) + +(defun notmuch-show-stash-cc () + "Copy CC field of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-cc))) + +(defun notmuch-show-stash-date () + "Copy date of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-date))) + +(defun notmuch-show-stash-filename () + "Copy filename of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-filename))) + +(defun notmuch-show-stash-from () + "Copy From address of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-from))) + +(defun notmuch-show-stash-message-id () + "Copy message-id of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-message-id))) + +(defun notmuch-show-stash-subject () + "Copy Subject field of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-subject))) + +(defun notmuch-show-stash-tags () + "Copy tags of current message to kill-ring as a comma separated list." + (interactive) + (notmuch-show-do-stash (mapconcat 'identity (notmuch-show-get-tags) ","))) + +(defun notmuch-show-stash-to () + "Copy To address of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-to))) + ; Make show mode a bit prettier, highlighting URLs and using word wrap (defun notmuch-show-pretty-hook ()