unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2 0/2] emacs: hello: saved search sort fixes
@ 2014-04-12 12:46 Mark Walters
  2014-04-12 12:46 ` [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work Mark Walters
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mark Walters @ 2014-04-12 12:46 UTC (permalink / raw)
  To: notmuch

This is v2 of the collection of patches in
id:1397292033-26502-1-git-send-email-markwalters1009@gmail.com

The series makes the alphabetically sorted saved searches options work
again, documents the new saved search sorting format, and fixes some
of the markdown problesm in the original NEWS patch.


Mark Walters (2):
  emacs: hello: bugfix: make alphabetically sorted saved searches work
  NEWS: document possible breakage from saved-search format change

 NEWS                   |   12 +++++++++---
 emacs/notmuch-hello.el |   15 ++++++++++-----
 2 files changed, 19 insertions(+), 8 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work
  2014-04-12 12:46 [PATCH v2 0/2] emacs: hello: saved search sort fixes Mark Walters
@ 2014-04-12 12:46 ` Mark Walters
  2014-04-15 10:02   ` David Bremner
  2014-04-12 12:46 ` [PATCH v2 2/2] NEWS: document possible breakage from saved-search format change Mark Walters
  2014-04-12 13:04 ` [PATCH v2 0/2] emacs: hello: saved search sort fixes Tomi Ollila
  2 siblings, 1 reply; 5+ messages in thread
From: Mark Walters @ 2014-04-12 12:46 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] NEWS: document possible breakage from saved-search format change
  2014-04-12 12:46 [PATCH v2 0/2] emacs: hello: saved search sort fixes Mark Walters
  2014-04-12 12:46 ` [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work Mark Walters
@ 2014-04-12 12:46 ` Mark Walters
  2014-04-12 13:04 ` [PATCH v2 0/2] emacs: hello: saved search sort fixes Tomi Ollila
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Walters @ 2014-04-12 12:46 UTC (permalink / raw)
  To: notmuch

If the user has unsorted or alphabetically sorted saved-searches these
should continue to work. If they have some custom lisp sort function
then it will need updating to work with the new saved-sort
format. Document this, and how the updating should be done.

Also roll in fixes for the markdown in the first part of the NEWS
suggested by Tomi: change `just work' to *just work* and removed
periods from the end of subtitle lines.
---
 NEWS |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 8aa4182..f1d5499 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@ Command-Line Interface
 Emacs Interface
 ---------------
 
-Changed format for saved searches.
+Changed format for saved searches
 
   The format for `notmuch-saved-searches` has changed, but old style
   saved searches are still supported. The new style means that a saved
@@ -24,7 +24,7 @@ Changed format for saved searches.
   shows.
 
   The variable is fully customizable and any configuration done
-  through customize should `just work', with the additional options
+  through customize should *just work*, with the additional options
   mentioned above. For manual customization see the documentation for
   `notmuch-saved-searches`.
 
@@ -32,7 +32,13 @@ Changed format for saved searches.
   previous versions of notmuch-emacs (even search will not work); to
   fix remove the customization for notmuch-saved-searches.
 
-Bug fix for saved searches with newlines in them.
+  If you have a custom saved search sort function (not unsorted or
+  alphabetical) then the sort function will need to be
+  modified. Replacing (car saved-search) by (notmuch-saved-search-get
+  saved-search :name) and (cdr saved-search) by
+  (notmuch-saved-search-get saved-search :query) should be sufficient.
+
+Bug fix for saved searches with newlines in them
 
   Split lines confuse `notmuch count --batch`, so we remove embedded
   newlines before calling notmuch count.
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] emacs: hello: saved search sort fixes
  2014-04-12 12:46 [PATCH v2 0/2] emacs: hello: saved search sort fixes Mark Walters
  2014-04-12 12:46 ` [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work Mark Walters
  2014-04-12 12:46 ` [PATCH v2 2/2] NEWS: document possible breakage from saved-search format change Mark Walters
@ 2014-04-12 13:04 ` Tomi Ollila
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2014-04-12 13:04 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Apr 12 2014, Mark Walters <markwalters1009@gmail.com> wrote:

> This is v2 of the collection of patches in
> id:1397292033-26502-1-git-send-email-markwalters1009@gmail.com
>
> The series makes the alphabetically sorted saved searches options work
> again, documents the new saved search sorting format, and fixes some
> of the markdown problesm in the original NEWS patch.

LGTM.

Tomi


>
>
> Mark Walters (2):
>   emacs: hello: bugfix: make alphabetically sorted saved searches work
>   NEWS: document possible breakage from saved-search format change
>
>  NEWS                   |   12 +++++++++---
>  emacs/notmuch-hello.el |   15 ++++++++++-----
>  2 files changed, 19 insertions(+), 8 deletions(-)
>
> -- 
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work
  2014-04-12 12:46 ` [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work Mark Walters
@ 2014-04-15 10:02   ` David Bremner
  0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-04-15 10:02 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> 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.

series pushed

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-15 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-12 12:46 [PATCH v2 0/2] emacs: hello: saved search sort fixes Mark Walters
2014-04-12 12:46 ` [PATCH v2 1/2] emacs: hello: bugfix: make alphabetically sorted saved searches work Mark Walters
2014-04-15 10:02   ` David Bremner
2014-04-12 12:46 ` [PATCH v2 2/2] NEWS: document possible breakage from saved-search format change Mark Walters
2014-04-12 13:04 ` [PATCH v2 0/2] emacs: hello: saved search sort fixes Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).