From e89e8ed2ce395ee48d54d41f3d10f58280f43050 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Thu, 2 Feb 2012 17:43:39 +0000 Subject: [PATCH] [PATCH v4 11/11] emacs: show: recognize the exclude flag. --- 91/3f6a2719daeff0818282a929aa1387a39bc154 | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 91/3f6a2719daeff0818282a929aa1387a39bc154 diff --git a/91/3f6a2719daeff0818282a929aa1387a39bc154 b/91/3f6a2719daeff0818282a929aa1387a39bc154 new file mode 100644 index 000000000..a5a406cd2 --- /dev/null +++ b/91/3f6a2719daeff0818282a929aa1387a39bc154 @@ -0,0 +1,114 @@ +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 68E07431FDB + for ; Thu, 2 Feb 2012 09:43:39 -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 tNgbFtPKUaOy for ; + Thu, 2 Feb 2012 09:43:38 -0800 (PST) +Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + BBB2D431FD4 for ; Thu, 2 Feb 2012 09:43:21 -0800 + (PST) +Received: by mail-ww0-f45.google.com with SMTP id dt12so2522817wgb.2 + for ; Thu, 02 Feb 2012 09:43:21 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=hs0iy7WMmE9chn11yMhNs+3x120hfjBNsgiFT6yiSLk=; + b=VWFmLhFhI1sFdtlrLIp1jS/5wb8aiwaz4QtcXIIQcxBvwF+JnE2wNVZN+joS9j1Nys + T8z/SNCeAH3aFMfydLQ5B6tgLET0C3J5ImwG+qQLR62Uxh4rT3CkSdjdleS56Gi0QGz1 + TDGEdnfvRl2qlRkwJDe5i328q2im6kaJczllM= +Received: by 10.180.94.68 with SMTP id da4mr6108177wib.22.1328204601232; + Thu, 02 Feb 2012 09:43:21 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + eq5sm9176135wib.2.2012.02.02.09.43.19 (version=TLSv1/SSLv3 cipher=OTHER); + Thu, 02 Feb 2012 09:43:20 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org, + amdragon@MIT.EDU +Subject: [PATCH v4 11/11] emacs: show: recognize the exclude flag. +Date: Thu, 2 Feb 2012 17:43:39 +0000 +Message-Id: <1328204619-25046-11-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.2.3 +In-Reply-To: <874nv9rv79.fsf@qmul.ac.uk> +References: <874nv9rv79.fsf@qmul.ac.uk> +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, 02 Feb 2012 17:43:39 -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 | 18 +++++++++++++++++- + 1 files changed, 17 insertions(+), 1 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 84ac624..8efadf6 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -905,7 +905,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-insert-tree (tree depth) + "Insert the message tree TREE at depth DEPTH in the current thread." +@@ -1015,6 +1016,9 @@ buffer." + ;; Move straight to the first open message + (unless (notmuch-show-message-visible-p) + (notmuch-show-next-open-message)) ++ (when (eq (point) (point-max)) ++ (goto-char (point-min)) ++ (notmuch-show-next-matching-message)) + + ;; Set the header line to the subject of the first open message. + (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject))) +@@ -1417,6 +1421,18 @@ any effects from previous calls to + (notmuch-show-message-adjust)) + (goto-char (point-max))))) + ++(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-previous-open-message () + "Show the previous message." + (interactive) +-- +1.7.2.3 + -- 2.26.2