-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create org-mode links to elfeed entries #18
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
(require 'org) | ||
(require 'dash) | ||
(require 's) | ||
(require 'rx) | ||
|
||
|
||
(defgroup elfeed-org nil | ||
|
@@ -195,6 +196,41 @@ all. Which in my opinion makes the process more traceable." | |
"Load all feed settings before elfeed is started." | ||
(rmh-elfeed-org-process rmh-elfeed-org-files rmh-elfeed-org-tree-id))) | ||
|
||
(org-add-link-type "elfeed" 'org-elfeed-open) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you perform these setup function in the `elfeed-org`` autoload function? |
||
(add-hook 'org-store-link-functions 'org-elfeed-store-link) | ||
|
||
(defun org-elfeed-open (path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you be so kind to rename these function to make them consistent with the naming of the other functions?
|
||
"Visit the elfeed on PATH." | ||
(string-match (rx bos | ||
"entry-feed:" | ||
(group (1+ any)) | ||
":entry-url:" | ||
(group (1+ any)) | ||
eos) | ||
path) | ||
(let* ((entry-feed (match-string 1 path)) | ||
(entry-url (match-string 2 path)) | ||
(entry (gethash (cons entry-feed entry-url) elfeed-db-entries))) | ||
(if entry | ||
(elfeed-show-entry entry) | ||
(error "This entry isn't in the database")))) | ||
|
||
(defun org-elfeed-store-link () | ||
"Store a link to an elfeed entry." | ||
(let ((entry (cond ((eq major-mode 'elfeed-search-mode) | ||
(elfeed-search-selected :ignore-region)) | ||
((eq major-mode 'elfeed-show-mode) | ||
elfeed-show-entry)))) | ||
(when entry | ||
(let* ((id (elfeed-entry-id entry)) | ||
(feed (first id)) | ||
(url (rest id)) | ||
(title (elfeed-entry-title entry))) | ||
(org-store-link-props | ||
:type "elfeed" | ||
:link (format "elfeed:entry-feed:%s:entry-url:%s" | ||
feed url) | ||
:description title))))) | ||
|
||
(provide 'elfeed-org) | ||
;;; elfeed-org.el ends here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library also needs to be added to `;; Package-Requires : ((elfeed "1.1.1") (org "8.2.7") (dash "2.10.0") (s "1.9.0"))`` for it to be installed correctly.