diff options
-rw-r--r-- | gnus.org | 9 | ||||
-rw-r--r-- | init.org | 10 |
2 files changed, 13 insertions, 6 deletions
@@ -749,8 +749,8 @@ (jao-browse-with-external-browser) (browse-url (jao-url-around-point)))))) - (defun jao-gnus-open-enclosure (&optional playp) - (interactive "P") + (defun jao-gnus-open-enclosure () + (interactive) (save-window-excursion (gnus-summary-select-article-buffer) (save-excursion @@ -758,10 +758,7 @@ (when (search-forward "Enclosure:") (forward-char 2) (when-let ((url (thing-at-point-url-at-point))) - (message "%s %s ..." (if playp "Playing" "Adding") url) - (when playp (jao-mpc-clear)) - (jao-mpc-add-url url) - (when playp (jao-mpc-play))))))) + (jao-browse-add-url-to-mpc url)))))) #+end_src * Keyboard shortcuts #+begin_src emacs-lisp @@ -1535,6 +1535,15 @@ (defun jao-elpher--browse (url &rest _) (elpher-go url)) + (defvar jao-browse--sound-rx + (format "^https?://.*/.*\\.%s" (regexp-opt '("mp4" "mp3" "flv")))) + + (defun jao-browse-add-url-to-mpc (url &rest _) + (let ((p (yes-or-no-p (format "Play %s right now?" url)))) + (when p (jao-mpc-clear)) + (jao-mpc-add-url url) + (if p (jao-mpc-play) (message "%s added to mpc queue" url)))) + (setq browse-url-handlers `(("^\\(gemini\\|gopher\\)://.*" . jao-elpher--browse) (,jao--doc-exts . jao--browse-doc) @@ -1543,6 +1552,7 @@ ("^file://?" . jao--find-file-other-window) (,jao-browse--external-regexp . ,jao-browse-url-external-function) ("^https?://.*\\.gotomeeting\\.com\\.*" . browse-url-chrome) + (,jao-browse--sound-rx . jao-browse-add-url-to-mpc) (,(jao-wget--regexp) . jao-download) (jao-video--url-p . jao-maybe-view-video) ("." . ,jao-browse-url-function))) |