summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--eos/jao-embark-targets.el (renamed from eos/jao-embark.el)36
1 files changed, 16 insertions, 20 deletions
diff --git a/eos/jao-embark.el b/eos/jao-embark-targets.el
index a59e241..f55398c 100644
--- a/eos/jao-embark.el
+++ b/eos/jao-embark-targets.el
@@ -1,4 +1,4 @@
-;;; jao-embark.el --- embark actions -*- lexical-binding: t; -*-
+;;; jao-embark-targets.el --- embark actions -*- lexical-binding: t; -*-
;; Copyright (C) 2021 jao
@@ -20,7 +20,7 @@
;;; Commentary:
-;; Actions and utilities for embark
+;; Embark targets and actions
;;; Code:
@@ -28,7 +28,7 @@
(declare-function w3m-anchor "w3m")
-(defvar jao-embark-video-url-rx
+(defvar jao-embark-targets-video-url-rx
(format "^https?://\\(?:www\\.\\)?%s/.+"
(regexp-opt '("youtu.be"
"youtube.com"
@@ -38,35 +38,31 @@
t))
"A regular expression matching URLs that point to video streams")
-(defun jao-embark-w3m-anchor ()
+(defun jao-embark-targets--w3m-anchor ()
(when (not (region-active-p))
(when-let ((url (or (w3m-anchor) w3m-current-url)))
(cons 'url url))))
-(defun jao-refine-url (url)
- (if (string-match-p jao-embark-video-url-rx url)
+(defun jao-embark-targets--refine-url (url)
+ (if (string-match-p jao-embark-targets-video-url-rx url)
(cons 'video-url url)
(cons 'url url)))
-;;;###autoload
-(defun jao-embark-play-video-url (&optional url)
+(defun jao-embark-targets-play-video-url (&optional url)
(interactive "sURL: ")
(let ((cmd (format "mpv %s" (shell-quote-argument url))))
(start-process-shell-command "mpv" nil cmd)))
-(define-key embark-url-map (kbd "f") #'browse-url-firefox)
-
-(embark-define-keymap jao-embark-video-url-map
+(embark-define-keymap jao-embark-targets-video-url-map
"Actions on URLs pointing to remote video streams."
:parent embark-url-map
- ("p" jao-embark-play-video-url))
+ ("p" jao-embark-targets-play-video-url))
+
+(define-key embark-url-map (kbd "f") #'browse-url-firefox)
-;;;###autoload
-(defun jao-embark-setup ()
- (interactive)
- (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)))
+(add-to-list 'embark-target-finders #'jao-embark-targets--w3m-anchor)
+(add-to-list 'embark-transformer-alist '(url . jao-embark-targets--refine-url))
+(add-to-list 'embark-keymap-alist '(video-url . jao-embark-targets-video-url-map))
-(provide 'jao-embark)
-;;; jao-embark.el ends here
+(provide 'jao-embark-targets)
+;;; jao-embark-targets.el ends here