Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep

From: Visuwesh <[email-masked]>
Date: Wed, 02 Oct 2024 10:53:35 +0530

[திங்கள் செப்டம்பர் 30, 2024] Daniel Cerqueira wrote:

> Using Gnus, doing 'G G' on a nnmaildir group gives me this error:
>
> ```
> nnselect-generate-artlist: gnus-search-run-query on
> ((search-query-spec (query . subject:meditation) (raw))
> (search-group-spec (nnmaildir:email archive clients crypto-archive
> crypto-sent drafts inbox git git-l10n job-hunting list medical penpal
> poker sent shopping software spam wellness writing) (nndraft
> nndraft:delayed) (nndraft:nnmaildir:email nndraft:drafts))) gave error
> (wrong-type-argument stringp nil)
> Group nnselect:nnselect-878qv99nf2.fsf contains no messages
> ```
>
> The relevant configuration of `~/.emacs` is:
>
> ```
> (setq message-kill-buffer-on-exit t) ;; C-c C-c kills the buffer
> (setq gnus-check-bogus-newsgroups t) ;; delete bogus newsgroups at gnus startup
>
> ;;; open gnus in topics mode
> (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
>
> ;;; lines with time
> (setq gnus-summary-line-format "%U%R%z%I %4L %(%[%-25,25D %-23,23f%]%) %s
> ")
>
> ;;; order threads by most recent date
> (setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date))
>
> ;; hide summary lines of articles that have scores lower than this
> (setq gnus-summary-expunge-below -9)
>
>
> (setq gnus-select-method
>       `(nnmaildir "email"
>                   (directory ,(expand-file-name "~/.mail"))
>                   (nnmaildir-directory ,(expand-file-name "~/.mail"))))
>
> (setq gnus-message-archive-group '((if (message-news-p) "list" "sent")))
> (setq nndraft-directory (expand-file-name "~/.mail/drafts"))
>
> (setq message-directory (expand-file-name "~/.mail"))
> (setq gnus-directory (expand-file-name "~/.emacs.d/news"))
> (setq nnfolder-directory (expand-file-name "~/.mail/archive"))
> (setq nnfolder-directory "~/.mail/archive")
> (setq nnfolder-active-file "~/.mail/archive/active")
> (setq gnus-server-alist '(("archive" nnfolder "archive"
>                            (nnfolder-directory "~/.mail/archive")
>                            (nnfolder-active-file "~/.mail/archive/active")
>                            (nnfolder-get-new-mail nil)
>                            (nnfolder-inhibit-expiry t))))
> (setq mail-default-directory "~/.mail")
> (setq smtpmail-queue-dir "~/.mail/.queued-mail")
>
> ;; gnus search
> (setq gnus-search-default-engines
>       '((nnimap . gnus-search-imap)
>         (nnmaildir . gnus-search-find-grep)
>         (nnselect . gnus-search-nnselect)))
> ```
>
> Gnus is running good, and I am trying to add searching capabilities to
> my, already organized, email.
>
> Doing an epheremal search using 'G G' with point on a nnmaildir group is
> giving me the error above. Doing the same of my Topic of my nnmaildir
> groups also give me this error.
>
> My GNU system has `grep` installed. I don't want to do searches on my
> maildirs with any other searching methods/executables.
>

IIRC, this is because the grep method does not change to the maildir
directory properly.  Since I do not know the maildir terminologies well,
if you say G G on a group named "nnmaildir+mail:spam" it does not
search in ~/.mail/spam/ but in ~/.mail/ using find with -maxdepth
1, which obviously fails.

[ AFAIR, the workaround I posted in bug#72196 does not work for the grep
  method.  ]