From: Mark Walters Date: Sat, 12 Apr 2014 12:46:26 +0000 (+0100) Subject: [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bbd85a2777d0f3a0615d46d63adb6b0bc0551f85;p=notmuch-archives.git [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work --- diff --git a/f7/7551c8ff0d5e07d8b54f33c86a825473e633c2 b/f7/7551c8ff0d5e07d8b54f33c86a825473e633c2 new file mode 100644 index 000000000..549aa262a --- /dev/null +++ b/f7/7551c8ff0d5e07d8b54f33c86a825473e633c2 @@ -0,0 +1,112 @@ +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 CED80431FBC + for ; Sat, 12 Apr 2014 05:46:40 -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 RWiRCvMglkE7 for ; + Sat, 12 Apr 2014 05:46:35 -0700 (PDT) +Received: from mail-we0-f175.google.com (mail-we0-f175.google.com + [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 29E2D431FBD + for ; Sat, 12 Apr 2014 05:46:35 -0700 (PDT) +Received: by mail-we0-f175.google.com with SMTP id q58so6384751wes.20 + for ; Sat, 12 Apr 2014 05:46:32 -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=sxRiQvKJda8s9Z4WJiICJ3mLVGnRaMtSJpHFkjadIWM=; + b=jACjchaHibXqJESNuMBB/5sDafsLyZSQRgMjlxPEsNflkTFvHplMRk9F87DcZqLJL1 + hfmjB8CvLI/0hOfXwU/ET3Xuv/NVaysiW/w0VXTTd0rtPjD/j6IMjqkfM4j9nielAG1k + UfqMJd9rVCaOIBrjTTCTyjx5IH4KO73mHujgZTKV4cLt6oSVWrT5aVpeJeQ6OmQEn8Qc + bfrnZLvwzHCCSh+ffktIyDSV6wuchAov7avtS7iqLB96ed3i1X31vxt53GVSH1no0Hy5 + EnYRwS/fIWGenS4NiwQoUmOZkZR7WI72ChuO+oecjnwe8wX7t792resua5aGyhDUzLg5 + 8E9g== +X-Received: by 10.180.188.134 with SMTP id ga6mr2352399wic.58.1397306792624; + Sat, 12 Apr 2014 05:46:32 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id + h19sm10434121wiw.17.2014.04.12.05.46.31 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 12 Apr 2014 05:46:31 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved + searches work +Date: Sat, 12 Apr 2014 13:46:26 +0100 +Message-Id: <1397306787-12207-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1397306787-12207-1-git-send-email-markwalters1009@gmail.com> +References: <1397306787-12207-1-git-send-email-markwalters1009@gmail.com> +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 12:46:41 -0000 + +My recent changes to the saved search format broke the alphabetically +sorted saved sort option. This makes it work again. + +Also update docs for saved-search sort defcustom to match the new +format. + +Finally, since the saved-search list is no longer an alist change the +names in the sort function to avoid confusion. +--- + emacs/notmuch-hello.el | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +index 4900a24..b8ec665 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. +@@ -51,8 +54,10 @@ (defcustom notmuch-saved-search-sort-function nil + stored in `notmuch-saved-searches'. Sort alphabetically sorts the + saved searches in alphabetical order. Custom sort function should + be a function or a lambda expression that takes the saved +-searches alist as a parameter, and returns a new saved searches +-alist to be used." ++searches list as a parameter, and returns a new saved searches ++list to be used. For compatibility with the various saved-search ++formats it should use notmuch-saved-search-get to access the ++fields of the search." + :type '(choice (const :tag "No sorting" nil) + (const :tag "Sort alphabetically" notmuch-sort-saved-searches) + (function :tag "Custom sort function" +-- +1.7.10.4 +