From b699c2ef504fa76ab06346f4d52c296dc1e5e075 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 12 Apr 2014 09:40:32 +0100 Subject: [PATCH] [PATCH 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work --- 0a/8a3f67ad1ec75edf9d333705e87c71a11b7bd0 | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 0a/8a3f67ad1ec75edf9d333705e87c71a11b7bd0 diff --git a/0a/8a3f67ad1ec75edf9d333705e87c71a11b7bd0 b/0a/8a3f67ad1ec75edf9d333705e87c71a11b7bd0 new file mode 100644 index 000000000..cbf4ee6ab --- /dev/null +++ b/0a/8a3f67ad1ec75edf9d333705e87c71a11b7bd0 @@ -0,0 +1,100 @@ +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 2B02A431FBD + for ; Sat, 12 Apr 2014 01:40:46 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 mWOYk2VxsNXZ for ; + Sat, 12 Apr 2014 01:40:40 -0700 (PDT) +Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com + [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 974CF431FAF + for ; Sat, 12 Apr 2014 01:40:40 -0700 (PDT) +Received: by mail-wi0-f173.google.com with SMTP id z2so2075243wiv.0 + for ; Sat, 12 Apr 2014 01:40:38 -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; + bh=AkElRQbBDAy1Qwg2hEIgzfa0UMbDyUCCogNsw/5J2i4=; + b=VCare2nvnErCzj01s+oe6rnK95hJCnsqnxU2BtPJilpSImpnth8aCBjcq4ZRVectC6 + 2ZjOo4I7kVvPzpxW6uftcKURd6xrRjv1bksmhzGJ7ClhpXSlWSSHMvxCCL0ZAPG0TY/3 + rZNS0DpanW+Jlc6hhZa8lr633xS3Yw+Lk+1NPFa1zDfQNpHAQ6s05dgGvUZuM7v4yYg3 + sqGe7XEVZD+twiCHVgFyMJ0y2oU45FmqepDgBeVTtOxew6RrVoEdxYvXe3VDNWMtI8ev + 00Lv3bTFJHBWhiGsjjxu8gG7aMiu+q6hGarNjTLOwa28a2nC/zLdgp2E8wUyT55JxKAj + kgAQ== +X-Received: by 10.180.24.134 with SMTP id u6mr1700156wif.41.1397292037857; + Sat, 12 Apr 2014 01:40:37 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id hu7sm9367633wib.10.2014.04.12.01.40.36 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 12 Apr 2014 01:40:37 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] emacs: hello: bugfix: make alphabetically sorted saved + searches work +Date: Sat, 12 Apr 2014 09:40:32 +0100 +Message-Id: <1397292033-26502-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +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: Sat, 12 Apr 2014 08:40:46 -0000 + +My recent changes to the saved search format broke the alphabetically +sorted saved sort option. This makes it work again. + +Also, since the saved-search list is no longer an alist change the +names in the sort function to avoid confusion. +--- +Thanks to Jani for pointing out the bug. + +Best wishes + +Mark + + emacs/notmuch-hello.el | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +index 4900a24..fca2bcc 100644 +--- a/emacs/notmuch-hello.el ++++ b/emacs/notmuch-hello.el +@@ -39,9 +39,12 @@ (defcustom notmuch-show-empty-saved-searches nil + :type 'boolean + :group 'notmuch-hello) + +-(defun notmuch-sort-saved-searches (alist) +- "Generate an alphabetically sorted saved searches alist." +- (sort (copy-sequence alist) (lambda (a b) (string< (car a) (car b))))) ++(defun notmuch-sort-saved-searches (saved-searches) ++ "Generate an alphabetically sorted saved searches list." ++ (sort (copy-sequence saved-searches) ++ (lambda (a b) ++ (string< (notmuch-saved-search-get a :name) ++ (notmuch-saved-search-get b :name))))) + + (defcustom notmuch-saved-search-sort-function nil + "Function used to sort the saved searches for the notmuch-hello view. +-- +1.7.10.4 + -- 2.26.2