From 72fe2a396cf8ac8d3293eea2139d3d09a320a017 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 2 Oct 2012 22:18:03 +0200 Subject: [PATCH] [PATCH 2/2] emacs: add support for defining custom sort order for saved searches --- c5/26413314116cc9d4628c9c3bd49c400525c5d6 | 124 ++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 c5/26413314116cc9d4628c9c3bd49c400525c5d6 diff --git a/c5/26413314116cc9d4628c9c3bd49c400525c5d6 b/c5/26413314116cc9d4628c9c3bd49c400525c5d6 new file mode 100644 index 000000000..979a4ea7c --- /dev/null +++ b/c5/26413314116cc9d4628c9c3bd49c400525c5d6 @@ -0,0 +1,124 @@ +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 8B87E431FC0 + for ; Tue, 2 Oct 2012 13:18:17 -0700 (PDT) +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 Vz8PLPghhA9I for ; + Tue, 2 Oct 2012 13:18:16 -0700 (PDT) +Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com + [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 59837431FBD + for ; Tue, 2 Oct 2012 13:18:16 -0700 (PDT) +Received: by mail-qc0-f181.google.com with SMTP id x40so6183217qcp.26 + for ; Tue, 02 Oct 2012 13:18:16 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references + :x-gm-message-state; + bh=gErQ33LhLmCiLz5SlCFgl7kq4SsynwBoXmOn/B1y2IU=; + b=NfRMBCrAj+9bYuaeN+kTxL79f7JTATFhrhnZC76jmt2eDwscInCkYdUdjZX7kvFa7L + dW+rq5YkaCeMQeJA/VSkGSFF6wKSMTwgex5ABjx3QhhlRNRjAQjZXWIgAVvnYzMcawYe + 6hORwfWjb9mYe1dSgKLUjnU1bIf/TmVm8mFaAkvDPjwjJt6ReN9An6CwM6yJ0LH1lSmn + TxQb60nRUrSEH9+V9PWSWPIL32QiWkRZTD21jmd4P/rWbgWiD7v4K8pSjhJrEu7SRQRW + K0TzpUKNd6mJusfE/ZGLeQbi2Hs2G/V5QSJtwczPpw05QCI18EEFb1ZQGa2JajKenanJ + vifw== +Received: by 10.49.59.82 with SMTP id x18mr7678668qeq.9.1349209096102; + Tue, 02 Oct 2012 13:18:16 -0700 (PDT) +Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) + by mx.google.com with ESMTPS id ck11sm2295914qab.17.2012.10.02.13.18.15 + (version=SSLv3 cipher=OTHER); Tue, 02 Oct 2012 13:18:15 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] emacs: add support for defining custom sort order for + saved searches +Date: Tue, 2 Oct 2012 22:18:03 +0200 +Message-Id: <1349209083-7170-3-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.7.2.5 +In-Reply-To: <1349209083-7170-1-git-send-email-jani@nikula.org> +References: <1349209083-7170-1-git-send-email-jani@nikula.org> +X-Gm-Message-State: + ALoCoQnDCNmQs701/We4W+bYGWKiZzJq2jvJYivvyXKir9xZgxyXdTE3EOBSddy9kPvPeY5BNIpM +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: Tue, 02 Oct 2012 20:18:18 -0000 + +Add a new customization option notmuch-saved-searches-oldest-first to +define custom sort order for saved searches. Do this as a separate +option from notmuch-saved-searches to dodge backwards compatibility +issues. + +NOTES: + +If the name of a tag matches the name of a saved search with a custom +sort order, then the search for that tag using the all tags section of +notmuch-hello will use the custom sort order too. + +If you change any sort orders, you must refresh notmuch-hello for the +changes to take effect. + +Only searches initiated from notmuch-hello will be affected. +--- + emacs/notmuch-hello.el | 6 +++++- + emacs/notmuch-lib.el | 9 +++++++++ + 2 files changed, 14 insertions(+), 1 deletions(-) + +diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +index 532f06d..e410357 100644 +--- a/emacs/notmuch-hello.el ++++ b/emacs/notmuch-hello.el +@@ -433,7 +433,11 @@ Such a list can be computed with `notmuch-hello-query-counts'." + (widget-create 'push-button + :notify #'notmuch-hello-widget-search + :notmuch-search-terms query +- :notmuch-search-oldest-first notmuch-search-oldest-first ++ :notmuch-search-oldest-first ++ (let ((m (assoc ++ name ++ notmuch-saved-searches-oldest-first))) ++ (if m (cdr m) notmuch-search-oldest-first)) + name) + (setq column-indent + (1+ (max 0 (- column-width (length name))))))) +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index 69867ad..e1cd7d2 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -82,6 +82,15 @@ + :type '(alist :key-type string :value-type string) + :group 'notmuch-hello) + ++(defcustom notmuch-saved-searches-oldest-first nil ++ "List of saved searches with custom sort order. ++ ++For each saved search name appearing in the list, use t for ++oldest-first, nil for newest-first. Saved searches not present in ++this list will use `notmuch-search-oldest-first' sort order." ++ :type '(alist :key-type string :value-type boolean) ++ :group 'notmuch-hello) ++ + (defcustom notmuch-archive-tags '("-inbox") + "List of tag changes to apply to a message or a thread when it is archived. + +-- +1.7.2.5 + -- 2.26.2