Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 71 / 9e5340c0ac1f063475697f0fe23729e8cc6800
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 9309C429E31\r
6         for <notmuch@notmuchmail.org>; Wed,  7 Sep 2011 01:01:42 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 17PaP-uS60Az for <notmuch@notmuchmail.org>;\r
17         Wed,  7 Sep 2011 01:01:40 -0700 (PDT)\r
18 Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com\r
19         [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id E685D429E26\r
22         for <notmuch@notmuchmail.org>; Wed,  7 Sep 2011 01:01:39 -0700 (PDT)\r
23 Received: by vxh7 with SMTP id 7so579623vxh.26\r
24         for <notmuch@notmuchmail.org>; Wed, 07 Sep 2011 01:01:39 -0700 (PDT)\r
25 Received: by 10.52.72.3 with SMTP id z3mr3291219vdu.301.1315382499068;\r
26         Wed, 07 Sep 2011 01:01:39 -0700 (PDT)\r
27 Received: from localhost (nikula.org [92.243.24.172])\r
28         by mx.google.com with ESMTPS id n20sm2032833vdu.6.2011.09.07.01.01.37\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Wed, 07 Sep 2011 01:01:38 -0700 (PDT)\r
31 From: Jani Nikula <jani@nikula.org>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH v2 1/2] emacs: Add new customization option to sort saved\r
34         searches\r
35 Date: Wed,  7 Sep 2011 08:01:27 +0000\r
36 Message-Id:\r
37  <c83e24e89458b92deb6fb6dad5846d8cf625d5cd.1315381553.git.jani@nikula.org>\r
38 X-Mailer: git-send-email 1.7.1\r
39 In-Reply-To: <1315322623575-3313863.post@n3.nabble.com>\r
40 References: <1315322623575-3313863.post@n3.nabble.com>\r
41 In-Reply-To: <cover.1315381553.git.jani@nikula.org>\r
42 References: <cover.1315381553.git.jani@nikula.org>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Wed, 07 Sep 2011 08:01:42 -0000\r
56 \r
57 Add new customization option notmuch-saved-search-sort-function to sort\r
58 saved searches in user-defined order. Provide a sort function to sort the\r
59 saved searches in alphabetical order. Setting the search function to nil\r
60 causes the saved searches not to be sorted, as before. This also remains\r
61 the default. The function only affects display of the saved searches, not\r
62 the order in which they are stored by custom.\r
63 \r
64 Signed-off-by: Jani Nikula <jani@nikula.org>\r
65 ---\r
66  emacs/notmuch-hello.el |   24 ++++++++++++++++++++++++\r
67  1 files changed, 24 insertions(+), 0 deletions(-)\r
68 \r
69 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
70 index 65fde75..6c8e265 100644\r
71 --- a/emacs/notmuch-hello.el\r
72 +++ b/emacs/notmuch-hello.el\r
73 @@ -42,6 +42,26 @@\r
74    :type 'boolean\r
75    :group 'notmuch)\r
76  \r
77 +(defun notmuch-sort-saved-searches (alist)\r
78 +  "Generate an alphabetically sorted saved searches alist."\r
79 +  (sort alist (lambda (a b) (string< (car a) (car b)))))\r
80 +\r
81 +(defcustom notmuch-saved-search-sort-function nil\r
82 +  "Function used to sort the saved searches for the notmuch-hello view.\r
83 +\r
84 +This variable controls how saved searches should be sorted. No\r
85 +sorting (nil) displays the saved searches in the order they are\r
86 +stored in `notmuch-saved-searches'. Sort alphabetically sorts the\r
87 +saved searches in alphabetical order. Custom sort function should\r
88 +be a function or a lambda expression that takes the saved\r
89 +searches alist as a parameter, and returns a new saved searches\r
90 +alist to be used."\r
91 +  :type '(choice (const :tag "No sorting" nil)\r
92 +                (const :tag "Sort alphabetically" notmuch-sort-saved-searches)\r
93 +                (function :tag "Custom sort function"\r
94 +                          :value notmuch-sort-saved-searches))\r
95 +  :group 'notmuch)\r
96 +\r
97  (defvar notmuch-hello-indent 4\r
98    "How much to indent non-headers.")\r
99  \r
100 @@ -440,6 +460,10 @@ Complete list of currently available key bindings:\r
101              (widest (max saved-widest alltags-widest)))\r
102  \r
103         (when saved-alist\r
104 +         ;; Sort saved searches if required.\r
105 +         (when notmuch-saved-search-sort-function\r
106 +           (setq saved-alist\r
107 +                 (funcall notmuch-saved-search-sort-function saved-alist)))\r
108           (widget-insert "\nSaved searches: ")\r
109           (widget-create 'push-button\r
110                          :notify (lambda (&rest ignore)\r
111 -- \r
112 1.7.1\r
113 \r