From 17eb8a609baf0c1804c003144b9d3dff2048a0b8 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sun, 29 Apr 2012 20:57:36 +2000 Subject: [PATCH] Re: [Patch v4 1/3] emacs: split notmuch-show-apply-state --- af/f63f6133c2eb038bd51861e47185c408069ef8 | 139 ++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 af/f63f6133c2eb038bd51861e47185c408069ef8 diff --git a/af/f63f6133c2eb038bd51861e47185c408069ef8 b/af/f63f6133c2eb038bd51861e47185c408069ef8 new file mode 100644 index 000000000..346ecd525 --- /dev/null +++ b/af/f63f6133c2eb038bd51861e47185c408069ef8 @@ -0,0 +1,139 @@ +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 8EBB5431FB6 + for ; Sat, 28 Apr 2012 17:57:40 -0700 (PDT) +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 Mw2OGjw0zHbi for ; + Sat, 28 Apr 2012 17:57:40 -0700 (PDT) +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 F262F431FAE + for ; Sat, 28 Apr 2012 17:57:39 -0700 (PDT) +X-AuditID: 12074425-b7f4a6d0000008e0-ab-4f9c9202e9f5 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 20.F4.02272.2029C9F4; Sat, 28 Apr 2012 20:57:38 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q3T0vcPt006381; + Sat, 28 Apr 2012 20:57:38 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3T0vbbp021021 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sat, 28 Apr 2012 20:57:37 -0400 (EDT) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1SOISH-0000Z2-0N; Sat, 28 Apr 2012 20:57:37 -0400 +Date: Sat, 28 Apr 2012 20:57:36 -0400 +From: Austin Clements +To: Mark Walters +Subject: Re: [Patch v4 1/3] emacs: split notmuch-show-apply-state +Message-ID: <20120429005736.GK2704@mit.edu> +References: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com> + <1335658006-20161-2-git-send-email-markwalters1009@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1335658006-20161-2-git-send-email-markwalters1009@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT0WWaNMffYNN3NYvVc3ksrt+cyezA + 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZSz6eoa1YItIxfOuJcwNjP/4uxg5OSQETCTa + L81kh7DFJC7cW88GYgsJ7GOU2LvBsYuRC8jewChx6MZFNgjnJJPEseXnmCGcJYwSd4+eZAJp + YRFQlXjxqwNsFJuAhsS2/csZQWwRAR2J24cWgMWZBaQlvv1uBqsXFnCUmHf9NjOIzSugLdG8 + 7QILxNBORokTF/+zQSQEJU7OfMIC0awlcePfS6BmDrBBy/9xgIQ5BbwkDr06BrZLVEBFYsrJ + bWwTGIVmIemehaR7FkL3AkbmVYyyKblVurmJmTnFqcm6xcmJeXmpRboWermZJXqpKaWbGMFh + 7aK6g3HCIaVDjAIcjEo8vLuy5vgLsSaWFVfmHmKU5GBSEuUVmgAU4kvKT6nMSCzOiC8qzUkt + PsQowcGsJMKrLQ6U401JrKxKLcqHSUlzsCiJ82pqvfMTEkhPLEnNTk0tSC2CycpwcChJ8EpP + BGoULEpNT61Iy8wpQUgzcXCCDOcBGi4MUsNbXJCYW5yZDpE/xagoJc7rBZIQAElklObB9cLS + zitGcaBXhHnVQKp4gCkLrvsV0GAmoMFMnrNABpckIqSkGhinlYifTbpp5jLxwkQjDTU3c965 + Hms+HV1Xvcb2U67E6c8uK48xbZx8++s/6aeCqZ+F4lf9crl4Iy5Bm2uJdiGr+ummxuCsiZub + n1oZH8hW0L/PGdnwYmrZLrX5aYuXhDVGn6kq8N/T96R0UeivqNlnF2/T3yrmbSRRdazNqH/O + hY/zDDf4Bx1VYinOSDTUYi4qTgQAPcRM4RYDAAA= +Cc: notmuch@notmuchmail.org +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, 29 Apr 2012 00:57:40 -0000 + +Hmm. I think this will wind up spuriously marking messages read. If +notmuch-show-refresh-view is called with reset-state set to t, it will +mark the first open message read, before you move to the previously +current message. + +IMO, notmuch-show-refresh-view should not be marking messages read at +all, but I tried to separate out that functionality before and failed. +Perhaps you can find a good way to do it. A more incremental but +slightly lame approach could be to pass some symbol for reset-state +that indicates it should reset the open state, but not the +position... and not mark anything read. Ugh. + +Quoth Mark Walters on Apr 29 at 1:06 am: +> Separate out a notmuch-show-goto-msg-id sub-function from +> notmuch-show-apply-state. There should be no functional change but the +> next patch will call the new function. +> --- +> emacs/notmuch-show.el | 18 +++++++++++------- +> 1 files changed, 11 insertions(+), 7 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 30b26d1..3bd9a64 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1085,6 +1085,16 @@ This includes: +> - the current message." +> (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages))) +> +> +(defun notmuch-show-goto-message (msg-id) +> + "Go to message with msg-id." +> + (goto-char (point-min)) +> + (unless (loop if (string= msg-id (notmuch-show-get-message-id)) +> + return t +> + until (not (notmuch-show-goto-message-next))) +> + (goto-char (point-min)) +> + (message "Message-id not found.")) +> + (notmuch-show-message-adjust)) +> + +> (defun notmuch-show-apply-state (state) +> "Apply STATE to the current buffer. +> +> @@ -1102,13 +1112,7 @@ This includes: +> until (not (notmuch-show-goto-message-next))) +> +> ;; Go to the previously open message. +> - (goto-char (point-min)) +> - (unless (loop if (string= current (notmuch-show-get-message-id)) +> - return t +> - until (not (notmuch-show-goto-message-next))) +> - (goto-char (point-min)) +> - (message "Previously current message not found.")) +> - (notmuch-show-message-adjust))) +> + (notmuch-show-goto-message current))) +> +> (defun notmuch-show-refresh-view (&optional reset-state) +> "Refresh the current view. + +-- +Austin Clements MIT/'06/PhD/CSAIL +amdragon@mit.edu http://web.mit.edu/amdragon + Somewhere in the dream we call reality you will find me, + searching for the reality we call dreams. -- 2.26.2