Last active
May 1, 2021 15:05
-
-
Save heikkil/1feaf53133b56e5c51e1 to your computer and use it in GitHub Desktop.
Elfeed configuration for emacs focusing on functions and bindings to copy and link to web pages
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
(use-package elfeed | |
:bind ("C-c f" . elfeed) | |
:init | |
(setq my/default-elfeed-search-filter "@1-month-ago +unread !sport ") | |
(setq-default elfeed-search-filter my/default-elfeed-search-filter) | |
:config | |
(elfeed-org) | |
;; | |
;; linking and capturing | |
;; | |
(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 (concat "[[" link "][" title "]]"))) | |
(when titlelink | |
(kill-new titlelink) | |
(x-set-selection 'PRIMARY titlelink) | |
(message "Yanked: %s" titlelink)))) | |
;; show mode | |
(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)) | |
(bind-keys :map elfeed-show-mode-map | |
("l" . elfeed-show-link-title) | |
("v" . elfeed-show-quick-url-note)) | |
;; search mode | |
(defun elfeed-search-link-title () | |
"Copy the current entry title and URL as org link to the clipboard." | |
(interactive) | |
(let ((entries (elfeed-search-selected))) | |
(cl-loop for entry in entries | |
when (elfeed-entry-link entry) | |
do (elfeed-link-title entry)))) | |
(defun elfeed-search-quick-url-note () | |
"In search mode, capture the title and link for the selected | |
entry or entries in org aganda." | |
(interactive) | |
(let ((entries (elfeed-search-selected))) | |
(cl-loop for entry in entries | |
do (elfeed-untag entry 'unread) | |
when (elfeed-entry-link entry) | |
do (elfeed-link-title entry) | |
do (org-capture nil "n") | |
do (yank) | |
do (org-capture-finalize) | |
(mapc #'elfeed-search-update-entry entries)) | |
(unless (use-region-p) (forward-line)))) | |
(bind-keys :map elfeed-search-mode-map | |
("l" . elfeed-search-link-title) | |
("v" . elfeed-search-quick-url-note))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment