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 7790E41EC14
\r
6 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 08:31:13 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 ADqwOOcTTRqG for <notmuch@notmuchmail.org>;
\r
16 Mon, 30 Jan 2012 08:31:12 -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 C644B429E34
\r
21 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 08:31:11 -0800 (PST)
\r
22 Received: by werb10 with SMTP id b10so3999808wer.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 08:31:10 -0800 (PST)
\r
24 Received: by 10.216.133.12 with SMTP id p12mr7221286wei.49.1327941070558;
\r
25 Mon, 30 Jan 2012 08:31:10 -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 eq5sm54042265wib.2.2012.01.30.08.31.07
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Mon, 30 Jan 2012 08:31:08 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 13F519FEE5; Mon, 30 Jan 2012 16:31:06 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
\r
36 Date: Mon, 30 Jan 2012 16:31:02 +0000
\r
37 Message-Id: <1327941064-20027-4-git-send-email-dme@dme.org>
\r
38 X-Mailer: git-send-email 1.7.8.3
\r
39 In-Reply-To: <1327941064-20027-1-git-send-email-dme@dme.org>
\r
40 References: <1327486729-18052-1-git-send-email-dme@dme.org>
\r
41 <1327941064-20027-1-git-send-email-dme@dme.org>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Mon, 30 Jan 2012 16:31:13 -0000
\r
56 Very deeply indented content is sometimes difficult to
\r
57 read (particular for something like patches). Allow the indentation of
\r
58 the content to be toggled with '<'.
\r
60 Indentation of the header lines is not affected, so it remains
\r
61 possible to see the structure of the thread.
\r
63 emacs/notmuch-show.el | 26 ++++++++++++++++++++++----
\r
64 1 files changed, 22 insertions(+), 4 deletions(-)
\r
66 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
67 index 99478a4..a2c4daf 100644
\r
68 --- a/emacs/notmuch-show.el
\r
69 +++ b/emacs/notmuch-show.el
\r
70 @@ -139,6 +139,10 @@ indentation."
\r
71 (make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
\r
72 (put 'notmuch-show-elide-non-matching-messages 'permanent-local t)
\r
74 +(defvar notmuch-show-indent-content t)
\r
75 +(make-variable-buffer-local 'notmuch-show-indent-content)
\r
76 +(put 'notmuch-show-indent-content 'permanent-local t)
\r
78 (defmacro with-current-notmuch-show-message (&rest body)
\r
79 "Evaluate body with current buffer set to the text of current message"
\r
81 @@ -249,10 +253,12 @@ operation on the contents of the current buffer."
\r
82 (all (buffer-substring (notmuch-show-message-top)
\r
83 (notmuch-show-message-bottom)))
\r
85 - (props (notmuch-show-get-message-properties)))
\r
86 + (props (notmuch-show-get-message-properties))
\r
87 + (indenting notmuch-show-indent-content))
\r
90 - (indent-rigidly (point-min) (point-max) (- depth))
\r
92 + (indent-rigidly (point-min) (point-max) (- depth)))
\r
93 ;; Remove the original header.
\r
94 (goto-char (point-min))
\r
95 (re-search-forward "^$" (point-max) nil)
\r
96 @@ -880,7 +886,8 @@ current buffer, if possible."
\r
97 (setq notmuch-show-previous-subject bare-subject)
\r
99 (setq body-start (point-marker))
\r
100 - (notmuch-show-insert-body msg (plist-get msg :body) depth)
\r
101 + (notmuch-show-insert-body msg (plist-get msg :body)
\r
102 + (if notmuch-show-indent-content depth 0))
\r
103 ;; Ensure that the body ends with a newline.
\r
106 @@ -888,7 +895,8 @@ current buffer, if possible."
\r
107 (setq content-end (point-marker))
\r
109 ;; Indent according to the depth in the thread.
\r
110 - (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth))
\r
111 + (if notmuch-show-indent-content
\r
112 + (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth)))
\r
114 (setq message-end (point-max-marker))
\r
116 @@ -935,6 +943,15 @@ current buffer, if possible."
\r
117 "Showing all messages."))
\r
118 (notmuch-show-refresh-view))
\r
120 +(defun notmuch-show-toggle-thread-indentation ()
\r
121 + "Toggle the indentation of threads."
\r
123 + (setq notmuch-show-indent-content (not notmuch-show-indent-content))
\r
124 + (message (if notmuch-show-indent-content
\r
125 + "Content is indented."
\r
126 + "Content is not indented."))
\r
127 + (notmuch-show-refresh-view))
\r
129 (defun notmuch-show-insert-tree (tree depth)
\r
130 "Insert the message tree TREE at depth DEPTH in the current thread."
\r
131 (let ((msg (car tree))
\r
132 @@ -1096,6 +1113,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
\r
133 (define-key map "#" 'notmuch-show-print-message)
\r
134 (define-key map "!" 'notmuch-show-toggle-elide-non-matching)
\r
135 (define-key map "$" 'notmuch-show-toggle-process-crypto)
\r
136 + (define-key map "<" 'notmuch-show-toggle-thread-indentation)
\r
138 "Keymap for \"notmuch show\" buffers.")
\r
139 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
\r