From 22ba165220a7041b331c860cb6dfdca237f59799 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 27 Aug 2020 23:19:20 -0400 Subject: elfeed, eww: Be stricter about the returned message ID Using the second group in piem-link-re is not reliable because the trailing part of the URL may be anything. Instead get the inboxes :url first and then generate a regular expression that has that value as the prefix. Message-Id: <20200828031920.7515-5-kyle@kyleam.com> --- piem-eww.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'piem-eww.el') diff --git a/piem-eww.el b/piem-eww.el index 5fb629b..62b7166 100644 --- a/piem-eww.el +++ b/piem-eww.el @@ -42,10 +42,11 @@ (defun piem-eww-get-mid () "Return the message ID of an EWW buffer." - (when (derived-mode-p 'eww-mode) - (when-let ((link (plist-get eww-data :url))) - (and (string-match piem-link-re link) - (match-string 2 link))))) + (when-let ((inbox (piem-eww-get-inbox)) + (inbox-url (piem-inbox-get :url inbox)) + (url (plist-get eww-data :url))) + (and (string-match (piem-message-link-re inbox-url) url) + (match-string 1 url)))) ;;;###autoload (define-minor-mode piem-eww-mode -- cgit v1.2.3