From: David Edmondson Date: Mon, 30 Jan 2012 11:31:32 +0000 (+0000) Subject: [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only matching messages. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=10f052cb9922f98bea4cb6b71ce1b3fa8a721b61;p=notmuch-archives.git [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only matching messages. --- diff --git a/70/c11dc9a5b7aba37522a5e44a72a53ef43873b8 b/70/c11dc9a5b7aba37522a5e44a72a53ef43873b8 new file mode 100644 index 000000000..3c7c8abb1 --- /dev/null +++ b/70/c11dc9a5b7aba37522a5e44a72a53ef43873b8 @@ -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 C302F429E34 + for ; Mon, 30 Jan 2012 03:31:40 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 6ltgvsxNBERk for ; + Mon, 30 Jan 2012 03:31:40 -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 + 26540431FBC for ; Mon, 30 Jan 2012 03:31:40 -0800 + (PST) +Received: by wgbdt12 with SMTP id dt12so3865828wgb.2 + for ; Mon, 30 Jan 2012 03:31:38 -0800 (PST) +Received: by 10.180.95.105 with SMTP id dj9mr26539210wib.18.1327923098924; + Mon, 30 Jan 2012 03:31:38 -0800 (PST) +Received: from hotblack-desiato.hh.sledj.net + (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) + by mx.google.com with ESMTPS id eq5sm51602955wib.2.2012.01.30.03.31.37 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 30 Jan 2012 03:31:37 -0800 (PST) +Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) + id BCB719FE47; Mon, 30 Jan 2012 11:31:35 +0000 (GMT) +From: David Edmondson +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only + matching messages. +Date: Mon, 30 Jan 2012 11:31:32 +0000 +Message-Id: <1327923093-31065-3-git-send-email-dme@dme.org> +X-Mailer: git-send-email 1.7.8.3 +In-Reply-To: <1327923093-31065-1-git-send-email-dme@dme.org> +References: <1327486729-18052-1-git-send-email-dme@dme.org> + <1327923093-31065-1-git-send-email-dme@dme.org> +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: Mon, 30 Jan 2012 11:31:41 -0000 + +The current behaviour (all messages shown, non-matching collapsed) +is retained as the default. Type '!' to switch to showing only +the matching messages - non-matching messages are not available. +'!' will switch back to showing everything. +--- + 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 53f6ae4..99478a4 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -135,6 +135,10 @@ indentation." + (make-variable-buffer-local 'notmuch-show-process-crypto) + (put 'notmuch-show-process-crypto 'permanent-local t) + ++(defvar notmuch-show-elide-non-matching-messages nil) ++(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages) ++(put 'notmuch-show-elide-non-matching-messages 'permanent-local t) ++ + (defmacro with-current-notmuch-show-message (&rest body) + "Evaluate body with current buffer set to the text of current message" + `(save-excursion +@@ -922,11 +926,22 @@ current buffer, if possible." + "Not processing cryptographic MIME parts.")) + (notmuch-show-refresh-view)) + ++(defun notmuch-show-toggle-elide-non-matching () ++ "Toggle the display of non-matching messages." ++ (interactive) ++ (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages)) ++ (message (if notmuch-show-elide-non-matching-messages ++ "Showing matching messages only." ++ "Showing all messages.")) ++ (notmuch-show-refresh-view)) ++ + (defun notmuch-show-insert-tree (tree depth) + "Insert the message tree TREE at depth DEPTH in the current thread." + (let ((msg (car tree)) + (replies (cadr tree))) +- (notmuch-show-insert-msg msg depth) ++ (if (or (not notmuch-show-elide-non-matching-messages) ++ (plist-get msg :match)) ++ (notmuch-show-insert-msg msg depth)) + (notmuch-show-insert-thread replies (1+ depth)))) + + (defun notmuch-show-insert-thread (thread depth) +@@ -1079,6 +1094,7 @@ Refreshes the current view, observing changes in cryptographic preferences." + (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) + (define-key map (kbd "RET") 'notmuch-show-toggle-message) + (define-key map "#" 'notmuch-show-print-message) ++ (define-key map "!" 'notmuch-show-toggle-elide-non-matching) + (define-key map "$" 'notmuch-show-toggle-process-crypto) + map) + "Keymap for \"notmuch show\" buffers.") +-- +1.7.8.3 +