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 DA88C431FD4
\r
6 for <notmuch@notmuchmail.org>; Mon, 6 Feb 2012 01:21:33 -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 EyiwJkmhphwa for <notmuch@notmuchmail.org>;
\r
16 Mon, 6 Feb 2012 01:21:32 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.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 BF8FD431FB6
\r
21 for <notmuch@notmuchmail.org>; Mon, 6 Feb 2012 01:21:30 -0800 (PST)
\r
22 Received: by wibhi8 with SMTP id hi8so4643235wib.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 01:21:29 -0800 (PST)
\r
24 Received: by 10.180.100.234 with SMTP id fb10mr25977021wib.8.1328520089495;
\r
25 Mon, 06 Feb 2012 01:21: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 q2sm23987295wiy.7.2012.02.06.01.21.25
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Mon, 06 Feb 2012 01:21:26 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 25E4DA0E82; Mon, 6 Feb 2012 09:21:24 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH v7 3/8] emacs: Allow the indentation of content to be toggled.
\r
36 Date: Mon, 6 Feb 2012 09:21:17 +0000
\r
37 Message-Id: <1328520082-26659-4-git-send-email-dme@dme.org>
\r
38 X-Mailer: git-send-email 1.7.8.3
\r
39 In-Reply-To: <1328520082-26659-1-git-send-email-dme@dme.org>
\r
40 References: <1327486729-18052-1-git-send-email-dme@dme.org>
\r
41 <1328520082-26659-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, 06 Feb 2012 09:21:34 -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 39f19d3..89663ee 100644
\r
68 --- a/emacs/notmuch-show.el
\r
69 +++ b/emacs/notmuch-show.el
\r
70 @@ -145,6 +145,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 @@ -255,10 +259,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 @@ -896,7 +902,8 @@ current buffer, if possible."
\r
97 (setq body-start (point-marker))
\r
98 ;; A blank line between the headers and the body.
\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 @@ -904,7 +911,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 @@ -951,6 +959,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 @@ -1113,6 +1130,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