Add capture templates for book + game progress

master
trémeur 12 months ago
parent d451b56eeb
commit d943dae2ea

@ -25,6 +25,50 @@
(insert "* books\n** obtained")) (insert "* books\n** obtained"))
(insert "\n** obtained")))) (insert "\n** obtained"))))
(defun findreading ()
"Find or create heading for reading progress"
(filedate)
(goto-char (point-min))
(if (not (search-forward "** progress" nil t))
(if (not (search-forward "* books" nil t))
(progn
(goto-char (point-max))
(insert "* books\n** progress"))
(insert "\n** progress"))))
(defun findbeaten ()
"Find or create heading for beaten games"
(filedate)
(goto-char (point-min))
(if (not (search-forward "** beaten" nil t))
(if (not (search-forward "* games" nil t))
(progn
(goto-char (point-max))
(insert "* games\n** beaten"))
(insert "\n** beaten"))))
(defun findobtained ()
"Find or create heading for acquired games"
(filedate)
(goto-char (point-min))
(if (not (search-forward "** acquired" nil t))
(if (not (search-forward "* games" nil t))
(progn
(goto-char (point-max))
(insert "* games\n** acquired"))
(insert "\n** acquired"))))
(defun findgaming ()
"Find or create heading for gaming progress"
(filedate)
(goto-char (point-min))
(if (not (search-forward "** gameplay" nil t))
(if (not (search-forward "* games" nil t))
(progn
(goto-char (point-max))
(insert "* games\n** gameplay"))
(insert "\n** gameplay"))))
(defun findwatched () (defun findwatched ()
"Find or create heading for watched films" "Find or create heading for watched films"
(filedate) (filedate)
@ -102,6 +146,18 @@
(setq thevenue (completing-read "Venue: " venues)) (setq thevenue (completing-read "Venue: " venues))
thevenue) thevenue)
(defun bookcalc ()
"Read in or calculate position in book"
(setq ispageno (y-or-n-p "Calculate percentage from page number?"))
(if ispageno
(progn
(setq reachedpage (string-to-number (concat (read-string "Page reached: ") ".0")))
(setq totalpages (string-to-number (concat (read-string "Total pages: ") ".0")))
(setq bookprogress (number-to-string (truncate (* 100 (/ reachedpage totalpages))))))
(setq bookprogress (read-string "Progress (%): ")))
(setq returnprogress (concat "*" bookprogress "%.* "))
returnprogress)
(setq org-default-notes-file (concat "~/Documents/drive/org/journal/" (format-time-string "%Y/%m/%Y-%m-%d") ".org")) (setq org-default-notes-file (concat "~/Documents/drive/org/journal/" (format-time-string "%Y/%m/%Y-%m-%d") ".org"))
(setq org-capture-templates (setq org-capture-templates
@ -109,7 +165,7 @@
(file+function "" findacquired) (file+function "" findacquired)
"* %^{Author} /%^{Title}/" "* %^{Author} /%^{Title}/"
:jump-to-captured t) :jump-to-captured t)
("b" "Read book" entry ("b" "Finished book" entry
(file+function "" findread) (file+function "" findread)
"* %^{Author} /%^{Title}/%(therating)" "* %^{Author} /%^{Title}/%(therating)"
:jump-to-captured t) :jump-to-captured t)
@ -121,13 +177,29 @@
(file+function "" findwatched) (file+function "" findwatched)
"* %^{Title} (%^{Year})%(therating)" "* %^{Title} (%^{Year})%(therating)"
:jump-to-captured t) :jump-to-captured t)
("g" "Beat game" entry
(file+function "" findgame)
"* %^{Title}%(therating)"
:jump-to-captured t)
("m" "Musical performance" entry ("m" "Musical performance" entry
(file+function "" findperf) (file+function "" findperf)
"* %(setensemble)\n** %^{Performance name} (%(setvenue))\n%?" "* %(setensemble)\n** %^{Performance name} (%(setvenue))\n%?"
:jump-to-captured t) :jump-to-captured t)
("n" "Gameplay progress" entry
(file+function "" findgaming)
"* %^{Title}\n%?"
:jump-to-captured t)
("o" "Obtained game" entry
(file+function "" findobtained)
"* %^{Title}"
:jump-to-captured t)
("p" "Visited place" entry ("p" "Visited place" entry
(file+function "" findvisited) (file+function "" findvisited)
"* %^{Place}%(thevisitdate)" "* %^{Place}%(thevisitdate)"
:jump-to-captured t)
("r" "Reading progress" entry
(file+function "" findreading)
"* %^{Author} /%^{Title}/\n%(bookcalc)%?"
:jump-to-captured t))) :jump-to-captured t)))
(global-set-key (kbd "C-c c") #'org-capture))) (global-set-key (kbd "C-c c") #'org-capture)))

Loading…
Cancel
Save