Skip to content

Instantly share code, notes, and snippets.

Created Dec 1, 2013

What would you like to do?
; Ad killer
(defun my-elfeed-no-ads (entry)
(let ((entry-feed-id (elfeed-entry-feed-id entry)))
; heise & golem
((or (string= entry-feed-id "" )
(string= entry-feed-id "" ))
(let* ((original (elfeed-deref (elfeed-entry-content entry)))
(replace (replace-regexp-in-string "<img.*" "" original)))
(message (elfeed-entry-link entry))
(setf (elfeed-entry-content entry) (elfeed-ref replace))))
(add-hook 'elfeed-new-entry-hook #'my-elfeed-no-ads)
; Read all key
(define-key elfeed-search-mode-map "R"
'(lambda () (interactive) (save-excursion
; comment links in hacker news
(defun my-elfeed-browse-hn-comment ()
"in an hn entry, open comments link"
(search-forward "Comments")
(execute-kbd-macro [ return ?q ]))
(define-key elfeed-search-mode-map "v"
'(lambda () (interactive)
(let ((hn? (re-search-forward "[(,]hn\\b" (line-end-position) t))) ; is it an hn entry?
(call-interactively 'elfeed-search-show-entry)
(if hn? ; yes, open comments link
(define-key elfeed-show-mode-map "c" 'my-elfeed-browse-hn-comment)
; handle pods via emms
(defun my-elfeed-play-pod ()
"play selected feed item (should be pod) via emms"
(let ((mp3-url (x-get-selection 'PRIMARY)))
(if (string-match "[mM][pP]3$" mp3-url)
(emms-play-url mp3-url)
; not an mp3 link, search for it
(re-search-forward "Enclosure:[^h]+http")
(setq mp3-url (get-text-property (point) 'shr-url))
(if (numberp (string-match "[mM][pP]3$" mp3-url))
(emms-play-url mp3-url)
(message "no mp3 link found!")
(define-key elfeed-search-mode-map "m"
'(lambda () (interactive)
(call-interactively 'elfeed-search-show-entry)
(define-key elfeed-show-mode-map "m" 'my-elfeed-play-pod)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.