summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--piem-elfeed.el9
-rw-r--r--piem.el13
2 files changed, 15 insertions, 7 deletions
diff --git a/piem-elfeed.el b/piem-elfeed.el
index b5e7dc8..979c5ed 100644
--- a/piem-elfeed.el
+++ b/piem-elfeed.el
@@ -35,23 +35,18 @@
:link '(info-link "(piem)Elfeed integration")
:group 'piem)
-(defvar piem-elfeed--link-re
- (rx "/" (group (one-or-more (not (any "/" "\n"))))
- "/" (group (one-or-more (not (any "/" "\n"))))
- "/" string-end))
-
(defun piem-elfeed-get-inbox ()
"Return inbox name from an `elfeed-show-mode' buffer."
(when (derived-mode-p 'elfeed-show-mode)
(when-let ((link (elfeed-entry-link elfeed-show-entry)))
- (and (string-match piem-elfeed--link-re link)
+ (and (string-match piem-link-re link)
(match-string 1 link)))))
(defun piem-elfeed-get-mid ()
"Return the message ID of an `elfeed-show-mode' buffer."
(when (derived-mode-p 'elfeed-show-mode)
(when-let ((link (elfeed-entry-link elfeed-show-entry)))
- (and (string-match piem-elfeed--link-re link)
+ (and (string-match piem-link-re link)
(match-string 2 link)))))
(define-minor-mode piem-elfeed-mode
diff --git a/piem.el b/piem.el
index 872da22..f014cbc 100644
--- a/piem.el
+++ b/piem.el
@@ -87,6 +87,19 @@ should return a function that takes no arguments and inserts the
mbox's contents in the current buffer."
:type 'hook)
+(defvar piem-link-re
+ (rx "/" (group (one-or-more (not (any "/" "\n"))))
+ "/" (group (one-or-more (not (any "/" "\n"))))
+ "/" (group (zero-or-one
+ (or "raw"
+ "t.mbox.gz"
+ (and (or "t" "T") "/#"
+ (one-or-more (not (any "/" "\n")))))))
+ string-end)
+ "Regular expression matching public-inbox HTTP link.
+The first group is the inbox, the second is the message ID, and
+the rest is any trailing endpoint.")
+
(defun piem-inbox-by-header-match ()
"Return inbox based on matching message headers.
This should be called from a buffer containing a message and is