From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83910 Path: news.gmane.org!not-for-mail From: Pedro Silva Newsgroups: gmane.emacs.gnus.general Subject: Re: Create a group from a list of message-ids Date: Mon, 25 Nov 2013 10:28:18 +0100 Message-ID: References: <87vbzjs5fk.fsf@gmail.com> <844n71b5nh.fsf@davestoy.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1385371725 1556 80.91.229.3 (25 Nov 2013 09:28:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Nov 2013 09:28:45 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M32165@lists.math.uh.edu Mon Nov 25 10:28:49 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VksTI-0001gH-On for ding-account@gmane.org; Mon, 25 Nov 2013 10:28:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1VksT7-0008Am-41; Mon, 25 Nov 2013 03:28:37 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1VksT5-0008Aa-9R for ding@lists.math.uh.edu; Mon, 25 Nov 2013 03:28:35 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1VksT3-0003wy-Hs for ding@lists.math.uh.edu; Mon, 25 Nov 2013 03:28:35 -0600 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1VksT2-0003e1-64 for ding@gnus.org; Mon, 25 Nov 2013 10:28:32 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VksT2-0001b0-2Q for ding@gnus.org; Mon, 25 Nov 2013 10:28:32 +0100 Original-Received: from pedrosilva.pt ([178.79.155.209]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Nov 2013 10:28:32 +0100 Original-Received: from psilva by pedrosilva.pt with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Nov 2013 10:28:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 126 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pedrosilva.pt User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (darwin) Cancel-Lock: sha1:qi9xIgDN6xaide5hWaTUFy2FKbc= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83910 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJSkxgyAAoJEIQwGS3UEcOs8uMP/0afHl7FhVv5iUe7A+g7A58v taTa7sfNKuK+5M10qulhicsi9wuN06BmqxWzTlkigpOd1PoM0zyKyhFYMJaRJ3dM zh9gni1glyNXhKVCx5eoUSUJ7uFEDcqXZoVeZCKr9Wfz15YTumpVTGF/9lk6dgvD PIgW3+uiYeOz1WBcDZiIFQX3GFy75QojcHov9AiPk4XuDImgCQUjp8+cyCF0VR1L ARxudZ5ixQizdsdw/dS51LIjoHPdoLEmHVZmLmKBLvLob31raPvJC3iXG9SdhjJ8 JZdy6H+QcNBLeDL54RI7TvQBLduwL53FM03DIu3RAnCFFcIxQUZtfxF0V29/RUGb G/PE/kaGG+wHyM13wBXGwiELiBAFjItRX5bDHnojUxKPGwuPi5bOhRwL1E3BWJd+ BMZ6UO78jgSne8NcwCqcxv8aqpsF5fvQeeXuB8r7+HY31lvz4j8K65gWso3R/Qnj 7nKXuOzCmtWsNGnmtVpBh6c1lnnFLo+twiVZtoLjKGdhbvmTUP54173cae1lFQ2P aHybT2bWZbl8dB5zgguFaqLnZDZKkKH1I9mYMNzwAWgjrU37zohZ1ticEUjgufBe ES8whURIx836TQljxfJFYRoPUgyuGpufwb4J/loh1gYdNraEbiI97MCZKr2rjGuR +pttSpm1Lw0NQNrvHzx1 =3pi7 -----END PGP SIGNATURE----- --=-=-=--