[PATCH v4 6/5] emacs: show: lazy-part bugfix
[notmuch-archives.git] / a0 / 51943450a51c449ab502eff33525a8dd11f922
1 Return-Path: <amthrax@drake.mit.edu>\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 6EB41431FC7\r
6         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 10:02:54 -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 rnC1VR69DePC for <notmuch@notmuchmail.org>;\r
16         Sun, 19 Feb 2012 10:02:53 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
18         [18.7.68.37])\r
19         by olra.theworths.org (Postfix) with ESMTP id 8D09A431FB6\r
20         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 10:02:53 -0800 (PST)\r
21 X-AuditID: 12074425-b7f4a6d0000008e0-3a-4f41394d707b\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 0C.87.02272.D49314F4; Sun, 19 Feb 2012 13:02:53 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q1JI2qXe024097; \r
27         Sun, 19 Feb 2012 13:02:52 -0500\r
28 Received: from drake.mit.edu\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1JI2lpT013402\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sun, 19 Feb 2012 13:02:51 -0500 (EST)\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
36         (envelope-from <amthrax@drake.mit.edu>)\r
37         id 1RzB5z-0007Mg-Di; Sun, 19 Feb 2012 13:02:47 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 2/4] emacs: When refreshing a show buffer,\r
41         only mark read when resetting state\r
42 Date: Sun, 19 Feb 2012 13:02:41 -0500\r
43 Message-Id: <1329674563-28223-3-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.7.3\r
45 In-Reply-To: <1329674563-28223-1-git-send-email-amdragon@mit.edu>\r
46 References: <1329632533-16152-1-git-send-email-amdragon@mit.edu>\r
47         <1329674563-28223-1-git-send-email-amdragon@mit.edu>\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6nrutr6ehvsPcUn8X1mzOZLd6snMfq\r
50         wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGVc6DjAWHBcoGLxn2VMDYxbeLsYOTkkBEwk\r
51         Xt+/wwhhi0lcuLeerYuRi0NIYB+jxOZlXVDOBkaJw5MfM0I495kkvu3/AOXMZ5T4f3oiE0g/\r
52         m4CGxLb9y8FmiQhIS+y8O5sVxGYWsJI4fHUTmC0skCix/MYKsHoWAVWJc9PesnQxcnDwCjhI\r
53         bHrvCnGGgsS51efYQcKcAo4SF//ZgYSFBMol5n54yzyBkX8BI8MqRtmU3Crd3MTMnOLUZN3i\r
54         5MS8vNQiXQu93MwSvdSU0k2M4EByUd3BOOGQ0iFGAQ5GJR5eyTIHfyHWxLLiytxDjJIcTEqi\r
55         vDzmjv5CfEn5KZUZicUZ8UWlOanFhxglOJiVRHhLb9r7C/GmJFZWpRblw6SkOViUxHk1td75\r
56         CQmkJ5akZqemFqQWwWRlODiUJHj3WQANFSxKTU+tSMvMKUFIM3FwggznARo+F6SGt7ggMbc4\r
57         Mx0if4pRUUqc9xpIQgAkkVGaB9cLi/RXjOJArwjzPgep4gEmCbjuV0CDmYAG8wrZgQwuSURI\r
58         STUwLqk7rmTYtlg34/zn/bKHdQJOhDgbWC3lT3zw1GFeXOrdgjc3olxn5ZbLvZKRz5yaePmE\r
59         Yecxj9BNnzbZ2ua2pZ3ivv9ZpjSsziHoxEqxrJrsrL3r9DwWrwvg6HfL3Ov4VHvStQ/aNY/N\r
60         U8QsS//dOrSQe9cRt5m7mDyn5h5znPZ68WHdy3eVlViKMxINtZiLihMBoggAuc8CAAA=\r
61 Cc: tomi.ollila@iki.fi\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.13\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66         <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Sun, 19 Feb 2012 18:02:55 -0000\r
75 \r
76 If we retain state while refreshing a show buffer, it should not mark\r
77 any messages read since it's not a navigation operation (it especially\r
78 shouldn't mark the first message matching the query read, which is\r
79 what it did previously).  If the user or caller requests that refresh\r
80 reset the state of the buffer, then we consider that a navigation\r
81 operation, so we do mark the message under point after the refresh\r
82 read.\r
83 \r
84 This is implemented by moving responsibility for read-marking out of\r
85 notmuch-show-worker and into its caller.\r
86 ---\r
87  emacs/notmuch-show.el |   14 +++++++++-----\r
88  1 files changed, 9 insertions(+), 5 deletions(-)\r
89 \r
90 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
91 index aa9ccee..d036c54 100644\r
92 --- a/emacs/notmuch-show.el\r
93 +++ b/emacs/notmuch-show.el\r
94 @@ -1047,7 +1047,10 @@ function is used."\r
95      (setq notmuch-show-thread-id thread-id\r
96           notmuch-show-parent-buffer parent-buffer\r
97           notmuch-show-query-context query-context)\r
98 -    (notmuch-show-worker)))\r
99 +    (notmuch-show-worker)\r
100 +\r
101 +    ;; Mark the first open message read\r
102 +    (notmuch-show-mark-read)))\r
103  \r
104  (defun notmuch-show-worker ()\r
105    (let ((inhibit-read-only t))\r
106 @@ -1081,9 +1084,7 @@ function is used."\r
107        (notmuch-show-next-open-message))\r
108  \r
109      ;; Set the header line to the subject of the first open message.\r
110 -    (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))\r
111 -\r
112 -    (notmuch-show-mark-read)))\r
113 +    (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))))\r
114  \r
115  (defun notmuch-show-capture-state ()\r
116    "Capture the state of the current buffer.\r
117 @@ -1132,7 +1133,10 @@ buffer is stored and re-applied after the refresh."\r
118      (erase-buffer)\r
119      (notmuch-show-worker)\r
120      (if state\r
121 -       (notmuch-show-apply-state state))))\r
122 +       (notmuch-show-apply-state state)\r
123 +      ;; Refreshing with state reset navigates to the first open\r
124 +      ;; message, so mark read like any other navigation operation.\r
125 +      (notmuch-show-mark-read))))\r
126  \r
127  (defvar notmuch-show-stash-map\r
128    (let ((map (make-sparse-keymap)))\r
129 -- \r
130 1.7.7.3\r
131 \r