diff options
author | jao <jao@gnu.org> | 2021-01-12 21:16:37 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-01-12 21:16:37 +0000 |
commit | 60e74a345c7ff8ca2ecfdf2c706b4e643c3ee499 (patch) | |
tree | a5d81d2d828eb6b142c04c8b8c136d5dd1374e05 | |
parent | c1bb6c356ec74ca065976557c264b16a224f18a0 (diff) | |
download | elibs-60e74a345c7ff8ca2ecfdf2c706b4e643c3ee499.tar.gz elibs-60e74a345c7ff8ca2ecfdf2c706b4e643c3ee499.tar.bz2 |
jao-embark, omar's suggestions
-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) |