Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / de / 5eecb3b3c1dd187e51350f1345b02f11818d15
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 842BA431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 02:19:00 -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 DyRKJ8iYE4xh for <notmuch@notmuchmail.org>;\r
16         Wed, 25 Jan 2012 02:18:59 -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 6B6A9431FD2\r
21         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 02:18:59 -0800 (PST)\r
22 Received: by werb10 with SMTP id b10so4266625wer.26\r
23         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 02:18:58 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.216.139.205 with SMTP id c55mr6851160wej.31.1327486738132;\r
26         Wed, 25 Jan 2012 02:18:58 -0800 (PST)\r
27 Received: from hotblack-desiato.hh.sledj.net\r
28         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
29         by mx.google.com with ESMTPS id dr5sm49687wib.0.2012.01.25.02.18.56\r
30         (version=TLSv1/SSLv3 cipher=OTHER);\r
31         Wed, 25 Jan 2012 02:18:57 -0800 (PST)\r
32 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
33         id BEE369FDC5; Wed, 25 Jan 2012 10:18:55 +0000 (GMT)\r
34 From: David Edmondson <dme@dme.org>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH 3/3] emacs: Allow the indentation of content to be toggled.\r
37 Date: Wed, 25 Jan 2012 10:18:49 +0000\r
38 Message-Id: <1327486729-18052-4-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.8.3\r
40 In-Reply-To: <1327486729-18052-1-git-send-email-dme@dme.org>\r
41 References: <1327486729-18052-1-git-send-email-dme@dme.org>\r
42 X-Gm-Message-State:\r
43  ALoCoQmaRX0YDq1zWCPDbXFIyCzWpmwe6JAq5JE2yk7Qf8rx7gSIeuwJPb7evxl0V2KThiSKINOk\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Wed, 25 Jan 2012 10:19:00 -0000\r
57 \r
58 Very deeply indented content is sometimes difficult to\r
59 read (particular for something like patches). Allow the indentation of\r
60 the content to be toggled with '<'.\r
61 \r
62 Indentation of the header lines is not affected, so it remains\r
63 possible to see the structure of the thread.\r
64 ---\r
65  emacs/notmuch-show.el |   23 ++++++++++++++++++++---\r
66  1 files changed, 20 insertions(+), 3 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
69 index 916b941..337cd50 100644\r
70 --- a/emacs/notmuch-show.el\r
71 +++ b/emacs/notmuch-show.el\r
72 @@ -138,6 +138,10 @@ indentation."\r
73  (make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)\r
74  (put 'notmuch-show-elide-non-matching-messages 'permanent-local t)\r
75  \r
76 +(defvar notmuch-show-indent-content t)\r
77 +(make-variable-buffer-local 'notmuch-show-indent-content)\r
78 +(put 'notmuch-show-indent-content 'permanent-local t)\r
79 +\r
80  (defmacro with-current-notmuch-show-message (&rest body)\r
81    "Evaluate body with current buffer set to the text of current message"\r
82    `(save-excursion\r
83 @@ -244,10 +248,12 @@ operation on the contents of the current buffer."\r
84          (all (buffer-substring (notmuch-show-message-top)\r
85                                 (notmuch-show-message-bottom)))\r
86  \r
87 -        (props (notmuch-show-get-message-properties)))\r
88 +        (props (notmuch-show-get-message-properties))\r
89 +        (indenting notmuch-show-indent-content))\r
90      (with-temp-buffer\r
91        (insert all)\r
92 -      (indent-rigidly (point-min) (point-max) (- depth))\r
93 +      (if indenting\r
94 +         (indent-rigidly (point-min) (point-max) (- depth)))\r
95        ;; Remove the original header.\r
96        (goto-char (point-min))\r
97        (re-search-forward "^$" (point-max) nil)\r
98 @@ -856,7 +862,8 @@ current buffer, if possible."\r
99      (setq content-end (point-marker))\r
100  \r
101      ;; Indent according to the depth in the thread.\r
102 -    (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth))\r
103 +    (if notmuch-show-indent-content\r
104 +       (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth)))\r
105  \r
106      (setq message-end (point-max-marker))\r
107  \r
108 @@ -903,6 +910,15 @@ current buffer, if possible."\r
109              "Showing all messages."))\r
110    (notmuch-show-refresh-view))\r
111  \r
112 +(defun notmuch-show-toggle-thread-indentation ()\r
113 +  "Toggle the indentation of threads."\r
114 +  (interactive)\r
115 +  (setq notmuch-show-indent-content (not notmuch-show-indent-content))\r
116 +  (message (if notmuch-show-indent-content\r
117 +              "Content is indented."\r
118 +            "Content is not indented."))\r
119 +  (notmuch-show-refresh-view))\r
120 +\r
121  (defun notmuch-show-insert-tree (tree depth)\r
122    "Insert the message tree TREE at depth DEPTH in the current thread."\r
123    (let ((msg (car tree))\r
124 @@ -1061,6 +1077,7 @@ Refreshes the current view, observing changes in cryptographic preferences."\r
125         (define-key map "#" 'notmuch-show-print-message)\r
126         (define-key map "!" 'notmuch-show-toggle-elide-non-matching)\r
127         (define-key map "$" 'notmuch-show-toggle-process-crypto)\r
128 +       (define-key map "<" 'notmuch-show-toggle-thread-indentation)\r
129         map)\r
130        "Keymap for \"notmuch show\" buffers.")\r
131  (fset 'notmuch-show-mode-map notmuch-show-mode-map)\r
132 -- \r
133 1.7.8.3\r
134 \r