Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 40 / 62e214ee4bbca4bd27d01855f3ee3873230313
1 Return-Path: <dme@dme.org>\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 1855841EC06\r
6         for <notmuch@notmuchmail.org>; Wed,  1 Feb 2012 06:39:32 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 DRCZiqXvzbnh for <notmuch@notmuchmail.org>;\r
16         Wed,  1 Feb 2012 06:39:31 -0800 (PST)\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 26791421192\r
21         for <notmuch@notmuchmail.org>; Wed,  1 Feb 2012 06:39:31 -0800 (PST)\r
22 Received: by werb10 with SMTP id b10so1130037wer.26\r
23         for <notmuch@notmuchmail.org>; Wed, 01 Feb 2012 06:39:29 -0800 (PST)\r
24 Received: by 10.216.139.87 with SMTP id b65mr10565721wej.59.1328107169930;\r
25         Wed, 01 Feb 2012 06:39:29 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id bj10sm45151850wib.9.2012.02.01.06.39.27\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Wed, 01 Feb 2012 06:39:28 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 36E8BA04C7; Wed,  1 Feb 2012 14:39:26 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH v5 2/6] emacs: Allow `notmuch-show-mode' to display only\r
36         matching messages.\r
37 Date: Wed,  1 Feb 2012 14:39:20 +0000\r
38 Message-Id: <1328107164-10520-3-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.8.3\r
40 In-Reply-To: <1328107164-10520-1-git-send-email-dme@dme.org>\r
41 References: <1327486729-18052-1-git-send-email-dme@dme.org>\r
42         <1328107164-10520-1-git-send-email-dme@dme.org>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Wed, 01 Feb 2012 14:39:32 -0000\r
56 \r
57 The current behaviour (all messages shown, non-matching collapsed)\r
58 is retained as the default. Type '!' to switch to showing only\r
59 the matching messages - non-matching messages are not available.\r
60 '!' will switch back to showing everything.\r
61 ---\r
62  emacs/notmuch-show.el |   18 +++++++++++++++++-\r
63  1 files changed, 17 insertions(+), 1 deletions(-)\r
64 \r
65 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
66 index b6329d2..df81cd1 100644\r
67 --- a/emacs/notmuch-show.el\r
68 +++ b/emacs/notmuch-show.el\r
69 @@ -141,6 +141,10 @@ indentation."\r
70  (make-variable-buffer-local 'notmuch-show-process-crypto)\r
71  (put 'notmuch-show-process-crypto 'permanent-local t)\r
72  \r
73 +(defvar notmuch-show-elide-non-matching-messages nil)\r
74 +(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)\r
75 +(put 'notmuch-show-elide-non-matching-messages 'permanent-local t)\r
76 +\r
77  (defmacro with-current-notmuch-show-message (&rest body)\r
78    "Evaluate body with current buffer set to the text of current message"\r
79    `(save-excursion\r
80 @@ -928,11 +932,22 @@ current buffer, if possible."\r
81              "Not processing cryptographic MIME parts."))\r
82    (notmuch-show-refresh-view))\r
83  \r
84 +(defun notmuch-show-toggle-elide-non-matching ()\r
85 +  "Toggle the display of non-matching messages."\r
86 +  (interactive)\r
87 +  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))\r
88 +  (message (if notmuch-show-elide-non-matching-messages\r
89 +              "Showing matching messages only."\r
90 +            "Showing all messages."))\r
91 +  (notmuch-show-refresh-view))\r
92 +\r
93  (defun notmuch-show-insert-tree (tree depth)\r
94    "Insert the message tree TREE at depth DEPTH in the current thread."\r
95    (let ((msg (car tree))\r
96         (replies (cadr tree)))\r
97 -    (notmuch-show-insert-msg msg depth)\r
98 +    (if (or (not notmuch-show-elide-non-matching-messages)\r
99 +           (plist-get msg :match))\r
100 +       (notmuch-show-insert-msg msg depth))\r
101      (notmuch-show-insert-thread replies (1+ depth))))\r
102  \r
103  (defun notmuch-show-insert-thread (thread depth)\r
104 @@ -1086,6 +1101,7 @@ Refreshes the current view, observing changes in cryptographic preferences."\r
105         (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
106         (define-key map (kbd "RET") 'notmuch-show-toggle-message)\r
107         (define-key map "#" 'notmuch-show-print-message)\r
108 +       (define-key map "!" 'notmuch-show-toggle-elide-non-matching)\r
109         (define-key map "$" 'notmuch-show-toggle-process-crypto)\r
110         map)\r
111        "Keymap for \"notmuch show\" buffers.")\r
112 -- \r
113 1.7.8.3\r
114 \r