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 21777431FC0 for ; Sat, 26 Dec 2009 19:53:21 -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 xa3gVgfEz1gF for ; Sat, 26 Dec 2009 19:53:20 -0800 (PST) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id 6FFA2431FBD for ; Sat, 26 Dec 2009 19:53:20 -0800 (PST) Received: from fctnnbsc30w-142167182194.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.182.194] helo=rocinante.cs.unb.ca) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NOkBz-0001fL-NQ; Sat, 26 Dec 2009 23:53:19 -0400 Received: from bremner by rocinante.cs.unb.ca with local (Exim 4.71) (envelope-from ) id 1NOkAF-0002mX-NF; Sat, 26 Dec 2009 23:51:31 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Date: Sat, 26 Dec 2009 23:51:16 -0400 Message-Id: <1261885877-10500-2-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.6.5 In-Reply-To: <1261885877-10500-1-git-send-email-david@tethera.net> References: <1261770829-23376-1-git-send-email-david@tethera.net> <1261885877-10500-1-git-send-email-david@tethera.net> X-Sender-Verified: bremner@pivot.cs.unb.ca Cc: David Bremner Subject: [notmuch] [PATCH 1/2] 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: Sun, 27 Dec 2009 03:53:21 -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. --- notmuch.el | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index 97914f2..8df0778 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,25 @@ 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 () + "Copy message-id of current message to kill-ring." + (interactive) + (notmuch-show-do-stash (notmuch-show-get-message-id))) + +(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-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) ","))) + ; Make show mode a bit prettier, highlighting URLs and using word wrap (defun notmuch-show-pretty-hook () -- 1.6.5