Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 66 / 851c013feaca6ad9b540a0b1e882edbe275eb0
1 Return-Path: <markwalters1009@gmail.com>\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 4C7FC431FC3\r
6         for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 01:15:58 -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.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id 5yoPKUTCT1sO for <notmuch@notmuchmail.org>;\r
18         Fri, 14 Feb 2014 01:15:52 -0800 (PST)\r
19 Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com\r
20         [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id DA4C3431FAE\r
23         for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 01:15:36 -0800 (PST)\r
24 Received: by mail-wi0-f172.google.com with SMTP id e4so250829wiv.5\r
25         for <notmuch@notmuchmail.org>; Fri, 14 Feb 2014 01:15:35 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
28         bh=jgTuoGDRLVGeqvCm1pXe6eINyEJNe87IgtL0xzTC82c=;\r
29         b=UZ06rYhGAkd0zL8UR5qYHbqnBrUg4h+b+lhXgJPbnbsB6YtqvnqQnbVa2VLK91H4+E\r
30         0gtL/x3IKLbrHpjNq6+6LsBVVWa083ZpmJz7euPYp8a6QtEAEtG2TkjlkQcxLX5UeqXm\r
31         ITPq9MkPuMQ8ScbMa6KsAdPvYu7g8NCtVj/zMgtonBmni6XtDCJVfI/UA1/ZqCt0Nh+B\r
32         Le9cu4n4YNczTf+gZv8c2c2p+yQk8VV54qLL4DXOXB5kt+G7EOALnLLKZH9NE1h/BbB5\r
33         ZGlbqM6Vd9W9K4azRguPjihDYDg6E3Vyir1xGt6fNL2SrTEqcmMFWBWaEUxQK1zhlRCb\r
34         i8xw==\r
35 X-Received: by 10.194.119.230 with SMTP id kx6mr3297974wjb.13.1392369335761;\r
36         Fri, 14 Feb 2014 01:15:35 -0800 (PST)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPSA id v6sm2462420wif.0.2014.02.14.01.15.35\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Fri, 14 Feb 2014 01:15:35 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org,\r
44         Austin Clements <amdragon@MIT.EDU>\r
45 Subject: [WIP Patch 6/7] emacs: search: use orig-tags in search\r
46 Date: Fri, 14 Feb 2014 09:15:18 +0000\r
47 Message-Id: <1392369319-24508-7-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 In-Reply-To: <1392369319-24508-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1392369319-24508-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Fri, 14 Feb 2014 09:15:58 -0000\r
64 \r
65 This uses the recent functionality to show the tag changes in the\r
66 search buffer. Currently this is only used to show changes the search\r
67 buffer makes itself: i.e., it does not make display any changes\r
68 reflecting tagging done by other notmuch-buffers.\r
69 ---\r
70  emacs/notmuch.el |   40 ++++++++++++++++++++++++----------------\r
71  1 files changed, 24 insertions(+), 16 deletions(-)\r
72 \r
73 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
74 index 1436e5a..f07b216 100644\r
75 --- a/emacs/notmuch.el\r
76 +++ b/emacs/notmuch.el\r
77 @@ -753,24 +753,32 @@ non-authors is found, assume that all of the authors match."\r
78       format-string (notmuch-sanitize (plist-get result :authors))))\r
79  \r
80     ((string-equal field "tags")\r
81 -    (let ((tags (plist-get result :tags)))\r
82 -      (insert (format format-string (notmuch-tag-format-tags tags tags)))))))\r
83 +    (let ((tags (plist-get result :tags))\r
84 +         (orig-tags (plist-get result :orig-tags)))\r
85 +      (insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))\r
86  \r
87 -(defun notmuch-search-show-result (result &optional pos)\r
88 -  "Insert RESULT at POS or the end of the buffer if POS is null."\r
89 +(defun notmuch-search-show-result (result beg)\r
90 +  "Insert RESULT at BEG."\r
91    ;; Ignore excluded matches\r
92    (unless (= (plist-get result :matched) 0)\r
93 -    (let ((beg (or pos (point-max))))\r
94 -      (save-excursion\r
95 -       (goto-char beg)\r
96 -       (dolist (spec notmuch-search-result-format)\r
97 -         (notmuch-search-insert-field (car spec) (cdr spec) result))\r
98 -       (insert "\n")\r
99 -       (notmuch-search-color-line beg (point) (plist-get result :tags))\r
100 -       (put-text-property beg (point) 'notmuch-search-result result))\r
101 -      (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
102 -       (setq notmuch-search-target-thread "found")\r
103 -       (goto-char beg)))))\r
104 +    (save-excursion\r
105 +      (goto-char beg)\r
106 +      (dolist (spec notmuch-search-result-format)\r
107 +       (notmuch-search-insert-field (car spec) (cdr spec) result))\r
108 +      (insert "\n")\r
109 +      (notmuch-search-color-line beg (point) (plist-get result :tags))\r
110 +      (put-text-property beg (point) 'notmuch-search-result result))\r
111 +    (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
112 +      (setq notmuch-search-target-thread "found")\r
113 +      (goto-char beg))))\r
114 +\r
115 +(defun notmuch-search-append-result (result)\r
116 +  "Insert RESULT at the end of the buffer.\r
117 +\r
118 +This is only called when a result is first inserted so it also\r
119 +sets the :orig-tag property."\r
120 +  (plist-put result :orig-tags (plist-get result :tags))\r
121 +  (notmuch-search-show-result result (point-max)))\r
122  \r
123  (defun notmuch-search-process-filter (proc string)\r
124    "Process and filter the output of \"notmuch search\""\r
125 @@ -784,7 +792,7 @@ non-authors is found, assume that all of the authors match."\r
126         (save-excursion\r
127           (goto-char (point-max))\r
128           (insert string))\r
129 -       (notmuch-sexp-parse-partial-list 'notmuch-search-show-result\r
130 +       (notmuch-sexp-parse-partial-list 'notmuch-search-append-result\r
131                                          results-buf)))))\r
132  \r
133  (defun notmuch-search-tag-all (tag-changes)\r
134 -- \r
135 1.7.9.1\r
136 \r