Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: Create a group from a list of message-ids
Date: Fri, 29 Nov 2013 10:41:22 +0700	[thread overview]
Message-ID: <87eh5zg9i5.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87zjooivk4.fsf@gmail.com>

Alexander Baier <lexi.baier@gmail.com> writes:

> On 13-11-26 05:06 Eric Abrahamsen wrote:
>> Frank Terbeck <ft@bewatermyfriend.org> writes:
>>
>>> Eric Abrahamsen wrote:
>>> [...]
>>>> It also comes with its own tagging structure and all kinds of stuff I
>>>> don't use. The superfluity bugs me a little, but the searching is nice
>>>> enough that it doesn't matter. A nnir plugin for notmuch might actually
>>>> be nice.
>>>
>>> Actually, at least in the git version of gnus, ‘nnir’ seems to feature
>>> support for ‘notmuch’ (ie. there is a defcustom ‘nnir-notmuch-program’
>>> and a defun ‘nnir-run-notmuch’).
>>>
>>> Since ‘mu’ seems to work fairly similarly to notmuch, I would guess
>>> that, this part would serve as a source for ideas for ‘mu’-integration.
>>>
>>> Regards, Frank
>>
>> Thanks to both of you for pointing that out! I had no idea that was
>> there, but would definitely prefer using a more gnus-y interface. I set
>> it up like so:
>>
>> (setq nnir-method-default-engines  '((nnimap . notmuch) (nntp . gmane)))
>>
>> And gave it a shot.
>>
>> It didn't work for me for two reasons. I have several different imap
>> servers, all run through dovecot with a maildir structure. They're all
>> under ~/.mail, like ~/.mail/acc1 ~/mail/acc2 etc. That means
>> nnir-notmuch-remove-prefix has to be set to an appropriate value for
>> each server, which you can do with server parameters. But that means you
>> can only search one server at a time (which I guess you'd do by putting
>> a notmuch-group key into the query? I don't even know how to do that).
>> That isn't really what I want -- I'd like to search all my mail at once.
>> And even if I had to do it server by server, it seems like
>> `nnir-run-notmuch' should be able to figure out how to filter to that
>> server by itself...

[...]

> Hi Eric,
>
> I am digging this up again, as I had some time to look at this myself
> and maybe have an idea of how to tackle this problem.
>
> Now, as I see it, the thing preventing us from searching multiple
> servers is the fact that nnir-compose-result might be passed a server
> that does not fit to the matched article as this may come from a
> different server.  So I think, solving this problem is "just" a matter
> of teaching nnir-compose-result to correct the server it is passed in
> case it does not fit to the matched article.  For nnir-compose-result to
> be able to so we need to tell it how to extract the server from the
> dirnam parameter.  The question is, how do we tell nnir-compose-result
> this?  Do you have any ideas on this?

Right now, servers to search are chosen with
`gnus-group-make-nnir-group', which does one of three things:

1. Extracts the server from the group under point
2. Extracts server from the marked groups, if groups are marked
3. If we're in the *Server* buffer, use the server under point

Options one and three obviously only provide a single server, option two
results in something like this (I marked the INBOXs of three different accounts):

(("nnimap:acc1" ("nnimap+acc1:INBOX"))
 ("nnimap:acc2" ("nnimap+acc2:INBOX"))
 ("nnimap:acc3" ("nnimap+acc3:INBOX")))

What eventually happens is that `nnir-run-query' loops
over each server in the above sexp (ignoring the group), and calls
`nnir-run-notmuch' once for each server. Each loop passes the same
search results to `nnir-compose-results', which filters the results
based on the current server.

So theoretically if you'd marked one group from each of the accounts you
wanted to search, you'd get full results. We should be able to do the
same thing by wrapping `gnus-group-make-nnir-group' and force-feeding it
arguments:

(setq notmuch-servers-to-search '(("nnimap:acc1")
                                  ("nnimap:acc2")
                                  ("nnimap:acc3")))

(defun nnir-search-all-servers (&optional query-spec)
  (interactive)
  (setq query-spec (or query-spec
		       (list (cons 'query
			      (read-string "Query: " nil 'nnir-search-history)))))
  (gnus-group-make-nnir-group
   nil (list
	(cons 'nnir-query-spec query-spec)
	(cons 'nnir-group-spec notmuch-servers-to-search))))


Can you set notmuch-servers-to-search appropriately, and test that? It's
hard for me to test as I'm still having the "is it maildir or isn't it"
problem, as well as the "I don't have an INBOX" problem.

Thanks,
Eric




  reply	other threads:[~2013-11-29  3:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-23 11:50 Alexander Baier
2013-11-25  2:02 ` Dave Goldberg
2013-11-25  8:52   ` Alexander Baier
2013-11-25  8:58     ` Frank Terbeck
2013-11-25  9:11       ` Alexander Baier
2013-11-25  9:01     ` Eric Abrahamsen
2013-11-25  9:13       ` Alexander Baier
2013-11-25 13:20         ` Eric Abrahamsen
2013-11-25 14:08           ` Alexander Baier
2013-11-25 15:26             ` Eric Abrahamsen
2013-11-25 15:44               ` Frank Terbeck
2013-11-26  4:06                 ` Eric Abrahamsen
2013-11-27  5:16                   ` Eric Abrahamsen
2013-11-27  7:34                     ` Alexander Baier
2013-11-27  8:10                       ` Eric Abrahamsen
2013-11-27  8:22                         ` Alexander Baier
2013-11-28 12:02                   ` Alexander Baier
2013-11-29  3:41                     ` Eric Abrahamsen [this message]
2013-11-30 18:56                       ` Alexander Baier
2013-11-25 16:11               ` Alexander Baier
2013-11-25  9:28   ` Pedro Silva
2013-11-25  9:44     ` Alexander Baier

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

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

  git send-email \
    --in-reply-to=87eh5zg9i5.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).