Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 77 / a16772bfd1924b35050086ea88d0f4d86053f4
1 Return-Path: <too@guru-group.fi>\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 53A1F431FDC\r
6         for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 05:15:52 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id LMpZu7ARJJoJ for <notmuch@notmuchmail.org>;\r
16         Sat, 24 Aug 2013 05:15:47 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 76981431FBD\r
19         for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 05:15:47 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 9C67410009D; Sat, 24 Aug 2013 15:15:41 +0300 (EEST)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH 1/1] emacs: add '?' to some prefix keymaps to describe its\r
25         bindings\r
26 Date: Sat, 24 Aug 2013 15:15:40 +0300\r
27 Message-Id: <1377346540-7094-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.8.0\r
29 Cc: tomi.ollila@iki.fi\r
30 X-BeenThere: notmuch@notmuchmail.org\r
31 X-Mailman-Version: 2.1.13\r
32 Precedence: list\r
33 List-Id: "Use and development of the notmuch mail system."\r
34         <notmuch.notmuchmail.org>\r
35 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
36         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
37 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
38 List-Post: <mailto:notmuch@notmuchmail.org>\r
39 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
40 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
42 X-List-Received-Date: Sat, 24 Aug 2013 12:15:52 -0000\r
43 \r
44 Added (private) function `notmuch--prefix-bindings' which wraps\r
45 `describe-prefix-bindings' to provide more suitable user interface for\r
46 showing the key sequences that follow a particular notmuch prefix\r
47 keymap invocation.\r
48 \r
49 The key '?' in prefix keymaps `notmuch-search-stash-map',\r
50 `notmuch-show-stash-map' and `notmuch-show-part-map' is bound to this\r
51 function via `lambda' expression. By using this lambda expression the\r
52 pop-up binding description window shows '??' instead of\r
53 `notmuch--prefix-bindings' for the binding of '?' -- which suits our\r
54 needs perfectly.\r
55 ---\r
56  emacs/notmuch-lib.el  | 9 +++++++++\r
57  emacs/notmuch-show.el | 2 ++\r
58  emacs/notmuch.el      | 1 +\r
59  3 files changed, 12 insertions(+)\r
60 \r
61 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
62 index 4796f17..8191aec 100644\r
63 --- a/emacs/notmuch-lib.el\r
64 +++ b/emacs/notmuch-lib.el\r
65 @@ -553,6 +553,15 @@ status."\r
66         (message "%s" (error-message-string err))))\r
67      (ignore-errors (delete-file err-file))))\r
68  \r
69 +(defun notmuch--prefix-bindings ()\r
70 +  "Notmuch private wrapper for `describe-prefix-bindings'."\r
71 +  ;;(interactive)\r
72 +  (describe-prefix-bindings)\r
73 +  (pop-to-buffer "*Help*") ; XXX that's what describe-bindings-internal uses\r
74 +  (let ((buffer-read-only nil))\r
75 +    (goto-char (point-min))\r
76 +    (insert "\nPress 'q' to quit this window.\n\n")))\r
77 +\r
78  ;; This variable is used only buffer local, but it needs to be\r
79  ;; declared globally first to avoid compiler warnings.\r
80  (defvar notmuch-show-process-crypto nil)\r
81 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
82 index 82b70ba..98bf3d4 100644\r
83 --- a/emacs/notmuch-show.el\r
84 +++ b/emacs/notmuch-show.el\r
85 @@ -1248,6 +1248,7 @@ reset based on the original query."\r
86      (define-key map "t" 'notmuch-show-stash-to)\r
87      (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
88      (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
89 +    (define-key map "?" (lambda () (interactive) (notmuch--prefix-bindings)))\r
90      map)\r
91    "Submap for stash commands")\r
92  (fset 'notmuch-show-stash-map notmuch-show-stash-map)\r
93 @@ -1258,6 +1259,7 @@ reset based on the original query."\r
94      (define-key map "v" 'notmuch-show-view-part)\r
95      (define-key map "o" 'notmuch-show-interactively-view-part)\r
96      (define-key map "|" 'notmuch-show-pipe-part)\r
97 +    (define-key map "?" (lambda () (interactive) (notmuch--prefix-bindings)))\r
98      map)\r
99    "Submap for part commands")\r
100  (fset 'notmuch-show-part-map notmuch-show-part-map)\r
101 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
102 index f3ce840..3a115c8 100644\r
103 --- a/emacs/notmuch.el\r
104 +++ b/emacs/notmuch.el\r
105 @@ -245,6 +245,7 @@ For a mouse binding, return nil."\r
106  (defvar notmuch-search-stash-map\r
107    (let ((map (make-sparse-keymap)))\r
108      (define-key map "i" 'notmuch-search-stash-thread-id)\r
109 +    (define-key map "?" (lambda () (interactive) (notmuch--prefix-bindings)))\r
110      map)\r
111    "Submap for stash commands")\r
112  (fset 'notmuch-search-stash-map notmuch-search-stash-map)\r
113 -- \r
114 1.8.0\r
115 \r