From: Mark Walters Date: Wed, 14 Oct 2015 08:38:22 +0000 (+0100) Subject: [PATCH 1/2] emacs: allow saved searches to select tree-view X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fda0df1ea5c45a376ec9e5e915ea2adfa92c0bf4;p=notmuch-archives.git [PATCH 1/2] emacs: allow saved searches to select tree-view --- diff --git a/c3/5a7234f6a3e40107180683075bc569cfe0ece9 b/c3/5a7234f6a3e40107180683075bc569cfe0ece9 new file mode 100644 index 000000000..84f604f5f --- /dev/null +++ b/c3/5a7234f6a3e40107180683075bc569cfe0ece9 @@ -0,0 +1,148 @@ +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 E3D526DE177D + for ; Wed, 14 Oct 2015 01:38:49 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.578 +X-Spam-Level: +X-Spam-Status: No, score=-0.578 tagged_above=-999 required=5 + tests=[AWL=-0.008, 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 xomYsON1JWjc for ; + Wed, 14 Oct 2015 01:38:48 -0700 (PDT) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) + by arlo.cworth.org (Postfix) with ESMTPS id 608926DE1789 + for ; Wed, 14 Oct 2015 01:38:41 -0700 (PDT) +Received: by wicgb1 with SMTP id gb1so120071259wic.1 + for ; Wed, 14 Oct 2015 01:38:39 -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=kE0PTwl/Xl0PL124w5W7pYsOgMKusWUWr6oXbKOLX9I=; + b=RoSa3cMj2h8NByr9BO2hex/6hq4NMS232buwcA1SV6Tu4C12g0/gl/HWlqIYtTWXkI + OfY9qxzqyJ/0e0/Zs1VuGXcWM8yUfJIsuDb5xQUkEyZFHQXt3Ze9+1DqM1/kPVhCZGjt + 9LrHsgX1UyD9C2shqEYk8m21q64l051Q2HSmNz7Wr9mr5jDQChctJPK4FBimfczey5JN + 5rPsFcpXDLcZfR0Vgdw3RKnlLgPZvPfaa9ZIUyWcHOIobdau7F6sIixbknIAwUBziny/ + 1taFr2MkJgfGznuY3WlY7vi/CXncWRfytMzrYy8zKV3gOHZp7gmouPV5GYH72PlFEWrA + lSWg== +X-Received: by 10.194.84.42 with SMTP id v10mr2753699wjy.1.1444811918774; + Wed, 14 Oct 2015 01:38:38 -0700 (PDT) +Received: from localhost ([161.23.118.65]) + by smtp.gmail.com with ESMTPSA id z2sm6171989wij.1.2015.10.14.01.38.37 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Wed, 14 Oct 2015 01:38:37 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] emacs: allow saved searches to select tree-view +Date: Wed, 14 Oct 2015 09:38:22 +0100 +Message-Id: <1444811903-16741-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1444811903-16741-1-git-send-email-markwalters1009@gmail.com> +References: <1444811903-16741-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: Wed, 14 Oct 2015 08:38:50 -0000 + +This patch allows the user to customize a saved search to choose tree +view rather than the default search view. It also updates notmuch-jump +so that it respects this choice. +--- + emacs/notmuch-hello.el | 21 ++++++++++++++++----- + emacs/notmuch-jump.el | 4 +++- + 2 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +index 7bfa752..d9fe3ff 100644 +--- a/emacs/notmuch-hello.el ++++ b/emacs/notmuch-hello.el +@@ -28,6 +28,8 @@ + + (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation)) + (declare-function notmuch-poll "notmuch" ()) ++(declare-function notmuch-tree "notmuch-tree" ++ (&optional query query-context target buffer-name open-target)) + + (defun notmuch-saved-search-get (saved-search field) + "Get FIELD from SAVED-SEARCH. +@@ -91,7 +93,11 @@ searches so they still work in customize." + (choice :tag " Sort Order" + (const :tag "Default" nil) + (const :tag "Oldest-first" oldest-first) +- (const :tag "Newest-first" newest-first)))))) ++ (const :tag "Newest-first" newest-first))) ++ (group :format "%v" :inline t (const :format "" :search-type) ++ (choice :tag " Search Type" ++ (const :tag "Search mode" nil) ++ (const :tag "Tree mode" tree)))))) + + (defcustom notmuch-saved-searches + `((:name "inbox" :query "tag:inbox" :key ,(kbd "i")) +@@ -425,10 +431,13 @@ diagonal." + append (notmuch-hello-reflect-generate-row ncols nrows row list)))) + + (defun notmuch-hello-widget-search (widget &rest ignore) +- (notmuch-search (widget-get widget +- :notmuch-search-terms) +- (widget-get widget +- :notmuch-search-oldest-first))) ++ (if (widget-get widget :notmuch-search-type) ++ (notmuch-tree (widget-get widget ++ :notmuch-search-terms)) ++ (notmuch-search (widget-get widget ++ :notmuch-search-terms) ++ (widget-get widget ++ :notmuch-search-oldest-first)))) + + (defun notmuch-saved-search-count (search) + (car (process-lines notmuch-command "count" search))) +@@ -564,6 +573,7 @@ with `notmuch-hello-query-counts'." + (newest-first nil) + (oldest-first t) + (otherwise notmuch-search-oldest-first))) ++ (search-type (eq (plist-get elem :search-type) 'tree)) + (msg-count (plist-get elem :count))) + (widget-insert (format "%8s " + (notmuch-hello-nice-number msg-count))) +@@ -571,6 +581,7 @@ with `notmuch-hello-query-counts'." + :notify #'notmuch-hello-widget-search + :notmuch-search-terms query + :notmuch-search-oldest-first oldest-first ++ :notmuch-search-type search-type + name) + (setq column-indent + (1+ (max 0 (- column-width (length name))))))) +diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el +index 20e24b2..506ae2c 100644 +--- a/emacs/notmuch-jump.el ++++ b/emacs/notmuch-jump.el +@@ -54,7 +54,9 @@ fast way to jump to a saved search from anywhere in Notmuch." + (oldest-first t) + (otherwise (default-value 'notmuch-search-oldest-first))))) + (push (list key name +- `(lambda () (notmuch-search ',query ',oldest-first))) ++ (if (eq (plist-get saved-search :search-type) 'tree) ++ `(lambda () (notmuch-tree ',query)) ++ `(lambda () (notmuch-search ',query ',oldest-first)))) + action-map))))) + (setq action-map (nreverse action-map)) + +-- +2.1.4 +