Add org-journal support
This commit is contained in:
parent
c29511a3cc
commit
e21c5b47d1
|
@ -29,6 +29,14 @@
|
|||
(require 'fg42/cube)
|
||||
|
||||
|
||||
(defflag org-journal
|
||||
"Enable the support for org-journal in FG42." t)
|
||||
|
||||
|
||||
(defvar fg42/default-org-journal-heder
|
||||
"#+TITLE: Yearly Journal
|
||||
#+STARTUP: folded logdrawer logdone logreschedule indent content align constSI entitiespretty")
|
||||
|
||||
|
||||
(defcube fg42/org-ql-cube
|
||||
"This package provides a query language for Org files. It offers two
|
||||
|
@ -142,7 +150,11 @@ For more info on ~org-mode~ check out [[https://orgmode.org/]]"
|
|||
(let ((capture-key (or (plist-get fg42/org-cube-params :capture-key)
|
||||
(kbd "<f6>")))
|
||||
(org-home (or (plist-get fg42/org-cube-params :org-home) "~/orgs"))
|
||||
(notes-file (or (plist-get fg42/org-cube-params :org-home) "~/orgs/notes.org")))
|
||||
(notes-file (or (plist-get fg42/org-cube-params :org-home) "~/orgs/notes.org"))
|
||||
(journal-header (or (plist-get fg42/org-cube-params :journal-header) fg42/default-org-journal-heder))
|
||||
(journal-type (or (plist-get fg42/org-cube-params :journal-type) 'yearly))
|
||||
(global-tags (plist-get fg42/org-cube-params :global-tags))
|
||||
(agenda-files (or (plist-get fg42/org-cube-params :agenda-files) '("~/orgs/main.org"))))
|
||||
|
||||
(fpkg/use org-bullets
|
||||
:hook (org-mode . org-bullets-mode))
|
||||
|
@ -151,12 +163,36 @@ For more info on ~org-mode~ check out [[https://orgmode.org/]]"
|
|||
(fg42/org-ql-cube)
|
||||
(fg42/org-sidebar)
|
||||
|
||||
(when-flag org-journal
|
||||
;; This function will handle the org-capture integration only if org-journal
|
||||
;; flag is set
|
||||
(defun fg42/org-journal-find-location ()
|
||||
;; Open today's journal, but specify a non-nil prefix argument in order to
|
||||
;; inhibit inserting the heading; org-capture will insert the heading.
|
||||
(org-journal-new-entry t)
|
||||
(unless (eq org-journal-file-type 'daily)
|
||||
(org-narrow-to-subtree))
|
||||
(goto-char (point-max)))
|
||||
|
||||
(fpkg/use org-journal
|
||||
:defer t
|
||||
:init
|
||||
;; Change default prefix key; needs to be set before loading org-journal
|
||||
(setq org-journal-prefix-key "C-c j ")
|
||||
:config
|
||||
(setq org-journal-file-type journal-type
|
||||
org-journal-file-header journal-header
|
||||
org-journal-dir (expand-file-name "journal" org-home)
|
||||
org-journal-date-format "%Y-%m-%d (%A): ")))
|
||||
|
||||
|
||||
(fpkg/use org-mode
|
||||
:init
|
||||
(progn
|
||||
(require 'org-capture)
|
||||
(global-set-key capture-key 'org-capture)
|
||||
(setq org-tag-alist global-tags)
|
||||
(setq org-agenda-files agenda-files)
|
||||
(setq org-directory org-home)
|
||||
(setq org-default-notes-file notes-file)
|
||||
(setq org-capture-templates
|
||||
|
@ -168,7 +204,14 @@ For more info on ~org-mode~ check out [[https://orgmode.org/]]"
|
|||
'("l" "Link" entry (file+headline ,(expand-file-name "bookmarks.org" org-home) "Links")
|
||||
(file ,(expand-file-name "templates/links" org-home))
|
||||
:prepend t
|
||||
:immediate-finish t
|
||||
:empty-lines 1)
|
||||
,@(when-flag org-journal
|
||||
'((quote ("j" "Journal Entry" plain #'fg42/org-journal-find-location
|
||||
"** %(format-time-string org-journal-time-format)%^{Title} %^G\n %?\n\n*** Context:\n %i\n From: %a"
|
||||
:jump-to-captured t
|
||||
:immediate-finish nil))))
|
||||
|
||||
'("h" "Thoughts" entry (file+datetree ,(expand-file-name "journal.org" org-home))
|
||||
(file ,(expand-file-name "templates/thoughts" org-home))))))
|
||||
(setq org-refile-targets '((org-agenda-files :maxlevel . 3)))
|
||||
|
|
Loading…
Reference in New Issue