1
0
Fork 0

Add things to deal with reading list in org-mode

This commit is contained in:
Tom Willemse 2020-12-01 09:28:21 -08:00
parent 5cd4dee407
commit 7969cd4251
3 changed files with 41 additions and 2 deletions

View file

@ -0,0 +1,9 @@
* READ %:description
:PROPERTIES:
:CREATED: %U
:END:
[[%:link]]
#+BEGIN: oni-backlinks
#+END

View file

@ -0,0 +1,7 @@
* READ %(oni-org-get-url-link (read-from-minibuffer "URL: ")) %^g
:PROPERTIES:
:CREATED: %U
:END:
#+BEGIN: oni-backlinks
#+END

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.1119.235712
;; Version: 2020.1130.123201
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons)
;; This program is free software; you can redistribute it and/or modify
@ -335,6 +335,7 @@ also move point to the start of the heading."
(setq org-agenda-custom-commands
'(("i" "Inbox" tags "CATEGORY=\"inbox\"")
("t" "Next" tags-todo "TODO=\"NEXT\"-CATEGORY=\"inbox\"")
("r" "Reading list" tags-todo "TODO=\"READ\"")
("s" "Someday" tags-todo "TODO=\"TODO\"-CATEGORY=\"inbox\"")
("p" "Projects & ideas" tags "CATEGORY=\"project\"|CATEGORY=\"idea\"")
("c" "Today's (Current) tasks" tags "SCHEDULED=\"<today>\"")
@ -342,7 +343,7 @@ also move point to the start of the heading."
("wo" "Overview" ((tags-todo "+work+FOR=\"\"")
(tags-todo "+work+FOR=\"Jordan\"")
(tags-todo "+work+FOR=\"Remy\"")))
("wt" "Word todo" tags-todo "+work+FOR=\"\"")
("wt" "Work todo" tags-todo "+work+FOR=\"\"")
("wj" "Topics for Jordan" tags-todo "+work+1o1+FOR=\"Jordan\"")
("wr" "Topics for Remy" tags-todo "+work+1o1+FOR=\"Remy\"")
("S" "Shopping" tags-todo "+shopping")))
@ -378,6 +379,22 @@ After running it once remove it from `org-capture-after-finalize-hook'."
(setf (frame-height) 24)
(add-hook 'org-capture-after-finalize-hook 'oni-org-delete-frame-once)))
(defun oni-org-get-url-title (url)
"Load URL and parse out the title."
(with-current-buffer
(url-retrieve-synchronously url)
(unwind-protect
(when (re-search-forward (rx "<title" (zero-or-more (not ">")) ">") nil t)
(let ((title-start (point)))
(when (re-search-forward (rx "</title>") nil t)
(string-trim (buffer-substring title-start (- (point) 8))))))
(kill-buffer))))
(defun oni-org-get-url-link (url)
"Turn URL into an org link."
(let ((title (oni-org-get-url-title url)))
(format "[[%s][%s]]" url title)))
(setq org-capture-templates
`(("i" "Inbox" entry (file "")
(file ,(expand-file-name "inbox.org" oni-org-capture-template-directory)))
@ -387,6 +404,12 @@ After running it once remove it from `org-capture-after-finalize-hook'."
(file ,(expand-file-name "task.org" oni-org-capture-template-directory)))
("a" "Appointment" entry (file "")
(file ,(expand-file-name "appointment.org" oni-org-capture-template-directory)))
("u" "URL to read" entry (file "")
(file ,(expand-file-name "reading-url.org" oni-org-capture-template-directory))
:immediate-finish t)
("U" "URL to read" entry (file "")
(file ,(expand-file-name "reading-url-protocol.org" oni-org-capture-template-directory))
:immediate-finish t)
("j" "Journal entry" entry
(file+olp+datetree
,(oni-org-expand-to-home "documents/gtd/journal.org"))