[PATCH] RFC: all deleting all properties with a given key
[notmuch-archives.git] / 7a / 0d52eeddba2c49c08560c949dbef94301de4d1
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 9B05F429E29\r
6         for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:59 -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 fZ0hQbfCUiTy for <notmuch@notmuchmail.org>;\r
18         Wed, 19 Feb 2014 12:20:54 -0800 (PST)\r
19 Received: from mail-we0-f175.google.com (mail-we0-f175.google.com\r
20         [74.125.82.175]) (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 9CE34431FD6\r
23         for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:42 -0800 (PST)\r
24 Received: by mail-we0-f175.google.com with SMTP id q59so755199wes.20\r
25         for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:41 -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=BS4YuF+JhlxmG7PCK2TmAJvuRPC1Zb1+hBTbJdB1wwo=;\r
29         b=qpzyxfI35AuPKZ+DXbVLLc/U8cuOs7P4aVWuHpXwYQJaIp455yiSlrDjGFZJn980Sz\r
30         PE4XjqK7EQu7i6Sxuh68AEFT6LQTKeOysL01rQYMai6L/6nH5mcB77xzsVtwpGWbbRZ4\r
31         Ci2AG5XoM+BLRkCBMNK+NP9kzJuVo5G4aS00FK4Fi5Q5+eLAIbO9UDd10maKIfCDL2T4\r
32         2TkTdoIHNApSlNyLzJ6NlS62mhiy6TRt9p+6nEXAargmrL4Ka0U+q9qUSNghNMd5OaNC\r
33         /XHMqF+S2k/ghbP06sL83axREUk1SnE1xADmwT7zPUamvkBtL9/Bquu8WeN4iyjfKx5Z\r
34         NKIg==\r
35 X-Received: by 10.180.107.136 with SMTP id hc8mr3428001wib.11.1392841241449;\r
36         Wed, 19 Feb 2014 12:20:41 -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 ee5sm4677221wib.8.2014.02.19.12.20.40\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Wed, 19 Feb 2014 12:20:40 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 6/7] emacs: search: use orig-tags in search\r
45 Date: Wed, 19 Feb 2014 20:20:11 +0000\r
46 Message-Id: <1392841212-8494-7-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Wed, 19 Feb 2014 20:20:59 -0000\r
63 \r
64 This uses the recent functionality to show the tag changes in the\r
65 search buffer. Currently this is only used to show changes the search\r
66 buffer makes itself: i.e., it does not make display any changes\r
67 reflecting tagging done by other notmuch-buffers.\r
68 ---\r
69  emacs/notmuch.el |   40 ++++++++++++++++++++++++----------------\r
70  1 files changed, 24 insertions(+), 16 deletions(-)\r
71 \r
72 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
73 index 04587c0..d8aef27 100644\r
74 --- a/emacs/notmuch.el\r
75 +++ b/emacs/notmuch.el\r
76 @@ -753,24 +753,32 @@ non-authors is found, assume that all of the authors match."\r
77       format-string (notmuch-sanitize (plist-get result :authors))))\r
78  \r
79     ((string-equal field "tags")\r
80 -    (let ((tags (plist-get result :tags)))\r
81 -      (insert (format format-string (notmuch-tag-format-tags tags tags)))))))\r
82 +    (let ((tags (plist-get result :tags))\r
83 +         (orig-tags (plist-get result :orig-tags)))\r
84 +      (insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))\r
85  \r
86 -(defun notmuch-search-show-result (result &optional pos)\r
87 -  "Insert RESULT at POS or the end of the buffer if POS is null."\r
88 +(defun notmuch-search-show-result (result beg)\r
89 +  "Insert RESULT at BEG."\r
90    ;; Ignore excluded matches\r
91    (unless (= (plist-get result :matched) 0)\r
92 -    (let ((beg (or pos (point-max))))\r
93 -      (save-excursion\r
94 -       (goto-char beg)\r
95 -       (dolist (spec notmuch-search-result-format)\r
96 -         (notmuch-search-insert-field (car spec) (cdr spec) result))\r
97 -       (insert "\n")\r
98 -       (notmuch-search-color-line beg (point) (plist-get result :tags))\r
99 -       (put-text-property beg (point) 'notmuch-search-result result))\r
100 -      (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
101 -       (setq notmuch-search-target-thread "found")\r
102 -       (goto-char beg)))))\r
103 +    (save-excursion\r
104 +      (goto-char beg)\r
105 +      (dolist (spec notmuch-search-result-format)\r
106 +       (notmuch-search-insert-field (car spec) (cdr spec) result))\r
107 +      (insert "\n")\r
108 +      (notmuch-search-color-line beg (point) (plist-get result :tags))\r
109 +      (put-text-property beg (point) 'notmuch-search-result result))\r
110 +    (when (string= (plist-get result :thread) notmuch-search-target-thread)\r
111 +      (setq notmuch-search-target-thread "found")\r
112 +      (goto-char beg))))\r
113 +\r
114 +(defun notmuch-search-append-result (result)\r
115 +  "Insert RESULT at the end of the buffer.\r
116 +\r
117 +This is only called when a result is first inserted so it also\r
118 +sets the :orig-tag property."\r
119 +  (let ((new-result (plist-put result :orig-tags (plist-get result :tags))))\r
120 +    (notmuch-search-show-result new-result (point-max))))\r
121  \r
122  (defun notmuch-search-process-filter (proc string)\r
123    "Process and filter the output of \"notmuch search\""\r
124 @@ -784,7 +792,7 @@ non-authors is found, assume that all of the authors match."\r
125         (save-excursion\r
126           (goto-char (point-max))\r
127           (insert string))\r
128 -       (notmuch-sexp-parse-partial-list 'notmuch-search-show-result\r
129 +       (notmuch-sexp-parse-partial-list 'notmuch-search-append-result\r
130                                          results-buf)))))\r
131  \r
132  (defun notmuch-search-tag-all (tag-changes)\r
133 -- \r
134 1.7.9.1\r
135 \r