Skip to content

Instantly share code, notes, and snippets.

@AlejandroCatalina
Last active November 11, 2022 11:42
Show Gist options
  • Save AlejandroCatalina/72acd723d8ade5787876 to your computer and use it in GitHub Desktop.
Save AlejandroCatalina/72acd723d8ade5787876 to your computer and use it in GitHub Desktop.
;;
;; 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")
(re-search-forward "Link:")
(insert " ")
(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 (progn
(re-search-forward "Link:")
(insert " ")
(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