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 9B553431E62 for ; Sun, 1 Dec 2013 02:02:44 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, 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 G00pTmjJPYES for ; Sun, 1 Dec 2013 02:02:38 -0800 (PST) Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E2F7A431FAF for ; Sun, 1 Dec 2013 02:02:37 -0800 (PST) Received: by mail-wg0-f48.google.com with SMTP id z12so10804144wgg.27 for ; Sun, 01 Dec 2013 02:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3Vf/imofLOIgUyrlDJFL9j2d6ZxpoFu8Uaygb2bfDf0=; b=sqj4QuTd6sIKPC5gy7tZMFdh9ChDM1G+Ip4I0R9J1JtYOxGwHRbAr21CK5H0LHF3Xi GUJ3GOqU35ciYp5yJedktFCfmWiUl2lj+BandGQUQ0V5RJ3l808t8le/P6oDi1OseC7s k0cMZf8lAxWj0didX5sOc5BjFRVrcSr2qCKdQ90NbpGYmptAgjTAVJGLa9YEndVf1A40 jTPpzp49wu8q7KbRbXV96VVFl75QCPbnMkxtizlUvaFqXaPN3MSa+g1oeYwf5m+ux2kC XnEbFtUT7G5ZnffJ20D/m0viv7YFRLpOU4/79X0KInTGaVsQBLiNcvf0vhqw9uzMq9ul yiFQ== X-Received: by 10.180.210.232 with SMTP id mx8mr13811800wic.34.1385892156568; Sun, 01 Dec 2013 02:02:36 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id f11sm93688599wic.4.2013.12.01.02.02.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 01 Dec 2013 02:02:36 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH WIP v2 3/6] emacs: show: sync seen to read on quit and refresh Date: Sun, 1 Dec 2013 10:02:24 +0000 Message-Id: <1385892147-16994-4-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1385892147-16994-1-git-send-email-markwalters1009@gmail.com> References: <1385892147-16994-1-git-send-email-markwalters1009@gmail.com> 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, 01 Dec 2013 10:02:44 -0000 This makes notmuch show buffers mark all seen messages as read when quitting or refreshing the show buffer, accept in the case these are called with a prefix argument. This slightly overloads the prefix-argument to refresh: as it tells refresh not to save state either. This is probably OK as it says "make the buffer look like the database". Note, at this point the seen functionality is not yet used: that is nothing yet marks a message seen. --- emacs/notmuch-show.el | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c63d295..05f649b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1213,6 +1213,11 @@ preferences. If invoked with a prefix argument (or RESET-STATE is non-nil) then the state of the buffer (open/closed messages) is reset based on the original query." (interactive "P") + ;; Do not mark seen messages read if we are resetting state. The + ;; idea is that resetting state is asking for the view to be reset + ;; to the current state of the database. + (notmuch-show-mark-all-seen-read reset-state) + (let ((inhibit-read-only t) (state (unless reset-state (notmuch-show-capture-state)))) @@ -1258,6 +1263,8 @@ reset based on the original query." (defvar notmuch-show-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) + ;; the following overrides the common-keymap quit + (define-key map [remap notmuch-kill-this-buffer] 'notmuch-show-quit-and-mark-read) (define-key map "Z" 'notmuch-tree-from-show-current-query) (define-key map (kbd "") 'widget-backward) (define-key map (kbd "M-TAB") 'notmuch-show-previous-button) @@ -1570,6 +1577,14 @@ we are not marking them." ((= count 0) (message "No messages marked read"))))))) +(put 'notmuch-show-quit-and-mark-read 'notmuch-prefix-doc + "... without marking seen messages read.") +(defun notmuch-show-quit-and-mark-read (&optional not-mark) + "Kill the current buffer marking seen messages read." + (interactive "P") + (notmuch-show-mark-all-seen-read not-mark) + (notmuch-kill-this-buffer)) + ;; Functions for getting attributes of several messages in the current ;; thread. -- 1.7.9.1