1
0
Fork 0

[oni-org] Add capture template for CODE Magazine issues

This commit is contained in:
Tom Willemse 2021-07-06 00:34:18 -07:00
parent 0befa1ec7c
commit f377541a46

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2021.0705.233009
;; Version: 2021.0706.003249
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti)
;; This program is free software; you can redistribute it and/or modify
@ -510,22 +510,51 @@ After running it once remove it from `org-capture-after-finalize-hook'."
(let ((title (oni-org-get-url-title url)))
(format "[[%s][%s]]" url title)))
(defun oni-org-format-months ()
(let* ((time (org-timestamp-to-time
(org-timestamp-from-string (concat "<" (org-read-date) ">"))))
(decoded (decode-time time))
(next-month
(time-add time (days-to-time (date-days-in-month
(decoded-time-year decoded)
(decoded-time-month decoded))))))
(concat (format-time-string "%b " time)
(format-time-string "%b " next-month)
(format-time-string "%Y" time))))
(defun oni-org-ask-names ()
(let ((n 1)
article-name
names)
(while (not (string-empty-p (setq article-name (read-string (format "Article Name %d: " n)))))
(push article-name names)
(cl-incf n))
(reverse names)))
(defun oni-org-format-names (names)
(mapconcat (lambda (n) (format "** READ %s" n)) names "\n"))
(setq org-capture-templates
`(("i" "Inbox" entry (file ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
(file ,(expand-file-name "inbox.org" oni-org-capture-template-directory)))
("I" "Inbox (add selection)" entry (file ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
(file ,(expand-file-name "inbox-with-selection.org" oni-org-capture-template-directory)))
("a" "Album" entry (file ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
("a" "Appointment" entry (file "")
(file ,(expand-file-name "appointment.org" oni-org-capture-template-directory)))
("A" "Album" entry (file ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
"* %^{Artist} - %^{Album Name}
** TODO Listen to %\\1 - %\\2
** TODO Rip %\\1 - %\\2 to disk
** TODO Add album art to %\\1 - %\\2
** TODO Transfer %\\1 - %\\2 to phone"
:immediate-finish t)
("m" "Code Magazine Issue" entry (file ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
"* CODE Issue %(oni-org-format-months)
** READ Editorial
%(oni-org-format-names (oni-org-ask-names))"
:immediate-finish t)
("t" "Task" entry (file ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
(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 ,(oni-org-expand-to-home "documents/gtd/inbox.org"))
(file ,(expand-file-name "reading-url.org" oni-org-capture-template-directory))
:immediate-finish t)