Gnus development mailing list
 help / color / mirror / Atom feed
From: myglc2 <myglc2@gmail.com>
To: ding@gnus.org
Subject: Re: notmuch is limited to a single local mail store, right?
Date: Fri, 15 Jan 2016 22:47:52 -0500	[thread overview]
Message-ID: <87h9iedw2f.fsf@gmail.com> (raw)
In-Reply-To: <8760yubnl7.fsf@tullinup.koldfront.dk>

Peter Münster <pmlists@free.fr> writes:

> On Fri, Jan 15 2016, myglc2 wrote:
>
>> notmuch does not support making more than one index.
>
> What about:
> NOTMUCH_CONFIG=here  notmuch
> NOTMUCH_CONFIG=there notmuch
> ?

asjo@koldfront.dk (Adam Sjøgren) writes:

> On Fri, Jan 15 2016, myglc2 wrote:
>
>> notmuch does not support making more than one index.
>
> I think you are overinterpreting in this statement.

OOPS! Hey, many thanks for straightening me out on this.

So... I tried passing notmuch config in as a switch like so ...

;; notmuch on 2nd test maildir folder
  (add-to-list 'gnus-secondary-select-methods
	       '(nnmaildir "foobar.2"
			   (directory "~/Maildir/foobar.2")
			   (nnir-search-engine notmuch)
			   (nnir-notmuch-remove-prefix
			    "/home/glc/Maildir/foobar.2/")
			   (nnir-notmuch-additional-switches
			    '("--config=/home/glc/.notmuch-config.2")
			    )
			   )
	       )

