[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Fixing slowness of following Gnus links to IMAP articles (was:

From: Tassilo Horn
Subject: [Orgmode] Fixing slowness of following Gnus links to IMAP articles (was: Behavior of Gnus when called from an hyperlink)
Date: Tue, 27 Jul 2010 08:45:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi Sébastien,

I'm trying to add a workaround to org-gnus.el which should save the
slowness of querying the IMAP server by looking up the article number in
the group's .overview file.  But since I don't have nnimap groups, we
have to play some question & answer game. ;-)

Please apply this patch and set
`org-gnus-nnimap-query-article-no-from-file' to t.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 7ec305b..118f088 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -55,6 +55,16 @@ negates this setting for the duration of the command."
   :group 'org-link-store
   :type 'boolean)
+(defcustom org-gnus-nnimap-query-article-no-from-file nil
+  "If non-nil, `org-gnus-follow-link' will try to translate
+Message-Ids to article numbers by querying the .overview file.
+Normally, this translation is done by querying the IMAP server,
+which is usually very fast.  Unfortunately, some (maybe badly
+configured) IMAP servers don't support this operation quickly.
+So if following a link to a Gnus article takes ages, try setting
+this variable to `t'."
+  :group 'org-link-store
+  :type 'boolean)
 ;; Install the link type
 (org-add-link-type "gnus" 'org-gnus-open)
@@ -173,7 +183,11 @@ If `org-store-link' was called with a prefix arg the 
meaning of
   (cond ((and group article)
         (gnus-activate-group group t)
         (condition-case nil
-            (let ((backend (car (gnus-find-method-for-group group))))
+            (let* ((method (gnus-find-method-for-group group))
+                   (backend (car method))
+                   (server (cadr method)))
+              (message "method = %s\ngroup = %s\nbackend = %s\nserver = %s"
+                       method group backend server)
                ((eq backend 'nndoc)
                 (if (gnus-group-read-group t nil group)
@@ -183,6 +197,12 @@ If `org-store-link' was called with a prefix arg the 
meaning of
                 (let ((articles 1)
+                  ;; work arround IMAP servers that perform badly in
+                  ;; SEARCH commands.
+                  (when (and (eq backend 'nnimap)
+                             org-gnus-nnimap-query-article-no-from-file)
+                    (let ((headers (nnimap-retrieve-headers-from-file )))
+                      (message "headers = %s" headers)))
                   (while (and (not group-opened)
                               ;; stop on integer overflows
                               (> articles 0))
--8<---------------cut here---------------end--------------->8---

Then follow some org link to a message in a nnimap group.  This will be
slow as usual, but produce some output in *Messages* that I need to go
ahead.  In that buffer, there should be 4 key-value pairs "<var> =
<value>".  Please poste these here.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]