Fix gtd file locations for Windows

This commit is contained in:
Tom Willemse 2018-08-14 11:35:41 -07:00
parent 51b7d8e47f
commit 539e0766d6

View file

@ -29,6 +29,13 @@
(require 'org-capture)
(require 'org-habit)
(defun oni-org-init-expand-to-home (file-name)
"Expand FILE-NAME to the base directory for that system.
The base for all org files on Windows is u:/, but on my linux
installs it will always be ~."
(let ((base-dir (if (eq system-type 'windows-nt) "u:/" "~")))
(expand-file-name file-name base-dir)))
(defun oni-org-init-setup-prettify-symbols-mode ()
"Set up prettify symbols mode for org mode."
(when (member "Ionicons" (font-family-list))
@ -73,7 +80,8 @@ ones that have a predecessor."
(oni-org-init-heading-has-predecessor-p))
(oni-org-init-next-heading-position))))
(setq org-default-notes-file "~/documents/gtd/inbox.org")
(setq org-default-notes-file
(oni-org-init-expand-to-home "documents/gtd/inbox.org"))
(setq org-src-fontify-natively t)
(setq org-return-follows-link t)
(setq org-fontify-whole-heading-line t)
@ -85,20 +93,26 @@ ones that have a predecessor."
(setq org-agenda-skip-function-global #'oni-org-init-skip-tasks)
(setq org-agenda-files
'("~/documents/gtd/todo.org"
"~/documents/gtd/projects.org"
"~/documents/gtd/appointments.org"))
(mapcar #'oni-org-init-expand-to-home
'("documents/gtd/todo.org"
"documents/gtd/projects.org"
"documents/gtd/appointments.org")))
(setq org-refile-targets
'(("~/documents/gtd/todo.org" :maxlevel . 1)
("~/documents/gtd/projects.org" :level . 2)
("~/documents/gtd/someday.org" :maxlevel . 2)
("~/documents/gtd/appointments.org" :maxlevel . 1)))
(mapcar (lambda (pair)
(cons (oni-org-init-expand-to-home (car pair))
(cdr pair)))
'(("documents/gtd/todo.org" :maxlevel . 1)
("documents/gtd/projects.org" :level . 2)
("documents/gtd/someday.org" :maxlevel . 2)
("documents/gtd/appointments.org" :maxlevel . 1))))
(setq org-capture-templates
'(("t" "Note" entry (file "~/documents/gtd/inbox.org")
`(("t" "Note" entry
(file ,(oni-org-init-expand-to-home "documents/gtd/inbox.org"))
"* TODO %i%?")
("a" "Appointment" entry (file "~/documents/gtd/appointments.org")
("a" "Appointment" entry
(file ,(oni-org-init-expand-to-home "documents/gtd/appointments.org"))
"* %i%?\n %U")))
(setq org-todo-keywords