[PATCH v2 2/4] emacs: When refreshing a show buffer, only mark read when resetting...
authorAustin Clements <amdragon@MIT.EDU>
Sun, 19 Feb 2012 18:02:41 +0000 (13:02 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:41 +0000 (09:44 -0800)
a0/51943450a51c449ab502eff33525a8dd11f922 [new file with mode: 0644]

diff --git a/a0/51943450a51c449ab502eff33525a8dd11f922 b/a0/51943450a51c449ab502eff33525a8dd11f922
new file mode 100644 (file)
index 0000000..816768f
--- /dev/null
@@ -0,0 +1,131 @@
+Return-Path: <amthrax@drake.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 6EB41431FC7\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 10:02:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id rnC1VR69DePC for <notmuch@notmuchmail.org>;\r
+       Sun, 19 Feb 2012 10:02:53 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
+       [18.7.68.37])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8D09A431FB6\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 10:02:53 -0800 (PST)\r
+X-AuditID: 12074425-b7f4a6d0000008e0-3a-4f41394d707b\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 0C.87.02272.D49314F4; Sun, 19 Feb 2012 13:02:53 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q1JI2qXe024097; \r
+       Sun, 19 Feb 2012 13:02:52 -0500\r
+Received: from drake.mit.edu\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1JI2lpT013402\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sun, 19 Feb 2012 13:02:51 -0500 (EST)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amthrax@drake.mit.edu>)\r
+       id 1RzB5z-0007Mg-Di; Sun, 19 Feb 2012 13:02:47 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 2/4] emacs: When refreshing a show buffer,\r
+       only mark read when resetting state\r
+Date: Sun, 19 Feb 2012 13:02:41 -0500\r
+Message-Id: <1329674563-28223-3-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1329674563-28223-1-git-send-email-amdragon@mit.edu>\r
+References: <1329632533-16152-1-git-send-email-amdragon@mit.edu>\r
+       <1329674563-28223-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6nrutr6ehvsPcUn8X1mzOZLd6snMfq\r
+       wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGVc6DjAWHBcoGLxn2VMDYxbeLsYOTkkBEwk\r
+       Xt+/wwhhi0lcuLeerYuRi0NIYB+jxOZlXVDOBkaJw5MfM0I495kkvu3/AOXMZ5T4f3oiE0g/\r
+       m4CGxLb9y8FmiQhIS+y8O5sVxGYWsJI4fHUTmC0skCix/MYKsHoWAVWJc9PesnQxcnDwCjhI\r
+       bHrvCnGGgsS51efYQcKcAo4SF//ZgYSFBMol5n54yzyBkX8BI8MqRtmU3Crd3MTMnOLUZN3i\r
+       5MS8vNQiXQu93MwSvdSU0k2M4EByUd3BOOGQ0iFGAQ5GJR5eyTIHfyHWxLLiytxDjJIcTEqi\r
+       vDzmjv5CfEn5KZUZicUZ8UWlOanFhxglOJiVRHhLb9r7C/GmJFZWpRblw6SkOViUxHk1td75\r
+       CQmkJ5akZqemFqQWwWRlODiUJHj3WQANFSxKTU+tSMvMKUFIM3FwggznARo+F6SGt7ggMbc4\r
+       Mx0if4pRUUqc9xpIQgAkkVGaB9cLi/RXjOJArwjzPgep4gEmCbjuV0CDmYAG8wrZgQwuSURI\r
+       STUwLqk7rmTYtlg34/zn/bKHdQJOhDgbWC3lT3zw1GFeXOrdgjc3olxn5ZbLvZKRz5yaePmE\r
+       Yecxj9BNnzbZ2ua2pZ3ivv9ZpjSsziHoxEqxrJrsrL3r9DwWrwvg6HfL3Ov4VHvStQ/aNY/N\r
+       U8QsS//dOrSQe9cRt5m7mDyn5h5znPZ68WHdy3eVlViKMxINtZiLihMBoggAuc8CAAA=\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 19 Feb 2012 18:02:55 -0000\r
+\r
+If we retain state while refreshing a show buffer, it should not mark\r
+any messages read since it's not a navigation operation (it especially\r
+shouldn't mark the first message matching the query read, which is\r
+what it did previously).  If the user or caller requests that refresh\r
+reset the state of the buffer, then we consider that a navigation\r
+operation, so we do mark the message under point after the refresh\r
+read.\r
+\r
+This is implemented by moving responsibility for read-marking out of\r
+notmuch-show-worker and into its caller.\r
+---\r
+ emacs/notmuch-show.el |   14 +++++++++-----\r
+ 1 files changed, 9 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index aa9ccee..d036c54 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1047,7 +1047,10 @@ function is used."\r
+     (setq notmuch-show-thread-id thread-id\r
+         notmuch-show-parent-buffer parent-buffer\r
+         notmuch-show-query-context query-context)\r
+-    (notmuch-show-worker)))\r
++    (notmuch-show-worker)\r
++\r
++    ;; Mark the first open message read\r
++    (notmuch-show-mark-read)))\r
\r
+ (defun notmuch-show-worker ()\r
+   (let ((inhibit-read-only t))\r
+@@ -1081,9 +1084,7 @@ function is used."\r
+       (notmuch-show-next-open-message))\r
\r
+     ;; Set the header line to the subject of the first open message.\r
+-    (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))\r
+-\r
+-    (notmuch-show-mark-read)))\r
++    (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))))\r
\r
+ (defun notmuch-show-capture-state ()\r
+   "Capture the state of the current buffer.\r
+@@ -1132,7 +1133,10 @@ buffer is stored and re-applied after the refresh."\r
+     (erase-buffer)\r
+     (notmuch-show-worker)\r
+     (if state\r
+-      (notmuch-show-apply-state state))))\r
++      (notmuch-show-apply-state state)\r
++      ;; Refreshing with state reset navigates to the first open\r
++      ;; message, so mark read like any other navigation operation.\r
++      (notmuch-show-mark-read))))\r
\r
+ (defvar notmuch-show-stash-map\r
+   (let ((map (make-sparse-keymap)))\r
+-- \r
+1.7.7.3\r
+\r