Commit 9aa8aa433019

Vincent Demeester <vincent@sbr.pm>
2022-07-08 17:04:38
tools/emacs: more elfeed customization
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 67fe680
Changed files (1)
tools
emacs
tools/emacs/config/config-elfeed.el
@@ -20,9 +20,57 @@
          :link link
          :description title)
         )))
-
   (add-hook 'org-store-link-functions
             'vde/org-elfeed-entry-store-link)
+
+  (defun elfeed-link-title (entry)
+    "Copy the entry title and URL as org link to the clipboard."
+    (interactive)
+    (let* ((link (elfeed-entry-link entry))
+           (title (elfeed-entry-title entry))
+           (titlelink (org-make-link-string link title))))
+    (when titlelink
+      (kill-new titlelink)
+      (x-set-selection 'PRIMARY titlelink)
+      (message "Yanked: %s" titlelink)))
+  (defun elfeed-show-link-title ()
+    "Copy the current entry title and URL as org link to the clipboard."
+    (interactive)
+    (elfeed-link-title elfeed-show-entry))
+
+  (defun elfeed-show-quick-url-note ()
+    "Fastest way to capture entry link to org agenda from elfeed show mode"
+    (interactive)
+    (elfeed-link-title elfeed-show-entry)
+    (org-capture nil "n")
+    (yank)
+    (org-capture-finalize))
+  
+  (defface elfeed-face-tag-reddit
+    '((t :foreground "#ffb9a0"))
+    "This is a custom font face for the F1 tag in Elfeed.")
+  
+  (push '(f1 elfeed-face-tag-reddit)
+        elfeed-search-face-alist)
+
+  (defun yt-dl-it (url)
+    "Downloads the URL in an async shell"
+    (let ((default-directory "~/desktop/videos"))
+      (async-shell-command (format "youtube-dl \"%s\"" url))))
+
+  (defun elfeed-youtube-dl (&optional use-generic-p)
+    "Youtube-DL link"
+    (interactive "P")
+    (let ((entries (elfeed-search-selected)))
+      (cl-loop for entry in entries
+               do (elfeed-untag entry 'unread)
+               when (elfeed-entry-link entry)
+               do (yt-dl-it it))
+      (mapc #'elfeed-search-update-entry entries)
+      (unless (use-region-p) (forward-line))))
+
+  (define-key elfeed-search-mode-map (kbd "d") 'elfeed-youtube-dl)
+  
   (use-package elfeed-org
     :command (elfeed-org)
     :config