emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: "Sébastien Vauban" <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Fixing slowness of following Gnus links to	IMAP	articles
Date: Sun, 15 Aug 2010 20:52:05 +0200	[thread overview]
Message-ID: <87ocd34skq.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <87r5ik20us.fsf@mundaneum.com>

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

Sébastien Vauban wrote:

>Just to say I'm back online -- after a week holiday and an almost nil access
>to the newsgroups.

>Thanks a lot for trying to get Gnus better behaving in face of slow servers
>like Courier...

>Do "you" want me to test something special to move things forward?

Okay, could you try the attached patch?  It is based on current master
and tries to look up the article number (uid) in NOVCACHE and falls
back to UID SEARCH when the message is not cached.

To make a message enter Gnus' cache you might to modify
`gnus-cache-enter-articles'.  The cache setting I used to test the
patch are:

,----[ gnus.el ]
| (setq nnimap-nov-is-evil nil)
| (setq gnus-use-cache t)
| (setq gnus-cache-enter-articles '(ticked dormant unread read))
`----

NOTE: This patch is deliberately not attached as text/plain to avoid
the patchtracker catching it (no proper commit message and all).

Best,
  -- David
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: 0001-Try-fix-1.patch --]
[-- Type: application/octet-stream, Size: 2955 bytes --]

From 1f48ce1fad323503c6c7f79c5cd7c2b3b05370ba Mon Sep 17 00:00:00 2001
From: David Maus <dmaus@ictsoc.de>
Date: Sun, 15 Aug 2010 20:41:59 +0200
Subject: [PATCH] Try fix 1.

---
 lisp/org-gnus.el |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 10a0426..f98256f 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -54,12 +54,40 @@ negates this setting for the duration of the command."
   :group 'org-link-store
   :type 'boolean)
 