... and discovered two issues. When I followed the help setting the
switches ...

  ;; nnir-notmuch-additional-switches is a variable defined in ‘nnir.el’.
  ;; Its value is nil
  ;;
  ;; Documentation:
  ;; *A list of strings, to be given as additional arguments to notmuch.
  ;;
  ;; Note that this should be a list.  I.e., do NOT use the following:
  ;;     (setq nnir-notmuch-additional-switches "-i -w") ; wrong
  ;; Instead, use this:
  ;;     (setq nnir-notmuch-additional-switches '("-i" "-w"))

... there was a spurious 'quote( )' passed to notmuch. So ... I removed
the leading quote, and the argument list shown in the message buffer
looked better. So maybe the help should be changed to read ...

  ;; Instead, use this:
  ;;     (setq nnir-notmuch-additional-switches ("-i" "-w"))

However, The order in which the additional switches are passed ...


notmuch args: search --format=text --output=files --config=/home/glc/.notmuch-config.2 olivia
Massaging notmuch output...done
Search produced empty results.

... and as constructed by this nnir.el code ...

      (let* ((cp-list `( ,nnir-notmuch-program
                         nil            ; input from /dev/null
                         t              ; output
                         nil            ; don't redisplay
                         "search"
                         "--format=text"
                         "--output=files"
                         ,@(nnir-read-server-parm 'nnir-notmuch-additional-switches server)
                         ,qstring       ; the query, in notmuch format
                         ))

... made notmuch unhappy. So I 'fixed' nnir-run-notmuch by changing the
order ...

      (let* ((cp-list `( ,nnir-notmuch-program
                         nil            ; input from /dev/null
                         t              ; output
                         nil            ; don't redisplay
                         ,@(nnir-read-server-parm 'nnir-notmuch-additional-switches server)
                         "search"
                         "--format=text"
                         "--output=files"
                         ,qstring       ; the query, in notmuch format
                         ))

... which made notmuch happy ...

notmuch args: --config=/home/glc/.notmuch-config.2 search --format=text
--output=files olivia Massaging notmuch output...done

So... Bottom line, a gnus config like this ...

;; notmuch on 2nd test maildir folder
  (add-to-list 'gnus-secondary-select-methods
	       '(nnmaildir "foobar.2"
			   (directory "~/Maildir/foobar.2")
			   (nnir-search-engine notmuch)
			   (nnir-notmuch-program "notmuch")
			   (nnir-notmuch-remove-prefix
			    "/home/glc/Maildir/foobar.2/")
			   (nnir-notmuch-additional-switches
			    ("--config=/home/glc/.notmuch-config.2")
			    )
			   )
	       )

... with the minor change to nnir.el shown above, allows multiple
notmuch indexes.

BTW, I also tried the 'NOTMUCH_CONFIG=here notmuch' scheme suggested by
Peter hoping it might not require any code changes. I tried this ...

  ;; notmuch on 3rdd test maildir folder
  (add-to-list 'gnus-secondary-select-methods
  	       '(nnmaildir "foobar.3"
  			   (directory "~/Maildir/foobar.3")
  			   (nnir-search-engine notmuch)
			   ;; Note: this fails because 'call-process'
			   ;; punts on the environmental var
  			   (nnir-notmuch-program
			    "NOTMUCH_CONFIG=${HOME}/.notmuch-config.3 notmuch")
  			   (nnir-notmuch-remove-prefix
  			    "/home/glc/Maildir/foobar.3/")
  			   )
  	       )

But I discovered that a global value of nnir-notmuch-program is used by
nnir-run-notmuch. I did a little hack to pick up the server-specific
value like so ...

      (let* ((cp-list `(,(nnir-read-server-parm 'nnir-notmuch-program server)
                         nil            ; input from /dev/null
                         t              ; output
                         nil            ; don't redisplay
                         ,@(nnir-read-server-parm 'nnir-notmuch-additional-switches server)
                         "search"
                         "--format=text"
                         "--output=files"
                         ,qstring       ; the query, in notmuch format
                         ))

... but then ...

                (apply 'call-process cp-list))))

... produced this error ...

c-append-to-state-cache: Searching for program: No such file or
directory, NOTMUCH_CONFIG=${HOME}/.notmuch-config.3 notmuch

So... how do one pass an environmental from an init file into a process?

Many thanks, - George




      reply	other threads:[~2016-01-16  3:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15  2:36 myglc2
2016-01-15  3:28 ` Eric Abrahamsen
2016-01-15 12:46   ` myglc2
2016-01-15 13:12     ` Erik Colson
2016-01-15 16:43       ` myglc2
2016-02-06  0:06         ` gnus async prefetch and nnimap Erik Colson
2016-02-06  1:13           ` Eric Abrahamsen
2016-02-06  1:15             ` Eric Abrahamsen
2016-08-01 21:29               ` IMAP changes timestamp when moving an article to another group Erik Colson
2016-08-01 23:49                 ` Greg Troxel
2016-08-05 19:21                   ` Steinar Bang
2016-08-16 13:22                     ` Erik Colson
2017-09-05 16:14                       ` Steinar Bang
2017-09-09  7:47                         ` Steinar Bang
2017-09-09 15:12                           ` Eric Abrahamsen
2017-09-10 10:03                             ` Steinar Bang
2017-09-14 22:29                               ` Eric Abrahamsen
2017-09-15 15:42                                 ` Steinar Bang
2017-09-15 21:52                                   ` Eric Abrahamsen
2018-04-11 20:25                                     ` Lars Ingebrigtsen
2018-04-11 22:08                                       ` Eric Abrahamsen
2016-01-15  5:30 ` notmuch is limited to a single local mail store, right? Adam Sjøgren
2016-01-15  7:49   ` Alan Schmitt
2016-01-15  8:17     ` Adam Sjøgren
2016-01-15 13:03       ` myglc2
2016-01-16  3:56         ` myglc2
2016-01-15 12:50   ` myglc2
2016-01-15 14:25     ` Peter Münster
2016-01-15 19:19     ` Adam Sjøgren
2016-01-15 20:21     ` Adam Sjøgren
2016-01-16  3:47       ` myglc2 [this message]

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=87h9iedw2f.fsf@gmail.com \
    --to=myglc2@gmail.com \
    --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).