emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: Fixing slowness of following Gnus links to IMAP articl


From: David Maus
Subject: Re: [Orgmode] Re: Fixing slowness of following Gnus links to IMAP articles
Date: Sun, 01 Aug 2010 10:38:07 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Tassilo Horn wrote:
>> Second it would return a cons (min-UID . max-UID).  That wouldn't help
>> us, would it?

>What an appropriately named function that is. ;-) No, that wouldn't
>help.  But its code could be stolen to write and own function to insert
>the right NOV file in a temp buffer, to search for the message-id.
>Something like that:

Well, using `nnimap-retrieve-headers-from-file' would work because it
loads the cache into `nntp-server-buffer'.  But it turned out that my
problem with the garbled cache is a bug in this function: It doesn't
erase the buffer before inserting the cache file and the buffer is not
empty (bug report filed).

So we need our own function.  A slight modification of yours:

--8<---------------cut here---------------start------------->8---
(defun org-gnus-nnimap-get-article-number (group server message-id)
  (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 (number-to-string (nth 0 hdr)))))))))))
--8<---------------cut here---------------start------------->8---

 - the message-id might also appear in a in-reply-to oder references
   field

 - use a temp buffer to avoid possible confusion for Gnus
   (e.g. content of nntp-server-buffer changed outside Gnus)

Best,
  -- David

--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgpC_dtpjt7P0.pgp
Description: PGP signature


reply via email to

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