help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Gnus: How to reference an article from a gmane mailing list


From: Emanuel Berg
Subject: Re: Gnus: How to reference an article from a gmane mailing list
Date: Wed, 08 Dec 2021 09:06:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Kévin Le Gouguec wrote:

> See my reply to Emanuel <877dcihgag.fsf@gmail.com>

Haha ... stop it :)

> it used to be that you could query the archive for a message
> ID, e.g. go here:
>
> https://lists.gnu.org/archive/html/help-gnu-emacs/
>
> Then type in this search string:
>
> +message-id:<6214117000e144ffaeceded74c239fb8@frb.gov>
>
> That shold yield a single result (from a message I picked at
> random in Gnus's summray buffer).
>
> For some reason though, the search engine does not seem to
> work for more recent messages. Maybe indexing is broken?
> Someone would need to ping the list admins.

Better ask them for a header to the future archive post ...
they should have it.

re: your Elisp ... it's very good!

Just add this ...

  (require 'gnus-sum)
  (require 'nnheader)
  (require 'shr)
  (require 'xml)

and LIST, ID, and URL to the docstrings and you're all set :)

> #+begin_src elisp
> ;; Utilities for mailing lists.
> (defun my/kill-message-id ()
>   (interactive)
>   (kill-new (mail-header-message-id (gnus-summary-article-header))))
>
> (defun my/describe-message (id url)
>   (kill-new (format "%s\n%s\n"
>                     (if (string-prefix-p "<" id)
>                         id
>                       (format "<%s>" id))
>                     url)))
>
> (defun my/describe-message-id (list id)
>   "Format references from the Message-ID of a gnu.org list."
>   (interactive
>    (list
>     (read-string "List: ")            ; TODO: default to current list.
>     (let ((default-id
>             (mail-header-message-id (gnus-summary-article-header))))
>       (read-string (format-prompt "Message-ID" default-id)
>                    nil nil default-id))))
>   (with-current-buffer
>       (url-retrieve-synchronously
>        (concat
>         ;; For some reason, literal "+" chars cause the search to fail.
>         ;; Escape them.
>         "https://lists.gnu.org/archive/cgi-bin/namazu.cgi";
>         "?query=%2Bmessage-id:"
>         (replace-regexp-in-string "\\+" "%2B" id)
>         "&submit=Search!"
>         "&idxname=" list))
>     (search-forward-regexp
>      (rx "<a href=\""
>          (group "/archive/html/" (literal list) "/"
>                 (+ (any "0-9-")) "/msg" (+ (any "0-9")) ".html")
>          "\">"))
>     (let ((url (concat "https://lists.gnu.org"; (match-string 1))))
>       (my/describe-message id url))))
>
> (defun my/describe-message-url (url)
>   "Format references from an article archived on MHonArc."
>   (interactive
>    (list
>     (let ((default (or (thing-at-point 'url)
>                        (and (derived-mode-p 'eww-mode)
>                             (shr-url-at-point nil)))))
>       (read-string (format-prompt "URL" default) nil nil default))))
>   (with-current-buffer (url-retrieve-synchronously url)
>     (search-forward-regexp "^<!--X-Message-Id: \\(.+\\) -->$")
>     (let ((id (xml-substitute-numeric-entities (match-string 1))))
>       (my/describe-message id url))))
> #+end_src
>

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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