summaryrefslogtreecommitdiff
path: root/view-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-01-21 23:52:21 +0800
committerJSDurand <mmemmew@gmail.com>2021-01-22 00:01:20 +0800
commit588b6031e152b031be1dee04c7b38938ea7eb706 (patch)
treeed25c53f4e1ece59f97ecbff19cb2325bf01baf3 /view-conf.el
parent53db9402916822e673b3b49fcba26537e2416b59 (diff)
Regular updates
In the course of configuring Emacs there are numerous changes to make. This is one regular step.
Diffstat (limited to 'view-conf.el')
-rw-r--r--view-conf.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/view-conf.el b/view-conf.el
index 945276f..4d4ff00 100644
--- a/view-conf.el
+++ b/view-conf.el
@@ -95,3 +95,26 @@ If ARG is '(16), view the battery information."
(define-key view-mode-map (vector ?j) #'View-scroll-line-forward)
(define-key view-mode-map (vector ?k) #'View-scroll-line-backward)
+
+;;; Convert downloaded videos from youtube to the URL again and copy
+;;; the result.
+
+;;;###autoload
+(defun durand-convert-youtube-video-to-url (video-name)
+ "Convert VIDEO-NAME to its original url."
+ (interactive (list (read-string "Video name: ")))
+ (cond
+ ((string-match "\\.[^.]+$" video-name)
+ ;; with extension
+ (kill-new
+ (concat
+ "https://www.youtube.com/watch?v="
+ (substring-no-properties
+ video-name
+ (- (match-beginning 0) 11)
+ (match-beginning 0)))))
+ (t
+ ;; no extension
+ (kill-new
+ (concat "https://www.youtube.com/watch?v="
+ (substring-no-properties video-name -11))))))