[Top][All Lists]

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

Re: functions to download mailing list archives

From: GH
Subject: Re: functions to download mailing list archives
Date: Thu, 16 Jun 2022 02:13:14 +0200

Fixed without recursion

#+begin_src elisp

;;; Code under GPLv3-or-later

(defun lists-mbox-url-list (url-head id date)
  (with-current-buffer "*eww*"
    (let ((url-list '()))
      (while (save-excursion
               (text-property-search-forward 'shr-url nil nil t))
        (let ((url (thing-at-point 'url)))
          (if (and url
                   (string-match (format "%s/archive/mbox/%s/%s\\(.+\\)" 
url-head id date)
              (add-to-list 'url-list url))))

(defun lists-mbox-download (url-head id)
  (let* ((date (read-number "Date filter: " 20))
         (dir (read-file-name "Download directory: "))
         (url-list (lists-mbox-url-list url-head id date)))
    (dolist (url url-list)
      (url-retrieve url #'eww-download-callback (list url dir)))))

(defun lists-load-archive (url-head id)
  (interactive (list "";
                     (read-from-minibuffer "Mailing list id: ")))
  (if (y-or-n-p "Load as mbox files?")
      (prog1 (eww-browse-url (format "%s/archive/mbox/%s/" url-head id))
        (if (y-or-n-p "Download archive mboxes?")
            (lists-mbox-download url-head id)))
    (eww-browse-url (format "%s/archive/html/%s/" url-head id))))


Test it

(lists-load-archive ""; "help-gnu-emacs")

Or call it interactivelly:

M-x lists-load-archive RET help-gnu-emacs RET y y

reply via email to

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