From: David Bremner <bremner@unb.ca> Provide key bindings for stuffing everything with a notmuch-show-get-foo function into the emacs kill-ring as text. Currently this is just message-id, filename, and tags. --- One thing I find myself doing often is going into raw message mode in order to grab a message-id. This patch automates that by letting you stash the message id in the emacs kill-ring (and X clipboard, if running under X). It also allows the same for filename and tags. It would be pretty trivial to add other similar commands for stashing other headers and parts of a message given a corresponding notmuch-show-get-foo function. notmuch.el | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index 97914f2..53eb5a3 100644 --- a/notmuch.el +++ b/notmuch.el @@ -51,6 +51,17 @@ (require 'mm-view) (require 'message) +(defvar notmuch-show-stash-map + (let ((map (make-sparse-keymap))) + (define-key map "m" 'notmuch-show-stash-message-id) + (define-key map "F" 'notmuch-show-stash-filename) + (define-key map "T" 'notmuch-show-stash-tags) + 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) @@ -78,6 +89,7 @@ (define-key map "n" 'notmuch-show-next-message) (define-key map (kbd "DEL") 'notmuch-show-rewind) (define-key map " " 'notmuch-show-advance-marking-read-and-archiving) + (define-key map "z" 'notmuch-show-stash-map) map) "Keymap for \"notmuch show\" buffers.") (fset 'notmuch-show-mode-map notmuch-show-mode-map) @@ -920,6 +932,22 @@ 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-message-id () + (interactive) + (notmuch-show-do-stash (notmuch-show-get-message-id))) + +(defun notmuch-show-stash-filename () + (interactive) + (notmuch-show-do-stash (notmuch-show-get-filename))) + +(defun notmuch-show-stash-tags () + (interactive) + (notmuch-show-do-stash (mapconcat 'identity (notmuch-show-get-tags) ","))) + ; Make show mode a bit prettier, highlighting URLs and using word wrap (defun notmuch-show-pretty-hook () -- 1.6.5.7