diff options
Diffstat (limited to 'eos')
-rw-r--r-- | eos/jao-ednc.el (renamed from eos/sys/jao-ednc.el) | 0 | ||||
-rw-r--r-- | eos/jao-embark.el (renamed from eos/sys/jao-embark.el) | 26 | ||||
-rw-r--r-- | eos/jao-minibuffer.el (renamed from eos/sys/jao-minibuffer.el) | 0 | ||||
-rw-r--r-- | eos/jao-notify.el (renamed from eos/sys/jao-notify.el) | 0 | ||||
-rw-r--r-- | eos/jao-osd.el (renamed from eos/sys/jao-osd.el) | 0 | ||||
-rw-r--r-- | eos/jao-sleep.el (renamed from eos/sys/jao-sleep.el) | 0 |
6 files changed, 17 insertions, 9 deletions
diff --git a/eos/sys/jao-ednc.el b/eos/jao-ednc.el index 03d4049..03d4049 100644 --- a/eos/sys/jao-ednc.el +++ b/eos/jao-ednc.el diff --git a/eos/sys/jao-embark.el b/eos/jao-embark.el index 9572489..b590782 100644 --- a/eos/sys/jao-embark.el +++ b/eos/jao-embark.el @@ -26,6 +26,8 @@ (require 'embark) +(declare-function w3m-anchor "w3m") + (defvar jao-embark-video-url-rx (format "^https?://\\(?:www\\.\\)?%s/.+" (regexp-opt '("youtu.be" @@ -36,27 +38,33 @@ 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 (thing-at-point-url-at-point))) - (when (string-match-p jao-embark-video-url-rx url) - (cons 'video-url url)))) + (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)))) +;;;###autoload (defun jao-embark-play-video-url (&optional url) (interactive "sURL: ") (let ((cmd (format "mpv %s" (shell-quote-argument url)))) (start-process-shell-command "mpv" nil cmd))) -(add-to-list 'embark-target-finders #'jao-embark-video-finder) +(define-key embark-url-map (kbd "f") #'browse-url-firefox) (embark-define-keymap jao-embark-video-url-map "Actions on URLs pointing to remote video streams." - ("p" jao-embark-play-video-url) - ("b" browse-url) - ("f" browse-url-firefox)) - -(add-to-list 'embark-keymap-alist '(video-url . jao-embark-video-url-map)) + :parent embark-url-map + ("p" jao-embark-play-video-url)) + +;;;###autoload +(defun jao-embark-setup () + (interactive) + (add-to-list 'embark-target-finders #'jao-embark-video-finder) + (add-to-list 'embark-keymap-alist '(video-url . jao-embark-video-url-map))) (provide 'jao-embark) ;;; jao-embark.el ends here diff --git a/eos/sys/jao-minibuffer.el b/eos/jao-minibuffer.el index b626151..b626151 100644 --- a/eos/sys/jao-minibuffer.el +++ b/eos/jao-minibuffer.el diff --git a/eos/sys/jao-notify.el b/eos/jao-notify.el index dc48ca4..dc48ca4 100644 --- a/eos/sys/jao-notify.el +++ b/eos/jao-notify.el diff --git a/eos/sys/jao-osd.el b/eos/jao-osd.el index acdc629..acdc629 100644 --- a/eos/sys/jao-osd.el +++ b/eos/jao-osd.el diff --git a/eos/sys/jao-sleep.el b/eos/jao-sleep.el index 93da0e7..93da0e7 100644 --- a/eos/sys/jao-sleep.el +++ b/eos/jao-sleep.el |