From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Re: Fixing slowness of following Gnus links to IMAP articles Date: Wed, 28 Jul 2010 08:36:57 +0200 Message-ID: <87fwz4159y.fsf@thinkpad.tsdh.de> References: <87r5jrcx9g.fsf@mundaneum.com> <23582.1277735944@gamaville.dokosmarshall.org> <87vd936wiq.fsf@mundaneum.com> <87eifr3t52.fsf@thinkpad.tsdh.de> <87vd8gcu6k.fsf@mundaneum.com> <87oce7j26i.fsf@thinkpad.tsdh.de> <87fwzjfyf8.fsf@mundaneum.com> <878w5bkxx7.fsf@mundaneum.com> <87hbjyzicz.fsf@thinkpad.tsdh.de> <13292.1279382554@gamaville.dokosmarshall.org> <87zkxpanh1.fsf@mundaneum.com> <23154.1279399784@gamaville.dokosmarshall.org> <87zkxpg5cg.fsf@mundaneum.com> <87wrstn4a9.fsf@mundaneum.com> <87fwzf51t1.fsf@thinkpad.tsdh.de> <87d3ujbrwt.wl%dmaus@ictsoc.de> <87wrsrmcnf.fsf@mundaneum.com> <87lj96k6xn.wl%dmaus@ictsoc.de> <87wrsoy5b2.fsf@mundaneum.com> <87aapdzalm.fsf_-_@thinkpad.tsdh.de> <874ofkoekr.wl%dmaus@ictsoc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=46507 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oe0GK-0007VN-SW for emacs-orgmode@gnu.org; Wed, 28 Jul 2010 02:37:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oe0GJ-0000Tn-Hu for emacs-orgmode@gnu.org; Wed, 28 Jul 2010 02:37:08 -0400 Received: from lo.gmane.org ([80.91.229.12]:39736) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oe0GJ-0000Ta-6I for emacs-orgmode@gnu.org; Wed, 28 Jul 2010 02:37:07 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Oe0GG-0000Ez-VJ for emacs-orgmode@gnu.org; Wed, 28 Jul 2010 08:37:05 +0200 Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Jul 2010 08:37:04 +0200 Received: from tassilo by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Jul 2010 08:37:04 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org David Maus writes: Hi David, >>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. > > The patch does not work: It calls `nnimap-retrieve-headers-from-file' > without the required arguments (group server) Argh, stupid me! Here's a corrected patch. --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el index 7ec305b..7a339cd 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) (cond ((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 (t (let ((articles 1) group-opened) + ;; 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 group server))) + (message "headers = %s" headers))) (while (and (not group-opened) ;; stop on integer overflows (> articles 0)) --8<---------------cut here---------------end--------------->8--- > and the headers are not fetched because > `nnimap-retrieve-headers-from-file' looks for a NOV cache file, not > .overview. Aren't overview file and NOV file synonyms? Hm, anyway. In the Gnus docs I've found this paragraph: ,----[ (info "(gnus)IMAP") ] | `nnimap-nov-is-evil' | Never generate or use a local NOV database. Defaults to the value | of `gnus-agent'. | | Using a NOV database usually makes header fetching much faster, | but it uses the `UID SEARCH UID' command, which is very slow on | some servers (notably some versions of Courier). Since the Gnus | Agent caches the information in the NOV database without using the | slow command, this variable defaults to true if the Agent is in | use, and false otherwise. `---- So maybe we're trying to replace one slow command with another slow command. Especially, the fact that Courier is explicitly mentioned is a bit frustrating. Well, let's try it out and see if it helps a bit. > Alas: I couldn't figure out how to enable NOV cache for my nnimap > group. Setting `nnimap-nov-is-evil' to nil didn't help. This variable defaults to the value of `gnus-agent', so I assume the agent has to be enabled (which is default), and most probably the IMAP server has to be agentized as well. That can be done in the server buffer (`^' in *Group*), and then: ,----[ (info "(gnus)Server Agent Commands") ] | `J a' | Add the current server to the list of servers covered by the Gnus | Agent (`gnus-agent-add-server'). `---- Bye, Tassilo