[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: |
Mon, 13 Jun 2022 14:43:04 +0200 |
Óscar Fuentes <ofv@wanadoo.es> writes:
> Instead of a recursive function use a recursive data structure: a list.
> The outer function puts in the list the initial URL, and then, in a
> loop, pops from the list a URL, downloads it, adds to the list the
> referenced URLs and repeats until the list is empty or some other
> condition is met.
> Some complications may remain: for instance, you need to detect cycles
> (the failure on your posted code probably comes from that). A list also
> comes handy for that, if you walk the list with dolist instead of
> popping elements and add new ones with add-to-list, which omits elements
> which are already in the list.
I dont know how. Maybe some like:
#+begin_src elisp
(defun lists-mbox-recursive-url-list (url-head id date)
(with-current-buffer "*eww*"
(shr-next-link)
(let ((url (thing-at-point 'url)))
(if (string-match (format "%s/archive/mbox/%s/%s\\(.+\\)" url-head id
date)
url)
(add-to-list url-list url)))
(if (save-excursion (shr-next-link))
(lists-mbox-recursive-url-list url-head id date)
url-list)))
(let ((url-list '()))
(with-current-buffer "*eww*"
(beginning-of-buffer)
(lists-mbox-recursive-url-list "https://lists.gnu.org" "help-gnu-emacs"
201)))
#+end_src
But return an error that I dont understand:
Debugger entered--Lisp error: (setting-constant nil)
add-to-list(nil "https://lists.gnu.org/archive/mbox/help-gnu-emacs/...")
(if (string-match (format "%s/archive/mbox/%s/%s\\(.+\\)" url-head id date)
url) (add-to-list url-list url))
(let ((url (thing-at-point 'url))) (if (string-match (format
"%s/archive/mbox/%s/%s\\(.+\\)" url-head id date) url) (add-to-list url-list
url)))
(save-current-buffer (set-buffer "*eww*") (shr-next-link) (let ((url
(thing-at-point 'url))) (if (string-match (format
"%s/archive/mbox/%s/%s\\(.+\\)" url-head id date) url) (add-to-list url-list
url))) (if (save-excursion (shr-next-link)) (lists-mbox-recursive-url-list
url-head id date) url-list))
lists-mbox-recursive-url-list("https://lists.gnu.org" "help-gnu-emacs" 201)
...
What mean "error: (setting-constant nil)"
- functions to download mailing list archives, GH, 2022/06/12
- Re: functions to download mailing list archives, Óscar Fuentes, 2022/06/12
- Re: functions to download mailing list archives,
GH <=
- Re: functions to download mailing list archives, Óscar Fuentes, 2022/06/13
- Re: functions to download mailing list archives, GH, 2022/06/13
- Re: functions to download mailing list archives, Óscar Fuentes, 2022/06/13
- Re: functions to download mailing list archives, GH, 2022/06/14
- Re: functions to download mailing list archives, Emanuel Berg, 2022/06/14
Re: functions to download mailing list archives, GH, 2022/06/15