Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 58820431FBC for ; Fri, 25 Dec 2009 11:54:14 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VT6cFA0bhsDl for ; Fri, 25 Dec 2009 11:54:13 -0800 (PST) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id 6BECF431FAE for ; Fri, 25 Dec 2009 11:54:13 -0800 (PST) Received: from fctnnbsc30w-142167182194.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.182.194] helo=localhost) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NOGEl-0004mz-NH; Fri, 25 Dec 2009 15:54:12 -0400 Received: from bremner by localhost with local (Exim 4.71) (envelope-from ) id 1NOGEg-00065z-AE; Fri, 25 Dec 2009 15:54:06 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Date: Fri, 25 Dec 2009 15:53:49 -0400 Message-Id: <1261770829-23376-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.6.5.7 X-Sender-Verified: bremner@pivot.cs.unb.ca Cc: David Bremner Subject: [notmuch] [PATCH] notmuch.el: add a submap (on "z" for "ztash") to stash things. X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Dec 2009 19:54:14 -0000 From: David Bremner 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