verticaleyes · 2022-09-23 08:47
verticaleyes · 2022-09-23 08:49
There is also a corresponding blog post for those who prefer text: https://bitspook.in/blog/extending-org-mode-to-handle-youtube-links/
Code in the blog-post handles more edge-cases and is a bit more polished.
You can also find the code snippet in [my emacs config on github](https://github.com/bitspook/spookmax.d/blob/5f1d71cf572cd18dc7d41f292753d4b7683877c3/readme.org#org-mode)
[deleted] · 2022-09-23 12:51
[deleted]
nv-elisp · 2022-09-23 14:53
From the docstring of `shell-command` (which `async-shell-command` calls):
> In Elisp, you will often be better served by calling `call-process` or
`start-process` directly, since they offer more control and do not
impose the use of a shell (with its need to quote arguments)."
verticaleyes · 2022-09-23 15:02
That is intentional. Having the output buffer at hand allow easily peeking in on command output when something goes wrong, and also killing the process when needed.
nv-elisp · 2022-09-23 15:28
You still can have those same benefits with `make-process`:
(make-process
:name "yt-test"
:buffer "*yt-test*"
:command (list "mpv" "https://www.youtube.com/watch?v=C0DPdy98e4c"))
Better yet would be to integrate your link with another package which handles playing media. That way it wouldn't be tied to a specific player and the UI could be had for free.
verticaleyes · 2022-09-23 15:37
Makes sense. I'll explore. Thank you!
paretoOptimalDev · 2022-09-23 16:22
You might be interested in some of the YouTube/MPV code here:
https://github.com/karthink/elfeed-tube
verticaleyes · 2022-09-24 12:50
I should've read the docs better. `make-process` is the better fit for me use-case here. I have updated the blog post as well.
Thank you!