Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 14 / 014295161e307ecf54e12bdcaa7caf0e357bd6
1 Return-Path: <notmuch@dima.secretsauce.net>\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 884D1431FD0\r
6         for <notmuch@notmuchmail.org>; Sun, 29 May 2011 01:56:34 -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\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 4rsEhS28wGCv for <notmuch@notmuchmail.org>;\r
16         Sun, 29 May 2011 01:56:33 -0700 (PDT)\r
17 Received: from hrndva-omtalb.mail.rr.com (hrndva-omtalb.mail.rr.com\r
18         [71.74.56.123])\r
19         by olra.theworths.org (Postfix) with ESMTP id B0C39431FB6\r
20         for <notmuch@notmuchmail.org>; Sun, 29 May 2011 01:56:33 -0700 (PDT)\r
21 X-Authority-Analysis: v=1.1 cv=NmbQexcdgr4rtO3OwYGrP5Q3rTMpacrTPhuaXkv4uP8=\r
22         c=1 sm=0 a=E-klbLaLA44A:10 a=8YMtuzaJ5FE3wtSInqJrPg==:17\r
23         a=ncDVm-j7AAAA:8 a=2PeZjLzq-K_LnB-q7ZMA:9\r
24         a=77gGT1gBv2MC1DDIb3YA:7 a=1TAlIYiSTWAA:10\r
25         a=8YMtuzaJ5FE3wtSInqJrPg==:117\r
26 X-Cloudmark-Score: 0\r
27 X-Originating-IP: 76.175.234.46\r
28 Received: from [76.175.234.46] ([76.175.234.46:57221]\r
29         helo=localhost.localdomain)\r
30         by hrndva-oedge01.mail.rr.com (envelope-from\r
31         <notmuch@dima.secretsauce.net>) (ecelerity 2.2.3.46 r()) with ESMTP\r
32         id D3/9C-08391-04A02ED4; Sun, 29 May 2011 08:56:33 +0000\r
33 From: notmuch@dima.secretsauce.net\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH] added keys to hide/show a portion of the thread\r
36 Date: Sun, 29 May 2011 01:56:44 -0700\r
37 Message-Id: <1306659404-21840-1-git-send-email-notmuch@dima.secretsauce.net>\r
38 X-Mailer: git-send-email 1.7.5.3\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sun, 29 May 2011 08:56:34 -0000\r
52 \r
53 From: Dima Kogan <dima@secretsauce.net>\r
54 \r
55 ---\r
56 \r
57  Here's another improvement. In the notmuch-show display this binds '[' to\r
58  expand all the children messages (replies). Analogously ']' collapses all the\r
59  children messages.\r
60 \r
61  dima\r
62 \r
63  emacs/notmuch-show.el |   34 ++++++++++++++++++++++++++++++++++\r
64  1 files changed, 34 insertions(+), 0 deletions(-)\r
65 \r
66 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
67 index 2ba151e..600f3ec 100644\r
68 --- a/emacs/notmuch-show.el\r
69 +++ b/emacs/notmuch-show.el\r
70 @@ -813,6 +813,8 @@ function is used. "\r
71         (define-key map " " 'notmuch-show-advance-and-archive)\r
72         (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
73         (define-key map (kbd "RET") 'notmuch-show-toggle-message)\r
74 +       (define-key map "]" 'notmuch-show-hide-hierarchy)\r
75 +       (define-key map "[" 'notmuch-show-show-hierarchy)\r
76         map)\r
77        "Keymap for \"notmuch show\" buffers.")\r
78  (fset 'notmuch-show-mode-map notmuch-show-mode-map)\r
79 @@ -1266,6 +1268,38 @@ argument, hide all of the messages."\r
80           until (not (notmuch-show-goto-message-next))))\r
81    (force-window-update))\r
82  \r
83 +; get the depth, assuming the point is at the start of the header line\r
84 +(defun notmuch-show-get-depth ()\r
85 +  (save-excursion\r
86 +    (let ((start (point)))\r
87 +      (- (re-search-forward "^ *") start))))\r
88 +\r
89 +(defun notmuch-show-hideshow-hierarchy (doshow)\r
90 +  "Hides or shows this message and all its replies"\r
91 +  (interactive)\r
92 +  (save-excursion\r
93 +    (notmuch-show-move-to-message-top)\r
94 +\r
95 +    (let ((depth0 (notmuch-show-get-depth)))\r
96 +      (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
97 +                                             doshow)\r
98 +            until (or (not (notmuch-show-goto-message-next))\r
99 +                      (<= (notmuch-show-get-depth) depth0))))\r
100 +  (force-window-update))\r
101 +)\r
102 +\r
103 +(defun notmuch-show-show-hierarchy ()\r
104 +  "Show this message and all its replies"\r
105 +  (interactive)\r
106 +  (notmuch-show-hideshow-hierarchy 1)\r
107 +)\r
108 +\r
109 +(defun notmuch-show-hide-hierarchy ()\r
110 +  "Hide this message and all its replies"\r
111 +  (interactive)\r
112 +  (notmuch-show-hideshow-hierarchy nil)\r
113 +)\r
114 +\r
115  (defun notmuch-show-next-button ()\r
116    "Advance point to the next button in the buffer."\r
117    (interactive)\r
118 -- \r
119 1.7.4.4\r
120 \r