commit af7351e6c33e891344724968f88f3f62d0f3275c parent c736b70115b8ea9d337f3d1018ac917f1e4d77c1 Author: Kévin Le Gouguec <kevin.legouguec@gmail.com> Date: Tue, 3 Nov 2020 18:29:44 +0100 Jot down POC code to retrieve a Message-ID from a URL Retrieved from: <https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg02212.html> (Aka <87eeml80oi.fsf@gmail.com>) Diffstat:
| M | itches/emacs/development.org | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/itches/emacs/development.org b/itches/emacs/development.org @@ -46,6 +46,23 @@ trick, e.g. &submit=Search! &idxname=$LIST #+end_example + ⇒ + #+begin_src elisp + (defun mhonarc-to-messageid (url) + "Retrieve the Message-ID from an article archived on MHonArc." + (interactive + (list + (let* ((default (or (thing-at-point-url-at-point) + (and (derived-mode-p 'eww-mode) + (shr-url-at-point nil)))) + (prompt (if default + (format "URL? (%s) " default) + "URL? "))) + (read-string prompt nil nil default)))) + (with-current-buffer (url-retrieve-synchronously url) + (search-forward-regexp "^<!--X-Message-Id: \\(.+\\) -->$") + (message (xml-substitute-numeric-entities (match-string 1))))) + #+end_src - public-inbox: trivial *** TODO HTTP archive → Message-ID - <https://lists.gnu.org>: cf. =X-Message-Id= comment in HTML