From: Mark Walters Date: Sun, 29 Jan 2012 18:39:54 +0000 (+0000) Subject: [PATCH 7/7] emacs: show: recognize the exclude flag. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=578e42c43f0f76d68d8dbeddb056b161e86d108d;p=notmuch-archives.git [PATCH 7/7] emacs: show: recognize the exclude flag. --- diff --git a/8e/bf78178c76089ed9038230a85d07c0deb2e611 b/8e/bf78178c76089ed9038230a85d07c0deb2e611 new file mode 100644 index 000000000..4ba295060 --- /dev/null +++ b/8e/bf78178c76089ed9038230a85d07c0deb2e611 @@ -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 0383D429E43 + for ; Sun, 29 Jan 2012 10:39:35 -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 79VDgXAYFQR6 for ; + Sun, 29 Jan 2012 10:39:34 -0800 (PST) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5CBBD429E3F + for ; Sun, 29 Jan 2012 10:39:34 -0800 (PST) +Received: by mail-wi0-f181.google.com with SMTP id hi8so2994807wib.26 + for ; Sun, 29 Jan 2012 10:39:34 -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=OmVuBDDMSUJvc9XdvKb+bLF0waYCbeZEGJYRKD+n6mTc1gCx3e3x/+kSVgDuDz6ZMF + +F149e300edimr10zT7ko+gf2K8xlzT9nZBpPgDOf+CuxspANi2X/ogRwMOfO8JK9fQi + tetK7l/cj8nr0sxAGGzvECM+S3weT8pwQf1eo= +Received: by 10.180.82.41 with SMTP id f9mr23029047wiy.7.1327862374124; + Sun, 29 Jan 2012 10:39:34 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + j16sm44638074wie.4.2012.01.29.10.39.32 (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 29 Jan 2012 10:39:33 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org, + amdragon@MIT.EDU +Subject: [PATCH 7/7] emacs: show: recognize the exclude flag. +Date: Sun, 29 Jan 2012 18:39:54 +0000 +Message-Id: <1327862394-14334-7-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.2.3 +In-Reply-To: <8762fu4aqt.fsf@qmul.ac.uk> +References: <8762fu4aqt.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: Sun, 29 Jan 2012 18:39:35 -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 +