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