diff options
| author | Craig Jennings <c@cjennings.net> | 2025-06-09 10:01:44 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-06-09 10:01:44 -0500 |
| commit | a9ecf37b6ce0ac146cf8daaaad96f838cc04340b (patch) | |
| tree | d2be419b6752a0f201bb2ebb1f97fda7a23086e8 /modules | |
| parent | e49a8fc30fb5a428310646a4d6cc29b6d3fa78fc (diff) | |
| download | dotemacs-a9ecf37b6ce0ac146cf8daaaad96f838cc04340b.tar.gz dotemacs-a9ecf37b6ce0ac146cf8daaaad96f838cc04340b.zip | |
adding inadequate docstrings; re-ordering last four functions
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/elfeed-config.el | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/modules/elfeed-config.el b/modules/elfeed-config.el index 2ea9b4a0..aa0e1c2f 100644 --- a/modules/elfeed-config.el +++ b/modules/elfeed-config.el @@ -12,13 +12,13 @@ (:map elfeed-show-mode-map ("w" . eww-open-in-new-buffer)) (:map elfeed-search-mode-map - ("w" . cj/elfeed-eww-open) ;; opens in eww - ("b" . cj/elfeed-browser-open) ;; opens in external browser - ("d" . cj/elfeed-youtube-dl) ;; async download with yt-dlp and tsp - ("p" . cj/play-with-mpv) ;; async play with mpv - ("v" . cj/play-with-mpv) ;; async play with mpv - ("R" . cj/elfeed-mark-all-as-read) ;; capital marks all as read, since upper case marks one as read - ("U" . cj/elfeed-mark-all-as-unread)) ;; capital marks all as unread, since lower case marks one as unread + ("w" . cj/elfeed-eww-open) ;; opens in eww + ("b" . cj/elfeed-browser-open) ;; opens in external browser + ("d" . cj/elfeed-youtube-dl) ;; async download with yt-dlp and tsp + ("p" . cj/play-with-mpv) ;; async play with mpv + ("v" . cj/play-with-mpv) ;; async play with mpv + ("R" . cj/elfeed-mark-all-as-read) ;; capital marks all as read, since upper case marks one as read + ("U" . cj/elfeed-mark-all-as-unread)) ;; capital marks all as unread, since lower case marks one as unread :config (setq elfeed-db-directory (concat user-emacs-directory ".elfeed-db")) (setq-default elfeed-search-title-max-width 150) @@ -79,7 +79,10 @@ ;; -------------------------- Elfeed Browser Functions ------------------------- (defun cj/elfeed-eww-open (&optional use-generic-p) - "Open currently selected entry with EWW." +"Opens the links of the currently selected Elfeed entries with EWW. +If USE-GENERIC-P is non-nil, uses the generic method instead. +Applies cj/eww-readable-nonce hook after EWW rendering. Updates the +Elfeed search entries as read and moves to the next line." (interactive "P") (let ((entries (elfeed-search-selected))) (cl-loop for entry in entries @@ -102,7 +105,9 @@ (remove-hook 'eww-after-render-hook #'cj/eww-readable-nonce))) (defun cj/elfeed-browser-open (&optional use-generic-p) - "Open the currently selected entry with default browser." +"Opens the link of the selected Elfeed entries in the default browser. +If USE-GENERIC-P is non-nil, uses the generic method instead. Updates +the Elfeed search entries as read and advances to the next line." (interactive "P") (let ((entries (elfeed-search-selected))) (cl-loop for entry in entries @@ -114,37 +119,43 @@ ;; --------------------- Elfeed Plan And Download Functions -------------------- -(defun cj/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 (cj/yt-dl-it it)) - (mapc #'elfeed-search-update-entry entries) - (unless (use-region-p) (forward-line)))) - (defun cj/yt-dl-it (url) "Downloads the URL in an async shell." (let ((default-directory videos-dir)) - (save-window-excursion - (async-shell-command (format "tsp yt-dlp --add-metadata -ic -o '%%(channel)s-%%(title)s.%%(ext)s' '%s'" url))))) + (save-window-excursion + (async-shell-command (format "tsp yt-dlp --add-metadata -ic -o '%%(channel)s-%%(title)s.%%(ext)s' '%s'" url))))) + +(defun cj/mpv-play-it (url) + "Play the URL with mpv in an async shell." + (async-shell-command (format "mpv '%s'" url))) + +(defun cj/elfeed-youtube-dl (&optional use-generic-p) +"Downloads the selected Elfeed entries' links with youtube-dl. +If USE-GENERIC-P is non-nil, uses the generic download method +instead. Updates the Elfeed search entries as read and moves to +the next line." + (interactive "P") + (let ((entries (elfeed-search-selected))) + (cl-loop for entry in entries + do (elfeed-untag entry 'unread) + when (elfeed-entry-link entry) + do (cj/yt-dl-it it)) + (mapc #'elfeed-search-update-entry entries) + (unless (use-region-p) (forward-line)))) (defun cj/play-with-mpv (&optional use-generic-p) - "MPV link." +"Plays the selected Elfeed entries' links with MPV. +If USE-GENERIC-P is non-nil, uses the generic player instead. Updates +the Elfeed search entries as read and focuses on the next line." (interactive "P") (let ((entries (elfeed-search-selected))) - (cl-loop for entry in entries - do (elfeed-untag entry 'unread) - when (elfeed-entry-link entry) - do (cj/mpv-play-it it)) - (mapc #'elfeed-search-update-entry entries) - (unless (use-region-p) (forward-line)))) + (cl-loop for entry in entries + do (elfeed-untag entry 'unread) + when (elfeed-entry-link entry) + do (cj/mpv-play-it it)) + (mapc #'elfeed-search-update-entry entries) + (unless (use-region-p) (forward-line)))) -(defun cj/mpv-play-it (url) - "Play the URL with mpv in an async shell." - (async-shell-command (format "mpv '%s'" url))) (provide 'elfeed-config) ;;; elfeed-config.el ends here |
