From: Mark Walters Date: Sat, 13 Jun 2015 08:08:09 +0000 (+0100) Subject: [PATCH v5 2/3] emacs: add a filter option to show X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9b0d982b2361e126f6efd7cfa76675eefe606fb5;p=notmuch-archives.git [PATCH v5 2/3] emacs: add a filter option to show --- diff --git a/cd/e7f25defbf9d869a31f9034e567ff7b89b0061 b/cd/e7f25defbf9d869a31f9034e567ff7b89b0061 new file mode 100644 index 000000000..130dc17d6 --- /dev/null +++ b/cd/e7f25defbf9d869a31f9034e567ff7b89b0061 @@ -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 arlo.cworth.org (Postfix) with ESMTP id 725C06DE1588 + for ; Sat, 13 Jun 2015 01:08:24 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.349 +X-Spam-Level: +X-Spam-Status: No, score=0.349 tagged_above=-999 required=5 tests=[AWL=0.919, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id jjLayqi48q2V for ; + Sat, 13 Jun 2015 01:08:22 -0700 (PDT) +Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com + [209.85.212.176]) + by arlo.cworth.org (Postfix) with ESMTPS id 373226DE0C51 + for ; Sat, 13 Jun 2015 01:08:21 -0700 (PDT) +Received: by wibut5 with SMTP id ut5so34351890wib.1 + for ; Sat, 13 Jun 2015 01:08:19 -0700 (PDT) +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=a6xFhodniWX+CCIakVjexRb6ep0LLoTn7VPDVlS8kB4=; + b=gPjNKHnaiTMgCPl4CzkUNc5BWNAZvOxgI2WcCMpThhJY5VPRfGMmg3mUvEhm/1ykM3 + TTsVfEleT4bS70TU5ZenxIyqqD+VkBSA74S8kpL/i49YUkQRGUBd3055VloQpX1riXM3 + owQJoUPapO+zKrp3NT3/ybyae8rxLjg+pPkBakl2UH33kkcG+wAnPOCtm7MHGGrVOAxG + pFGJz6Pj3RRXwvyy5CVfMN/Ow7sV7ih7xvh5O67KRSzDDHZl76jt/pX32FlMMZJEA5Cd + Ku/FqmosLK3ViJd8gcwC4O5AMtMuzUP6YSTgQtw74iQ947bqQtJHuOQCM4m8OLQeeCpS + MukA== +X-Received: by 10.180.109.111 with SMTP id hr15mr14010927wib.53.1434182899752; + Sat, 13 Jun 2015 01:08:19 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id z9sm6188635wiv.9.2015.06.13.01.08.18 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 13 Jun 2015 01:08:19 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v5 2/3] emacs: add a filter option to show +Date: Sat, 13 Jun 2015 09:08:09 +0100 +Message-Id: <1434182890-8047-3-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1434182890-8047-1-git-send-email-markwalters1009@gmail.com> +References: <1434182890-8047-1-git-send-email-markwalters1009@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Sat, 13 Jun 2015 08:08:24 -0000 + +Show the current thread with a different filter (i.e., open messages +in the thread matching the new query). + +Bound to 'l' for "limit". + +Note that it is not the same as filter in search mode as it replaces +the existing query rather than ANDing with it (but it does keep the +thread-id part of the query). +--- + emacs/notmuch-show.el | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index a978d3c..4dee34b 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -47,6 +47,7 @@ + (declare-function notmuch-tree "notmuch-tree" + (&optional query query-context target buffer-name open-target)) + (declare-function notmuch-tree-get-message-properties "notmuch-tree" nil) ++(declare-function notmuch-read-query "notmuch" (prompt)) + + (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") + "Headers that should be shown in a message, in this order. +@@ -1372,6 +1373,7 @@ (defvar notmuch-show-mode-map + (define-key map (kbd "") 'notmuch-show-previous-button) + (define-key map (kbd "TAB") 'notmuch-show-next-button) + (define-key map "f" 'notmuch-show-forward-message) ++ (define-key map "l" 'notmuch-show-filter-thread) + (define-key map "r" 'notmuch-show-reply-sender) + (define-key map "R" 'notmuch-show-reply) + (define-key map "|" 'notmuch-show-pipe-message) +@@ -1660,6 +1662,16 @@ (defun notmuch-show-command-hook () + (save-excursion + (funcall notmuch-show-mark-read-function (window-start) (window-end))))) + ++(defun notmuch-show-filter-thread (query) ++ "Filter or LIMIT the current thread based on a new query string. ++ ++Reshows the current thread with matches defined by the new query-string." ++ (interactive (list (notmuch-read-query "Filter thread: "))) ++ (let ((msg-id (notmuch-show-get-message-id))) ++ (setq notmuch-show-query-context (if (string= query "") nil query)) ++ (notmuch-show-refresh-view t) ++ (notmuch-show-goto-message msg-id))) ++ + ;; Functions for getting attributes of several messages in the current + ;; thread. + +-- +2.1.4 +