1 Return-Path: <markwalters1009@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id F259B431FC4
\r
6 for <notmuch@notmuchmail.org>; Tue, 29 Oct 2013 16:02:53 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id uKK46l5ZZacI for <notmuch@notmuchmail.org>;
\r
18 Tue, 29 Oct 2013 16:02:48 -0700 (PDT)
\r
19 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com
\r
20 [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 37392431FBC
\r
23 for <notmuch@notmuchmail.org>; Tue, 29 Oct 2013 16:02:48 -0700 (PDT)
\r
24 Received: by mail-wi0-f169.google.com with SMTP id cb5so5641612wib.0
\r
25 for <notmuch@notmuchmail.org>; Tue, 29 Oct 2013 16:02:47 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
28 bh=dAGdcOL9ak6gHjE5+BlGzwNTN6FNdZDfF18l7E+Otiw=;
\r
29 b=doLREtvg4rQjkNTJMs7WhithPZS1WeKbcBsWBo7ocf6FB3UUCDO+uJZCDJwJmfd2y2
\r
30 Jb+KTUizhHR+kiwFxeyzr51uL1uzCTXIoHjshuKfqye8hFztqhPbmUORlP+INuKLJBer
\r
31 7cxKrh5enJ8pCV87bQQeuRefxZ7qr7CyhpdPcQdSk/8qtFI7fWPneSMu1wlJtUBSvoRk
\r
32 qZefZ5onuEfdP9yR5WuV3aaQpaMTa35aX3Ofme5knx4oIeL9VPjxzh28crUETuQaMnV3
\r
33 TU97fuy4IvMj8wY7l4RuhTwtQ2Rw5pgBbPf1b5ab5FtFGL+fP+HU5/CLCIji9iz23J6Z
\r
35 X-Received: by 10.180.13.142 with SMTP id h14mr110696wic.3.1383087344398;
\r
36 Tue, 29 Oct 2013 15:55:44 -0700 (PDT)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPSA id b7sm9537512wiz.8.2013.10.29.15.55.43
\r
39 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Tue, 29 Oct 2013 15:55:44 -0700 (PDT)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH 01/11] emacs: move notmuch-help to lib
\r
45 Date: Tue, 29 Oct 2013 22:55:28 +0000
\r
46 Message-Id: <1383087338-10220-2-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 In-Reply-To: <1383087338-10220-1-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1383087338-10220-1-git-send-email-markwalters1009@gmail.com>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Tue, 29 Oct 2013 23:02:54 -0000
\r
64 notmuch-help is in notmuch.el not notmuch-lib.el and this is
\r
65 incovenient for the way pick/tree uses it. I think lib makes more
\r
66 sense anyway so move it there.
\r
68 emacs/notmuch-lib.el | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++
\r
69 emacs/notmuch.el | 87 --------------------------------------------------
\r
70 2 files changed, 87 insertions(+), 87 deletions(-)
\r
72 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
73 index 6541282..e7c5c97 100644
\r
74 --- a/emacs/notmuch-lib.el
\r
75 +++ b/emacs/notmuch-lib.el
\r
76 @@ -215,6 +215,93 @@ depending on the value of `notmuch-poll-script'."
\r
78 (kill-buffer (current-buffer)))
\r
80 +(defun notmuch-documentation-first-line (symbol)
\r
81 + "Return the first line of the documentation string for SYMBOL."
\r
82 + (let ((doc (documentation symbol)))
\r
85 + (insert (documentation symbol t))
\r
86 + (goto-char (point-min))
\r
87 + (let ((beg (point)))
\r
89 + (buffer-substring beg (point))))
\r
92 +(defun notmuch-prefix-key-description (key)
\r
93 + "Given a prefix key code, return a human-readable string representation.
\r
95 +This is basically just `format-kbd-macro' but we also convert ESC to M-."
\r
96 + (let ((desc (format-kbd-macro (vector key))))
\r
97 + (if (string= desc "ESC")
\r
99 + (concat desc " "))))
\r
101 +(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)
\r
102 + "Return a list of strings, each describing one binding in KEYMAP.
\r
104 +Each string gives a human-readable description of the key and a
\r
105 +one-line description of the bound function. See `notmuch-help'
\r
106 +for an overview of how this documentation is extracted.
\r
108 +UA-KEYS should be a key sequence bound to `universal-argument'.
\r
109 +It will be used to describe bindings of commands that support a
\r
110 +prefix argument. PREFIX and TAIL are used internally."
\r
112 + (lambda (key binding)
\r
113 + (cond ((mouse-event-p key) nil)
\r
114 + ((keymapp binding)
\r
116 + (notmuch-describe-keymap
\r
117 + binding ua-keys (notmuch-prefix-key-description key) tail)))
\r
119 + (when (and ua-keys (symbolp binding)
\r
120 + (get binding 'notmuch-prefix-doc))
\r
121 + ;; Documentation for prefixed command
\r
122 + (let ((ua-desc (key-description ua-keys)))
\r
123 + (push (concat ua-desc " " prefix (format-kbd-macro (vector key))
\r
124 + "\t" (get binding 'notmuch-prefix-doc))
\r
126 + ;; Documentation for command
\r
127 + (push (concat prefix (format-kbd-macro (vector key)) "\t"
\r
128 + (or (and (symbolp binding) (get binding 'notmuch-doc))
\r
129 + (notmuch-documentation-first-line binding)))
\r
134 +(defun notmuch-substitute-command-keys (doc)
\r
135 + "Like `substitute-command-keys' but with documentation, not function names."
\r
137 + (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
\r
138 + (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
\r
139 + (keymap (symbol-value (intern keymap-name)))
\r
140 + (ua-keys (where-is-internal 'universal-argument keymap t))
\r
141 + (desc-list (notmuch-describe-keymap keymap ua-keys))
\r
142 + (desc (mapconcat #'identity desc-list "\n")))
\r
143 + (setq doc (replace-match desc 1 1 doc)))
\r
144 + (setq beg (match-end 0)))
\r
147 +(defun notmuch-help ()
\r
148 + "Display help for the current notmuch mode.
\r
150 +This is similar to `describe-function' for the current major
\r
151 +mode, but bindings tables are shown with documentation strings
\r
152 +rather than command names. By default, this uses the first line
\r
153 +of each command's documentation string. A command can override
\r
154 +this by setting the 'notmuch-doc property of its command symbol.
\r
155 +A command that supports a prefix argument can explicitly document
\r
156 +its prefixed behavior by setting the 'notmuch-prefix-doc property
\r
157 +of its command symbol."
\r
159 + (let* ((mode major-mode)
\r
160 + (doc (substitute-command-keys (notmuch-substitute-command-keys (documentation mode t)))))
\r
161 + (with-current-buffer (generate-new-buffer "*notmuch-help*")
\r
163 + (goto-char (point-min))
\r
164 + (set-buffer-modified-p nil)
\r
165 + (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
\r
167 (defvar notmuch-buffer-refresh-function nil
\r
168 "Function to call to refresh the current buffer.")
\r
169 (make-variable-buffer-local 'notmuch-buffer-refresh-function)
\r
170 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
171 index d0cd906..19210cb 100644
\r
172 --- a/emacs/notmuch.el
\r
173 +++ b/emacs/notmuch.el
\r
174 @@ -119,93 +119,6 @@ To enter a line break in customize, press \\[quoted-insert] C-j."
\r
175 (mm-save-part p))))
\r
178 -(defun notmuch-documentation-first-line (symbol)
\r
179 - "Return the first line of the documentation string for SYMBOL."
\r
180 - (let ((doc (documentation symbol)))
\r
182 - (with-temp-buffer
\r
183 - (insert (documentation symbol t))
\r
184 - (goto-char (point-min))
\r
185 - (let ((beg (point)))
\r
187 - (buffer-substring beg (point))))
\r
190 -(defun notmuch-prefix-key-description (key)
\r
191 - "Given a prefix key code, return a human-readable string representation.
\r
193 -This is basically just `format-kbd-macro' but we also convert ESC to M-."
\r
194 - (let ((desc (format-kbd-macro (vector key))))
\r
195 - (if (string= desc "ESC")
\r
197 - (concat desc " "))))
\r
199 -(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)
\r
200 - "Return a list of strings, each describing one binding in KEYMAP.
\r
202 -Each string gives a human-readable description of the key and a
\r
203 -one-line description of the bound function. See `notmuch-help'
\r
204 -for an overview of how this documentation is extracted.
\r
206 -UA-KEYS should be a key sequence bound to `universal-argument'.
\r
207 -It will be used to describe bindings of commands that support a
\r
208 -prefix argument. PREFIX and TAIL are used internally."
\r
210 - (lambda (key binding)
\r
211 - (cond ((mouse-event-p key) nil)
\r
212 - ((keymapp binding)
\r
214 - (notmuch-describe-keymap
\r
215 - binding ua-keys (notmuch-prefix-key-description key) tail)))
\r
217 - (when (and ua-keys (symbolp binding)
\r
218 - (get binding 'notmuch-prefix-doc))
\r
219 - ;; Documentation for prefixed command
\r
220 - (let ((ua-desc (key-description ua-keys)))
\r
221 - (push (concat ua-desc " " prefix (format-kbd-macro (vector key))
\r
222 - "\t" (get binding 'notmuch-prefix-doc))
\r
224 - ;; Documentation for command
\r
225 - (push (concat prefix (format-kbd-macro (vector key)) "\t"
\r
226 - (or (and (symbolp binding) (get binding 'notmuch-doc))
\r
227 - (notmuch-documentation-first-line binding)))
\r
232 -(defun notmuch-substitute-command-keys (doc)
\r
233 - "Like `substitute-command-keys' but with documentation, not function names."
\r
235 - (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
\r
236 - (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
\r
237 - (keymap (symbol-value (intern keymap-name)))
\r
238 - (ua-keys (where-is-internal 'universal-argument keymap t))
\r
239 - (desc-list (notmuch-describe-keymap keymap ua-keys))
\r
240 - (desc (mapconcat #'identity desc-list "\n")))
\r
241 - (setq doc (replace-match desc 1 1 doc)))
\r
242 - (setq beg (match-end 0)))
\r
245 -(defun notmuch-help ()
\r
246 - "Display help for the current notmuch mode.
\r
248 -This is similar to `describe-function' for the current major
\r
249 -mode, but bindings tables are shown with documentation strings
\r
250 -rather than command names. By default, this uses the first line
\r
251 -of each command's documentation string. A command can override
\r
252 -this by setting the 'notmuch-doc property of its command symbol.
\r
253 -A command that supports a prefix argument can explicitly document
\r
254 -its prefixed behavior by setting the 'notmuch-prefix-doc property
\r
255 -of its command symbol."
\r
257 - (let* ((mode major-mode)
\r
258 - (doc (substitute-command-keys (notmuch-substitute-command-keys (documentation mode t)))))
\r
259 - (with-current-buffer (generate-new-buffer "*notmuch-help*")
\r
261 - (goto-char (point-min))
\r
262 - (set-buffer-modified-p nil)
\r
263 - (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
\r
267 (defun notmuch-hl-line-mode ()
\r