Created
December 1, 2013 13:50
-
-
Save anonymous/7733901 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;---- | |
; Ad killer | |
(defun my-elfeed-no-ads (entry) | |
(let ((entry-feed-id (elfeed-entry-feed-id entry))) | |
(cond | |
; heise & golem | |
((or (string= entry-feed-id "http://www.heise.de/newsticker/heise.rdf" ) | |
(string= entry-feed-id "http://www.golem.de/rss.php?feed=RSS1.0" )) | |
(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 | |
(mark-whole-buffer) | |
(elfeed-search-untag-all-unread) | |
))) | |
;---- | |
; comment links in hacker news | |
(defun my-elfeed-browse-hn-comment () | |
"in an hn entry, open comments link" | |
(interactive) | |
(search-forward "Comments") | |
(backward-char) | |
(execute-kbd-macro [ return ?q ])) | |
(define-key elfeed-search-mode-map "v" | |
'(lambda () (interactive) | |
(beginning-of-line) | |
(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 | |
(my-elfeed-browse-hn-comment) | |
)) | |
(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" | |
(interactive) | |
(elfeed-show-yank) | |
(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) | |
(my-elfeed-play-pod))) | |
(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