From 60e74a345c7ff8ca2ecfdf2c706b4e643c3ee499 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 12 Jan 2021 21:16:37 +0000 Subject: jao-embark, omar's suggestions --- eos/jao-embark.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'eos/jao-embark.el') diff --git a/eos/jao-embark.el b/eos/jao-embark.el index b590782..2450fdf 100644 --- a/eos/jao-embark.el +++ b/eos/jao-embark.el @@ -38,14 +38,13 @@ t)) "A regular expression matching URLs that point to video streams") -;;;###autoload -(defun jao-embark-video-finder () - "Check whether we're looking at a video URL. -Return (video-url . ) if so." - (when-let ((url (or (embark-target-url-at-point) (w3m-anchor)))) - (if (string-match-p jao-embark-video-url-rx url) - (cons 'video-url url) - (cons 'url url)))) +(defun jao-embark-w3m-anchor () + (when-let ((url (w3m-anchor))) (cons 'url url))) + +(defun jao-refine-url (url) + (if (string-match-p jao-embark-video-url-rx url) + (cons 'video-url url) + (cons 'url url))) ;;;###autoload (defun jao-embark-play-video-url (&optional url) @@ -63,7 +62,8 @@ Return (video-url . ) if so." ;;;###autoload (defun jao-embark-setup () (interactive) - (add-to-list 'embark-target-finders #'jao-embark-video-finder) + (add-to-list 'embark-target-finders #'jao-embark-w3m-anchor) + (add-to-list 'embark-transformer-alist '(url . jao-refine-url)) (add-to-list 'embark-keymap-alist '(video-url . jao-embark-video-url-map))) (provide 'jao-embark) -- cgit v1.2.3