Re: [Patch v4 1/3] emacs: split notmuch-show-apply-state
authorAustin Clements <amdragon@MIT.EDU>
Sun, 29 Apr 2012 00:57:36 +0000 (20:57 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:48 +0000 (09:46 -0800)
af/f63f6133c2eb038bd51861e47185c408069ef8 [new file with mode: 0644]

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