Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / e1 / 1726307c8260b01c99ce56cb43441cb383fb6e
1 Return-Path: <jrollins@servo.finestructure.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 9E18B431FD0\r
6         for <notmuch@notmuchmail.org>; Thu,  2 Jun 2011 10:06:33 -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: -1.921\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id DVmCY2V1IKrE for <notmuch@notmuchmail.org>;\r
17         Thu,  2 Jun 2011 10:06:32 -0700 (PDT)\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
19         [131.215.239.19])\r
20         by olra.theworths.org (Postfix) with ESMTP id 435E2431FB6\r
21         for <notmuch@notmuchmail.org>; Thu,  2 Jun 2011 10:06:32 -0700 (PDT)\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
23         by fire-doxen-postvirus (Postfix) with ESMTP id D3CDC32806D;\r
24         Thu,  2 Jun 2011 09:59:43 -0700 (PDT)\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com\r
27         [98.149.172.122]) (Authenticated sender: jrollins)\r
28         by fire-doxen-submit (Postfix) with ESMTP id 09BEE2E50E71;\r
29         Thu,  2 Jun 2011 09:59:40 -0700 (PDT)\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)\r
31         id 8E181AD8; Thu,  2 Jun 2011 10:06:27 -0700 (PDT)\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>\r
34 Subject: [PATCH] emacs: Fix handling of message/rfc822 parts.\r
35 Date: Thu,  2 Jun 2011 10:06:26 -0700\r
36 Message-Id: <1307034386-6107-1-git-send-email-jrollins@finestructure.net>\r
37 X-Mailer: git-send-email 1.7.4.4\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Thu, 02 Jun 2011 17:06:33 -0000\r
51 \r
52 After the recent part-handling overhaul, emacs handling of\r
53 message/rfc822 parts broke, not outputting the message contents.  This\r
54 "fixes" then handling as is, but there are still problems with how\r
55 notmuch is outputting message parts that needs to be addressed (for\r
56 instance, message headers are not being output at the moment).\r
57 \r
58 This also indicates that we need a test for output of message parts in\r
59 emacs.\r
60 ---\r
61  emacs/notmuch-show.el |   27 ++++++++++++++++-----------\r
62  1 files changed, 16 insertions(+), 11 deletions(-)\r
63 \r
64 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
65 index 9837c7a..714200a 100644\r
66 --- a/emacs/notmuch-show.el\r
67 +++ b/emacs/notmuch-show.el\r
68 @@ -516,21 +516,26 @@ current buffer, if possible."\r
69    t)\r
70  \r
71  (defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type)\r
72 -  (let* ((message-part (plist-get part :content))\r
73 -        (inner-parts (plist-get message-part :content)))\r
74 -    (notmuch-show-insert-part-header nth declared-type content-type nil)\r
75 -    ;; Override `notmuch-message-headers' to force `From' to be\r
76 -    ;; displayed.\r
77 -    (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date")))\r
78 -      (notmuch-show-insert-headers (plist-get part :headers)))\r
79 -    ;; Blank line after headers to be compatible with the normal\r
80 -    ;; message display.\r
81 -    (insert "\n")\r
82 +  (notmuch-show-insert-part-header nth declared-type content-type nil)\r
83 +  (let ((inner-parts (plist-get part :content))\r
84 +       (start (point)))\r
85 +    (if (plist-member part :headers)\r
86 +       (progn\r
87 +         ;; Override `notmuch-message-headers' to force `From' to be\r
88 +         ;; displayed.\r
89 +         (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date")))\r
90 +           (notmuch-show-insert-headers (plist-get part :headers)))\r
91 +         ;; Blank line after headers to be compatible with the normal\r
92 +         ;; message display.\r
93 +         (insert "foo\n")))\r
94  \r
95      ;; Show all of the parts.\r
96      (mapc (lambda (inner-part)\r
97             (notmuch-show-insert-bodypart msg inner-part depth))\r
98 -         inner-parts))\r
99 +         inner-parts)\r
100 +\r
101 +    (when notmuch-show-indent-multipart\r
102 +      (indent-rigidly start (point) 1)))\r
103    t)\r
104  \r
105  (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth declared-type)\r
106 -- \r
107 1.7.4.4\r
108 \r