Patchworkβ notmuch.el: Prefix arg inverts the sort order of notmuch-search.

login
register
about
Submitter David Edmondson
Date 2010-02-11 12:19:12
Message ID <1265890752-26242-1-git-send-email-dme@dme.org>
Download mbox | patch
Permalink /patch/355/
State New
Headers show

Comments

David Edmondson - 2010-02-11 12:19:12
---
 notmuch.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Sebastian Spaeth - 2010-02-11 13:42:40
On Thu, 11 Feb 2010 12:19:12 +0000, David Edmondson <dme@dme.org> wrote:
...

I think the correct thing here would be to let notmuch return search is
inverse sort order rather than reverting this later in the client
(unneccessary work). 

 --sort=oldest|newest|relevance 

seems to be what xapian can easily provide us with.
David Edmondson - 2010-02-11 14:01:14
On Thu, 11 Feb 2010 14:42:40 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> On Thu, 11 Feb 2010 12:19:12 +0000, David Edmondson <dme@dme.org> wrote:
> ...
> 
> I think the correct thing here would be to let notmuch return search is
> inverse sort order rather than reverting this later in the client
> (unneccessary work). 
> 
>  --sort=oldest|newest|relevance 
> 
> seems to be what xapian can easily provide us with.

That's what happens:

	(let ((proc (start-process-shell-command
		     "notmuch-search" buffer notmuch-command "search"
		     (if oldest-first "--sort=oldest-first" "--sort=newest-first")
		     (shell-quote-argument query))))

Isn't it?

dme.
Sebastian Spaeth - 2010-02-11 14:05:28
On Thu, 11 Feb 2010 14:01:14 +0000, David Edmondson <dme@dme.org> wrote:
> 	(let ((proc (start-process-shell-command
> 		     "notmuch-search" buffer notmuch-command "search"
> 		     (if oldest-first "--sort=oldest-first" "--sort=newest-first")

Doh, I should shut up when I haven't actually looked at the code. 
The only thing to my defense is that looking at elisp makes me feel
dizzy.

Sorry,
Sebastian

Patch

diff --git a/notmuch.el b/notmuch.el
index 8f50abe..de9ddf8 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1398,7 +1398,8 @@  characters as well as `_.+-'.
 (defun notmuch-search (query &optional oldest-first)
   "Run \"notmuch search\" with the given query string and display results."
   (interactive "sNotmuch search: ")
-  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*"))))
+  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*")))
+	(oldest-first (if current-prefix-arg (not oldest-first) oldest-first)))
     (switch-to-buffer buffer)
     (notmuch-search-mode)
     (set 'notmuch-search-query-string query)