Gnus development mailing list
 help / color / mirror / Atom feed
From: Andrew Cohen <cohen@andy.bu.edu>
To: ding@gnus.org
Subject: Re: nnir and the new nnimap
Date: Sat, 25 Sep 2010 08:02:29 -0400	[thread overview]
Message-ID: <87fwwy2fqi.fsf@andy.bu.edu> (raw)
In-Reply-To: <m339sz3yqb.fsf@quimbies.gnus.org>

[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]

>>>>> "Lars" == Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

    Lars> Vegard Vesterheim <vegard.vesterheim@uninett.no> 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 "".


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnir.el --]
[-- Type: text/x-diff, Size: 1199 bytes --]

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)

  reply	other threads:[~2010-09-25 12:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 18:58 Knut Anders Hatlen
2010-09-21 21:37 ` Lars Magne Ingebrigtsen
2010-09-22  9:17   ` Vegard Vesterheim
2010-09-22 16:38     ` Lars Magne Ingebrigtsen
2010-09-22 19:04       ` Steinar Bang
2010-09-22 19:50         ` Lars Magne Ingebrigtsen
2010-09-22 20:27           ` Lars Magne Ingebrigtsen
2010-09-22 21:25             ` Knut Anders Hatlen
2010-09-22 21:31               ` Lars Magne Ingebrigtsen
2010-09-22 21:42                 ` Knut Anders Hatlen
2010-09-22 21:45                   ` Lars Magne Ingebrigtsen
2010-09-23 12:36                     ` Andrew Cohen
2010-09-23 17:33                       ` Lars Magne Ingebrigtsen
2010-09-23 21:11                         ` Andrew Cohen
2010-09-23 21:17                           ` Lars Magne Ingebrigtsen
2010-09-22 10:11   ` Steinar Bang
2010-09-22 16:39     ` Lars Magne Ingebrigtsen
2010-09-22 19:03       ` Steinar Bang
2010-09-24  7:36       ` Vegard Vesterheim
2010-09-24  8:10         ` Steinar Bang
2010-09-24 16:14         ` Lars Magne Ingebrigtsen
2010-09-25 12:02           ` Andrew Cohen [this message]
2010-09-25 14:19             ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwwy2fqi.fsf@andy.bu.edu \
    --to=cohen@andy.bu.edu \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).