From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/71704 Path: news.gmane.org!not-for-mail From: Andrew Cohen Newsgroups: gmane.emacs.gnus.general Subject: Re: nnir and the new nnimap Date: Sat, 25 Sep 2010 08:02:29 -0400 Message-ID: <87fwwy2fqi.fsf@andy.bu.edu> References: <1siq1vy4mm.fsf@voll.uninett.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1285416181 21576 80.91.229.12 (25 Sep 2010 12:03:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 25 Sep 2010 12:03:01 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M20077@lists.math.uh.edu Sat Sep 25 14:03:00 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OzTSz-0000Dg-8L for ding-account@gmane.org; Sat, 25 Sep 2010 14:02:57 +0200 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 1OzTSt-0004VA-JH; Sat, 25 Sep 2010 07:02:51 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1OzTSr-0004Ur-QD for ding@lists.math.uh.edu; Sat, 25 Sep 2010 07:02:49 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1OzTSm-0003jq-H7 for ding@lists.math.uh.edu; Sat, 25 Sep 2010 07:02:49 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1OzTSl-0002KS-00 for ; Sat, 25 Sep 2010 14:02:43 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OzTSj-00009U-HF for ding@gnus.org; Sat, 25 Sep 2010 14:02:41 +0200 Original-Received: from andy.bu.edu ([128.197.41.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 Sep 2010 14:02:41 +0200 Original-Received: from cohen by andy.bu.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 Sep 2010 14:02:41 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 76 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: andy.bu.edu User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:XSZwRLrsYJlF/bnexMrfzFWx0qA= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:71704 Archived-At: --=-=-= Content-Type: text/plain >>>>> "Lars" == Lars Magne Ingebrigtsen writes: Lars> Vegard Vesterheim writes: >> I have, however, done a simple modification to the actual search >> function (nnir-run-imap). I like to express my search criteria >> in IMAP syntax directly as IMAP itself supports a query language >> of sorts. I am not sure I see the need to invent another, more >> limited, mini-query-language implemented in elisp, at least not >> until it can be supported with a nice GUI for building complex >> queries. >> Lars> I think that sounds very useful. Could you post the patch Lars> here? And have you (or are you willing to) sign copyright Lars> assignment papers for the code to the FSF (if the code is Lars> long-ish)? I thought this sounded useful as well, so here is a very simple implementation. If you use "G G" in the group buffer with a prefix arg you get queried for the search string, and then queried for the field to search in (e.g. Subject, From, Header). I've changed this so that if you enter nothing for the field it interprets the search as a raw imap search. If you want raw imap searches to be the default for all queries (even without using a prefix arg) just set nnir-imap-search-field to "". --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=nnir.el.diff Content-Description: nnir.el diff --git a/lisp/nnir.el b/lisp/nnir.el index ec22c78..db8b397 100644 --- a/lisp/nnir.el +++ b/lisp/nnir.el @@ -345,14 +345,16 @@ (gnus-declare-backend "nnir" 'mail) (defvar nnir-imap-search-field "TEXT" - "The IMAP search item when doing an nnir search") + "The IMAP search item when doing an nnir search. To use raw + imap queries by default set this to \"\"") (defvar nnir-imap-search-arguments '(("Whole message" . "TEXT") ("Subject" . "SUBJECT") ("To" . "TO") ("From" . "FROM") - (nil . "HEADER \"%s\"")) + ("Head" . "HEADER \"%s\"") + (nil . "")) "Mapping from user readable strings to IMAP search items for use in nnir") (defvar nnir-imap-search-argument-history () @@ -981,8 +983,11 @@ details on the language and supported extensions" (message "Searching %s..." group) (let ((arts 0) (result - (nnimap-command "UID SEARCH %s" - (nnir-imap-make-query criteria qstring)))) + (nnimap-command "UID SEARCH %s" + (if (string= criteria "") + qstring + (nnir-imap-make-query criteria qstring) + )))) (mapc (lambda (artnum) (push (vector group artnum 1) artlist) --=-=-=--