Re: [PATCH] NEWS: initial NEWS for 0.22.1
[notmuch-archives.git] / d4 / 89d30e09e9d3d241c8642a52d08b9a4bdce68b
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 EE28D431FBC\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 08:08:28 -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 RN+KvhBwUuYb for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Feb 2012 08:08:28 -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 0141F431FAF\r
21         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 08:08:27 -0800 (PST)\r
22 Received: by wibhi8 with SMTP id hi8so4952689wib.26\r
23         for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 08:08:26 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.180.83.70 with SMTP id o6mr2795260wiy.19.1328544506822;\r
26         Mon, 06 Feb 2012 08:08:26 -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 n5sm47676065wiw.7.2012.02.06.08.08.24\r
30         (version=TLSv1/SSLv3 cipher=OTHER);\r
31         Mon, 06 Feb 2012 08:08:25 -0800 (PST)\r
32 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
33         id 413FBA05C6; Mon,  6 Feb 2012 16:08:23 +0000 (GMT)\r
34 From: David Edmondson <dme@dme.org>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH v2 1/2] emacs: Use text properties rather than overlays in\r
37         `notmuch-show-mode'.\r
38 Date: Mon,  6 Feb 2012 16:08:21 +0000\r
39 Message-Id: <1328544502-22615-2-git-send-email-dme@dme.org>\r
40 X-Mailer: git-send-email 1.7.8.3\r
41 In-Reply-To: <1328544502-22615-1-git-send-email-dme@dme.org>\r
42 References: <1327405007-4026-1-git-send-email-dme@dme.org>\r
43         <1328544502-22615-1-git-send-email-dme@dme.org>\r
44 X-Gm-Message-State:\r
45  ALoCoQkaOeb6HA0t5q1lObu7uTR0xN7SRoC6m9ICUjjV/jfE3OdmGPY1kRbtZ6LSu0Fdf7BHOO7A\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Mon, 06 Feb 2012 16:08:29 -0000\r
59 \r
60 Except for where invisibility is involved, replace the use of overlays\r
61 in `notmuch-show-mode' with text properties, which are more efficient\r
62 and can be merged together more effectively.\r
63 ---\r
64  emacs/notmuch-show.el |   66 +++++++++++++++++++++++++++++++-----------------\r
65  emacs/notmuch-wash.el |    8 ++++-\r
66  2 files changed, 48 insertions(+), 26 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
69 index 7469e2e..13d2e81 100644\r
70 --- a/emacs/notmuch-show.el\r
71 +++ b/emacs/notmuch-show.el\r
72 @@ -264,10 +264,10 @@ operation on the contents of the current buffer."\r
73                (t\r
74                 'message-header-other))))\r
75  \r
76 -    (overlay-put (make-overlay (point) (re-search-forward ":"))\r
77 -                'face 'message-header-name)\r
78 -    (overlay-put (make-overlay (point) (re-search-forward ".*$"))\r
79 -                'face face)))\r
80 +    (put-text-property (point) (re-search-forward ":")\r
81 +                      'face 'message-header-name)\r
82 +    (put-text-property (point) (re-search-forward ".*$")\r
83 +                      'face face)))\r
84  \r
85  (defun notmuch-show-colour-headers ()\r
86    "Apply some colouring to the current headers."\r
87 @@ -284,12 +284,11 @@ operation on the contents of the current buffer."\r
88    "Update the displayed tags of the current message."\r
89    (save-excursion\r
90      (goto-char (notmuch-show-message-top))\r
91 -    (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
92 -       (let ((inhibit-read-only t))\r
93 -         (replace-match (concat "("\r
94 -                                (propertize (mapconcat 'identity tags " ")\r
95 -                                            'face 'notmuch-tag-face)\r
96 -                                ")"))))))\r
97 +    (when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)\r
98 +      (let ((inhibit-read-only t))\r
99 +       (replace-match (propertize (mapconcat 'identity tags " ")\r
100 +                                  'face '(notmuch-tag-face notmuch-message-summary-face))\r
101 +                      nil nil nil 1)))))\r
102  \r
103  (defun notmuch-show-clean-address (address)\r
104    "Try to clean a single email ADDRESS for display.  Return\r
105 @@ -352,15 +351,26 @@ unchanged ADDRESS if parsing fails."\r
106    "Insert a notmuch style headerline based on HEADERS for a\r
107  message at DEPTH in the current thread."\r
108    (let ((start (point)))\r
109 -    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))\r
110 -           (notmuch-show-clean-address (plist-get headers :From))\r
111 -           " ("\r
112 -           date\r
113 -           ") ("\r
114 -           (propertize (mapconcat 'identity tags " ")\r
115 -                       'face 'notmuch-tag-face)\r
116 -           ")\n")\r
117 -    (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))\r
118 +    (insert\r
119 +     (propertize (concat (notmuch-show-clean-address (plist-get headers :From))\r
120 +                        " ("\r
121 +                        date\r
122 +                        ") (")\r
123 +                'face 'notmuch-message-summary-face)\r
124 +     (propertize (mapconcat 'identity tags " ")\r
125 +                'face '(notmuch-tag-face notmuch-message-summary-face))\r
126 +     (propertize ")\n"\r
127 +                'face 'notmuch-message-summary-face))\r
128 +\r
129 +    ;; Ensure that any insertions at the start of this line (usually\r
130 +    ;; just spaces for indentation purposes) inherit the face of the\r
131 +    ;; rest of the line...\r
132 +    (put-text-property start (1+ start)\r
133 +                      'front-sticky '(face))\r
134 +    ;; ...and that insertions at the end of this region do _not_\r
135 +    ;; inherit the face of the rest of this line.\r
136 +    (put-text-property (1- (point)) (point)\r
137 +                      'rear-nonsticky '(face))))\r
138  \r
139  (defun notmuch-show-insert-header (header header-value)\r
140    "Insert a single header."\r
141 @@ -796,8 +806,15 @@ current buffer, if possible."\r
142  (defun notmuch-show-insert-bodypart (msg part depth)\r
143    "Insert the body part PART at depth DEPTH in the current thread."\r
144    (let ((content-type (downcase (plist-get part :content-type)))\r
145 -       (nth (plist-get part :id)))\r
146 -    (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type))\r
147 +       (nth (plist-get part :id))\r
148 +       (start (point)))\r
149 +    (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type)\r
150 +\r
151 +    ;; Ensure that face properties applied to text in the buffer by\r
152 +    ;; the part handler don't leak into the following text.\r
153 +    (put-text-property start (point-max)\r
154 +                      'rear-nonsticky '(face)))\r
155 +\r
156    ;; Some of the body part handlers leave point somewhere up in the\r
157    ;; part, so we make sure that we're down at the end.\r
158    (goto-char (point-max))\r
159 @@ -888,11 +905,12 @@ current buffer, if possible."\r
160      (setq body-end (point-marker))\r
161      (setq content-end (point-marker))\r
162  \r
163 -    ;; Indent according to the depth in the thread.\r
164 -    (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth))\r
165 -\r
166      (setq message-end (point-max-marker))\r
167  \r
168 +    ;; Indent according to the depth in the thread.\r
169 +    (indent-rigidly message-start message-end\r
170 +                   (* notmuch-show-indent-messages-width depth))\r
171 +\r
172      ;; Save the extents of this message over the whole text of the\r
173      ;; message.\r
174      (put-text-property message-start message-end :notmuch-message-extent (cons message-start message-end))\r
175 diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
176 index 56981d0..29a9d45 100644\r
177 --- a/emacs/notmuch-wash.el\r
178 +++ b/emacs/notmuch-wash.el\r
179 @@ -187,7 +187,9 @@ that PREFIX should not include a newline."\r
180      (let* ((cite-start (match-beginning 0))\r
181            (cite-end (match-end 0))\r
182            (cite-lines (count-lines cite-start cite-end)))\r
183 -      (overlay-put (make-overlay cite-start cite-end) 'face 'message-cited-text)\r
184 +      (put-text-property cite-start cite-end 'face 'message-cited-text)\r
185 +      ;; Ensure that the next line doesn't inherit our face.\r
186 +      (put-text-property (1- cite-end) cite-end 'rear-nonsticky '(face))\r
187        (when (> cite-lines (+ notmuch-wash-citation-lines-prefix\r
188                              notmuch-wash-citation-lines-suffix\r
189                              1))\r
190 @@ -209,7 +211,9 @@ that PREFIX should not include a newline."\r
191                   (sig-end-marker (make-marker)))\r
192               (set-marker sig-start-marker sig-start)\r
193               (set-marker sig-end-marker (point-max))\r
194 -             (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 'message-cited-text)\r
195 +             (put-text-property sig-start-marker sig-end-marker 'face 'message-cited-text)\r
196 +             ;; Ensure that the next line doesn't inherit our face.\r
197 +             (put-text-property (1- sig-end-marker) sig-end-marker 'rear-nonsticky '(face))\r
198               (notmuch-wash-region-to-button\r
199                msg sig-start-marker sig-end-marker\r
200                "signature"))))))\r
201 -- \r
202 1.7.8.3\r
203 \r