From: GH <project@gnuhacker.org>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: functions to download mailing list archives
Date: Mon, 13 Jun 2022 14:43:04 +0200 [thread overview]
Message-ID: <87h74ozqcn.fsf@gnu.org> (raw)
In-Reply-To: <878rq1cwl9.fsf@telefonica.net> ("Óscar Fuentes"'s message of "Mon, 13 Jun 2022 01:04:34 +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)"
next prev parent reply other threads:[~2022-06-13 12:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-12 22:30 functions to download mailing list archives GH
2022-06-12 23:04 ` Óscar Fuentes
2022-06-13 12:43 ` GH [this message]
2022-06-13 16:46 ` Óscar Fuentes
2022-06-13 18:41 ` GH
2022-06-13 22:09 ` Óscar Fuentes
2022-06-14 9:58 ` GH
2022-06-14 10:26 ` Emanuel Berg
2022-06-16 0:13 ` GH
2022-06-16 4:23 ` Emanuel Berg
2022-06-16 12:27 ` GH
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h74ozqcn.fsf@gnu.org \
--to=project@gnuhacker.org \
--cc=help-gnu-emacs@gnu.org \
--cc=ofv@wanadoo.es \
/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.
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).