summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-11-03 18:29:44 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-11-03 18:29:44 +0100
commitaf7351e6c33e891344724968f88f3f62d0f3275c (patch)
treec6e8322fa4d686c789c872794af31dfad60fa707
parentc736b70115b8ea9d337f3d1018ac917f1e4d77c1 (diff)
downloadmemory-leaks-af7351e6c33e891344724968f88f3f62d0f3275c.tar.xz
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>)
-rw-r--r--itches/emacs/development.org17
1 files changed, 17 insertions, 0 deletions
diff --git a/itches/emacs/development.org b/itches/emacs/development.org
index a1fe3f2..a3e05da 100644
--- 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