--- /dev/null
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 18F19431FB6\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 18:30:41 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id pVckcPazvs9W for <notmuch@notmuchmail.org>;\r
+ Sat, 5 Apr 2014 18:30:33 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu\r
+ [18.9.25.14])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 7827D431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 18:30:33 -0700 (PDT)\r
+X-AuditID: 1209190e-f79ee6d000000c40-08-5340ae385e56\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 45.3B.03136.83EA0435; Sat, 5 Apr 2014 21:30:32 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s361UVBQ024227; \r
+ Sat, 5 Apr 2014 21:30:32 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s361UTjV021355\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Sat, 5 Apr 2014 21:30:30 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1WWbun-0007BH-Fo; Sat, 05 Apr 2014 21:30:29 -0400\r
+Date: Sat, 5 Apr 2014 21:30:29 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 5/5] emacs: Add a sort-order option to saved-searches\r
+Message-ID: <20140406013029.GG15472@mit.edu>\r
+References: <1396733065-32602-1-git-send-email-markwalters1009@gmail.com>\r
+ <1396733065-32602-6-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1396733065-32602-6-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFvrPIsWRmVeSWpSXmKPExsUixG6nomuxziHYYM0WVYvVc3ksrt+cyezA\r
+ 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZdzbaVAwX7Li9dM77A2MB4S7GDk5JARMJJ4v\r
+ 7WCGsMUkLtxbzwZiCwnMZpK4P9eii5ELyN7AKNH7cCEzhHOKSeLGnOdQzhJGiWNP7zN1MXJw\r
+ sAioSJzZHg/SzSagIbFt/3JGEFtEQEfi9qEF7CA2s4C0xLffzUwgtrCAp8Sjty2sIK28QDVN\r
+ G+whFncySmztcQGxeQUEJU7OfMIC0aolcePfS7BNIGOW/+MACXMKeEm867sIViIKdMCUk9vY\r
+ JjAKzULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0jfVyM0v0UlNKNzGCwplT\r
+ km8H49eDSocYBTgYlXh4L+Y5BAuxJpYVV+YeYpTkYFIS5e2aARTiS8pPqcxILM6ILyrNSS0+\r
+ xCjBwawkwvskCCjHm5JYWZValA+TkuZgURLnfWttFSwkkJ5YkpqdmlqQWgSTleHgUJLgdVkL\r
+ 1ChYlJqeWpGWmVOCkGbi4AQZzgM0/NUakOHFBYm5xZnpEPlTjIpS4ryCIM0CIImM0jy4Xli6\r
+ ecUoDvSKMK8OSBUPMFXBdb8CGswENLghzA5kcEkiQkqqgZFfp8HyssWE8wlyXHsy9x66ac//\r
+ JvKTHfsMmZb87f+iVD+lH8if8CC2fmn2supJlnuad0pH8PqLy/bKVNYVX36zT+3VhTUTOLnr\r
+ k8QNz53/Exbm/zKh5XXd0y3v652r+iv5JVY7FCSUl/P3C7vI73hV2/e/1VPRdqvJthvTv8Ur\r
+ +otX7by3UImlOCPRUIu5qDgRALxS48sSAwAA\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Sun, 06 Apr 2014 01:30:41 -0000\r
+\r
+Quoth Mark Walters on Apr 05 at 10:24 pm:\r
+> This adds a sort-order option to saved-searches, stores it in the\r
+> saved-search buttons (widgets), and uses the stored value when the\r
+> button is pressed.\r
+> \r
+> Storing the sort-order in the widget was suggested by Jani in\r
+> id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org.\r
+> ---\r
+> emacs/notmuch-hello.el | 11 ++++++++++-\r
+> emacs/notmuch-lib.el | 7 ++++++-\r
+> 2 files changed, 16 insertions(+), 2 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+> index aa40e6f..6a28372 100644\r
+> --- a/emacs/notmuch-hello.el\r
+> +++ b/emacs/notmuch-hello.el\r
+> @@ -364,7 +364,8 @@ (defun notmuch-hello-reflect (list ncols)\r
+> (defun notmuch-hello-widget-search (widget &rest ignore)\r
+> (notmuch-search (widget-get widget\r
+> :notmuch-search-terms)\r
+> - notmuch-search-oldest-first))\r
+> + (widget-get widget\r
+> + :notmuch-search-oldest-first)))\r
+> \r
+> (defun notmuch-saved-search-count (search)\r
+> (car (process-lines notmuch-command "count" search)))\r
+> @@ -496,12 +497,20 @@ (defun notmuch-hello-insert-buttons (searches)\r
+> (widget-insert (make-string column-indent ? )))\r
+> (let* ((name (plist-get elem :name))\r
+> (query (plist-get elem :query))\r
+> + (oldest-first (cond\r
+> + ((eq (plist-get elem :sort-order) 'newest-first)\r
+> + nil)\r
+> + ((eq (plist-get elem :sort-order) 'oldest-first)\r
+> + t)\r
+> + (t\r
+> + notmuch-search-oldest-first)))\r
+\r
+(case (plist-get elem :sort-order)\r
+ (newest-first nil)\r
+ (oldest-first t)\r
+ (otherwise notmuch-search-oldest-first))\r
+\r
+> (msg-count (plist-get elem :count)))\r
+> (widget-insert (format "%8s "\r
+> (notmuch-hello-nice-number msg-count)))\r
+> (widget-create 'push-button\r
+> :notify #'notmuch-hello-widget-search\r
+> :notmuch-search-terms query\r
+> + :notmuch-search-oldest-first oldest-first\r
+> name)\r
+> (setq column-indent\r
+> (1+ (max 0 (- column-width (length name)))))))\r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 8a12f91..8aa8cfc 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -125,7 +125,12 @@ (define-widget 'notmuch-saved-search-plist 'list\r
+> (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v")))\r
+> (checklist :inline t\r
+> :format "%v"\r
+> - (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")))))\r
+> + (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))\r
+> + (group :format "%v" :inline t (const :format "" :sort-order)\r
+> + (choice :tag " Sort Order"\r
+\r
+Should there be a colon? (I haven't applied the patches and I'm\r
+afraid this is beyond my mental implementation of define-widget!)\r
+\r
+> + (const :tag "Default" nil)\r
+> + (const :tag "Oldest-first" oldest-first)\r
+> + (const :tag "Newest-first" newest-first))))))\r
+> \r
+> (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")\r
+> (:name "unread" :query "tag:unread"))\r