diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-08-27 23:19:20 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-08-28 23:05:56 -0400 |
commit | 22ba165220a7041b331c860cb6dfdca237f59799 (patch) | |
tree | a8ee0d3312399c1fafbad74a53f3d5105855d74a /piem-elfeed.el | |
parent | 673811ea1b2285059ab36e09c42682cd2d21686f (diff) | |
download | piem-22ba165220a7041b331c860cb6dfdca237f59799.tar.gz |
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>
Diffstat (limited to 'piem-elfeed.el')
-rw-r--r-- | piem-elfeed.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/piem-elfeed.el b/piem-elfeed.el index 5a6472b..b1e112b 100644 --- a/piem-elfeed.el +++ b/piem-elfeed.el @@ -43,10 +43,11 @@ (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-link-re link) - (match-string 2 link))))) + (when-let ((inbox (piem-elfeed-get-inbox)) + (inbox-url (piem-inbox-get :url inbox)) + (link (elfeed-entry-link elfeed-show-entry))) + (and (string-match (piem-message-link-re inbox-url) link) + (match-string 1 link)))) ;;;###autoload (define-minor-mode piem-elfeed-mode |