From: Austin Clements Date: Tue, 21 Feb 2012 15:42:31 +0000 (+1900) Subject: [PATCH v3 1/3] emacs: When refreshing a show buffer, only mark read when resetting... X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e7ba9ab043f912d35400f807c66c2559f4bc9637;p=notmuch-archives.git [PATCH v3 1/3] emacs: When refreshing a show buffer, only mark read when resetting state --- diff --git a/83/e887850cf50471f4bd76a9b8cb78cbb0fcf148 b/83/e887850cf50471f4bd76a9b8cb78cbb0fcf148 new file mode 100644 index 000000000..59920c845 --- /dev/null +++ b/83/e887850cf50471f4bd76a9b8cb78cbb0fcf148 @@ -0,0 +1,148 @@ +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 490F6431FAE + for ; Tue, 21 Feb 2012 07:42:41 -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 CKvzl7BkhEAk for ; + Tue, 21 Feb 2012 07:42:40 -0800 (PST) +Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 6CCE6431FAF + for ; Tue, 21 Feb 2012 07:42:40 -0800 (PST) +X-AuditID: 1209190e-b7f7c6d0000008c3-fa-4f43bb6fdd9f +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id DC.F1.02243.F6BB34F4; Tue, 21 Feb 2012 10:42:40 -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 q1LFgdDG015612; + Tue, 21 Feb 2012 10:42:39 -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 q1LFgai4025723 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Tue, 21 Feb 2012 10:42:38 -0500 (EST) +Received: from amthrax by drake.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1RzrrQ-0005Ou-Qz; Tue, 21 Feb 2012 10:42:36 -0500 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v3 1/3] emacs: When refreshing a show buffer, + only mark read when resetting state +Date: Tue, 21 Feb 2012 10:42:31 -0500 +Message-Id: <1329838953-20666-2-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.7.3 +In-Reply-To: <1329838953-20666-1-git-send-email-amdragon@mit.edu> +References: <1329632533-16152-1-git-send-email-amdragon@mit.edu> + <1329838953-20666-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6nrluw29nf4Fcno8X1mzOZLd6snMfq + wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGXsP97AVHBdtGLmtZuMDYyXBLsYOTkkBEwk + Dky9yQhhi0lcuLeerYuRi0NIYB+jRM/zdnaQhJDABkaJs7tkIBL3mSRWP73KCuHMZ5To2/yC + DaSKTUBDYtv+5WCjRASkJXbenc0KYjMLWEkcvroJyObgEBZIlNjywQ0kzCKgKjFj33GwVl4B + B4mXBw+zQFyhIHFu9TmwxZwCjhLL1/1mhjiiXKJlxmTGCYz8CxgZVjHKpuRW6eYmZuYUpybr + Ficn5uWlFuka6+VmluilppRuYgQFEqck3w7GrweVDjEKcDAq8fCe2uzsL8SaWFZcmXuIUZKD + SUmUd8suoBBfUn5KZUZicUZ8UWlOavEhRgkOZiUR3sULgHK8KYmVValF+TApaQ4WJXFeNa13 + fkIC6YklqdmpqQWpRTBZGQ4OJQneYyBDBYtS01Mr0jJzShDSTBycIMN5gIZ/A6nhLS5IzC3O + TIfIn2JUlBLnvQaSEABJZJTmwfXCIv0VozjQK8K8r0CqeIBJAq77FdBgJqDBLf8dQQaXJCKk + pBoYJ2+aZ2X9qjiqamWtRESexu3oWQKy2u1rp0UfWLXY61CYruPfaPXDizSi575eVrzJ9OYs + 3p5eS/+D30M95e/EpR9Ou7pdJqchZ6r7+WJ+q233XBbssK16W568KkBvnvAjrxnL1++a9J97 + cc9V0yXqK1Zv+rYhxy1QT/XbpHl8E1YWeEofrJ8uqsRSnJFoqMVcVJwIABryzi7PAgAA +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: Tue, 21 Feb 2012 15:42:41 -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 initial positioning +and read-marking out of notmuch-show-worker and into its caller. +Since notmuch-show-worker is now exclusively about building the show +buffer, we rename it to notmuch-show-build-buffer. +--- + emacs/notmuch-show.el | 26 +++++++++++++++----------- + 1 files changed, 15 insertions(+), 11 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index aa9ccee..f759351 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1047,9 +1047,14 @@ 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-build-buffer) + +-(defun notmuch-show-worker () ++ ;; Move to the first open message and mark it read ++ (if (notmuch-show-message-visible-p) ++ (notmuch-show-mark-read) ++ (notmuch-show-next-open-message)))) ++ ++(defun notmuch-show-build-buffer () + (let ((inhibit-read-only t)) + + (notmuch-show-mode) +@@ -1076,14 +1081,8 @@ function is used." + + (run-hooks 'notmuch-show-hook)) + +- ;; Move straight to the first open message +- (unless (notmuch-show-message-visible-p) +- (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. +@@ -1130,9 +1129,14 @@ buffer is stored and re-applied after the refresh." + (if retain-state + (setq state (notmuch-show-capture-state))) + (erase-buffer) +- (notmuch-show-worker) ++ (notmuch-show-build-buffer) + (if state +- (notmuch-show-apply-state state)))) ++ (notmuch-show-apply-state state) ++ ;; We're resetting state, so navigate to the first open message ++ ;; and mark it read, just like opening a new show buffer. ++ (if (notmuch-show-message-visible-p) ++ (notmuch-show-mark-read) ++ (notmuch-show-next-open-message))))) + + (defvar notmuch-show-stash-map + (let ((map (make-sparse-keymap))) +-- +1.7.7.3 +