Gnus development mailing list
 help / color / mirror / Atom feed
From: Andrew Cohen <cohen@andy.bu.edu>
To: ding@gnus.org
Subject: Re: Any juicy outstanding Gnus bugs?
Date: Thu, 07 Oct 2010 18:06:23 -0400	[thread overview]
Message-ID: <87bp754q00.fsf@andy.bu.edu> (raw)
In-Reply-To: <87d3rz10v9.fsf@andy.bu.edu>

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

It took longer than I expected but all the required paperwork went to
the FSF on Wednesday, so hopefully this is now taken care of.

Attached is a patch for nnir.el that does a few things:

1. gnus-summary-nnir-goto-thread implementation for imap. I'm finding
   the thread by searching for all articles that are referenced by the
   original article, or reference any of the articles referenced by the
   original article (i.e. I'm being pretty aggressive in finding the
   thread). It seems quite fast, but if it turns out to be too slow it
   is easily changed.

2. Fixes gnus-completing-read (the recent changeover broke things).

3. Cleans up the autoloads and some obsolete comments. One function was
   still loaded from the old imap.el and I thought it might be prudent
   to move this function into nnir.el (imap-quote-specials) so that
   imap.el can just go away. 

Regards,
Andy


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

diff --git a/lisp/nnir.el b/lisp/nnir.el
index 3739cb8..4e8a97b 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -339,6 +339,12 @@
 (eval-when-compile
   (require 'cl))
 
+
+(eval-when-compile
+  (autoload 'nnimap-buffer "nnimap")
+  (autoload 'nnimap-command "nnimap")
+  (autoload 'nnimap-possibly-change-group "nnimap"))
+
 (nnoo-declare nnir)
 (nnoo-define-basics nnir)
 
@@ -346,15 +352,15 @@
 
 (defvar nnir-imap-search-field "TEXT"
   "The IMAP search item when doing an nnir search. To use raw
-  imap queries by default set this to \"\"")
+  imap queries by default set this to \"Imap\"")
 
 (defvar nnir-imap-search-arguments
   '(("Whole message" . "TEXT")
     ("Subject" . "SUBJECT")
     ("To" . "TO")
     ("From" . "FROM")
-    ("Head" . "HEADER \"%s\"")
-    (nil . ""))
+    ("Imap" . "")
+    (nil . "HEADER \"%s\""))
   "Mapping from user readable strings to IMAP search items for use in nnir")
 
 (defvar nnir-imap-search-argument-history ()
@@ -375,9 +381,8 @@ result, `gnus-retrieve-headers' will be called instead.")
              ())
     (imap    nnir-run-imap
              ((criteria
-	       "Search in: "                      ; Prompt
+	       "Search in"                        ; Prompt
 	       ,nnir-imap-search-arguments        ; alist for completing
-	       nil                                ; no filtering
 	       nil                                ; allow any user input
 	       nil                                ; initial value
 	       nnir-imap-search-argument-history  ; the history to use
@@ -703,19 +708,30 @@ and show thread that contains this article."
   (let* ((cur (gnus-summary-article-number))
          (group (nnir-artlist-artitem-group nnir-artlist cur))
          (backend-number (nnir-artlist-artitem-number nnir-artlist cur))
-	 server backend-group)
-    (setq server (nnir-group-server group))
-    (setq backend-group (gnus-group-real-name group))
-    (gnus-group-read-ephemeral-group
-     backend-group
-     (gnus-server-to-method server)
-     t                                  ; activate
-     (cons (current-buffer)
-           'summary)                    ; window config
-     nil
-     (list backend-number))
-    (gnus-summary-limit (list backend-number))
-    (gnus-summary-refer-thread)))
+	 (id (mail-header-id (gnus-summary-article-header)))
+	 (refs (split-string
+		(mail-header-references (gnus-summary-article-header)))))
+    (if (string= (car (gnus-group-method group)) "nnimap")
+	(with-current-buffer (nnimap-buffer)
+	  (let* ((cmd (let ((value
+			     (format
+			      "(OR HEADER REFERENCES %s HEADER Message-Id %s)"
+			      id id)))
+			(dolist (refid refs value)
+			  (setq value (format
+				       "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
+				       refid refid value)))))
+		 (result (nnimap-command
+			  "UID SEARCH %s" cmd)))
+	    (gnus-summary-read-group-1 group t t gnus-summary-buffer nil
+				       (and (car result)
+					    (delete 0 (mapcar #'string-to-number
+							      (cdr (assoc "SEARCH" (cdr result)))))))))
+      (gnus-summary-read-group-1 group t t gnus-summary-buffer
+				 nil (list backend-number))
+      (gnus-summary-limit (list backend-number))
+      (gnus-summary-refer-thread))))
+
 
 (if (fboundp 'eval-after-load)
     (eval-after-load "gnus-sum"
@@ -937,22 +953,9 @@ pairs (also vectors, actually)."
 
 ;; IMAP interface.
 ;; todo:
-;; nnir invokes this two (2) times???!
-;; we should not use nnimap at all but open our own server connection
-;; we should not LIST * but use nnimap-list-pattern from defs
 ;; send queries as literals
 ;; handle errors
 
-(autoload 'nnimap-open-server "nnimap")
-(defvar nnimap-server-buffer) ;; nnimap.el
-(autoload 'imap-mailbox-select "imap")
-(autoload 'imap-search "imap")
-(autoload 'imap-quote-specials "imap")
-
-(eval-when-compile
-  (autoload 'nnimap-buffer "nnimap")
-  (autoload 'nnimap-command "nnimap")
-  (autoload 'nnimap-possibly-change-group "nnimap"))
 
 (defun nnir-run-imap (query srv &optional group-option)
   "Run a search against an IMAP back-end server.
@@ -1045,7 +1048,7 @@ In future the following will be added to the language:
   (cond
    ;; Simple string term
    ((stringp expr)
-    (format "%s \"%s\"" criteria (imap-quote-specials expr)))
+    (format "%s \"%s\"" criteria (nnir-imap-quote-specials expr)))
    ;; Trivial term: and
    ((eq expr 'and) nil)
    ;; Composite term: or expression
@@ -1579,7 +1582,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
   (let ((sym (car parmspec))
         (prompt (cdr parmspec)))
     (if (listp prompt)
-	(let* ((result (gnus-completing-read prompt nil))
+	(let* ((result (apply 'gnus-completing-read prompt))
 	       (mapping (or (assoc result nnir-imap-search-arguments)
 			    (assoc nil nnir-imap-search-arguments))))
 	  (cons sym (format (cdr mapping) result)))
@@ -1693,6 +1696,16 @@ The Gnus backend/server information is added."
             with-dups)
     res))
 
+(defun nnir-imap-quote-specials (string)
+  (with-temp-buffer
+    (insert string)
+    (goto-char (point-min))
+    (while (re-search-forward "[\\\"]" nil t)
+      (forward-char -1)
+      (insert "\\")
+      (forward-char 1))
+    (buffer-string)))
+
 
 ;; The end.
 (provide 'nnir)

  reply	other threads:[~2010-10-07 22:06 UTC|newest]

Thread overview: 182+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 19:58 Lars Magne Ingebrigtsen
2010-09-25 20:10 ` Julien Danjou
2010-09-25 20:27   ` Lars Magne Ingebrigtsen
2010-09-25 20:40     ` Julien Danjou
2010-09-25 20:44       ` Lars Magne Ingebrigtsen
2010-09-25 20:48         ` Sven Joachim
2010-09-25 21:26           ` Lars Magne Ingebrigtsen
2010-09-25 21:46             ` Frank Schmitt
2010-09-25 22:12               ` Lars Magne Ingebrigtsen
2010-09-25 22:20                 ` Any juicy outstanding Gnus bugs Steinar Bang
2010-09-25 22:58                   ` Lars Magne Ingebrigtsen
2010-09-25 22:53                 ` Any juicy outstanding Gnus bugs? Russ Allbery
2010-09-25 23:00                   ` Lars Magne Ingebrigtsen
2010-09-25 23:12                     ` Russ Allbery
2010-09-25 23:13                     ` Lars Magne Ingebrigtsen
2010-09-25 23:29                       ` nndebbugs (was: Re: Any juicy outstanding Gnus bugs?) Lars Magne Ingebrigtsen
2010-09-25 23:36                         ` nndebbugs Russ Allbery
2010-09-26  0:17                           ` nndebbugs Lars Magne Ingebrigtsen
2010-09-26  0:31                             ` nndebbugs Lars Magne Ingebrigtsen
2010-09-26  0:33                             ` nndebbugs Russ Allbery
2010-09-26  0:41                               ` nndebbugs Lars Magne Ingebrigtsen
2010-09-26  1:04                                 ` nndebbugs Lars Magne Ingebrigtsen
2010-09-27  6:25                                   ` nndebbugs Reiner Steib
2010-09-26  9:01                                 ` nndebbugs Michael Albinus
2010-09-26  7:55                           ` nndebbugs Steinar Bang
2010-09-26  8:39                             ` nndebbugs Russ Allbery
2010-09-26 12:11                               ` nndebbugs Lars Magne Ingebrigtsen
2010-09-27 14:56           ` Any juicy outstanding Gnus bugs? Tom Tromey
2010-09-25 20:42 ` Frank Schmitt
2010-09-25 21:29   ` Lars Magne Ingebrigtsen
2010-09-25 21:14 ` Julien Danjou
2010-09-25 21:17   ` Julien Danjou
2010-09-25 21:26     ` Lars Magne Ingebrigtsen
2010-09-26  2:08 ` Nils Ackermann
2010-09-26  2:16   ` Lars Magne Ingebrigtsen
2010-09-26  2:38     ` Nils Ackermann
2010-09-26 12:56       ` Lars Magne Ingebrigtsen
2010-09-26 18:28         ` Nils Ackermann
2010-09-26 18:50           ` Lars Magne Ingebrigtsen
2010-09-27 16:38             ` Nils Ackermann
2010-09-27 18:39               ` Lars Magne Ingebrigtsen
2010-09-28  4:24                 ` Nils Ackermann
2010-09-29 14:33                   ` Lars Magne Ingebrigtsen
2010-09-26  8:32 ` Sivaram Neelakantan
2010-09-26 11:59   ` Lars Magne Ingebrigtsen
2010-09-26 10:16 ` Tassilo Horn
2010-09-26 12:06   ` Lars Magne Ingebrigtsen
2010-09-26 17:06     ` Tassilo Horn
2010-09-26 13:56 ` Richard Riley
2010-09-26 14:10   ` Lars Magne Ingebrigtsen
2010-09-26 15:43     ` Steinar Bang
2010-09-26 15:54       ` Lars Magne Ingebrigtsen
2010-09-26 17:10 ` Julien Danjou
2010-09-26 17:14   ` Lars Magne Ingebrigtsen
2010-09-26 21:24     ` James Cloos
2010-09-26 21:31       ` Lars Magne Ingebrigtsen
2010-09-27 19:13       ` Lars Magne Ingebrigtsen
2010-09-26 17:23   ` Charles Philip Chan
2010-09-26 22:23   ` Andreas Schwab
2010-09-26 18:41 ` Steinar Bang
2010-09-26 18:55   ` Lars Magne Ingebrigtsen
2010-09-27 14:30     ` Andrew Cohen
2010-09-27 18:40       ` Lars Magne Ingebrigtsen
2010-09-27 18:45         ` Andrew Cohen
2010-10-07 22:06           ` Andrew Cohen [this message]
2010-10-07 22:36             ` Lars Magne Ingebrigtsen
2010-10-10 13:23               ` Andrew Cohen
2010-10-10 13:36                 ` Lars Magne Ingebrigtsen
2010-10-10 15:26                 ` Andreas Schwab
2010-10-08  9:41             ` Steinar Bang
2010-09-26 18:57   ` Andrew Cohen
2010-09-26 20:46   ` Ted Zlatanov
2010-09-27  7:35     ` Steinar Bang
2010-09-27 18:15       ` Ted Zlatanov
2010-09-27 18:37         ` Lars Magne Ingebrigtsen
2010-09-27 18:48           ` Ted Zlatanov
2010-09-27 19:02             ` Lars Magne Ingebrigtsen
2010-09-26 19:04 ` Gnus loads too much when entering group before letting the agent fetch (was: Any juicy outstanding Gnus bugs?) Tassilo Horn
2010-09-26 19:07   ` Gnus loads too much when entering group before letting the agent fetch Lars Magne Ingebrigtsen
2010-09-26 19:29     ` Tassilo Horn
2010-09-26 19:38       ` Lars Magne Ingebrigtsen
2010-09-26 20:26         ` Tassilo Horn
2010-09-26 20:43           ` Tassilo Horn
2010-09-26 21:04             ` Lars Magne Ingebrigtsen
2010-09-26 19:56 ` gnus-group-jump-to-group completion bug Dan Christensen
2010-09-26 20:39   ` Lars Magne Ingebrigtsen
2010-09-26 23:04     ` Dan Christensen
2010-09-27 17:37       ` Lars Magne Ingebrigtsen
2010-09-27 18:25         ` Dan Christensen
2010-09-27 18:39           ` Julien Danjou
2010-09-27 18:42             ` Lars Magne Ingebrigtsen
2010-09-26 19:58 ` gnus-summary-insert-new-articles in an nnimap group doesn't work Dan Christensen
2010-09-26 21:01   ` Lars Magne Ingebrigtsen
2010-09-26 23:10     ` Dan Christensen
2010-09-27 17:36       ` Lars Magne Ingebrigtsen
2010-09-27 18:37         ` Dan Christensen
2010-09-27 18:59           ` Lars Magne Ingebrigtsen
2010-09-27 19:08             ` Dan Christensen
2010-09-27 19:49               ` Lars Magne Ingebrigtsen
2010-09-28  1:19                 ` Dan Christensen
2010-09-26 20:04 ` Any juicy outstanding Gnus bugs? Robert Pluim
2010-09-26 20:13   ` Julien Danjou
2010-09-26 20:27     ` Robert Pluim
2010-09-26 20:34       ` Dan Christensen
2010-09-26 20:37       ` Lars Magne Ingebrigtsen
2010-09-26 20:43         ` Dan Christensen
2010-09-26 20:41       ` Julien Danjou
2010-09-26 21:09         ` Robert Pluim
2010-09-26 21:14           ` Lars Magne Ingebrigtsen
2010-09-26 21:23             ` Robert Pluim
2010-09-26 20:10 ` nnmairix not working again Dan Christensen
2010-09-27 18:35   ` Lars Magne Ingebrigtsen
2010-09-27 18:58     ` David Engster
2010-09-27 20:27       ` Dan Christensen
2010-09-26 20:43 ` Any juicy outstanding Gnus bugs? Ted Zlatanov
2010-09-26 20:46   ` Lars Magne Ingebrigtsen
2010-09-26 21:16     ` Richard Riley
2010-09-27  7:40       ` Steinar Bang
2010-09-27 18:41       ` Lars Magne Ingebrigtsen
2010-09-27 18:45         ` Steinar Bang
2010-09-27 19:04           ` Lars Magne Ingebrigtsen
2010-09-28 19:11     ` nnimap splitting (was: Any juicy outstanding Gnus bugs?) Ted Zlatanov
2010-09-29 15:24       ` nnimap splitting Lars Magne Ingebrigtsen
2010-09-29 18:31         ` Ted Zlatanov
2010-09-29 19:06           ` Lars Magne Ingebrigtsen
2010-09-29 19:56             ` Ted Zlatanov
2010-09-29 21:28               ` Andreas Schwab
2010-09-29 21:36               ` Lars Magne Ingebrigtsen
2010-09-29 18:44     ` Any juicy outstanding Gnus bugs? Ted Zlatanov
2010-09-29 19:09       ` Lars Magne Ingebrigtsen
2010-09-29 20:01         ` Ted Zlatanov
2010-09-29 21:34           ` Andreas Schwab
2010-09-30 15:02             ` Ted Zlatanov
2010-09-30 16:48               ` Lars Magne Ingebrigtsen
2010-09-29 21:53           ` Lars Magne Ingebrigtsen
2010-09-30 15:13             ` Ted Zlatanov
2010-09-30 16:52               ` Lars Magne Ingebrigtsen
2010-09-30 17:34                 ` Ted Zlatanov
2010-09-30 17:38                   ` Lars Magne Ingebrigtsen
2010-09-30 17:56                     ` Ted Zlatanov
2010-09-30 18:54                       ` Lars Magne Ingebrigtsen
2010-09-30 19:09                   ` Dan Christensen
2010-09-30 19:13                     ` Ted Zlatanov
2010-09-30 19:42                       ` Lars Magne Ingebrigtsen
2010-09-30 20:01                       ` Ted Zlatanov
2010-09-30 20:10                         ` Lars Magne Ingebrigtsen
2010-09-30 21:34                           ` Ted Zlatanov
2010-10-01 19:12                             ` Lars Magne Ingebrigtsen
2010-10-01 19:45                               ` Ted Zlatanov
2010-10-01 20:25                                 ` Lars Magne Ingebrigtsen
2010-10-01 20:52                                   ` Ted Zlatanov
2010-10-02 18:47                   ` Gijs Hillenius
2010-10-03 11:46                     ` Gijs Hillenius
2010-10-03 12:29                     ` Ted Zlatanov
2010-10-01  0:30               ` nnimap issues: split error and initially missing unread articles (was: Any juicy outstanding Gnus bugs?) Ted Zlatanov
2010-10-01 16:52                 ` nnimap issues: split error and initially missing unread articles Lars Magne Ingebrigtsen
2010-10-01 17:19                   ` Ted Zlatanov
2010-10-01 18:57                     ` Lars Magne Ingebrigtsen
2010-10-01 19:47                       ` Ted Zlatanov
2010-10-01 19:55                       ` Ted Zlatanov
2010-10-01 20:12                         ` Lars Magne Ingebrigtsen
2010-10-01 20:58                           ` Ted Zlatanov
2010-10-01 19:59                       ` Ted Zlatanov
2010-10-01 20:13                         ` Lars Magne Ingebrigtsen
2010-10-01 20:58                           ` Ted Zlatanov
2010-10-01 21:12                             ` Lars Magne Ingebrigtsen
2010-10-08 17:37                               ` Ted Zlatanov
2010-09-27  5:55 ` Any juicy outstanding Gnus bugs? Richard Riley
2010-09-27 18:40   ` Lars Magne Ingebrigtsen
2010-09-28  7:17     ` Gijs Hillenius
2010-09-29 14:37       ` Lars Magne Ingebrigtsen
2010-10-01  7:43     ` Richard Riley
2010-10-01 16:39       ` Lars Magne Ingebrigtsen
2010-10-02 11:39         ` Richard Riley
2010-09-28 14:10 ` Richard Riley
2010-09-29 14:38   ` Lars Magne Ingebrigtsen
2010-09-30 16:49     ` Richard Riley
2010-09-30 16:54       ` Lars Magne Ingebrigtsen
2010-10-02 16:35 ` Richard Riley
2010-10-02 17:22   ` Lars Magne Ingebrigtsen
2010-10-03  6:49     ` Richard Riley
2010-10-03 12:34       ` 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=87bp754q00.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).