+(defcustom org-gnus-nnimap-query-article-no-from-file t
+  "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)
 (add-hook 'org-store-link-functions 'org-gnus-store-link)
 
 ;; Implementation
 
+(defun org-gnus-nnimap-cached-article-number (group server message-id)
+  "Return cached article number (uid) of message in GROUP on SERVER.
+MESSAGE-ID is the message-id header field that identifies the
+message.  If the uid is not cached, return nil."
+  (with-temp-buffer
+    (let ((nov (nnimap-group-overview-filename group server)))
+      (when (file-exists-p nov)
+	(mm-insert-file-contents nov)
+	(set-buffer-modified-p nil)
+	(goto-char (point-min))
+	(catch 'found
+	  (while (search-forward message-id nil t)
+	    (let ((hdr (split-string (thing-at-point 'line) "\t")))
+	      (if (string= (nth 4 hdr) message-id)
+		  (throw 'found (nth 0 hdr))))))))))
+
 (defun org-gnus-group-link (group)
   "Create a link to the Gnus group GROUP.
 If GROUP is a newsgroup and `org-gnus-prefer-web-links' is
@@ -171,7 +199,9 @@ 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)))
 	       (cond
 		((eq backend 'nndoc)
 		 (if (gnus-group-read-group t nil group)
@@ -181,6 +211,12 @@ If `org-store-link' was called with a prefix arg the meaning of
 		(t
 		 (let ((articles 1)
 		       group-opened)
+		   (when (and (eq backend 'nnimap)
+			      org-gnus-nnimap-query-article-no-from-file)
+		     (setq article
+			   (or (org-gnus-nnimap-cached-article-number
+				(nth 1 (split-string group ":"))
+				server (concat "<" article ">")) article)))
 		   (while (and (not group-opened)
 			       ;; stop on integer overflows
 			       (> articles 0))
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-08-15 20:28 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28  9:38 Behavior of Gnus when called from an hyperlink Sébastien Vauban
2010-06-28 10:19 ` Tassilo Horn
2010-06-28 11:36   ` Leo
2010-06-28 11:49     ` Carsten Dominik
2010-06-28 12:47       ` Bernt Hansen
2010-06-28 13:57       ` Greg Troxel
2010-06-28 19:44       ` [PATCH] Add customization for WL in `org-link-frame-setup' David Maus
2010-06-29  4:42         ` Carsten Dominik
2010-06-28 19:44       ` [PATCH] Add customization option to open WL links in other frame David Maus
2010-06-30 10:12       ` Behavior of Gnus when called from an hyperlink Noorul Islam K M
2010-07-02  4:44         ` Carsten Dominik
2010-07-02  8:21           ` Leo
2010-07-02  8:21           ` Bastien
2010-07-02 11:59           ` Bernt Hansen
2010-06-28 12:05   ` Sébastien Vauban
2010-06-28 12:51     ` Sébastien Vauban
2010-06-28 14:39       ` Nick Dokos
2010-06-28 14:51         ` Sébastien Vauban
2010-06-28 15:19           ` Nick Dokos
2010-06-28 18:32           ` Tassilo Horn
2010-07-15 21:27             ` Sébastien Vauban
2010-07-16  7:50               ` Tassilo Horn
2010-07-16 11:39                 ` Sébastien Vauban
2010-07-16 18:11                   ` Nick Dokos
2010-07-16 19:23                     ` Sébastien Vauban
2010-07-16 19:51                   ` Sébastien Vauban
2010-07-17  7:18                     ` Tassilo Horn
2010-07-17 16:02                       ` Nick Dokos
2010-07-17 19:59                         ` Sébastien Vauban
2010-07-17 20:49                           ` Nick Dokos
2010-07-17 21:34                             ` Sébastien Vauban
2010-07-17 22:15                               ` Sébastien Vauban
2010-07-19  8:11                                 ` Tassilo Horn
2010-07-19 12:02                                   ` David Maus
2010-07-19 20:37                                     ` Sébastien Vauban
2010-07-20  6:23                                       ` David Maus
2010-07-21 19:59                                         ` Sébastien Vauban
2010-07-22 12:31                                           ` Tassilo Horn
2010-07-26 13:17                                             ` David Maus
2010-07-26 15:12                                               ` Tassilo Horn
2010-07-26 18:47                                                 ` Tassilo Horn
2010-07-27  6:45                                           ` Fixing slowness of following Gnus links to IMAP articles (was: Behavior of Gnus when called from an hyperlink) Tassilo Horn
2010-07-27 20:27                                             ` David Maus
2010-07-27 21:18                                               ` Nick Dokos
2010-07-28  6:50                                                 ` Fixing slowness of following Gnus links to IMAP articles Tassilo Horn
2010-07-29  7:33                                                   ` David Maus
2010-07-29 18:06                                                     ` Tassilo Horn
2010-07-30 20:03                                                       ` Sébastien Vauban
2010-08-15 18:52                                                         ` David Maus [this message]
2010-09-08 15:09                                                           ` Sébastien Vauban
2010-09-08 19:08                                                             ` David Maus
2010-09-08 21:42                                                               ` Sébastien Vauban
2010-09-09 12:19                                                                 ` David Maus
2010-10-01  0:53                                                                   ` Matt Lundin
2010-10-11 18:33                                                                     ` David Maus
2010-08-01  8:38                                                       ` David Maus
2010-07-28  6:36                                               ` Tassilo Horn
2010-07-31  8:34                                                 ` Patchwork: Patch 176 Accepted Bastien Guerry
2010-07-31 18:21                                                   ` Tassilo Horn
2010-07-31 23:52                                                     ` Bastien
2010-08-03  8:01                                             ` Fixing slowness of following Gnus links to IMAP articles Sébastien Vauban
2010-08-05 18:21                                               ` Tassilo Horn
2010-07-20 11:50                                       ` Behavior of Gnus when called from an hyperlink Tassilo Horn
2010-07-21 19:28                                         ` Sébastien Vauban
2010-07-20 12:08                                       ` Bernt Hansen
2010-07-20 16:11                                         ` Tassilo Horn
2010-07-21 19:38                                           ` Sébastien Vauban
2010-07-22 12:29                                             ` Tassilo Horn
2010-07-22 13:51                                               ` Matt Lundin
2010-07-22 19:29                                                 ` Sébastien Vauban
2010-07-22 19:21                                               ` Sébastien Vauban
2010-07-22 20:11                                                 ` Tassilo Horn
2010-07-23  8:54                                                   ` Giovanni Ridolfi
2010-07-23 10:40                                                     ` Tassilo Horn
2010-07-24 22:32                                                       ` Sébastien Vauban
2010-07-21 19:33                                         ` Sébastien Vauban
2010-07-21 23:30                                           ` Bernt Hansen

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87ocd34skq.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).