david.goldberg6@verizon.net (Dave Goldberg) writes: >> Hello, >> I use a tool called mu [1] to index and search my mail, which is stored >> in a Maildir folder. mu is able to give me the message ids of all the >> mails that match a given query. I want to use these ids to create a new >> group in gnus that shows the search result. So it basically boils down >> to this: > >> Is there a function or facility in gnus that takes a list of message-ids >> (or even a list of local path names) and creates a new group containing >> the corresponding messages? > >> I am fine with writing some elisp to call out to mu and converting its >> output to a list, I just need above mentioned functionality. > > nnir.el provides an interface to various search capabilities and although I > can't speak to it as I don't use it, I see maildir mentioned for one of the > backends. Perhaps that is enough to get you started. I while back I wanted exactly this. It's a work in progress; to be frank I don't remeber if I ever for it working, as I switched away from maildir and consequently mu. Worth a shot! --8<---------------cut here---------------start------------->8--- (require 'nnir) (defcustom nnir-mu-program "mu" "*Name of mu indexing program." :type '(string) :group 'nnir) (defcustom nnir-mu-additional-switches '() "*A list of strings, to be given as additional arguments to mu. Note that this should be a list. Ie, do NOT use the following: (setq nnir-mu-additional-switches \"-s date -z\") ; wrong Instead, use this: (setq nnir-mu-additional-switches '(\"-s\" \"date\" \"-z\"))" :type '(repeat (string)) :group 'nnir) (defun nnir-run-mu (query server &optional group) "Run QUERY against mu. Returns a vector of (group name, file name) pairs (also vectors, actually)." (save-excursion (let ((qstring (cdr (assq 'query query))) (groupspec (car group)) artlist) (when (equal "" qstring) (error "mu: You didn't enter anything")) (set-buffer (get-buffer-create nnir-tmp-buffer)) (erase-buffer) (if groupspec (message "Doing mu query %s on %s..." qstring groupspec) (message "Doing mu query %s..." qstring)) (let* ((cp-list `( ,nnir-mu-program nil ; input from /dev/null t ; output nil ; don't redisplay "find" "--format=sexp" ,@(nnir-read-server-parm 'nnir-mu-additional-switches server) ,@(split-string qstring "\\s-+") ; the query, in mu format )) (exitstatus (progn (message "%s args: %s" nnir-mu-program (mapconcat 'identity (cddddr cp-list) " ")) ;; ??? (apply 'call-process cp-list)))) (unless (or (null exitstatus) (zerop exitstatus)) (nnheader-report 'nnir "Couldn't run mu: %s" exitstatus) ;; mu failure reason is in this buffer, show it if ;; the user wants it. (when (> gnus-verbose 6) (display-buffer nnir-tmp-buffer)))) ;; The results are output in the format of: ;; plists (goto-char (point-min)) (while (not (eobp)) (ignore-errors (let* ((item (read (current-buffer))) (group (concat server ":" (substring (plist-get item :maildir) 1))) (artno (plist-get item :docid)) (score 1000)) (push (vector group artno score) artlist)))) (message "Massaging mu output...done") (print artlist) artlist))) (add-to-list 'nnir-engines '(mu nnir-run-mu ())) --8<---------------cut here---------------end--------------->8--- -- Pedro