diff options
-rw-r--r-- | eos/jao-embark.el | 18 |
1 files changed, 9 insertions, 9 deletions
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 . <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 . <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) |