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 D2335431FAF for ; Thu, 1 Mar 2012 14:29:52 -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 InBP-QeCsMPo for ; Thu, 1 Mar 2012 14:29:51 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D4729431FDA for ; Thu, 1 Mar 2012 14:29:48 -0800 (PST) Received: by mail-we0-f181.google.com with SMTP id m13so775491wer.26 for ; Thu, 01 Mar 2012 14:29:48 -0800 (PST) Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates 10.180.82.227 as permitted sender) client-ip=10.180.82.227; Authentication-Results: mr.google.com; spf=pass (google.com: domain of markwalters1009@gmail.com designates 10.180.82.227 as permitted sender) smtp.mail=markwalters1009@gmail.com; dkim=pass header.i=markwalters1009@gmail.com Received: from mr.google.com ([10.180.82.227]) by 10.180.82.227 with SMTP id l3mr15012262wiy.1.1330640988710 (num_hops = 1); Thu, 01 Mar 2012 14:29:48 -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:x-mailer:in-reply-to:references; bh=HXooxiQR2Gh1c1aSByOtrG10GZvrOkR/KUAglx4PYE4=; b=1CbucXD5M2KNUvdNENFKsvLvopkanCHPQhKfhdJcbt1GIhXwAuiBey4N/iqugRgMnx +8umxqL3lqjK1S8MvgsGWu2hLv/5LYt5R4TfxIFN7KVUXOpmbdMJHj/r5f2ZUCJjwDSk Vrrd2NYPx3LMFXkDkba2QP9tb9FeRBLB6svbOiru2YBMjC2gRdFmnxOkXkG9pjyUvh6a GQYo8XyCeNEL4I+Vf3mLeEVzbEA3nOrniHi2PetZyfPCngGICMcSlaZAjHPYP6HZKdh+ G2p3/Ybpgaa7gHwKhu9xtIvIUQCeKzlbpo9l626McA9ALhSny/oC0e9PeUX1VXvaZEUK qs+g== Received: by 10.180.82.227 with SMTP id l3mr12054064wiy.1.1330640988659; Thu, 01 Mar 2012 14:29:48 -0800 (PST) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id h19sm44658185wiw.9.2012.03.01.14.29.46 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Mar 2012 14:29:47 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [Patch v7 12/13] emacs: show: recognize the exclude flag. Date: Thu, 1 Mar 2012 22:30:44 +0000 Message-Id: <1330641045-27416-13-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com> References: <1330641045-27416-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: Thu, 01 Mar 2012 22:29:53 -0000 Show mode will recognize the exclude flag by not opening excluding messages by default, and will start at the first matching non-excluded message. If there are no matching non-excluded messages it will go to the first matching (necessarily excluded) message. --- emacs/notmuch-show.el | 36 +++++++++++++++++++++++++++--------- 1 files changed, 27 insertions(+), 9 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 7c4c0be..4a60631 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -981,7 +981,8 @@ current buffer, if possible." ;; Message visibility depends on whether it matched the search ;; criteria. - (notmuch-show-message-visible msg (plist-get msg :match)))) + (notmuch-show-message-visible msg (and (plist-get msg :match) + (not (plist-get msg :excluded)))))) (defun notmuch-show-toggle-process-crypto () "Toggle the processing of cryptographic MIME parts." @@ -1081,11 +1082,7 @@ function is used." notmuch-show-parent-buffer parent-buffer notmuch-show-query-context query-context) (notmuch-show-build-buffer) - - ;; 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)))) + (notmuch-show-goto-first-wanted-message))) (defun notmuch-show-build-buffer () (let ((inhibit-read-only t)) @@ -1167,9 +1164,7 @@ reset based on the original query." (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))))) + (notmuch-show-goto-first-wanted-message)))) (defvar notmuch-show-stash-map (let ((map (make-sparse-keymap))) @@ -1601,6 +1596,29 @@ to show, nil otherwise." (goto-char (point-max)))) r)) +(defun notmuch-show-next-matching-message () + "Show the next matching message." + (interactive) + (let (r) + (while (and (setq r (notmuch-show-goto-message-next)) + (not (notmuch-show-get-prop :match)))) + (if r + (progn + (notmuch-show-mark-read) + (notmuch-show-message-adjust)) + (goto-char (point-max))))) + +(defun notmuch-show-goto-first-wanted-message () + "Move to the first open message and mark it read" + (goto-char (point-min)) + (if (notmuch-show-message-visible-p) + (notmuch-show-mark-read) + (notmuch-show-next-open-message)) + (when (eobp) + (goto-char (point-min)) + (unless (notmuch-show-get-prop :match) + (notmuch-show-next-matching-message)))) + (defun notmuch-show-previous-open-message () "Show the previous open message." (interactive) -- 1.7.2.3