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.... dmj...@jabber.org
Email..... dm...@ictsoc.de

Attachment: pgptd3ICl9sJa.pgp
Description: PGP signature

_______________________________________________
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 via email to