--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 F259B431FC4\r
+ for <notmuch@notmuchmail.org>; Tue, 29 Oct 2013 16:02:53 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ 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 uKK46l5ZZacI for <notmuch@notmuchmail.org>;\r
+ Tue, 29 Oct 2013 16:02:48 -0700 (PDT)\r
+Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com\r
+ [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 37392431FBC\r
+ for <notmuch@notmuchmail.org>; Tue, 29 Oct 2013 16:02:48 -0700 (PDT)\r
+Received: by mail-wi0-f169.google.com with SMTP id cb5so5641612wib.0\r
+ for <notmuch@notmuchmail.org>; Tue, 29 Oct 2013 16:02:47 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=dAGdcOL9ak6gHjE5+BlGzwNTN6FNdZDfF18l7E+Otiw=;\r
+ b=doLREtvg4rQjkNTJMs7WhithPZS1WeKbcBsWBo7ocf6FB3UUCDO+uJZCDJwJmfd2y2\r
+ Jb+KTUizhHR+kiwFxeyzr51uL1uzCTXIoHjshuKfqye8hFztqhPbmUORlP+INuKLJBer\r
+ 7cxKrh5enJ8pCV87bQQeuRefxZ7qr7CyhpdPcQdSk/8qtFI7fWPneSMu1wlJtUBSvoRk\r
+ qZefZ5onuEfdP9yR5WuV3aaQpaMTa35aX3Ofme5knx4oIeL9VPjxzh28crUETuQaMnV3\r
+ TU97fuy4IvMj8wY7l4RuhTwtQ2Rw5pgBbPf1b5ab5FtFGL+fP+HU5/CLCIji9iz23J6Z\r
+ o+qA==\r
+X-Received: by 10.180.13.142 with SMTP id h14mr110696wic.3.1383087344398;\r
+ Tue, 29 Oct 2013 15:55:44 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id b7sm9537512wiz.8.2013.10.29.15.55.43\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Tue, 29 Oct 2013 15:55:44 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 01/11] emacs: move notmuch-help to lib\r
+Date: Tue, 29 Oct 2013 22:55:28 +0000\r
+Message-Id: <1383087338-10220-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1383087338-10220-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1383087338-10220-1-git-send-email-markwalters1009@gmail.com>\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: Tue, 29 Oct 2013 23:02:54 -0000\r
+\r
+notmuch-help is in notmuch.el not notmuch-lib.el and this is\r
+incovenient for the way pick/tree uses it. I think lib makes more\r
+sense anyway so move it there.\r
+---\r
+ emacs/notmuch-lib.el | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ emacs/notmuch.el | 87 --------------------------------------------------\r
+ 2 files changed, 87 insertions(+), 87 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 6541282..e7c5c97 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -215,6 +215,93 @@ depending on the value of `notmuch-poll-script'."\r
+ (interactive)\r
+ (kill-buffer (current-buffer)))\r
+ \r
++(defun notmuch-documentation-first-line (symbol)\r
++ "Return the first line of the documentation string for SYMBOL."\r
++ (let ((doc (documentation symbol)))\r
++ (if doc\r
++ (with-temp-buffer\r
++ (insert (documentation symbol t))\r
++ (goto-char (point-min))\r
++ (let ((beg (point)))\r
++ (end-of-line)\r
++ (buffer-substring beg (point))))\r
++ "")))\r
++\r
++(defun notmuch-prefix-key-description (key)\r
++ "Given a prefix key code, return a human-readable string representation.\r
++\r
++This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
++ (let ((desc (format-kbd-macro (vector key))))\r
++ (if (string= desc "ESC")\r
++ "M-"\r
++ (concat desc " "))))\r
++\r
++(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
++ "Return a list of strings, each describing one binding in KEYMAP.\r
++\r
++Each string gives a human-readable description of the key and a\r
++one-line description of the bound function. See `notmuch-help'\r
++for an overview of how this documentation is extracted.\r
++\r
++UA-KEYS should be a key sequence bound to `universal-argument'.\r
++It will be used to describe bindings of commands that support a\r
++prefix argument. PREFIX and TAIL are used internally."\r
++ (map-keymap\r
++ (lambda (key binding)\r
++ (cond ((mouse-event-p key) nil)\r
++ ((keymapp binding)\r
++ (setq tail\r
++ (notmuch-describe-keymap\r
++ binding ua-keys (notmuch-prefix-key-description key) tail)))\r
++ (t\r
++ (when (and ua-keys (symbolp binding)\r
++ (get binding 'notmuch-prefix-doc))\r
++ ;; Documentation for prefixed command\r
++ (let ((ua-desc (key-description ua-keys)))\r
++ (push (concat ua-desc " " prefix (format-kbd-macro (vector key))\r
++ "\t" (get binding 'notmuch-prefix-doc))\r
++ tail)))\r
++ ;; Documentation for command\r
++ (push (concat prefix (format-kbd-macro (vector key)) "\t"\r
++ (or (and (symbolp binding) (get binding 'notmuch-doc))\r
++ (notmuch-documentation-first-line binding)))\r
++ tail))))\r
++ keymap)\r
++ tail)\r
++\r
++(defun notmuch-substitute-command-keys (doc)\r
++ "Like `substitute-command-keys' but with documentation, not function names."\r
++ (let ((beg 0))\r
++ (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)\r
++ (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
++ (keymap (symbol-value (intern keymap-name)))\r
++ (ua-keys (where-is-internal 'universal-argument keymap t))\r
++ (desc-list (notmuch-describe-keymap keymap ua-keys))\r
++ (desc (mapconcat #'identity desc-list "\n")))\r
++ (setq doc (replace-match desc 1 1 doc)))\r
++ (setq beg (match-end 0)))\r
++ doc))\r
++\r
++(defun notmuch-help ()\r
++ "Display help for the current notmuch mode.\r
++\r
++This is similar to `describe-function' for the current major\r
++mode, but bindings tables are shown with documentation strings\r
++rather than command names. By default, this uses the first line\r
++of each command's documentation string. A command can override\r
++this by setting the 'notmuch-doc property of its command symbol.\r
++A command that supports a prefix argument can explicitly document\r
++its prefixed behavior by setting the 'notmuch-prefix-doc property\r
++of its command symbol."\r
++ (interactive)\r
++ (let* ((mode major-mode)\r
++ (doc (substitute-command-keys (notmuch-substitute-command-keys (documentation mode t)))))\r
++ (with-current-buffer (generate-new-buffer "*notmuch-help*")\r
++ (insert doc)\r
++ (goto-char (point-min))\r
++ (set-buffer-modified-p nil)\r
++ (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))\r
++\r
+ (defvar notmuch-buffer-refresh-function nil\r
+ "Function to call to refresh the current buffer.")\r
+ (make-variable-buffer-local 'notmuch-buffer-refresh-function)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index d0cd906..19210cb 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -119,93 +119,6 @@ To enter a line break in customize, press \\[quoted-insert] C-j."\r
+ (mm-save-part p))))\r
+ mm-handle))\r
+ \r
+-(defun notmuch-documentation-first-line (symbol)\r
+- "Return the first line of the documentation string for SYMBOL."\r
+- (let ((doc (documentation symbol)))\r
+- (if doc\r
+- (with-temp-buffer\r
+- (insert (documentation symbol t))\r
+- (goto-char (point-min))\r
+- (let ((beg (point)))\r
+- (end-of-line)\r
+- (buffer-substring beg (point))))\r
+- "")))\r
+-\r
+-(defun notmuch-prefix-key-description (key)\r
+- "Given a prefix key code, return a human-readable string representation.\r
+-\r
+-This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
+- (let ((desc (format-kbd-macro (vector key))))\r
+- (if (string= desc "ESC")\r
+- "M-"\r
+- (concat desc " "))))\r
+-\r
+-(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
+- "Return a list of strings, each describing one binding in KEYMAP.\r
+-\r
+-Each string gives a human-readable description of the key and a\r
+-one-line description of the bound function. See `notmuch-help'\r
+-for an overview of how this documentation is extracted.\r
+-\r
+-UA-KEYS should be a key sequence bound to `universal-argument'.\r
+-It will be used to describe bindings of commands that support a\r
+-prefix argument. PREFIX and TAIL are used internally."\r
+- (map-keymap\r
+- (lambda (key binding)\r
+- (cond ((mouse-event-p key) nil)\r
+- ((keymapp binding)\r
+- (setq tail\r
+- (notmuch-describe-keymap\r
+- binding ua-keys (notmuch-prefix-key-description key) tail)))\r
+- (t\r
+- (when (and ua-keys (symbolp binding)\r
+- (get binding 'notmuch-prefix-doc))\r
+- ;; Documentation for prefixed command\r
+- (let ((ua-desc (key-description ua-keys)))\r
+- (push (concat ua-desc " " prefix (format-kbd-macro (vector key))\r
+- "\t" (get binding 'notmuch-prefix-doc))\r
+- tail)))\r
+- ;; Documentation for command\r
+- (push (concat prefix (format-kbd-macro (vector key)) "\t"\r
+- (or (and (symbolp binding) (get binding 'notmuch-doc))\r
+- (notmuch-documentation-first-line binding)))\r
+- tail))))\r
+- keymap)\r
+- tail)\r
+-\r
+-(defun notmuch-substitute-command-keys (doc)\r
+- "Like `substitute-command-keys' but with documentation, not function names."\r
+- (let ((beg 0))\r
+- (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)\r
+- (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
+- (keymap (symbol-value (intern keymap-name)))\r
+- (ua-keys (where-is-internal 'universal-argument keymap t))\r
+- (desc-list (notmuch-describe-keymap keymap ua-keys))\r
+- (desc (mapconcat #'identity desc-list "\n")))\r
+- (setq doc (replace-match desc 1 1 doc)))\r
+- (setq beg (match-end 0)))\r
+- doc))\r
+-\r
+-(defun notmuch-help ()\r
+- "Display help for the current notmuch mode.\r
+-\r
+-This is similar to `describe-function' for the current major\r
+-mode, but bindings tables are shown with documentation strings\r
+-rather than command names. By default, this uses the first line\r
+-of each command's documentation string. A command can override\r
+-this by setting the 'notmuch-doc property of its command symbol.\r
+-A command that supports a prefix argument can explicitly document\r
+-its prefixed behavior by setting the 'notmuch-prefix-doc property\r
+-of its command symbol."\r
+- (interactive)\r
+- (let* ((mode major-mode)\r
+- (doc (substitute-command-keys (notmuch-substitute-command-keys (documentation mode t)))))\r
+- (with-current-buffer (generate-new-buffer "*notmuch-help*")\r
+- (insert doc)\r
+- (goto-char (point-min))\r
+- (set-buffer-modified-p nil)\r
+- (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))\r
+-\r
+ (require 'hl-line)\r
+ \r
+ (defun notmuch-hl-line-mode ()\r
+-- \r
+1.7.9.1\r
+\r