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 17D94431FB6 for ; Fri, 7 Feb 2014 03:26:14 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 JCChOQmfchXT for ; Fri, 7 Feb 2014 03:26:10 -0800 (PST) Received: from mail-qa0-f41.google.com (mail-qa0-f41.google.com [209.85.216.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BA12C431FC2 for ; Fri, 7 Feb 2014 03:26:06 -0800 (PST) Received: by mail-qa0-f41.google.com with SMTP id w8so4970038qac.14 for ; Fri, 07 Feb 2014 03:26:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=RxuJGdzFWCJQF/+e2AHTJ2mkGA7WPSJLJXvg1sMjTJs=; b=hCYILFht45NXVHVWawnJhs/cBlpU8roxMl6wUtpuAOn53aQb/6MhIfGh5h9HWjTqXX X3Quz9dTUkaB44ztYOrgf3PZg5FXtXC10Gtd6ooDT4kp16jQ5okB/qHeUZJX6K9VajFz V8575NCQGbhhWjnaptYUPwXKNE0VGeJWXv4XCwE7z27Cj3wM1kWC5bAgoNPwifrwz08Y fpnuuLPQlgyyoRQBGCW26w9WKCScL+jsQrlNZfI5a6/cVpSsF2F0FAJz6zQP6/40ti5Y eacUVOAlhIdGuS4FgkJDB3OKt1vDYQaBAkxWBuhPY64rNoRwuaJFxTs6nKE1SGgoBUjM mWRg== X-Gm-Message-State: ALoCoQnwJ/d5AD1e+buEVNwPz8ZR73cIyRwx72nI5sbDrJXE3T5f/sVLkEVkFjT418PqUrR5fKxu X-Received: by 10.140.109.72 with SMTP id k66mr19639364qgf.20.1391772366103; Fri, 07 Feb 2014 03:26:06 -0800 (PST) Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) by mx.google.com with ESMTPSA id s2sm12452340qat.1.2014.02.07.03.26.05 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 07 Feb 2014 03:26:05 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org, cworth@cworth.org Subject: [PATCH 2/2] emacs: add support for defining custom sort order for saved searches Date: Fri, 7 Feb 2014 12:25:53 +0100 Message-Id: <061c4bf44c9bd08ab69ca6dfcae9037101ff69a8.1391771337.git.jani@nikula.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1391727088-22172-1-git-send-email-cworth@cworth.org> References: <1391727088-22172-1-git-send-email-cworth@cworth.org> In-Reply-To: References: 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: Fri, 07 Feb 2014 11:26:14 -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. NOTE: 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 1c30b47..530b3ac 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -463,7 +463,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 fa35fa9..16d9a52 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -113,6 +113,15 @@ Note that the recommended way of achieving the same is using :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