[-- Attachment #1: Type: text/plain, Size: 61 bytes --] Sorry, forgot to send this to the list as well as to Eric. [-- Attachment #2: Type: message/rfc822, Size: 1997 bytes --] From: Laura Conrad <lconrad@laymusic.org> To: Eric Abrahamsen <eric@ericabrahamsen.net> Subject: Re: Notmuch as search engine Date: Tue, 12 Apr 2022 14:53:11 -0400 Message-ID: <87tuay16co.fsf@laymusic.org> >>>>> "Eric" == Eric Abrahamsen <eric@ericabrahamsen.net> writes: >> Am I running notmuch wrong? Lots of people (including people on this >> list) seem to be using it with gnus, so it must be possible. Eric> The format of notmuch's search results depends on the switches it is Eric> called with. If you use "--output=files" it will give you filenames. Thanks, that gives me reasonable output from the command line. But adding that to the Nnir Notmuch Additional Switches option in the customize buffer doesn't seem to change what I get from gnus. Eric> I'm curious how you're using notmuch from within Gnus. Both the "old" Eric> nnir library and the "new" gnus-search library know to use the correct Eric> --output switch. What version of Emacs/Gnus are you using? GNU Emacs 27.2.50 (build 1, x86_64-pc-linux-gnu, X toolkit) of 2022-01-27 Gnus V 5.13 I have also tried it on: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26 also with Gnus V 5.13 My .emacs does have: '(nnir-notmuch-additional-switches '("--output=files")) in the section that the configure writes. -- Laura (mailto:lconrad@laymusic.org) (617) 661-8097 233 Broadway, Cambridge, MA 02139 <http://www.laymusic.org/> <http://www.serpentpublications.org> One very useful exercise is to ask a student to sing, just once, as badly as they can. It's amazing what wonderful things come out when you give them that permission. Phillip Langridge, quoted in his New York Times obituary, March 8, 2010 [-- Attachment #3: Type: text/plain, Size: 468 bytes --] -- Laura (mailto:lconrad@laymusic.org) (617) 661-8097 233 Broadway, Cambridge, MA 02139 <http://www.laymusic.org/> <http://www.serpentpublications.org> ...Dickens gave a dinner for his friends every Christmas Eve, in which a tired tramp had to stand outside in the snowstorm under the window and shout every few minutes, "Brr! How cold it is!" -- so that the people inside enjoyed the warmth and the food even more. Harry Mulisch _The Discovery of Heaven_
Laura Conrad <lconrad@laymusic.org> writes:
> Sorry, forgot to send this to the list as well as to Eric.
>
> From: Laura Conrad <lconrad@laymusic.org>
> Subject: Re: Notmuch as search engine
> To: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Tue, 12 Apr 2022 14:53:11 -0400 (4 hours, 8 minutes, 34 seconds ago)
> Message-ID: <87tuay16co.fsf@laymusic.org>
>
>>>>>> "Eric" == Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> >> Am I running notmuch wrong? Lots of people (including people on this
> >> list) seem to be using it with gnus, so it must be possible.
>
> Eric> The format of notmuch's search results depends on the switches it is
> Eric> called with. If you use "--output=files" it will give you filenames.
>
> Thanks, that gives me reasonable output from the command line. But
> adding that to the Nnir Notmuch Additional Switches option in the
> customize buffer doesn't seem to change what I get from gnus.
That switch is already part of nnir's search command, so you shouldn't
have to add it to the additional switches config. Can you un-set that
option and try again?
If it's still not working, I'm guessing that it's actually something
else that's going wrong. If you have the sources installed, you can take
a look at `nnir-run-notmuch' and try replicating the search command on
the command line, or maybe edebug a call?
Laura, how are you configuring the search engine in your .gnus file? I have, for instance, #+begin_src emacs-lisp (setq gnus-secondary-select-methods '((nnml "outlook" (gnus-search-engine gnus-search-notmuch (remove-prefix "/home/ucecesf/Mail") (config-file "/home/ucecesf/.notmuch-config") ) (get-new-mail t)))) #+end_src where the config file includes the lines: ,---- | [database] | path=/home/ucecesf/Mail `---- -- Eric S Fraga with org 9.5.2 in Emacs 29.0.50 on Debian 11.3
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> Laura,
>
> how are you configuring the search engine in your .gnus file? I have,
> for instance,
>
> #+begin_src emacs-lisp
> (setq gnus-secondary-select-methods
> '((nnml "outlook"
> (gnus-search-engine gnus-search-notmuch
> (remove-prefix "/home/ucecesf/Mail")
> (config-file "/home/ucecesf/.notmuch-config")
> )
> (get-new-mail t))))
> #+end_src
>
> where the config file includes the lines:
>
> ,----
> | [database]
> | path=/home/ucecesf/Mail
> `----
This is the newer gnus-search configuration, I had the impression that
Laura is using nnir.
On Wednesday, 13 Apr 2022 at 08:24, Eric Abrahamsen wrote:
> This is the newer gnus-search configuration, I had the impression that
> Laura is using nnir.
Ah, apologies for the noise.
--
Eric S Fraga with org 9.5.2 in Emacs 29.0.50 on Debian 11.3
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Wednesday, 13 Apr 2022 at 08:24, Eric Abrahamsen wrote:
>> This is the newer gnus-search configuration, I had the impression that
>> Laura is using nnir.
>
> Ah, apologies for the noise.
Not at all. It makes it all the more confusing, since that's code that
should have been working for years...
>>>>> "Eric" == Eric Abrahamsen <eric@ericabrahamsen.net> writes: Eric> The format of notmuch's search results depends on the switches it is Eric> called with. If you use "--output=files" it will give you filenames. >> >> Thanks, that gives me reasonable output from the command line. But >> adding that to the Nnir Notmuch Additional Switches option in the >> customize buffer doesn't seem to change what I get from gnus. Eric> That switch is already part of nnir's search command, so you shouldn't Eric> have to add it to the additional switches config. Can you un-set that Eric> option and try again? Yes, no difference. Eric> If it's still not working, I'm guessing that it's actually something Eric> else that's going wrong. If you have the sources installed, you can take Eric> a look at `nnir-run-notmuch' and try replicating the search command on Eric> the command line, or maybe edebug a call? As far as I can see, it's running "notmuch --format=text --output=files <query>", and that works fine from the command line. I attempted to do the edebug thing, but probably did it wrong. It didn't stop when I ran "G G". But I suppose that could mean that nnir doesn't know to be running notmuch? -- Laura (mailto:lconrad@laymusic.org) (617) 661-8097 233 Broadway, Cambridge, MA 02139 <http://www.laymusic.org/> <http://www.serpentpublications.org> There is no such thing as bad publicity except your own obituary. Brendan Behan (1923 - 1964)
Laura, I may not have the full thread but did you post how you specify the search engine to use? I used to have in the configuration for my nnml group, before moving to nnselect: (nnir-search-engine notmuch) -- Eric S Fraga with org 9.5.2 in Emacs 29.0.50 on Debian 11.3
>>>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes: Eric> I may not have the full thread but did you post how you specify the Eric> search engine to use? I have: (setq gnus-select-method '(nnml "private" (gnus-search-engine notmuch))) -- Laura (mailto:lconrad@laymusic.org) (617) 661-8097 233 Broadway, Cambridge, MA 02139 <http://www.laymusic.org/> <http://www.serpentpublications.org> what if war is just a male version of dressing up, Louise Glück, quoted in Dwight Macdonald's New York Times review of her collected poems, November 8, 2012
On Thursday, 14 Apr 2022 at 17:42, Laura Conrad wrote:
> (setq gnus-select-method '(nnml "private" (gnus-search-engine notmuch)))
But if you are using nnir, maybe try what I had, i.e.
(setq gnus-select-method '(nnml "private" (nnir-search-engine notmuch)))
as this was what I had and it worked?
--
Eric S Fraga with org 9.5.2 in Emacs 29.0.50 on Debian 11.3
>>>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes: Eric> On Thursday, 14 Apr 2022 at 17:42, Laura Conrad wrote: >> (setq gnus-select-method '(nnml "private" (gnus-search-engine notmuch))) Eric> But if you are using nnir, maybe try what I had, i.e. Eric> (setq gnus-select-method '(nnml "private" (nnir-search-engine notmuch))) Eric> as this was what I had and it worked? Well, that doesn't work for me either. I still get: gnus-select-newsgroup: Couldn’t request group nnir:nnir-87tuavth0w.fsf: Search produced empty results. Whereas from the command line: notmuch search --format=text --output=files scuttle produces lots of nice results like: /home/lconrad/Mail/laymusic/87119 /home/lconrad/Mail/ding/31033 /home/lconrad/Mail/sent/32975 /home/lconrad/Mail/ding/31032 /home/lconrad/Mail/sent/32974 /home/lconrad/Mail/laymusic/87120 /home/lconrad/Mail/laymusic/87119 -- Laura (mailto:lconrad@laymusic.org) (617) 661-8097 233 Broadway, Cambridge, MA 02139 <http://www.laymusic.org/> <http://www.serpentpublications.org> If I had been the Virgin Mary, I would have said "No." Margaret _Stevie_ Smith
Laura Conrad <lconrad@laymusic.org> writes:
>>>>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
> Eric> On Thursday, 14 Apr 2022 at 17:42, Laura Conrad wrote:
> >> (setq gnus-select-method '(nnml "private" (gnus-search-engine notmuch)))
>
> Eric> But if you are using nnir, maybe try what I had, i.e.
>
> Eric> (setq gnus-select-method '(nnml "private" (nnir-search-engine notmuch)))
>
> Eric> as this was what I had and it worked?
>
> Well, that doesn't work for me either. I still get:
>
> gnus-select-newsgroup: Couldn’t request group nnir:nnir-87tuavth0w.fsf:
> Search produced empty results.
>
> Whereas from the command line:
>
> notmuch search --format=text --output=files scuttle
>
> produces lots of nice results like:
>
> /home/lconrad/Mail/laymusic/87119
> /home/lconrad/Mail/ding/31033
> /home/lconrad/Mail/sent/32975
> /home/lconrad/Mail/ding/31032
> /home/lconrad/Mail/sent/32974
> /home/lconrad/Mail/laymusic/87120
> /home/lconrad/Mail/laymusic/87119
And `nnir-notmuch-remove-prefix' is set to "/home/lconrad/Mail"? It
should be, that would be the default...
>>>>> "Eric" == Eric Abrahamsen <eric@ericabrahamsen.net> writes: Eric> Laura Conrad <lconrad@laymusic.org> writes: >>>>>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes: >> Eric> On Thursday, 14 Apr 2022 at 17:42, Laura Conrad wrote: >> >> (setq gnus-select-method '(nnml "private" (gnus-search-engine >> > notmuch))) >> Eric> But if you are using nnir, maybe try what I had, i.e. >> Eric> (setq gnus-select-method '(nnml "private" Eric> (nnir-search-engine notmuch))) >> Eric> as this was what I had and it worked? >> >> Well, that doesn't work for me either. I still get: >> >> gnus-select-newsgroup: Couldn’t request group nnir:nnir-87tuavth0w.fsf: >> Search produced empty results. >> >> Whereas from the command line: >> >> notmuch search --format=text --output=files scuttle >> >> produces lots of nice results like: >> >> /home/lconrad/Mail/laymusic/87119 >> /home/lconrad/Mail/ding/31033 >> /home/lconrad/Mail/sent/32975 >> /home/lconrad/Mail/ding/31032 >> /home/lconrad/Mail/sent/32974 >> /home/lconrad/Mail/laymusic/87120 >> /home/lconrad/Mail/laymusic/87119 Eric> And `nnir-notmuch-remove-prefix' is set to "/home/lconrad/Mail"? It Eric> should be, that would be the default... Yes. -- Laura (mailto:lconrad@laymusic.org) (617) 661-8097 233 Broadway, Cambridge, MA 02139 <http://www.laymusic.org/> <http://www.serpentpublications.org> From a pound of iron worth a few pennies can be made many thousand watch-springs, which are worth hundreds of thousands. Put to good use the pound that God has given you. Robert Schumann, Preface to 'Album für die Jugend'
Laura Conrad <lconrad@laymusic.org> writes:
>>>>>> "Eric" == Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
> Eric> Laura Conrad <lconrad@laymusic.org> writes:
> >>>>>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> >>
> Eric> On Thursday, 14 Apr 2022 at 17:42, Laura Conrad wrote:
> >> >> (setq gnus-select-method '(nnml "private" (gnus-search-engine
> >> > notmuch)))
> >>
> Eric> But if you are using nnir, maybe try what I had, i.e.
> >>
> Eric> (setq gnus-select-method '(nnml "private"
> Eric> (nnir-search-engine notmuch)))
> >>
> Eric> as this was what I had and it worked?
> >>
> >> Well, that doesn't work for me either. I still get:
> >>
> >> gnus-select-newsgroup: Couldn’t request group nnir:nnir-87tuavth0w.fsf:
> >> Search produced empty results.
> >>
> >> Whereas from the command line:
> >>
> >> notmuch search --format=text --output=files scuttle
> >>
> >> produces lots of nice results like:
> >>
> >> /home/lconrad/Mail/laymusic/87119
> >> /home/lconrad/Mail/ding/31033
> >> /home/lconrad/Mail/sent/32975
> >> /home/lconrad/Mail/ding/31032
> >> /home/lconrad/Mail/sent/32974
> >> /home/lconrad/Mail/laymusic/87120
> >> /home/lconrad/Mail/laymusic/87119
>
> Eric> And `nnir-notmuch-remove-prefix' is set to "/home/lconrad/Mail"? It
> Eric> should be, that would be the default...
>
> Yes.
If notmuch is actually returning an error, which I suspect it isn't, you
can set `gnus-verbose' to something higher than 6, and it will show you
the buffer with the error message.
If (as I suspect) that doesn't do anything, try evaluating this version
of `nnir-run-notmuch'. It should pop up a buffer showing you the results
of the notmuch call, and put some messages in the *Messages* buffer
about the parsing of individual search results.
(defun nnir-run-notmuch (query server &optional groups)
"Run QUERY against notmuch.
Returns a vector of (group name, file name) pairs (also vectors,
actually). If GROUPS is a list of group names, use them to
construct path: search terms (see the variable
`nnir-notmuch-filter-group-names-function')."
(save-excursion
(let* ((qstring (cdr (assq 'query query)))
(prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server))
artlist
(article-pattern (if (string-match "\\`nnmaildir:"
(gnus-group-server server))
":[0-9]+"
"^[0-9]+$"))
(groups (when nnir-notmuch-filter-group-names-function
(delq nil
(mapcar nnir-notmuch-filter-group-names-function
(mapcar #'gnus-group-short-name groups)))))
(pathquery (when groups
(concat " ("
(mapconcat (lambda (g)
(format "path:%s" g))
groups " or")
")")))
artno dirnam filenam)
(when (equal "" qstring)
(error "notmuch: You didn't enter anything"))
(set-buffer (get-buffer-create nnir-tmp-buffer))
(erase-buffer)
(if groups
(message "Doing notmuch query %s on %s..."
qstring (mapconcat #'identity groups " "))
(message "Doing notmuch query %s..." qstring))
(when groups
(setq qstring (concat qstring pathquery)))
(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
))
(exitstatus
(progn
(message "%s args: %s" nnir-notmuch-program
(mapconcat #'identity (nthcdr 4 cp-list) " ")) ;; ???
(apply #'call-process cp-list))))
(unless (or (null exitstatus)
(zerop exitstatus))
(nnheader-report 'nnir "Couldn't run notmuch: %s" exitstatus)))
(display-buffer nnir-tmp-buffer)
;; The results are output in the format of:
;; absolute-path-name
(goto-char (point-min))
(while (not (eobp))
(setq filenam (buffer-substring-no-properties (line-beginning-position)
(line-end-position))
artno (file-name-nondirectory filenam)
dirnam (file-name-directory filenam))
(forward-line 1)
(message "Directory/group: %s; article number %s" dirnam artno)
;; don't match directories
(when (string-match article-pattern artno)
(when (not (null dirnam))
(message "Accepting result %s : %s" dirnam artno)
(nnir-add-result dirnam artno "" prefix server artlist))))
(message "Massaging notmuch output...done")
artlist)))