From ddbcd4f183afb855634d9e2d9d729adba3ead150 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 12 Sep 2021 02:28:15 +0100 Subject: videos in www workspace --- completion.org | 5 +++-- w3m.org | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/completion.org b/completion.org index 7b30f3b..b5a6e2e 100644 --- a/completion.org +++ b/completion.org @@ -407,6 +407,7 @@ (defun jao-embark-targets--play-video (player url) (interactive "sURL: ") (let ((cmd (format "%s %s" player (shell-quote-argument url)))) + (jao-afio--goto-www) (start-process-shell-command player nil cmd))) (defun jao-embark-targets-mpv (&optional url) @@ -422,8 +423,8 @@ (embark-define-keymap jao-embark-targets-video-url-map "Actions on URLs pointing to remote video streams." :parent embark-url-map - ("RET" jao-embark-targets-mpv) - ("v" jao-embark-targets-vlc)) + ("v" jao-embark-targets-mpv) + ("RET" jao-embark-targets-vlc)) (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)) diff --git a/w3m.org b/w3m.org index 6a6b57f..3ef4e7a 100644 --- a/w3m.org +++ b/w3m.org @@ -67,28 +67,32 @@ (kill-new (format "[[doc:%s][%s]] ([[%s][original]])" basename title url)))) #+end_src -* Narrowing +* Consult narrowing #+begin_src emacs-lisp (with-eval-after-load "w3m-util" (with-eval-after-load "consult" (defvar jao-consult-w3m-buffer-history nil) + (defun jao-www--buffer-p (b) + (or (eq 'w3m-mode (buffer-local-value 'major-mode b)) + (member (buffer-local-value 'exwm-class-name b) '("vlc" "mpv")))) + (defun jao-www--item (b) + (with-current-buffer b + (propertize (or w3m-current-title (buffer-name)) + 'buffer b + 'url (or w3m-current-url (buffer-name))))) (defvar jao-consult-w3m-source - (list :name "w3m buffer" - :category 'w3m-buffer + (list :name "www buffer" + :category 'www-buffer :hidden t - :narrow (cons ?w "w3m") + :narrow (cons ?w "www") :annotate (lambda (b) (when b (get-text-property 0 'url b))) :history 'jao-consult-w3m-buffer-history + :items (lambda () + (seq-map #'jao-www--item + (seq-filter #'jao-www--buffer-p (buffer-list)))) :action (lambda (b) (jao-afio--goto-www) - (switch-to-buffer (get-text-property 0 'buffer b))) - :items (lambda () - (seq-map (lambda (b) - (with-current-buffer b - (propertize (or w3m-current-title "") - 'buffer b - 'url w3m-current-url))) - (w3m-list-buffers))))) + (pop-to-buffer (get-text-property 0 'buffer b))))) (jao-consult-add-buffer-source 'jao-consult-w3m-source "Web" ?w))) #+end_src * Package -- cgit v1.2.3