diff options
author | jao <jao@gnu.org> | 2021-01-25 16:57:39 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-01-25 16:57:51 +0000 |
commit | 92eb0dfbb7bbf450350ca5ac178c4dd93f2ad649 (patch) | |
tree | 97276890e904504f3bef056eef0f4c66a848ecc3 /eos | |
parent | b24e28d4726f76c7c69eb65b2aee8f2302c79dfd (diff) | |
download | elibs-92eb0dfbb7bbf450350ca5ac178c4dd93f2ad649.tar.gz elibs-92eb0dfbb7bbf450350ca5ac178c4dd93f2ad649.tar.bz2 |
emabark-targets and prompter
Diffstat (limited to 'eos')
-rw-r--r-- | eos/jao-embark-prompter.el | 22 | ||||
-rw-r--r-- | eos/jao-embark-targets.el | 19 |
2 files changed, 27 insertions, 14 deletions
diff --git a/eos/jao-embark-prompter.el b/eos/jao-embark-prompter.el index 969111e..5656e6a 100644 --- a/eos/jao-embark-prompter.el +++ b/eos/jao-embark-prompter.el @@ -35,15 +35,18 @@ (let ((desc (if (numberp k) (single-key-description k) (key-description k))) - (cmd (symbol-name c))) - (insert (propertize desc 'face 'embark-keybinding) - embark-key-action-separator - (symbol-name c) - "\n"))))) + (doc (car (split-string + (or (ignore-errors (documentation c)) "") + "\n")))) + (insert (format "%s %s (%s)\n" + (propertize desc 'face 'embark-keybinding) + (propertize doc 'face 'italic) + (symbol-name c))))))) (cdr (keymap-canonicalize keymap))) - (insert "Action? ") + (delete-char -1) (read-only-mode 1) - (pop-to-buffer (current-buffer) nil t))) + (pop-to-buffer (current-buffer) nil t) + (fit-window-to-buffer))) (defun jao-embark--prompter (keymap) (let* ((buf (jao-embark--show-keymap keymap)) @@ -51,13 +54,12 @@ (embark-kill-buffer-and-window buf) cmd)) -(advice-add 'embark-completing-read-prompter :override - #'jao-embark--prompter) +(advice-add 'embark-completing-read-prompter :override #'jao-embark--prompter) (add-to-list 'display-buffer-alist '("\\`\\*Embark Actions*\\*" (display-buffer-at-bottom) - (window-parameters (mode-line-format . none)) + ;; (window-parameters (mode-line-format . none)) (window-height . fit-window-to-buffer))) (provide 'jao-embark-prompter) diff --git a/eos/jao-embark-targets.el b/eos/jao-embark-targets.el index f55398c..0461769 100644 --- a/eos/jao-embark-targets.el +++ b/eos/jao-embark-targets.el @@ -48,15 +48,26 @@ (cons 'video-url url) (cons 'url url))) -(defun jao-embark-targets-play-video-url (&optional url) +(defun jao-embark-targets--play-video (player url) (interactive "sURL: ") - (let ((cmd (format "mpv %s" (shell-quote-argument url)))) - (start-process-shell-command "mpv" nil cmd))) + (let ((cmd (format "%s %s" player (shell-quote-argument url)))) + (start-process-shell-command player nil cmd))) + +(defun jao-embark-targets-mpv (&optional url) + "Play video stream with mpv" + (interactive "sURL: ") + (jao-embark-targets--play-video "mpv" url)) + +(defun jao-embark-targets-vlc (&optional url) + "Play video stream with vlc" + (interactive "sURL: ") + (jao-embark-targets--play-video "vlc" url)) (embark-define-keymap jao-embark-targets-video-url-map "Actions on URLs pointing to remote video streams." :parent embark-url-map - ("p" jao-embark-targets-play-video-url)) + ("v" jao-embark-targets-vlc) + ("m" jao-embark-targets-mpv)) (define-key embark-url-map (kbd "f") #'browse-url-firefox) |