Reported by: Daniel Cerqueira <dan.list <at> lispclub.com>
Date: Tue, 1 Oct 2024 15:55:02 UTC
Severity: normal
Found in version 29.4
To reply to this bug, email your comments to 73581 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Tue, 01 Oct 2024 15:55:02 GMT) Full text and rfc822 format available.Daniel Cerqueira <dan.list <at> lispclub.com>
:bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
.
(Tue, 01 Oct 2024 15:55:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: bug-gnu-emacs <at> gnu.org Subject: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Mon, 30 Sep 2024 16:44:26 +0100
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. Did not crash. In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu) of 2024-09-29 built on torre Repository revision: 6a299b3caceb2c73b932ba73849738faa8c5d975 Repository branch: release System Description: Parabola GNU/Linux-libre Configured using: 'configure --without-x --with-x=no --with-x-toolkit=no --without-dbus --without-gconf --without-gsettings --without-toolkit-scroll-bars --without-xim --disable-largefile --with-modules --without-libsystemd --without-cairo --without-gpm' Configured features: ACL GMP GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY INOTIFY PDUMPER SECCOMP SOUND SQLITE3 THREADS TREE_SITTER XIM ZLIB Important settings: value of $LANG: pt_PT.UTF-8 locale-coding-system: utf-8-unix Major mode: ELisp/l Minor modes in effect: bug-reference-prog-mode: t erc-list-mode: t erc-menu-mode: t erc-ring-mode: t erc-pcomplete-mode: t erc-track-mode: t erc-match-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-netsplit-mode: t erc-autoaway-mode: t erc-log-mode: t windmove-mode: t shell-dirtrack-mode: t gpm-mouse-mode: t rainbow-delimiters-mode: t paredit-mode: t emms-mode-line-mode: t emms-playing-time-display-mode: t emms-playing-time-mode: t jabber-activity-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t erc-networks-mode: t server-mode: t winner-mode: t display-time-mode: t electric-pair-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t tab-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: linux auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/guest/me/programming/desktop/emacs-jabber/lisp/jabber-autoloads hides /home/guest/me/programming/desktop/emacs-jabber/jabber-autoloads /home/guest/.emacs.d/elpa/transient-20240918.1138/transient hides /usr/local/share/emacs/29.4/lisp/transient Features: (shadow emacsbug bug-reference grep apropos info-look emacs-news-mode face-remap gnus-search markdown-mode noutline outline vc-git diff-mode vc-dispatcher webjump view diary-lib diary-loaddefs solar cal-dst holidays holiday-loaddefs cal-move mailalias erc-list erc-menu erc-ring erc-pcomplete erc-track erc-match erc-button erc-fill erc-stamp erc-netsplit erc-autoaway erc-log dired-aux ispell pcmpl-unix pcmpl-gnu canlock cl-print re-builder tabify imenu man epa-mail transpose-frame windmove mail-extr gnus-bcklg compile expand-region text-mode-expansions html-mode-expansions er-basic-expansions expand-region-core expand-region-custom misearch multi-isearch textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check eww xdg gnus-ml jka-compr disp-table mule-util display-line-numbers shortdoc gnus-async gnus-cite gnus-cus gnus-demon gnus-diary nndiary gnus-draft gnus-dup gnus-fun gnus-html url-queue gnus-kill gnus-logic gnus-mh mh-comp mh-scan mh-gnus mh-e mh-buffers mh-loaddefs gnus-registry registry rmailsum rmail gnus-salt gnus-uu yenc gnus-vm nnselect help-fns radix-tree qp cus-edit cus-start cus-load jabber-rtt captain sasl-scram-rfc sasl-scram-sha-1 rfc2104 hex-util sh-script rx smie treesit executable files-x shell pcomplete gnus-topic mm-archive url-http url-gw url-cache url-auth nndraft nnmh nnrss utf-7 epa-file network-stream nsm nnfolder nnmaildir gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache t-mouse term/linux rainbow-delimiters paredit go-translate go-translate-v2 gts-engine-youdao gts-engine-stardict gts-engine-deepl gts-engine-google-rpc gts-engine-google gts-engine-bing gts-implements gts-faces gts-core warnings icons gt-text-utility gt-engine-echo gt-engine-chatgpt gt-engine-youdao gt-engine-stardict gt-engine-deepl gt-engine-google-rpc gt-engine-google gt-engine-bing gt-extension gt-faces gt-core let-alist transient edmacro kmacro emms-idapi-browser emms-idapi emms-idapi-musicbrainz emms-mpris emms-librefm-stream emms-librefm-scrobbler emms-playlist-limit emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-volume easy-mmode emms-volume-sndioctl emms-volume-mixerctl emms-volume-pulse emms-volume-amixer emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq emms-lyrics emms-url emms-streams emms-show-all emms-tag-editor emms-tag-tracktag emms-mark emms-mode-line emms-cache emms-info-native emms-info-native-spc emms-info-native-mp3 emms-info-native-ogg emms-info-native-opus emms-info-native-flac emms-info-native-vorbis bindat emms-info-tinytag emms-info-metaflac emms-info-opusinfo emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mpv emms-playing-time emms-player-mplayer emms-player-simple emms-source-playlist emms-source-file locate emms-setup emms-info-exiftool emms-info emms-later-do emms emms-compat jabber-httpupload jabber jabber-time jabber-autoaway jabber-vcard-avatars jabber-chatstates jabber-events jabber-vcard jabber-avatar jabber-activity jabber-watch jabber-modeline jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion jabber-muc-nick-completion hippie-exp comint ansi-osc ansi-color jabber-muc jabber-bookmarks jabber-muc-nick-coloring color jabber-browse jabber-search jabber-register jabber-widget jabber-chat jabber-history jabber-chatbuffer jabber-roster jabber-carbons jabber-presence jabber-private jabber-logon jabber-conn srv dns starttls jabber-core jabber-keepalive jabber-ping jabber-disco jabber-iq jabber-console sgml-mode facemenu jabber-truncate ewoc jabber-alert jabber-keymap jabber-sasl sasl sasl-anonymous sasl-login sasl-plain jabber-menu jabber-util jabber-xml goto-addr fsm jabber-autoloads weri erc-goodies erc thingatpt pp format-spec erc-backend erc-networks erc-common erc-compat compat compat-30 erc-loaddefs ebdb-message ebdb-gnus gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range message yank-media puny dired dnd dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 gmm-utils mailheader gnus-win ebdb-mua ebdb-com crm ebdb-format ebdb regexp-opt mailabbrev eieio-opt cl-extra help-mode speedbar ezimage dframe find-func eieio-base cal-menu calendar cal-loaddefs timezone server pinentry advice mm-url gnus nnheader gnus-util text-property-search time-date range wid-edit smtpmail sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils winner ring ido time image elec-pair my-lisp 0x0-autoloads 0xc-autoloads 2048-game-autoloads 2bit-autoloads 4clojure-autoloads captain-autoloads clhs-autoloads ebdb-autoloads emms-autoloads expand-region-autoloads fsm-autoloads ledger-mode-autoloads magit-autoloads pcase magit-section-autoloads dash-autoloads markdown-mode-autoloads paredit-autoloads pinentry-autoloads plisp-mode-autoloads po-mode-autoloads rainbow-delimiters-autoloads request-autoloads s-autoloads srv-autoloads transient-autoloads transpose-frame-autoloads with-editor-autoloads info tool-bar compat-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads inotify lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 1817214 244127) (symbols 48 138452 33) (strings 32 363961 65668) (string-bytes 1 15169011) (vectors 16 111054) (vector-slots 8 3315957 244523) (floats 8 1026 1222) (intervals 56 138365 3776) (buffers 984 58))
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Wed, 02 Oct 2024 05:52:01 GMT) Full text and rfc822 format available.Message #8 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep 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. ]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Thu, 10 Apr 2025 10:55:01 GMT) Full text and rfc822 format available.Message #11 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Thu, 10 Apr 2025 11:54:05 +0100
I am coming back to this issue. It still is unresolved. I have made some progress, but still I get an error. Here is what I have done: My search configuration: (setq gnus-search-default-engines '((nnimap . gnus-search-imap) ;; (nnmaildir . gnus-search-find-grep) ;; (nnselect . gnus-search-nnselect) (nnselect . gnus-search-find-grep))) (setq gnus-select-method `(nnmaildir "email" (directory ,(expand-file-name "~/Mail")) (remove-prefix ,(expand-file-name "~/Mail")) (nnmaildir-directory ,(expand-file-name "~/Mail")) (gnus-search-engine gnus-search-find-grep))) My error message: nnselect-generate-artlist: gnus-search-run-query on ((search-query-spec (query . parabéns) (raw)) (search-group-spec (nnmaildir:email friends))) gave error (wrong-type-argument stringp nil) nnselect-generate-artlist: nil on nil gave error (void-function nil) [2 times] gnus-request-group: Wrong type argument: stringp, nil
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Thu, 10 Apr 2025 13:20:02 GMT) Full text and rfc822 format available.Message #14 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Thu, 10 Apr 2025 18:15:31 +0530
[வியாழன் ஏப்ரல் 10, 2025] Daniel Cerqueira wrote: > I am coming back to this issue. It still is unresolved. > > I have made some progress, but still I get an error. Here is what I > have done: > > > My search configuration: > > (setq gnus-search-default-engines > '((nnimap . gnus-search-imap) > ;; (nnmaildir . gnus-search-find-grep) > ;; (nnselect . gnus-search-nnselect) > (nnselect . gnus-search-find-grep))) > > (setq gnus-select-method > `(nnmaildir "email" > (directory ,(expand-file-name "~/Mail")) > (remove-prefix ,(expand-file-name "~/Mail")) > (nnmaildir-directory ,(expand-file-name "~/Mail")) > (gnus-search-engine gnus-search-find-grep))) > > > My error message: > > nnselect-generate-artlist: gnus-search-run-query on ((search-query-spec (query . parabéns) (raw)) (search-group-spec (nnmaildir:email friends))) gave error (wrong-type-argument stringp nil) > nnselect-generate-artlist: nil on nil gave error (void-function nil) [2 times] > gnus-request-group: Wrong type argument: stringp, nil There are a number of problems with gnus-search-find-grep and its interaction with a nnmaildir virtual server: 1. It assumes that every mail server uses the server option SERVER-directory when nnmaildir uses only directory. 2. It might not be obvious but your query should be grep:parabéns IIUC. 3. However, (2) won't solve the issue because of the problematic find command that I talked about in the last mail. You can work around this. 4. Its conversion of nnmaildir mail filename to article number is not correct. With all that accounted for, I ended up with the (ugly?) patch below. diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 41915a0e3c0..fa5eaf936b7 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1980,8 +1980,11 @@ gnus-search-run-search &optional groups) "Run find and grep to obtain matching articles." (let* ((method (gnus-server-to-method server)) - (sym (intern - (concat (symbol-name (car method)) "-directory"))) + ;; `nnmaildir' backends use the 'directory' setting. + (sym (if (eq (car method) 'nnmaildir) + 'directory + (intern + (concat (symbol-name (car method)) "-directory")))) (directory (cadr (assoc sym (cddr method)))) (regexp (alist-get 'grep query)) (grep-options (slot-value engine 'grep-options)) @@ -1996,6 +1999,11 @@ gnus-search-run-search #'vconcat (mapcar (lambda (x) (let ((group x) + (nnmaildir-strip-regexp + (concat (regexp-quote (gnus-group-real-name x)) + "/\\(?:new\\|cur\\)/")) + (nnmaildir-strip-repl + (concat (gnus-group-real-name x) "/")) artlist) (gnus-message 7 "Searching %s using find-grep..." (or group server)) @@ -2003,7 +2011,7 @@ gnus-search-run-search (set-buffer buffer) (if (> gnus-verbose 6) (pop-to-buffer (current-buffer))) - (cd directory) ; Using relative paths simplifies + (cd directory) ; Using relative paths simplifies ; postprocessing. (let ((group (if (not group) @@ -2029,28 +2037,49 @@ gnus-search-run-search (save-excursion (apply #'call-process "find" nil t - "find" group "-maxdepth" "1" "-type" "f" - "-name" "[0-9]*" "-exec" - (slot-value engine 'grep-program) - `("-l" ,@(and grep-options - (split-string grep-options "\\s-" t)) - "-e" ,regexp "{}" "+")))) + "find" + (delq + nil ; nil can be present if GREP-OPTIONS=nil. + `(,@(if (eq (car method) 'nnmaildir) + (list (concat group "/cur") + (concat group "/new")) + group) + "-maxdepth" "1" "-type" "f" + "-name" "[0-9]*" "-exec" + ,(slot-value engine 'grep-program) + "-l" ,@(and grep-options + (split-string grep-options "\\s-" t)) + "-e" ,regexp "{}" "+"))))) ;; Translate relative paths to group names. (while (not (eobp)) - (let* ((path (split-string - (buffer-substring - (point) - (line-end-position)) - "/" t)) - (art (string-to-number (car (last path))))) + (let* ((path (buffer-substring + (point) + (line-end-position))) + (path (split-string (if (eq (car method) 'nnmaildir) + (replace-regexp-in-string + nnmaildir-strip-regexp + nnmaildir-strip-repl + path) + path) + "/" t)) + (art (car (last path)))) (while (string= "." (car path)) (setq path (cdr path))) (let ((group (mapconcat #'identity (cl-subseq path 0 -1) "."))) (push - (vector (gnus-group-full-name group server) art 0) + (vector (gnus-group-full-name group server) + ;; FIXME: Code duplication. This is + ;; copied over from + ;; `gnus-search-indexed-parse-output'. + (if (string-match-p "\\`[[:digit:]]+\\'" art) + (string-to-number art) + (nnmaildir-base-name-to-article-number + (substring art 0 (string-search ":" art)) + group (string-remove-prefix "nnmaildir:" server))) + 0) artlist)) (forward-line 1))) (gnus-message 7 "Searching %s using find-grep...done"
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Thu, 10 Apr 2025 13:30:02 GMT) Full text and rfc822 format available.Message #17 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Thu, 10 Apr 2025 18:59:02 +0530
[வியாழன் ஏப்ரல் 10, 2025] Visuwesh wrote: > With all that accounted for, I ended up with the (ugly?) patch below. Here's a slightly better patch which directly edits the buffer text instead of working with strings. diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 41915a0e3c0..1f66225318c 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1980,8 +1980,11 @@ gnus-search-run-search &optional groups) "Run find and grep to obtain matching articles." (let* ((method (gnus-server-to-method server)) - (sym (intern - (concat (symbol-name (car method)) "-directory"))) + ;; `nnmaildir' backends use the 'directory' setting. + (sym (if (eq (car method) 'nnmaildir) + 'directory + (intern + (concat (symbol-name (car method)) "-directory")))) (directory (cadr (assoc sym (cddr method)))) (regexp (alist-get 'grep query)) (grep-options (slot-value engine 'grep-options)) @@ -1996,6 +1999,12 @@ gnus-search-run-search #'vconcat (mapcar (lambda (x) (let ((group x) + (nnmaildir-strip-regexp + ;; TODO: Does it need the ^ anchor? + (concat (regexp-quote (gnus-group-real-name x)) + "/\\(?:new\\|cur\\)/")) + (nnmaildir-strip-repl + (concat (gnus-group-real-name x) "/")) artlist) (gnus-message 7 "Searching %s using find-grep..." (or group server)) @@ -2003,7 +2012,7 @@ gnus-search-run-search (set-buffer buffer) (if (> gnus-verbose 6) (pop-to-buffer (current-buffer))) - (cd directory) ; Using relative paths simplifies + (cd directory) ; Using relative paths simplifies ; postprocessing. (let ((group (if (not group) @@ -2029,28 +2038,49 @@ gnus-search-run-search (save-excursion (apply #'call-process "find" nil t - "find" group "-maxdepth" "1" "-type" "f" - "-name" "[0-9]*" "-exec" - (slot-value engine 'grep-program) - `("-l" ,@(and grep-options - (split-string grep-options "\\s-" t)) - "-e" ,regexp "{}" "+")))) - + "find" + (delq + nil ; nil can be present if GREP-OPTIONS=nil. + `(,@(if (eq (car method) 'nnmaildir) + (list (concat group "/cur") + (concat group "/new")) + group) + "-maxdepth" "1" "-type" "f" + "-name" "[0-9]*" "-exec" + ,(slot-value engine 'grep-program) + "-l" ,@(and grep-options + (split-string grep-options "\\s-" t)) + "-e" ,regexp "{}" "+"))))) + + ;; When searching in a maildir directory, change the + ;; filenames to not have cur and new. + (when (eq (car method) 'nnmaildir) + (save-excursion + (while (re-search-forward nnmaildir-strip-regexp nil t) + (replace-match nnmaildir-strip-repl t)))) ;; Translate relative paths to group names. (while (not (eobp)) - (let* ((path (split-string - (buffer-substring - (point) - (line-end-position)) - "/" t)) - (art (string-to-number (car (last path))))) + (let* ((path (split-string (buffer-substring + (point) + (line-end-position)) + "/" t)) + (art (car (last path)))) (while (string= "." (car path)) (setq path (cdr path))) (let ((group (mapconcat #'identity (cl-subseq path 0 -1) "."))) (push - (vector (gnus-group-full-name group server) art 0) + (vector (gnus-group-full-name group server) + ;; FIXME: Code duplication. This is + ;; copied over from + ;; `gnus-search-indexed-parse-output'. + (if (string-match-p "\\`[[:digit:]]+\\'" art) + (string-to-number art) + (nnmaildir-base-name-to-article-number + (substring art 0 (string-search ":" art)) + group (string-remove-prefix "nnmaildir:" server))) + 0) artlist)) (forward-line 1))) (gnus-message 7 "Searching %s using find-grep...done"
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Fri, 11 Apr 2025 16:11:02 GMT) Full text and rfc822 format available.Message #20 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Fri, 11 Apr 2025 17:10:00 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes: > [வியாழன் ஏப்ரல் 10, 2025] Visuwesh wrote: > >> With all that accounted for, I ended up with the (ugly?) patch below. > > Here's a slightly better patch which directly edits the buffer text > instead of working with strings. > > diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el > index 41915a0e3c0..1f66225318c 100644 > --- a/lisp/gnus/gnus-search.el > +++ b/lisp/gnus/gnus-search.el [...] This makes me happy! Thank you Visuwesh! It does work! :-) .
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Fri, 11 Apr 2025 18:52:01 GMT) Full text and rfc822 format available.Message #23 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Fri, 11 Apr 2025 19:51:29 +0100
[Message part 1 (text/plain, inline)]
A bit related: Can you give an overview how to make search queries with find-grep? For example, I am trying to make a query with "grep:"happy birthday" subject:friend" and it is not working. Should I prepend a "grep:" after each space (on the search keywords)? How to search in the subject or by date? Cheers.
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 04:42:02 GMT) Full text and rfc822 format available.Message #26 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 10:11:04 +0530
[வெள்ளி ஏப்ரல் 11, 2025] Daniel Cerqueira wrote: > A bit related: > > Can you give an overview how to make search queries with find-grep? > > For example, I am trying to make a query with "grep:"happy birthday" > subject:friend" and it is not working. Should I prepend a "grep:" after > each space (on the search keywords)? AFAIU the code, you can't have space in the grep part. See how gnus-search parses these "meta keywords" in gnus-search-prepare-query. Having two grep: selects the last one. Give the patch below a try, I don't think it is a good idea to reuse gnus-search-query-next-expr since it does more than just go over "": diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 41915a0e3c0..7ca67e2134b 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -2110,20 +2140,28 @@ gnus-search-prepare-query val) (when (stringp query) ;; Look for these meta keys: - (while (string-match - "\\(thread\\|grep\\|limit\\|raw\\):\\([^ ]+\\)" - query) - (setq val (match-string 2 query)) - (setf (alist-get (intern (match-string 1 query)) query-spec) - ;; This is stupid. - (cond - ((equal val "t")) - ((null (zerop (string-to-number val))) - (string-to-number val)) - (t val))) - (setq query - (string-trim (replace-match "" t t query 0))) - (setf (alist-get 'query query-spec) query))) + (with-temp-buffer + (insert query) + (goto-char (point-min)) + (while (re-search-forward "\\(thread\\|grep\\|limit\\|raw\\):" nil t) + (setq val (cons + (match-string 1) + (buffer-substring (point) + (if (eq (char-after) ?\") + (progn (forward-sexp) (point)) + (progn (forward-whitespace) (1- (point))))))) + (setf (alist-get (intern (car val)) query-spec) + ;; This is stupid. + (cond + ((equal (cdr val) "t")) + ((null (zerop (string-to-number (cdr val)))) + (string-to-number (cdr val))) + (t (string-trim (cdr val) "\"" "\"")))) + (setq query (string-trim (string-replace + (concat (car val) ":" (cdr val)) + "" + query))) + (setf (alist-get 'query query-spec) query)))) (when (and gnus-search-use-parsed-queries (null (alist-get 'raw query-spec))) (setf (alist-get 'parsed-query query-spec) > How to search in the subject or by date? You can't, the find-grep search backend simply runs grep. If you don't want to use mu or notmuch, you could try writing a backend for mblaze.
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 07:59:02 GMT) Full text and rfc822 format available.Message #29 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 08:58:29 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes: > [வெள்ளி ஏப்ரல் 11, 2025] Daniel Cerqueira wrote: > >> A bit related: >> >> Can you give an overview how to make search queries with find-grep? >> >> For example, I am trying to make a query with "grep:"happy birthday" >> subject:friend" and it is not working. Should I prepend a "grep:" after >> each space (on the search keywords)? > > AFAIU the code, you can't have space in the grep part. See how > gnus-search parses these "meta keywords" in gnus-search-prepare-query. > Having two grep: selects the last one. Give the patch below a try, I > don't think it is a good idea to reuse gnus-search-query-next-expr since > it does more than just go over "": > > diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el > index 41915a0e3c0..7ca67e2134b 100644 > --- a/lisp/gnus/gnus-search.el > +++ b/lisp/gnus/gnus-search.el > @@ -2110,20 +2140,28 @@ gnus-search-prepare-query [...] The patch did not work. I haven't recorded the message error, but it was something to do with the something-generate-artlist having the wrong number of arguments. You don't need to fix it, if you don't want to, have too much work, or don't have time. >> How to search in the subject or by date? > > You can't, the find-grep search backend simply runs grep. If you don't > want to use mu or notmuch, you could try writing a backend for mblaze. Okay. Regarding subject, I understand grep not doing it; but regarding time, something can be done with find (it is find-grep after all). No need or no pressure in doing it, though.
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 08:26:02 GMT) Full text and rfc822 format available.Message #32 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 13:54:57 +0530
[சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > Visuwesh <visuweshm <at> gmail.com> writes: > >> [வெள்ளி ஏப்ரல் 11, 2025] Daniel Cerqueira wrote: >> >>> A bit related: >>> >>> Can you give an overview how to make search queries with find-grep? >>> >>> For example, I am trying to make a query with "grep:"happy birthday" >>> subject:friend" and it is not working. Should I prepend a "grep:" after >>> each space (on the search keywords)? >> >> AFAIU the code, you can't have space in the grep part. See how >> gnus-search parses these "meta keywords" in gnus-search-prepare-query. >> Having two grep: selects the last one. Give the patch below a try, I >> don't think it is a good idea to reuse gnus-search-query-next-expr since >> it does more than just go over "": >> >> diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el >> index 41915a0e3c0..7ca67e2134b 100644 >> --- a/lisp/gnus/gnus-search.el >> +++ b/lisp/gnus/gnus-search.el >> @@ -2110,20 +2140,28 @@ gnus-search-prepare-query > > [...] > > The patch did not work. I haven't recorded the message error, but it > was something to do with the something-generate-artlist having the wrong > number of arguments. > > You don't need to fix it, if you don't want to, have too much work, or > don't have time. I can give a shot at debugging, when I have time, if you provide the backtrace. Getting the find-grep backend to work was a goal for me, you gave me a good excuse to procrastinate from working on my thesis. ;-) >>> How to search in the subject or by date? >> >> You can't, the find-grep search backend simply runs grep. If you don't >> want to use mu or notmuch, you could try writing a backend for mblaze. > > Okay. Regarding subject, I understand grep not doing it; but regarding > time, something can be done with find (it is find-grep after all). No > need or no pressure in doing it, though. I don't think we can exploit the various time statistics attached with a file to achieve what you want. A message from 2019 reports: % stat ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S File: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S Size: 8420 Blocks: 24 IO Block: 4096 regular file Device: 8,4 Inode: 5774494 Links: 1 Access: (0600/-rw-------) Uid: ( 1000/ viz) Gid: ( 1000/ viz) Access: 2025-04-12 13:46:05.575388637 +0530 Modify: 2022-01-08 18:13:32.297967005 +0530 Change: 2022-06-05 07:44:16.919565297 +0530 Birth: 2022-01-08 18:13:32.297967005 +0530 % grep ^Date: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S Date: Mon, 21 Jan 2019 02:14:48 -0800 My first impressions of mblaze tells me writing a gnus-search backend for it is going to be a formidable task since there's no easy way to compose multi-header queries (we can use mpick but I don't think it can act on message body text).
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 11:39:04 GMT) Full text and rfc822 format available.Message #35 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 12:38:27 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes: > [சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > >> Visuwesh <visuweshm <at> gmail.com> writes: >> >>> [வெள்ளி ஏப்ரல் 11, 2025] Daniel Cerqueira wrote: >>> >>>> A bit related: >>>> >>>> Can you give an overview how to make search queries with find-grep? >>>> >>>> For example, I am trying to make a query with "grep:"happy birthday" >>>> subject:friend" and it is not working. Should I prepend a "grep:" after >>>> each space (on the search keywords)? >>> >>> AFAIU the code, you can't have space in the grep part. See how >>> gnus-search parses these "meta keywords" in gnus-search-prepare-query. >>> Having two grep: selects the last one. Give the patch below a try, I >>> don't think it is a good idea to reuse gnus-search-query-next-expr since >>> it does more than just go over "": >>> >>> diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el >>> index 41915a0e3c0..7ca67e2134b 100644 >>> --- a/lisp/gnus/gnus-search.el >>> +++ b/lisp/gnus/gnus-search.el >>> @@ -2110,20 +2140,28 @@ gnus-search-prepare-query >> >> [...] >> >> The patch did not work. I haven't recorded the message error, but it >> was something to do with the something-generate-artlist having the wrong >> number of arguments. >> >> You don't need to fix it, if you don't want to, have too much work, or >> don't have time. > > I can give a shot at debugging, when I have time, if you provide the > backtrace. Getting the find-grep backend to work was a goal for me, you > gave me a good excuse to procrastinate from working on my thesis. ;-) Ahaha! Now it is giving no error. But it is also not resulting a result (from a search query that I know it has matches). The message that I get is: Group nnselect:nnselect-87tt6taade.fsf contains no messages I also have changed this variable: (set 'gnus-search-default-engines '((nnimap . gnus-search-imap) (nnmaildir . gnus-search-find-grep) (nnselect . gnus-search-nnselect) ;; (nnselect . gnus-search-find-grep) )) Maybe this variable is incorrect? What I want is for the nnmaildir back-end to use find-grep. Also, in listing all buffers, I have this variable (which comes from doing a search): "*gnus-search-" . It seems to be missing a name in the end, and also an "*". >>>> How to search in the subject or by date? >>> >>> You can't, the find-grep search backend simply runs grep. If you don't >>> want to use mu or notmuch, you could try writing a backend for mblaze. >> >> Okay. Regarding subject, I understand grep not doing it; but regarding >> time, something can be done with find (it is find-grep after all). No >> need or no pressure in doing it, though. > > I don't think we can exploit the various time statistics attached with a > file to achieve what you want. A message from 2019 reports: > > % stat ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S > File: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S > Size: 8420 Blocks: 24 IO Block: 4096 regular file > Device: 8,4 Inode: 5774494 Links: 1 > Access: (0600/-rw-------) Uid: ( 1000/ viz) Gid: ( 1000/ viz) > Access: 2025-04-12 13:46:05.575388637 +0530 > Modify: 2022-01-08 18:13:32.297967005 +0530 > Change: 2022-06-05 07:44:16.919565297 +0530 > Birth: 2022-01-08 18:13:32.297967005 +0530 > % grep ^Date: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S > Date: Mon, 21 Jan 2019 02:14:48 -0800 What I was thinking is using the arguments of the executable find, such as atime, ctime, mtime (which one fits best?), when using a query for time, such as since:3d (I believe the keyword for other queries is "since:", but I am not sure of this). > My first impressions of mblaze tells me writing a gnus-search backend > for it is going to be a formidable task since there's no easy way to > compose multi-header queries (we can use mpick but I don't think it can > act on message body text). I am not willing to install more executables on my system. That is why I am wanting to use find-grep.
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 12:08:04 GMT) Full text and rfc822 format available.Message #38 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 17:37:19 +0530
[சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: >>> The patch did not work. I haven't recorded the message error, but it >>> was something to do with the something-generate-artlist having the wrong >>> number of arguments. >>> >>> You don't need to fix it, if you don't want to, have too much work, or >>> don't have time. >> >> I can give a shot at debugging, when I have time, if you provide the >> backtrace. Getting the find-grep backend to work was a goal for me, you >> gave me a good excuse to procrastinate from working on my thesis. ;-) > > Ahaha! Now it is giving no error. But it is also not resulting a > result (from a search query that I know it has matches). > > The message that I get is: > > Group nnselect:nnselect-87tt6taade.fsf contains no messages > > I also have changed this variable: > > (set 'gnus-search-default-engines > '((nnimap . gnus-search-imap) > (nnmaildir . gnus-search-find-grep) > (nnselect . gnus-search-nnselect) > ;; (nnselect . gnus-search-find-grep) > )) > > Maybe this variable is incorrect? What I want is for the nnmaildir > back-end to use find-grep. I modify that exact variable to make nnmaildir use gnus-search-find-grep. I forgot to pass the mandatory argument to forward-whitespace. Please try the patch below instead, diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 41915a0e3c0..d6450bbbaff 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -2110,20 +2140,31 @@ gnus-search-prepare-query val) (when (stringp query) ;; Look for these meta keys: - (while (string-match - "\\(thread\\|grep\\|limit\\|raw\\):\\([^ ]+\\)" - query) - (setq val (match-string 2 query)) - (setf (alist-get (intern (match-string 1 query)) query-spec) - ;; This is stupid. - (cond - ((equal val "t")) - ((null (zerop (string-to-number val))) - (string-to-number val)) - (t val))) - (setq query - (string-trim (replace-match "" t t query 0))) - (setf (alist-get 'query query-spec) query))) + (with-temp-buffer + (insert query) + (goto-char (point-min)) + (while (re-search-forward "\\(thread\\|grep\\|limit\\|raw\\):" nil t) + (setq val (cons + (match-string 1) + (buffer-substring (point) + (if (eq (char-after) ?\") + (progn (forward-sexp) (point)) + (progn (forward-whitespace 1) + (if (eobp) + (point) + (1- (point)))))))) + (setf (alist-get (intern (car val)) query-spec) + ;; This is stupid. + (cond + ((equal (cdr val) "t")) + ((null (zerop (string-to-number (cdr val)))) + (string-to-number (cdr val))) + (t (string-trim (cdr val) "\"" "\"")))) + (setq query (string-trim (string-replace + (concat (car val) ":" (cdr val)) + "" + query))) + (setf (alist-get 'query query-spec) query)))) (when (and gnus-search-use-parsed-queries (null (alist-get 'raw query-spec))) (setf (alist-get 'parsed-query query-spec) >>> Okay. Regarding subject, I understand grep not doing it; but regarding >>> time, something can be done with find (it is find-grep after all). No >>> need or no pressure in doing it, though. >> >> I don't think we can exploit the various time statistics attached with a >> file to achieve what you want. A message from 2019 reports: >> >> % stat ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S >> File: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S >> Size: 8420 Blocks: 24 IO Block: 4096 regular file >> Device: 8,4 Inode: 5774494 Links: 1 >> Access: (0600/-rw-------) Uid: ( 1000/ viz) Gid: ( 1000/ viz) >> Access: 2025-04-12 13:46:05.575388637 +0530 >> Modify: 2022-01-08 18:13:32.297967005 +0530 >> Change: 2022-06-05 07:44:16.919565297 +0530 >> Birth: 2022-01-08 18:13:32.297967005 +0530 >> % grep ^Date: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S >> Date: Mon, 21 Jan 2019 02:14:48 -0800 > > What I was thinking is using the arguments of the executable find, such > as atime, ctime, mtime (which one fits best?), when using a query for > time, such as since:3d (I believe the keyword for other queries is > "since:", but I am not sure of this). The problem is mtime, ctime and atime are clearly not reliable as shown in the example above. So we cannot rely on them to indirectly query the Date header.
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 12:55:03 GMT) Full text and rfc822 format available.Message #41 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 13:53:47 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes: > [சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > [...] >>> I can give a shot at debugging, when I have time, if you provide the >>> backtrace. Getting the find-grep backend to work was a goal for me, you >>> gave me a good excuse to procrastinate from working on my thesis. ;-) >> >> Ahaha! Now it is giving no error. But it is also not resulting a >> result (from a search query that I know it has matches). >> >> The message that I get is: >> >> Group nnselect:nnselect-87tt6taade.fsf contains no messages >> >> I also have changed this variable: >> >> (set 'gnus-search-default-engines >> '((nnimap . gnus-search-imap) >> (nnmaildir . gnus-search-find-grep) >> (nnselect . gnus-search-nnselect) >> ;; (nnselect . gnus-search-find-grep) >> )) >> >> Maybe this variable is incorrect? What I want is for the nnmaildir >> back-end to use find-grep. > > I modify that exact variable to make nnmaildir use > gnus-search-find-grep. I forgot to pass the mandatory argument to > forward-whitespace. Please try the patch below instead, > > diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el [...] It is working. No errors. But I don't understand what functionality you did add. Can you document this or, the meantime, tell me? >>>> Okay. Regarding subject, I understand grep not doing it; but regarding >>>> time, something can be done with find (it is find-grep after all). No >>>> need or no pressure in doing it, though. >>> >>> I don't think we can exploit the various time statistics attached with a >>> file to achieve what you want. A message from 2019 reports: >>> >>> % stat ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S >>> File: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S >>> Size: 8420 Blocks: 24 IO Block: 4096 regular file >>> Device: 8,4 Inode: 5774494 Links: 1 >>> Access: (0600/-rw-------) Uid: ( 1000/ viz) Gid: ( 1000/ viz) >>> Access: 2025-04-12 13:46:05.575388637 +0530 >>> Modify: 2022-01-08 18:13:32.297967005 +0530 >>> Change: 2022-06-05 07:44:16.919565297 +0530 >>> Birth: 2022-01-08 18:13:32.297967005 +0530 >>> % grep ^Date: ~/mail/XXX/inbox/cur/1641645812.328064_1.astatine,U=1:2,S >>> Date: Mon, 21 Jan 2019 02:14:48 -0800 >> >> What I was thinking is using the arguments of the executable find, such >> as atime, ctime, mtime (which one fits best?), when using a query for >> time, such as since:3d (I believe the keyword for other queries is >> "since:", but I am not sure of this). > > The problem is mtime, ctime and atime are clearly not reliable as shown > in the example above. So we cannot rely on them to indirectly query the > Date header. Since "grep:" is also unable to specify to search in a mail field or in the body, etc. I was thinking that `find` would also not be able to search in the Date header. It does make sense. It would only search on the attributes of the file (with mtime, ctime or atime). Also, not that is with 'list-all-buffers function, the buffer *Buffer List* shows this line: * *gnus-search- 4008 Fundamental ~/Mail/ Something is missing in *gnus-search- . Maybe this is revealing a bug that hasn't quite done damage, yet. Have a good thesis writing :-) .
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 14:54:08 GMT) Full text and rfc822 format available.Message #44 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 20:22:47 +0530
[சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > Visuwesh <visuweshm <at> gmail.com> writes: >> >> I modify that exact variable to make nnmaildir use >> gnus-search-find-grep. I forgot to pass the mandatory argument to >> forward-whitespace. Please try the patch below instead, >> >> diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el > > [...] > > It is working. No errors. But I don't understand what functionality > you did add. Can you document this or, the meantime, tell me? The above patch should allow grep:"one two" for multiword queries. With the other patch, you should be able to use find-grep for maildirs. > [...] > Also, not that is with 'list-all-buffers function, the buffer *Buffer > List* shows this line: > > * *gnus-search- 4008 Fundamental ~/Mail/ > > Something is missing in *gnus-search- . Maybe this is revealing a bug > that hasn't quite done damage, yet. I don't see such a stale buffer on my end. I don't know what it is about. Does it get created when you kill it?
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 21:11:02 GMT) Full text and rfc822 format available.Message #47 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 22:09:58 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes: > [சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > >> Visuwesh <visuweshm <at> gmail.com> writes: >>> >>> I modify that exact variable to make nnmaildir use >>> gnus-search-find-grep. I forgot to pass the mandatory argument to >>> forward-whitespace. Please try the patch below instead, >>> >>> diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el >> >> [...] >> >> It is working. No errors. But I don't understand what functionality >> you did add. Can you document this or, the meantime, tell me? > > The above patch should allow grep:"one two" for multiword queries. > > With the other patch, you should be able to use find-grep for maildirs. Ah, thanks. This is an important feature. >> [...] >> Also, not that is with 'list-all-buffers function, the buffer *Buffer >> List* shows this line: >> >> * *gnus-search- 4008 Fundamental ~/Mail/ >> >> Something is missing in *gnus-search- . Maybe this is revealing a bug >> that hasn't quite done damage, yet. > > I don't see such a stale buffer on my end. I don't know what it is > about. Does it get created when you kill it? It does not get created when I kill it. In fact, if I kill it, I can no longer do nnmaildir searches: I have to restart GNU Emacs. To see the buffer in the buffer list, you must do a nnmaildir search and then eval: (display-buffer (list-buffers-noselect files-only (buffer-list)))
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sat, 12 Apr 2025 21:42:03 GMT) Full text and rfc822 format available.Message #50 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sat, 12 Apr 2025 22:41:06 +0100
[Message part 1 (text/plain, inline)]
Daniel Cerqueira <dan.list <at> lispclub.com> writes: [...] > To see the buffer in the buffer list, you must do a nnmaildir search and > then eval: (display-buffer (list-buffers-noselect files-only > (buffer-list))) I mean: (display-buffer (list-buffers-noselect nil (buffer-list)))
[signature.asc (application/pgp-signature, inline)]
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sun, 13 Apr 2025 04:47:03 GMT) Full text and rfc822 format available.Message #53 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Daniel Cerqueira <dan.list <at> lispclub.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sun, 13 Apr 2025 10:16:42 +0530
[சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > Daniel Cerqueira <dan.list <at> lispclub.com> writes: > > > [...] > >> To see the buffer in the buffer list, you must do a nnmaildir search and >> then eval: (display-buffer (list-buffers-noselect files-only >> (buffer-list))) > > I mean: > > (display-buffer (list-buffers-noselect nil (buffer-list))) It's a hidden buffer that is used internally by gnus-search to have the results of find stored.
bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org
:bug#73581
; Package emacs,gnus
.
(Sun, 13 Apr 2025 10:22:02 GMT) Full text and rfc822 format available.Message #56 received at 73581 <at> debbugs.gnu.org (full text, mbox):
From: Daniel Cerqueira <dan.list <at> lispclub.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: 73581 <at> debbugs.gnu.org Subject: Re: bug#73581: 29.4; Gnus: Error doing a search on nnmaildir with gnus-search-find-grep Date: Sun, 13 Apr 2025 11:21:11 +0100
[Message part 1 (text/plain, inline)]
Visuwesh <visuweshm <at> gmail.com> writes: > [சனி ஏப்ரல் 12, 2025] Daniel Cerqueira wrote: > >> Daniel Cerqueira <dan.list <at> lispclub.com> writes: >> >> >> [...] >> >>> To see the buffer in the buffer list, you must do a nnmaildir search and >>> then eval: (display-buffer (list-buffers-noselect files-only >>> (buffer-list))) >> >> I mean: >> >> (display-buffer (list-buffers-noselect nil (buffer-list))) > > It's a hidden buffer that is used internally by gnus-search to have the > results of find stored. I know that, but the name of the buffer is incomplete. It ends on "...-" which means a word is missing, and it begins on "*" and does not end on "*". For me, this points to a missing a word. If we are lucky, it does not cause any harm. Still, it is kinda odd to have it stay that way. Thank you for your improvements Visuwesh :-) . Time for you to enjoy and celebrate. Have a glass for me :-))) .
[signature.asc (application/pgp-signature, inline)]
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.