Emacs: Add youtube-dl-at-point command

master
Pierre Neidhardt 2018-07-30 09:45:17 +02:00
parent 688d5b8ed7
commit e8d6b34a40
1 changed files with 13 additions and 0 deletions

View File

@ -441,4 +441,17 @@ Each paragraph stand on its line."
(let ((fill-column (point-max)))
(fill-region (region-beginning) (region-end) nil)))
(defun ambrevar/youtube-dl-at-point (&optional url)
"Run 'youtube-dl' over thr URL at point.
If URL is non nil, use that instead."
(interactive)
(setq url (or url (thing-at-point-url-at-point)))
(let ((eshell-buffer-name "*youtube-dl*"))
(eshell)
(when (eshell-interactive-process)
(eshell t))
(eshell-interrupt-process)
(insert "cd ~/temp && youtube-dl " url)
(eshell-send-input)))
(provide 'functions)