diff options
author | Tom Willemse | 2020-12-01 09:28:21 -0800 |
---|---|---|
committer | Tom Willemse | 2020-12-01 09:28:21 -0800 |
commit | 7969cd4251368706607fcaf887d00e0b720ef08a (patch) | |
tree | 09d2151f1c2e4d9c75cffa01a7f36d0233ecd17d /oni-org/oni-org.el | |
parent | 5cd4dee407f35c20d70f18dd95b44aa4ebb33499 (diff) | |
download | emacs-config-7969cd4251368706607fcaf887d00e0b720ef08a.tar.gz emacs-config-7969cd4251368706607fcaf887d00e0b720ef08a.zip |
Add things to deal with reading list in org-mode
Diffstat (limited to 'oni-org/oni-org.el')
-rw-r--r-- | oni-org/oni-org.el | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index be193b9..efa90a2 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -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")) |