Re: [PATCH v3 0/6] Make Emacs search use sexp format
[notmuch-archives.git] / 83 / e887850cf50471f4bd76a9b8cb78cbb0fcf148
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 490F6431FAE\r
6         for <notmuch@notmuchmail.org>; Tue, 21 Feb 2012 07:42:41 -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 CKvzl7BkhEAk for <notmuch@notmuchmail.org>;\r
16         Tue, 21 Feb 2012 07:42:40 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id 6CCE6431FAF\r
20         for <notmuch@notmuchmail.org>; Tue, 21 Feb 2012 07:42:40 -0800 (PST)\r
21 X-AuditID: 1209190e-b7f7c6d0000008c3-fa-4f43bb6fdd9f\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id DC.F1.02243.F6BB34F4; Tue, 21 Feb 2012 10:42:40 -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 q1LFgdDG015612; \r
27         Tue, 21 Feb 2012 10:42:39 -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 q1LFgai4025723\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Tue, 21 Feb 2012 10:42:38 -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 1RzrrQ-0005Ou-Qz; Tue, 21 Feb 2012 10:42:36 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v3 1/3] emacs: When refreshing a show buffer,\r
41         only mark read when resetting state\r
42 Date: Tue, 21 Feb 2012 10:42:31 -0500\r
43 Message-Id: <1329838953-20666-2-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.7.3\r
45 In-Reply-To: <1329838953-20666-1-git-send-email-amdragon@mit.edu>\r
46 References: <1329632533-16152-1-git-send-email-amdragon@mit.edu>\r
47         <1329838953-20666-1-git-send-email-amdragon@mit.edu>\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6nrluw29nf4Fcno8X1mzOZLd6snMfq\r
50         wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGXsP97AVHBdtGLmtZuMDYyXBLsYOTkkBEwk\r
51         Dky9yQhhi0lcuLeerYuRi0NIYB+jRM/zdnaQhJDABkaJs7tkIBL3mSRWP73KCuHMZ5To2/yC\r
52         DaSKTUBDYtv+5WCjRASkJXbenc0KYjMLWEkcvroJyObgEBZIlNjywQ0kzCKgKjFj33GwVl4B\r
53         B4mXBw+zQFyhIHFu9TmwxZwCjhLL1/1mhjiiXKJlxmTGCYz8CxgZVjHKpuRW6eYmZuYUpybr\r
54         Ficn5uWlFuka6+VmluilppRuYgQFEqck3w7GrweVDjEKcDAq8fCe2uzsL8SaWFZcmXuIUZKD\r
55         SUmUd8suoBBfUn5KZUZicUZ8UWlOavEhRgkOZiUR3sULgHK8KYmVValF+TApaQ4WJXFeNa13\r
56         fkIC6YklqdmpqQWpRTBZGQ4OJQneYyBDBYtS01Mr0jJzShDSTBycIMN5gIZ/A6nhLS5IzC3O\r
57         TIfIn2JUlBLnvQaSEABJZJTmwfXCIv0VozjQK8K8r0CqeIBJAq77FdBgJqDBLf8dQQaXJCKk\r
58         pBoYJ2+aZ2X9qjiqamWtRESexu3oWQKy2u1rp0UfWLXY61CYruPfaPXDizSi575eVrzJ9OYs\r
59         3p5eS/+D30M95e/EpR9Ou7pdJqchZ6r7+WJ+q233XBbssK16W568KkBvnvAjrxnL1++a9J97\r
60         cc9V0yXqK1Zv+rYhxy1QT/XbpHl8E1YWeEofrJ8uqsRSnJFoqMVcVJwIABryzi7PAgAA\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: Tue, 21 Feb 2012 15:42:41 -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 initial positioning\r
85 and read-marking out of notmuch-show-worker and into its caller.\r
86 Since notmuch-show-worker is now exclusively about building the show\r
87 buffer, we rename it to notmuch-show-build-buffer.\r
88 ---\r
89  emacs/notmuch-show.el |   26 +++++++++++++++-----------\r
90  1 files changed, 15 insertions(+), 11 deletions(-)\r
91 \r
92 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
93 index aa9ccee..f759351 100644\r
94 --- a/emacs/notmuch-show.el\r
95 +++ b/emacs/notmuch-show.el\r
96 @@ -1047,9 +1047,14 @@ function is used."\r
97      (setq notmuch-show-thread-id thread-id\r
98           notmuch-show-parent-buffer parent-buffer\r
99           notmuch-show-query-context query-context)\r
100 -    (notmuch-show-worker)))\r
101 +    (notmuch-show-build-buffer)\r
102  \r
103 -(defun notmuch-show-worker ()\r
104 +    ;; Move to the first open message and mark it read\r
105 +    (if (notmuch-show-message-visible-p)\r
106 +       (notmuch-show-mark-read)\r
107 +      (notmuch-show-next-open-message))))\r
108 +\r
109 +(defun notmuch-show-build-buffer ()\r
110    (let ((inhibit-read-only t))\r
111  \r
112      (notmuch-show-mode)\r
113 @@ -1076,14 +1081,8 @@ function is used."\r
114  \r
115        (run-hooks 'notmuch-show-hook))\r
116  \r
117 -    ;; Move straight to the first open message\r
118 -    (unless (notmuch-show-message-visible-p)\r
119 -      (notmuch-show-next-open-message))\r
120 -\r
121      ;; Set the header line to the subject of the first open message.\r
122 -    (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))\r
123 -\r
124 -    (notmuch-show-mark-read)))\r
125 +    (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))))\r
126  \r
127  (defun notmuch-show-capture-state ()\r
128    "Capture the state of the current buffer.\r
129 @@ -1130,9 +1129,14 @@ buffer is stored and re-applied after the refresh."\r
130      (if retain-state\r
131         (setq state (notmuch-show-capture-state)))\r
132      (erase-buffer)\r
133 -    (notmuch-show-worker)\r
134 +    (notmuch-show-build-buffer)\r
135      (if state\r
136 -       (notmuch-show-apply-state state))))\r
137 +       (notmuch-show-apply-state state)\r
138 +      ;; We're resetting state, so navigate to the first open message\r
139 +      ;; and mark it read, just like opening a new show buffer.\r
140 +      (if (notmuch-show-message-visible-p)\r
141 +         (notmuch-show-mark-read)\r
142 +       (notmuch-show-next-open-message)))))\r
143  \r
144  (defvar notmuch-show-stash-map\r
145    (let ((map (make-sparse-keymap)))\r
146 -- \r
147 1.7.7.3\r
148 \r