--- /dev/null
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 93DCD431FBF\r
+ for <notmuch@notmuchmail.org>; Wed, 7 May 2014 04:21:46 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id E8Cp5+8RTrMh for <notmuch@notmuchmail.org>;\r
+ Wed, 7 May 2014 04:21:42 -0700 (PDT)\r
+Received: from mail-we0-f172.google.com (mail-we0-f172.google.com\r
+ [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id CFA3C431FC3\r
+ for <notmuch@notmuchmail.org>; Wed, 7 May 2014 04:21:39 -0700 (PDT)\r
+Received: by mail-we0-f172.google.com with SMTP id k48so841742wev.3\r
+ for <notmuch@notmuchmail.org>; Wed, 07 May 2014 04:21:37 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=RdrK3DqqSYCN3W1Z9pFqjZ0Va8HuEzQVhgWkubstlIE=;\r
+ b=VuIOfuwrNu7O6CZVrsaj1SaRDurWpN+O9NWW9vHB0wqWSUl6qA9UGyOqIXNyEnC/+O\r
+ fki5XzSeuRPsKV63v4t4MLXpMWIWd8wHxoBgeeEGPHp203IM73oZN5I6+A89EyuoIzgd\r
+ EyE0LpfC2ZeeixVYpNbztnUkYtpftR9JEydrdA9/CRUch19M1X2UFWqHB+ZZvq5y4bpy\r
+ ykKdhFGQtcLjzP4FIG/sDNjAun4wz7+9mrNv8dgZrMZNx3Z545dS9aWpeKyI2eaTJw6e\r
+ /Mg0voF8KNnNVu00vozovZNjxM4LBAPVW2XoNMzw7NKjIpvPR2WQKudxp7XuQePOAEDu\r
+ QcAw==\r
+X-Gm-Message-State:\r
+ ALoCoQmkcypotU04eTVfPIk5jziDuM/6DJpZqupRphgSIFgTg6Y9fDYzavb/uSXPD7MUyXxKdJdK\r
+X-Received: by 10.180.74.203 with SMTP id w11mr7206384wiv.27.1399461697275;\r
+ Wed, 07 May 2014 04:21:37 -0700 (PDT)\r
+Received: from hotblack-desiato.hh.sledj.net (disaster-area.hh.sledj.net.\r
+ [81.149.164.25]) by mx.google.com with ESMTPSA id\r
+ g13sm26211391wjn.15.2014.05.07.04.21.35 for <notmuch@notmuchmail.org>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Wed, 07 May 2014 04:21:36 -0700 (PDT)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+ id D2BCF1088C5; Wed, 7 May 2014 12:21:34 +0100 (BST)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] emacs: Add support for saved search accelerators\r
+Date: Wed, 7 May 2014 12:21:34 +0100\r
+Message-Id: <1399461694-25350-2-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 2.0.0.rc0\r
+In-Reply-To: <1399461694-25350-1-git-send-email-dme@dme.org>\r
+References: <1399385776-19918-1-git-send-email-dme@dme.org>\r
+ <1399461694-25350-1-git-send-email-dme@dme.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 07 May 2014 11:21:46 -0000\r
+\r
+Extended the saved search definition to allow the inclusion of an\r
+accelerator key for the search. Bind 'j' in the common mode map as a\r
+leader for such accelerator keys.\r
+---\r
+ emacs/notmuch-hello.el | 5 ++++-\r
+ emacs/notmuch-lib.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++\r
+ 2 files changed, 50 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 3de5238..64d5aa1 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -85,6 +85,7 @@ searches so they still work in customize."\r
+ (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v")))\r
+ (checklist :inline t\r
+ :format "%v"\r
++ (group :format "%v" :inline t (const :format " Key: " :key) (key-sequence :format "%v"))\r
+ (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))\r
+ (group :format "%v" :inline t (const :format "" :sort-order)\r
+ (choice :tag " Sort Order"\r
+@@ -101,6 +102,7 @@ a plist. Supported properties are\r
+ \r
+ :name Name of the search (required).\r
+ :query Search to run (required).\r
++ :key Optional accelerator key.\r
+ :count-query Optional extra query to generate the count\r
+ shown. If not present then the :query property\r
+ is used.\r
+@@ -551,7 +553,8 @@ with `notmuch-hello-query-counts'."\r
+ (when elem\r
+ (if (> column-indent 0)\r
+ (widget-insert (make-string column-indent ? )))\r
+- (let* ((name (plist-get elem :name))\r
++ (let* ((key (plist-get elem :key))\r
++ (name (plist-get elem :name))\r
+ (query (plist-get elem :query))\r
+ (oldest-first (case (plist-get elem :sort-order)\r
+ (newest-first nil)\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 2941da3..f8c5f96 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -25,6 +25,10 @@\r
+ (require 'mm-decode)\r
+ (require 'cl)\r
+ \r
++(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))\r
++(declare-function notmuch-saved-search-get "notmuch-hello" (saved-search field))\r
++(defvar notmuch-saved-searches) ;; In `notmuch-hello.el'.\r
++\r
+ (defvar notmuch-command "notmuch"\r
+ "Command to run the notmuch binary.")\r
+ \r
+@@ -130,6 +134,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an\r
+ (define-key map "m" 'notmuch-mua-new-mail)\r
+ (define-key map "=" 'notmuch-refresh-this-buffer)\r
+ (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)\r
++ (define-key map "j" 'notmuch-jump)\r
+ map)\r
+ "Keymap shared by all notmuch modes.")\r
+ \r
+@@ -845,6 +850,47 @@ status."\r
+ (defvar notmuch-show-process-crypto nil)\r
+ (make-variable-buffer-local 'notmuch-show-process-crypto)\r
+ \r
++;; Jump key support:\r
++\r
++(defvar notmuch-jump-search nil)\r
++(defun notmuch-jump-map ()\r
++ (let ((map (make-sparse-keymap))\r
++ help)\r
++ (set-keymap-parent map minibuffer-local-map)\r
++ (suppress-keymap map)\r
++ (dolist (saved-search notmuch-saved-searches)\r
++ (let ((key (notmuch-saved-search-get saved-search :key)))\r
++ (when key\r
++ (define-key map key `(lambda ()\r
++ (interactive)\r
++ (setq notmuch-jump-search ',saved-search)\r
++ (exit-minibuffer)))\r
++ (push (format "%s: %s"\r
++ (propertize key 'face 'minibuffer-prompt)\r
++ (notmuch-saved-search-get saved-search :name))\r
++ help))))\r
++ ;; Hitting ? displays a quick hint of the accelerators.\r
++ (define-key map "?" `(lambda ()\r
++ (interactive)\r
++ (message "%s"\r
++ (mapconcat #'identity\r
++ ;; Reverse the list so\r
++ ;; that elements appear\r
++ ;; in the same order as\r
++ ;; `notmuch-saved-searches'.\r
++ (reverse ',help)\r
++ " "))))\r
++ map))\r
++\r
++(defun notmuch-jump ()\r
++ "Read a saved search accelerator key and perform the search."\r
++ (interactive)\r
++ (setq notmuch-jump-search nil)\r
++ (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))\r
++ (when notmuch-jump-search\r
++ (notmuch-search (notmuch-saved-search-get notmuch-jump-search :query)\r
++ (notmuch-saved-search-get notmuch-jump-search :oldest-first))))\r
++\r
+ (provide 'notmuch-lib)\r
+ \r
+ ;; Local Variables:\r
+-- \r
+2.0.0.rc0\r
+\r