Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 9c / 892a430d6ba93c7a58dfb36480f37c5c01c526
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 7A689431FD0\r
6         for <notmuch@notmuchmail.org>; Sun,  1 Dec 2013 02:08:32 -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 3ScLmYa9ZR3w for <notmuch@notmuchmail.org>;\r
18         Sun,  1 Dec 2013 02:08:27 -0800 (PST)\r
19 Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com\r
20  [74.125.82.44])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  D09C7431FD2    for <notmuch@notmuchmail.org>; Sun,  1 Dec 2013 02:08:26 -0800\r
23  (PST)\r
24 Received: by mail-wg0-f44.google.com with SMTP id a1so8742474wgh.11\r
25         for <notmuch@notmuchmail.org>; Sun, 01 Dec 2013 02:08:25 -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=K3wprTwWhykGUau4nn5vyDf2jfHbu0RJjdMUWSUxTko=;\r
29         b=QNqqmZKpe7kcak/JPOR7MKVW6lvdgBmXHz/ppLp31APlqDcEHq6r4R684aLa405XzS\r
30         4W0sJUIjl8idLk6FtQeg6sdpvVtHJqbYzQB1mu8iq66Pg7dJ4WqFhaRywz1eqf0mf6po\r
31         ke6iV7RLdB4cCyVJV+TUdxnuVE/XdLlR7faz8zD5jFSPXL3aDZ6RNQeH7NQBfUx3IdkZ\r
32         fJOkOb1buIIRvuETTxAiSeLSIHH2hhqGuMr3IHsKC4HFR9SgcYhIQjZo8NuaxBRFJJky\r
33         IqMl0Ze1pmNrs0/ZuWAg85hzWCKYI4MuHYgQed3wn6QxDg7MYj/ETp+qPf/am/nrRWoX\r
34         PL8g==\r
35 X-Received: by 10.194.78.141 with SMTP id b13mr31650481wjx.32.1385892154498;\r
36         Sun, 01 Dec 2013 02:02:34 -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\r
39         x19sm110885362wia.5.2013.12.01.02.02.33 for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Sun, 01 Dec 2013 02:02:33 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH WIP v2 2/6] emacs: show: add some seen helpers\r
45 Date: Sun,  1 Dec 2013 10:02:23 +0000\r
46 Message-Id: <1385892147-16994-3-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1385892147-16994-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1385892147-16994-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: Sun, 01 Dec 2013 10:08:32 -0000\r
63 \r
64 We separate out "seeing" a message from marking it read. The intention\r
65 is only to mark read at certain times (eg quitting a show buffer). We\r
66 use the term seen to mean we have seen the message (for some\r
67 definition of seen) in the current buffer, but have not (typically)\r
68 marked the message read yet.\r
69 \r
70 This adds helper functions to test/set the seen property and a\r
71 function to tag all seen messages read. The last of these tells the\r
72 user how many messages have been marked read.  It also takes an\r
73 argument that tells the function not to do any marking.  This last use\r
74 case displays a messages saying "Not marking messages read" and keeps\r
75 the logic of what to do when the user does not want to sync seen to\r
76 read in one place.\r
77 ---\r
78  emacs/notmuch-show.el |   34 ++++++++++++++++++++++++++++++++++\r
79  1 files changed, 34 insertions(+), 0 deletions(-)\r
80 \r
81 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
82 index a135e79..c63d295 100644\r
83 --- a/emacs/notmuch-show.el\r
84 +++ b/emacs/notmuch-show.el\r
85 @@ -1536,6 +1536,40 @@ marked as unread, i.e. the tag changes in\r
86      (apply 'notmuch-show-tag-message\r
87            (notmuch-tag-change-list notmuch-show-mark-read-tags unread))))\r
88  \r
89 +(defun notmuch-show-seen-p ()\r
90 +  "Return t if current message has been seen."\r
91 +  (notmuch-show-get-prop :seen))\r
92 +\r
93 +(defun notmuch-show-mark-seen ()\r
94 +  "Mark current message seen."\r
95 +  (notmuch-show-set-prop :seen t))\r
96 +\r
97 +(defun notmuch-show-mark-all-seen-read (&optional not-mark)\r
98 +  "Mark read all messages that have been seen in this buffer.\r
99 +\r
100 +If NOT-MARK then do not mark the messages read, and tell the user\r
101 +we are not marking them."\r
102 +  (if not-mark\r
103 +      (message "Not marking messages read")\r
104 +    (let ((messages-to-mark-read))\r
105 +      ;; We get a list of all message to tag read. A list means that\r
106 +      ;; we can tag all the messages in one tag operation rather than\r
107 +      ;; needing one per read message.\r
108 +      (notmuch-show-mapc\r
109 +       (lambda ()\r
110 +        (when (and (notmuch-show-seen-p) (notmuch-show-unread-p))\r
111 +          (push (notmuch-show-get-message-id) messages-to-mark-read))))\r
112 +      (when messages-to-mark-read\r
113 +       (notmuch-tag (mapconcat #'identity messages-to-mark-read " ")\r
114 +                    (notmuch-tag-change-list notmuch-show-mark-read-tags)))\r
115 +      (let ((count (length messages-to-mark-read)))\r
116 +       (cond ((> count 1)\r
117 +              (message "Marked %s messages read" count))\r
118 +             ((= count 1)\r
119 +              (message "Marked one message read"))\r
120 +             ((= count 0)\r
121 +              (message "No messages marked read")))))))\r
122 +\r
123  ;; Functions for getting attributes of several messages in the current\r
124  ;; thread.\r
125  \r
126 -- \r
127 1.7.9.1\r
128 \r