unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH] nmbug-status: add support for specifying sort order for each view
Date: Mon, 06 Apr 2015 14:43:54 +0300	[thread overview]
Message-ID: <m2wq1pa3d1.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1428047832-14922-1-git-send-email-jani@nikula.org>

On Fri, Apr 03 2015, Jani Nikula <jani@nikula.org> wrote:

> Let each view have "sort" key with possible values "oldest-first",
> "newest-first", and "unsorted", and sort the results
> accordingly. Oldest first remains the default.
> ---

lgtm.

Tomi

>  devel/nmbug/nmbug-status | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
> index 19dc48abf557..e1abf4db15ba 100755
> --- a/devel/nmbug/nmbug-status
> +++ b/devel/nmbug/nmbug-status
> @@ -156,11 +156,19 @@ class Page (object):
>              stream.write(self.footer)
>  
>      def _write_view(self, database, view, stream):
> +        sort = {
> +            'oldest-first': notmuch.Query.SORT.OLDEST_FIRST,
> +            'newest-first': notmuch.Query.SORT.NEWEST_FIRST,
> +            'unsorted': notmuch.Query.SORT.UNSORTED
> +        }
>          if 'query-string' not in view:
>              query = view['query']
>              view['query-string'] = ' and '.join(query)
>          q = notmuch.Query(database, view['query-string'])
> -        q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
> +        if 'sort' in view and view['sort'] in sort:
> +            q.set_sort(sort[view['sort']])
> +        else:
> +            q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
>          threads = self._get_threads(messages=q.search_messages())
>          self._write_view_header(view=view, stream=stream)
>          self._write_threads(threads=threads, stream=stream)
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2015-04-06 11:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-03  7:57 [PATCH] nmbug-status: add support for specifying sort order for each view Jani Nikula
2015-04-06 11:43 ` Tomi Ollila [this message]
2015-04-06 15:56 ` W. Trevor King
2015-04-06 16:48   ` Tomi Ollila
2015-09-26 11:37     ` [PATCH v2] " Jani Nikula
2015-09-26 18:47       ` W. Trevor King
2015-09-29 11:27       ` David Bremner
2015-09-29 18:58         ` Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2wq1pa3d1.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).