Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 46 / 4b15b25293c29e96a1f0b4d3c0a45485d5c7c3
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 1F02D431FC4\r
6         for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 02:21:30 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \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 2H0qBRyZEEts for <notmuch@notmuchmail.org>;\r
18         Thu, 14 Nov 2013 02:21:20 -0800 (PST)\r
19 Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com\r
20  [74.125.82.46])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  666E5431FAE    for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 02:21:20 -0800\r
23  (PST)\r
24 Received: by mail-wg0-f46.google.com with SMTP id x12so1641073wgg.13\r
25         for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 02:21:17 -0800 (PST)\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;\r
28         bh=nD2Uy2sOysb4jb+5AfLYvM+VkWx7i4BpQGc02u76mLM=;\r
29         b=gNaNF550oEsdErRiv66FY0w4fhldxGYYIv0/hEIVkrdrOJhbGS6XZP/eZDRgLPGnj3\r
30         UWCDlT/6EHjfDOKCEnPdyXXncfM0eH0O0QiyVrglWESCT7w9BT/40oCVmXuGniSuFY8d\r
31         Jt45mkkOM/Wi0dZ7zeSYGE0jfd0S9+7F1Ai8hkT+cSAMglqQFUSRl0tzk8WN4vxWYpZX\r
32         ILTDyBBmObW9aSBWs33b94XlGHaVLKEQtz5XB8UluaFcFbPQFKpFFo5CifCpi7EKsSDb\r
33         GiBlGw0xlvvWb5tN4agoPtOppiEYqd+NA125MGDD5rQldGLvRSAihOg0TBTY3Wezx3kc\r
34         iTaw==\r
35 X-Received: by 10.180.39.140 with SMTP id p12mr1483981wik.12.1384422590582;\r
36         Thu, 14 Nov 2013 01:49:50 -0800 (PST)\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 hv5sm63991736wib.2.2013.11.14.01.49.49\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Thu, 14 Nov 2013 01:49:50 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH] emacs: add '?' to some prefix keymaps to describe its\r
45  bindings\r
46 Date: Thu, 14 Nov 2013 09:49:46 +0000\r
47 Message-Id: <1384422586-21806-1-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Thu, 14 Nov 2013 10:21:30 -0000\r
62 \r
63 Added function notmuch-subkeymap-help to describe keybindings of a\r
64 subkeymap (eg after . or c in notmuch-search and notmuch-show).\r
65 ---\r
66 This a reimplementation of Tomi's patch at\r
67 id:1377346540-7094-1-git-send-email-tomi.ollila@iki.fi but the help\r
68 screen shows docstrings rather than function names.\r
69 \r
70 Best wishes\r
71 \r
72 Mark\r
73 \r
74 \r
75 \r
76 \r
77 \r
78  emacs/notmuch-lib.el  |   25 ++++++++++++++++++++++++-\r
79  emacs/notmuch-show.el |    2 ++\r
80  emacs/notmuch.el      |    1 +\r
81  3 files changed, 27 insertions(+), 1 deletions(-)\r
82 \r
83 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
84 index 49fe644..2be409b 100644\r
85 --- a/emacs/notmuch-lib.el\r
86 +++ b/emacs/notmuch-lib.el\r
87 @@ -231,7 +231,8 @@ depending on the value of `notmuch-poll-script'."\r
88    "Given a prefix key code, return a human-readable string representation.\r
89  \r
90  This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
91 -  (let ((desc (format-kbd-macro (vector key))))\r
92 +  (let* ((key-vector (if (vectorp key) key (vector key)))\r
93 +        (desc (format-kbd-macro key-vector)))\r
94      (if (string= desc "ESC")\r
95         "M-"\r
96        (concat desc " "))))\r
97 @@ -337,6 +338,28 @@ of its command symbol."\r
98        (set-buffer-modified-p nil)\r
99        (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))\r
100  \r
101 +(defun notmuch-subkeymap-help ()\r
102 +  "Show help for a subkeymap."\r
103 +  (interactive)\r
104 +  (let* ((key (this-command-keys-vector))\r
105 +       (prefix (make-vector (1- (length key)) nil))\r
106 +       (i 0))\r
107 +    (while (< i (length prefix))\r
108 +      (aset prefix i (aref key i))\r
109 +      (setq i (1+ i)))\r
110 +\r
111 +    (let* ((subkeymap (key-binding prefix))\r
112 +          (ua-keys (where-is-internal 'universal-argument nil t))\r
113 +          (prefix-string (notmuch-prefix-key-description prefix))\r
114 +          (desc-alist (notmuch-describe-keymap subkeymap ua-keys subkeymap prefix-string))\r
115 +          (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
116 +          (desc (mapconcat #'identity desc-list "\n")))\r
117 +      (with-help-window (help-buffer)\r
118 +       (with-current-buffer standard-output\r
119 +         (insert "\nPress 'q' to quit this window.\n\n")\r
120 +         (insert desc)))\r
121 +      (pop-to-buffer (help-buffer)))))\r
122 +\r
123  (defvar notmuch-buffer-refresh-function nil\r
124    "Function to call to refresh the current buffer.")\r
125  (make-variable-buffer-local 'notmuch-buffer-refresh-function)\r
126 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
127 index f00273a..45dca8b 100644\r
128 --- a/emacs/notmuch-show.el\r
129 +++ b/emacs/notmuch-show.el\r
130 @@ -1232,6 +1232,7 @@ reset based on the original query."\r
131      (define-key map "t" 'notmuch-show-stash-to)\r
132      (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
133      (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
134 +    (define-key map "?" 'notmuch-subkeymap-help)\r
135      map)\r
136    "Submap for stash commands")\r
137  (fset 'notmuch-show-stash-map notmuch-show-stash-map)\r
138 @@ -1242,6 +1243,7 @@ reset based on the original query."\r
139      (define-key map "v" 'notmuch-show-view-part)\r
140      (define-key map "o" 'notmuch-show-interactively-view-part)\r
141      (define-key map "|" 'notmuch-show-pipe-part)\r
142 +    (define-key map "?" 'notmuch-subkeymap-help)\r
143      map)\r
144    "Submap for part commands")\r
145  (fset 'notmuch-show-part-map notmuch-show-part-map)\r
146 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
147 index c9bc2f2..0471750 100644\r
148 --- a/emacs/notmuch.el\r
149 +++ b/emacs/notmuch.el\r
150 @@ -165,6 +165,7 @@ To enter a line break in customize, press \\[quoted-insert] C-j."\r
151  (defvar notmuch-search-stash-map\r
152    (let ((map (make-sparse-keymap)))\r
153      (define-key map "i" 'notmuch-search-stash-thread-id)\r
154 +    (define-key map "?" 'notmuch-subkeymap-help)\r
155      map)\r
156    "Submap for stash commands")\r
157  (fset 'notmuch-search-stash-map notmuch-search-stash-map)\r
158 -- \r
159 1.7.9.1\r
160 \r