Re: [PATCH] nmbug-status: add support for specifying sort order for each view
authorTomi Ollila <tomi.ollila@iki.fi>
Mon, 6 Apr 2015 11:43:54 +0000 (14:43 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:44 +0000 (14:48 -0700)
bb/f6e964673797a9ca3d90b77cd1ac9665ff94d8 [new file with mode: 0644]

diff --git a/bb/f6e964673797a9ca3d90b77cd1ac9665ff94d8 b/bb/f6e964673797a9ca3d90b77cd1ac9665ff94d8
new file mode 100644 (file)
index 0000000..b7f4cbe
--- /dev/null
@@ -0,0 +1,99 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id B2FB96DE19CD\r
+ for <notmuch@notmuchmail.org>; Mon,  6 Apr 2015 04:53:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.226\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.226 tagged_above=-999 required=5 tests=[AWL=0.574, \r
+ SPF_NEUTRAL=0.652] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id akUPbNz8k2E5 for <notmuch@notmuchmail.org>;\r
+ Mon,  6 Apr 2015 04:53:52 -0700 (PDT)\r
+X-Greylist: delayed 572 seconds by postgrey-1.35 at arlo;\r
+ Mon, 06 Apr 2015 04:53:52 PDT\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 27F3C6DE19C7\r
+ for <notmuch@notmuchmail.org>; Mon,  6 Apr 2015 04:53:52 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 4639210019F;\r
+ Mon,  6 Apr 2015 14:43:55 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] nmbug-status: add support for specifying sort order for\r
+ each view\r
+In-Reply-To: <1428047832-14922-1-git-send-email-jani@nikula.org>\r
+References: <1428047832-14922-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.19+107~gab55bdb (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 06 Apr 2015 14:43:54 +0300\r
+Message-ID: <m2wq1pa3d1.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 06 Apr 2015 11:53:54 -0000\r
+\r
+On Fri, Apr 03 2015, Jani Nikula <jani@nikula.org> wrote:\r
+\r
+> Let each view have "sort" key with possible values "oldest-first",\r
+> "newest-first", and "unsorted", and sort the results\r
+> accordingly. Oldest first remains the default.\r
+> ---\r
+\r
+lgtm.\r
+\r
+Tomi\r
+\r
+>  devel/nmbug/nmbug-status | 10 +++++++++-\r
+>  1 file changed, 9 insertions(+), 1 deletion(-)\r
+>\r
+> diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+> index 19dc48abf557..e1abf4db15ba 100755\r
+> --- a/devel/nmbug/nmbug-status\r
+> +++ b/devel/nmbug/nmbug-status\r
+> @@ -156,11 +156,19 @@ class Page (object):\r
+>              stream.write(self.footer)\r
+>  \r
+>      def _write_view(self, database, view, stream):\r
+> +        sort = {\r
+> +            'oldest-first': notmuch.Query.SORT.OLDEST_FIRST,\r
+> +            'newest-first': notmuch.Query.SORT.NEWEST_FIRST,\r
+> +            'unsorted': notmuch.Query.SORT.UNSORTED\r
+> +        }\r
+>          if 'query-string' not in view:\r
+>              query = view['query']\r
+>              view['query-string'] = ' and '.join(query)\r
+>          q = notmuch.Query(database, view['query-string'])\r
+> -        q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)\r
+> +        if 'sort' in view and view['sort'] in sort:\r
+> +            q.set_sort(sort[view['sort']])\r
+> +        else:\r
+> +            q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)\r
+>          threads = self._get_threads(messages=q.search_messages())\r
+>          self._write_view_header(view=view, stream=stream)\r
+>          self._write_threads(threads=threads, stream=stream)\r
+> -- \r
+> 2.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r