diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-11-29 13:56:05 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-11-29 13:56:05 +0100 |
| commit | d393a44d17e1d1278bfa51de42abd0eedebf99f8 (patch) | |
| tree | ab22dce15b8845038dfaaba856383affc625a940 /itches/emacs | |
| parent | bacf765b2e7b6089c41e6d91540c3574be26e79e (diff) | |
| download | memory-leaks-d393a44d17e1d1278bfa51de42abd0eedebf99f8.tar.xz | |
Expand notes on lists.gnu.org ↔ message-id mappings
- move function to correct section, and tweak it
- add function for retrieving a lists.gnu.org URL from a
message-id (unfinished, would like to automatically grab the
list-id)
- remove indentation; pandoc sees how the #+begin_src tag is indented
and does TRT
- say "emacs-lisp" instead of "elisp", as pandoc does not know the
latter
https://github.com/jgm/pandoc/blob/2.11.2/src/Text/Pandoc/Readers/Org/Shared.hs#L71
Diffstat (limited to 'itches/emacs')
| -rw-r--r-- | itches/emacs/development.org | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/itches/emacs/development.org b/itches/emacs/development.org index a3e05da..755330b 100644 --- a/itches/emacs/development.org +++ b/itches/emacs/development.org @@ -35,35 +35,66 @@ trick, e.g. * Mailing lists ** Message IDs *** Summary buffer → Message-ID -#+begin_src elisp +#+begin_src emacs-lisp (kill-new (mail-header-message-id (gnus-summary-article-header))) #+end_src *** TODO Message-ID → HTTP archive - <https://lists.gnu.org>: #+begin_example - https://lists.gnu.org/archive/cgi-bin/namazu.cgi - ?query=%2Bmessage-id:<$MESSAGE_ID> - &submit=Search! - &idxname=$LIST +https://lists.gnu.org/archive/cgi-bin/namazu.cgi + ?query=%2Bmessage-id:<$MESSAGE_ID> + &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))))) + #+begin_src emacs-lisp +(defun messageid-to-lgo-url (list id) + "Find the lists.gnu.org URL for a given Message-ID." + (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)))) + (kill-new url) + (message url)))) #+end_src + - public-inbox: trivial -*** TODO HTTP archive → Message-ID +*** DONE HTTP archive → Message-ID - <https://lists.gnu.org>: cf. =X-Message-Id= comment in HTML + ⇒ + #+begin_src emacs-lisp +(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))))) + (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)))) + (kill-new id) + (message id)))) + #+end_src + - public-inbox: cf. URL |
