[PATCH 2/2] emacs: add support for defining custom sort order for saved searches
authorJani Nikula <jani@nikula.org>
Fri, 7 Feb 2014 11:25:53 +0000 (12:25 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:47 +0000 (09:59 -0800)
5a/697b8cdc85d30655bf34667f8c0105d45cfa65 [new file with mode: 0644]

diff --git a/5a/697b8cdc85d30655bf34667f8c0105d45cfa65 b/5a/697b8cdc85d30655bf34667f8c0105d45cfa65
new file mode 100644 (file)
index 0000000..8b48f82
--- /dev/null
@@ -0,0 +1,131 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 17D94431FB6\r
+       for <notmuch@notmuchmail.org>; Fri,  7 Feb 2014 03:26:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id JCChOQmfchXT for <notmuch@notmuchmail.org>;\r
+       Fri,  7 Feb 2014 03:26:10 -0800 (PST)\r
+Received: from mail-qa0-f41.google.com (mail-qa0-f41.google.com\r
+       [209.85.216.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id BA12C431FC2\r
+       for <notmuch@notmuchmail.org>; Fri,  7 Feb 2014 03:26:06 -0800 (PST)\r
+Received: by mail-qa0-f41.google.com with SMTP id w8so4970038qac.14\r
+       for <notmuch@notmuchmail.org>; Fri, 07 Feb 2014 03:26:06 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:in-reply-to:references;\r
+       bh=RxuJGdzFWCJQF/+e2AHTJ2mkGA7WPSJLJXvg1sMjTJs=;\r
+       b=hCYILFht45NXVHVWawnJhs/cBlpU8roxMl6wUtpuAOn53aQb/6MhIfGh5h9HWjTqXX\r
+       X3Quz9dTUkaB44ztYOrgf3PZg5FXtXC10Gtd6ooDT4kp16jQ5okB/qHeUZJX6K9VajFz\r
+       V8575NCQGbhhWjnaptYUPwXKNE0VGeJWXv4XCwE7z27Cj3wM1kWC5bAgoNPwifrwz08Y\r
+       fpnuuLPQlgyyoRQBGCW26w9WKCScL+jsQrlNZfI5a6/cVpSsF2F0FAJz6zQP6/40ti5Y\r
+       eacUVOAlhIdGuS4FgkJDB3OKt1vDYQaBAkxWBuhPY64rNoRwuaJFxTs6nKE1SGgoBUjM\r
+       mWRg==\r
+X-Gm-Message-State:\r
+ ALoCoQnwJ/d5AD1e+buEVNwPz8ZR73cIyRwx72nI5sbDrJXE3T5f/sVLkEVkFjT418PqUrR5fKxu\r
+X-Received: by 10.140.109.72 with SMTP id k66mr19639364qgf.20.1391772366103;\r
+       Fri, 07 Feb 2014 03:26:06 -0800 (PST)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+       by mx.google.com with ESMTPSA id s2sm12452340qat.1.2014.02.07.03.26.05\r
+       for <multiple recipients>\r
+       (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+       Fri, 07 Feb 2014 03:26:05 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org,\r
+       cworth@cworth.org\r
+Subject: [PATCH 2/2] emacs: add support for defining custom sort order for\r
+       saved searches\r
+Date: Fri,  7 Feb 2014 12:25:53 +0100\r
+Message-Id:\r
+ <061c4bf44c9bd08ab69ca6dfcae9037101ff69a8.1391771337.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <1391727088-22172-1-git-send-email-cworth@cworth.org>\r
+References: <1391727088-22172-1-git-send-email-cworth@cworth.org>\r
+In-Reply-To: <cover.1391771337.git.jani@nikula.org>\r
+References: <cover.1391771337.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 07 Feb 2014 11:26:14 -0000\r
+\r
+Add a new customization option notmuch-saved-searches-oldest-first to\r
+define custom sort order for saved searches. Do this as a separate\r
+option from notmuch-saved-searches to dodge backwards compatibility\r
+issues.\r
+\r
+NOTE:\r
+\r
+If the name of a tag matches the name of a saved search with a custom\r
+sort order, then the search for that tag using the all tags section of\r
+notmuch-hello will use the custom sort order too.\r
+\r
+If you change any sort orders, you must refresh notmuch-hello for the\r
+changes to take effect.\r
+\r
+Only searches initiated from notmuch-hello will be affected.\r
+---\r
+ emacs/notmuch-hello.el |    6 +++++-\r
+ emacs/notmuch-lib.el   |    9 +++++++++\r
+ 2 files changed, 14 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 1c30b47..530b3ac 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -463,7 +463,11 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
+               (widget-create 'push-button\r
+                              :notify #'notmuch-hello-widget-search\r
+                              :notmuch-search-terms query\r
+-                             :notmuch-search-oldest-first notmuch-search-oldest-first\r
++                             :notmuch-search-oldest-first\r
++                             (let ((m (assoc\r
++                                       name\r
++                                       notmuch-saved-searches-oldest-first)))\r
++                               (if m (cdr m) notmuch-search-oldest-first))\r
+                              name)\r
+               (setq column-indent\r
+                     (1+ (max 0 (- column-width (length name)))))))\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index fa35fa9..16d9a52 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -113,6 +113,15 @@ Note that the recommended way of achieving the same is using\r
+   :type '(alist :key-type string :value-type string)\r
+   :group 'notmuch-hello)\r
\r
++(defcustom notmuch-saved-searches-oldest-first nil\r
++  "List of saved searches with custom sort order.\r
++\r
++For each saved search name appearing in the list, use t for\r
++oldest-first, nil for newest-first. Saved searches not present in\r
++this list will use `notmuch-search-oldest-first' sort order."\r
++  :type '(alist :key-type string :value-type boolean)\r
++  :group 'notmuch-hello)\r
++\r
+ (defcustom notmuch-archive-tags '("-inbox")\r
+   "List of tag changes to apply to a message or a thread when it is archived.\r
\r
+-- \r
+1.7.2.5\r
+\r