unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch.el: Prefix arg inverts the sort order of notmuch-search.
@ 2010-02-11 12:19 David Edmondson
  2010-02-11 13:42 ` Sebastian Spaeth
  0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2010-02-11 12:19 UTC (permalink / raw)
  To: notmuch

---
 notmuch.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

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)
-- 
1.6.6.1

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

* Re: notmuch.el: Prefix arg inverts the sort order of notmuch-search.
  2010-02-11 12:19 [PATCH] notmuch.el: Prefix arg inverts the sort order of notmuch-search David Edmondson
@ 2010-02-11 13:42 ` Sebastian Spaeth
  2010-02-11 14:01   ` David Edmondson
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Spaeth @ 2010-02-11 13:42 UTC (permalink / raw)
  To: notmuch

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.

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

* Re: notmuch.el: Prefix arg inverts the sort order of notmuch-search.
  2010-02-11 13:42 ` Sebastian Spaeth
@ 2010-02-11 14:01   ` David Edmondson
  2010-02-11 14:05     ` Sebastian Spaeth
  0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2010-02-11 14:01 UTC (permalink / raw)
  To: Sebastian Spaeth, notmuch

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.
-- 
David Edmondson, http://dme.org

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

* Re: notmuch.el: Prefix arg inverts the sort order of notmuch-search.
  2010-02-11 14:01   ` David Edmondson
@ 2010-02-11 14:05     ` Sebastian Spaeth
  2010-02-11 14:20       ` racin
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Spaeth @ 2010-02-11 14:05 UTC (permalink / raw)
  To: notmuch

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

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

* Re: notmuch.el: Prefix arg inverts the sort order of notmuch-search.
  2010-02-11 14:05     ` Sebastian Spaeth
@ 2010-02-11 14:20       ` racin
  2010-02-11 17:23         ` micah anderson
  0 siblings, 1 reply; 6+ messages in thread
From: racin @ 2010-02-11 14:20 UTC (permalink / raw)
  To: Sebastian Spaeth; +Cc: notmuch

Using a prefix arg to invert search order would conflict with my patch http://notmuchmail.org/pipermail/notmuch/2009/000914.html
in which the prefix arg is used to show deleted messages. I don't known which behaviour for prefix patch would be best.

Though we can also add "toggle keys" that toggle search order, or toggle display of deleted messages, which would solve the problem.

Matthieu

----- Mail Original -----
De: "Sebastian Spaeth" <Sebastian@SSpaeth.de>
À: notmuch@notmuchmail.org
Envoyé: Jeudi 11 Février 2010 14h05:28 GMT +00:00 GMT - Grande-Bretagne, Irlande, Portugal
Objet: Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

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
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: notmuch.el: Prefix arg inverts the sort order of notmuch-search.
  2010-02-11 14:20       ` racin
@ 2010-02-11 17:23         ` micah anderson
  0 siblings, 0 replies; 6+ messages in thread
From: micah anderson @ 2010-02-11 17:23 UTC (permalink / raw)
  To: racin, Sebastian Spaeth; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

On Thu, 11 Feb 2010 15:20:54 +0100 (CET), racin@free.fr wrote:

> Using a prefix arg to invert search order would conflict with my patch
> http://notmuchmail.org/pipermail/notmuch/2009/000914.html in which the
> prefix arg is used to show deleted messages. I don't known which
> behaviour for prefix patch would be best.

I always understood a prefix arg to invert the original (or provide a
numeric repetition), but I do not have a wide sample to tell if this is
how most elisp implements it. 

> Though we can also add "toggle keys" that toggle search order, or
> toggle display of deleted messages, which would solve the problem.

There is the 'o' key now which toggles the search order, isn't there? 

m

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

end of thread, other threads:[~2010-02-11 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11 12:19 [PATCH] notmuch.el: Prefix arg inverts the sort order of notmuch-search David Edmondson
2010-02-11 13:42 ` Sebastian Spaeth
2010-02-11 14:01   ` David Edmondson
2010-02-11 14:05     ` Sebastian Spaeth
2010-02-11 14:20       ` racin
2010-02-11 17:23         ` micah anderson

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