Improve the organize setup with org-roam
This commit is contained in:
parent
31271e90fc
commit
511467c1af
|
@ -30,11 +30,13 @@ let
|
|||
org-super-agenda
|
||||
org-ql
|
||||
org-modern
|
||||
] ++ optionals (cfg.org-roam) [
|
||||
org-roam
|
||||
org-roam-ui
|
||||
websocket
|
||||
simple-httpd
|
||||
citar
|
||||
citar-org-roam
|
||||
citeproc
|
||||
f
|
||||
]);
|
||||
|
||||
|
@ -52,11 +54,10 @@ in
|
|||
|
||||
options.fg42.organize = {
|
||||
enable = mkAndEnableOption "organize";
|
||||
org-roam = mkAndEnableOption "organize";
|
||||
org-dir = mkOption {
|
||||
type = types.str;
|
||||
default = "~/.orgs";
|
||||
example = literalExpression ''"~/.orgs"'';
|
||||
default = "~/orgs";
|
||||
example = literalExpression ''"~/orgs"'';
|
||||
description = mdDoc ''
|
||||
A non-nix `path` (string `path`) of the location your want org-mode
|
||||
to store you org files.
|
||||
|
@ -72,7 +73,6 @@ in
|
|||
|
||||
fg42.vars = [
|
||||
(defVar "org-home" cfg.org-dir "Where to store org files.")
|
||||
(defVar "org-roam" cfg.org-roam "Enable org-roam?")
|
||||
];
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -22,23 +22,42 @@
|
|||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg)
|
||||
(require 'fg42/utils)
|
||||
(require 'fg42/config)
|
||||
(require 'hydra))
|
||||
(require 'fpkg)
|
||||
(require 'fg42/utils)
|
||||
(require 'fg42/config)
|
||||
(require 'hydra))
|
||||
|
||||
;;=============================================================================
|
||||
;; Vars that user meant to set
|
||||
;;=============================================================================
|
||||
(defvar org-home "~/.orgs"
|
||||
|
||||
(defvar org-home "~/orgs"
|
||||
"The location to the org file repository.")
|
||||
|
||||
|
||||
(defvar fg42/bibliograhpy-file nil
|
||||
"A list of `.bib' files no use with citar.
|
||||
The nil value will force FG42 to look inside `org-home' for a `bibliograghy.bib'
|
||||
file.")
|
||||
|
||||
(defvar fg42/org-main-template "#+TITLE: Main
|
||||
#+SEQ_TODO: TODO(t/!) NEXT(n/!) BLOCKED(b@/!) | DONE(d%) CANCELLED(c@/!) FAILED(f@/!)
|
||||
#+TAGS:
|
||||
#+STARTUP: logdrawer logdone logreschedule indent content align constSI entitiespretty
|
||||
#+ARCHIVE: ./archive.org::
|
||||
|
||||
* Inbox
|
||||
** Tasks
|
||||
** Thoughts
|
||||
"
|
||||
"The template to use to create the main org file.")
|
||||
|
||||
(defvar fg42/org-main-file "main.org")
|
||||
(defvar fg42/org-notes-file "notes.org")
|
||||
(defvar fg42/org-agenda-files "main.org")
|
||||
|
||||
(defvar fg42/global-tags nil)
|
||||
|
||||
|
||||
;;=============================================================================
|
||||
;; Helper functions
|
||||
;;=============================================================================
|
||||
|
@ -54,7 +73,14 @@
|
|||
|
||||
(defun fg42/organize-setup ()
|
||||
"Setup all the necessary files and directories to use `org' and `org-roam'."
|
||||
(fg42/create-org-home))
|
||||
(interactive)
|
||||
(fg42/create-org-home)
|
||||
(let ((main (path-join (fg42/org-home)
|
||||
fg42/org-main-file)))
|
||||
(when (not (file-exists-p main))
|
||||
(with-temp-file main
|
||||
(insert fg42/org-main-template)))))
|
||||
|
||||
|
||||
;;=============================================================================
|
||||
;; Package defs
|
||||
|
@ -97,19 +123,29 @@ For more information checkout `https://github.com/alphapapa/org-super-agenda'"
|
|||
:init
|
||||
(setq-default
|
||||
org-capture-templates
|
||||
(eval
|
||||
`(list
|
||||
'("t" "Todo" entry (file+headline ,(expand-file-name fg42/org-main-file (fg42/org-home)) "New Tasks")
|
||||
(file ,(expand-file-name "templates/todo" (fg42/org-home)))
|
||||
:prepend t)
|
||||
'("l" "Link" entry (file+headline ,(expand-file-name "bookmarks.org" (fg42/org-home)) "Links")
|
||||
(file ,(expand-file-name "templates/links" (fg42/org-home)))
|
||||
:prepend t
|
||||
:immediate-finish t
|
||||
:empty-lines 1)
|
||||
`(("t" "Todo" entry
|
||||
(file+olp ,(path-join (fg42/org-home) fg42/org-main-file) "Inbox" "Tasks")
|
||||
"** TODO %^{title}
|
||||
:PROPERTIES:
|
||||
:Timestamp: %T
|
||||
:Context: %x
|
||||
:At: %F
|
||||
:END:
|
||||
%?"
|
||||
:unnarrowed t
|
||||
:prepend t)
|
||||
|
||||
'("h" "Thoughts" entry (file+datetree ,(expand-file-name "journal.org" (fg42/org-home)))
|
||||
(file ,(expand-file-name "templates/thoughts" (fg42/org-home))))))))
|
||||
("f" "Thoughts (Fleeting Notes)" entry
|
||||
(file+olp ,(path-join (fg42/org-home) fg42/org-main-file) "Inbox" "Thoughts")
|
||||
"** %^{Title}
|
||||
:PROPERTIES:
|
||||
:Timestamp: %T
|
||||
:Context: %x
|
||||
:At: %F
|
||||
:END:
|
||||
%?"
|
||||
:unnarrowed th
|
||||
:prepend t))))
|
||||
|
||||
|
||||
(use! org-protocol
|
||||
|
@ -132,33 +168,31 @@ For more info on ~org-mode~ check out `https://orgmode.org/'"
|
|||
(org-mode . fg42/organize-setup)
|
||||
:init
|
||||
(setq
|
||||
org-auto-align-tags nil
|
||||
org-tags-column 0
|
||||
org-catch-invisible-edits 'show-and-error
|
||||
org-special-ctrl-a/e t
|
||||
org-insert-heading-respect-content t)
|
||||
org-tag-alist fg42/global-tags
|
||||
;; Org styling, hide markup etc.
|
||||
org-hide-emphasis-markers t
|
||||
org-pretty-entities t
|
||||
org-ellipsis "…"
|
||||
;; Agenda styling
|
||||
org-agenda-tags-column 0
|
||||
org-agenda-block-separator ?─
|
||||
org-agenda-time-grid
|
||||
'((daily today require-timed)
|
||||
(800 1000 1200 1400 1600 1800 2000)
|
||||
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
|
||||
org-agenda-current-time-string
|
||||
"<── now ─────────────────────────────────────────────────"
|
||||
org-agenda-files (concat (file-name-as-directory (fg42/org-home))
|
||||
fg42/org-agenda-files)
|
||||
org-insert-heading-respect-content t
|
||||
org-tag-alist fg42/global-tags
|
||||
;; Org styling, hide markup etc.
|
||||
org-hide-emphasis-markers t
|
||||
org-pretty-entities t
|
||||
org-ellipsis "…"
|
||||
;; Agenda styling
|
||||
org-agenda-tags-column 0
|
||||
org-agenda-block-separator ?─
|
||||
org-agenda-time-grid
|
||||
'((daily today require-timed)
|
||||
(800 1000 1200 1400 1600 1800 2000)
|
||||
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
|
||||
org-agenda-current-time-string
|
||||
"<── now ─────────────────────────────────────────────────"
|
||||
org-agenda-files (path-join (fg42/org-home)
|
||||
fg42/org-agenda-files)
|
||||
|
||||
org-directory (fg42/org-home)
|
||||
org-default-notes-file (concat (file-name-as-directory (fg42/org-home))
|
||||
fg42/org-notes-file)
|
||||
org-directory (fg42/org-home)
|
||||
org-default-notes-file (path-join (fg42/org-home)
|
||||
fg42/org-main-file)
|
||||
|
||||
org-refile-targets '((org-agenda-files :maxlevel . 3))
|
||||
org-refile-targets '((org-agenda-files :maxlevel . 3)))
|
||||
|
||||
(with-eval-after-load "ox-latex"
|
||||
(setq org-latex-default-packages-alist
|
||||
|
@ -168,43 +202,100 @@ For more info on ~org-mode~ check out `https://orgmode.org/'"
|
|||
|
||||
(use! org-modern
|
||||
"A modern look for the old org."
|
||||
:hook ((org-mode . org-modern-mode)
|
||||
(org-agenda-finalize . org-modern-mode)))
|
||||
:hook
|
||||
(org-mode . org-modern-mode)
|
||||
(org-agenda-finalize . org-modern-mode))
|
||||
|
||||
|
||||
(with-config "org-roam"
|
||||
(use! org-roam
|
||||
"Create a second brain for yourself with this great knowledge base tool."
|
||||
:after org
|
||||
:commands (org-roam-node-find org-roam-node-insert
|
||||
org-roam-capture org-roam-ui-mode)
|
||||
:config
|
||||
(setq-default org-roam-directory (file-truename (path-join (fg42/org-home) "roam"))
|
||||
org-roam-db-update-on-save t)
|
||||
(make-directory org-roam-directory t)
|
||||
(org-roam-db-autosync-mode))
|
||||
(use! org-roam
|
||||
"Create a second brain for yourself with this great knowledge base tool."
|
||||
:after org
|
||||
:commands (org-roam-node-find org-roam-node-insert org-roam-capture
|
||||
org-roam-capture org-roam-ui-mode)
|
||||
:bind ("C-<f6>" . org-roam-capture)
|
||||
:hook (server-mode . (lambda () (require 'org-roam-protocol)))
|
||||
:config
|
||||
(let ((roam-path (path-join (fg42/org-home) "notes")))
|
||||
(make-directory roam-path t)
|
||||
(setq-default
|
||||
org-roam-directory (file-truename roam-path)
|
||||
org-roam-db-update-on-save t
|
||||
org-roam-completion-everywhere t
|
||||
org-roam-capture-templates
|
||||
'(("f" "Feeliting Note" entry
|
||||
:target (file+heading (path-join roam-path "inbox.org") "Fleeting Notes")
|
||||
"* TODO %^{Note title}\nContext: %a\n%?" :empty-lines-before 1)
|
||||
("r" "Reference Note" entry
|
||||
:target (file+heading (path-join roam-path "inbox.org") "Litrature Notes")
|
||||
"* TODO %^{Note title}\nREF: %(org-cite-insert)\n%?\n%?")))
|
||||
;; Since we control Emacs itself, we can be sure
|
||||
;; that it is built with SQLite support
|
||||
(setq org-roam-database-connector 'sqlite-builtin)
|
||||
(org-roam-db-autosync-mode)))
|
||||
|
||||
(use! websocket
|
||||
"Websocket support for Elisp."
|
||||
:after org-roam)
|
||||
|
||||
(use! org-roam-ui
|
||||
"A nice web UI for `org-roam'"
|
||||
:after org-roam
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
(use! websocket
|
||||
"Websocket support for Elisp."
|
||||
:after org-roam)
|
||||
|
||||
(defhydra hydra-org-roam (:exit t)
|
||||
"Org Roam"
|
||||
("i" org-roam-node-insert "Insert")
|
||||
("f" org-roam-node-find "Find")
|
||||
("c" org-roam-capture "Capture")
|
||||
("u" org-roam-ui-mode "Web UI"))
|
||||
|
||||
(global-set-key (kbd "C-c o") 'hydra-org-roam/body))
|
||||
(use! org-roam-ui
|
||||
"A nice web UI for `org-roam'"
|
||||
:after org-roam
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
|
||||
(use! ebib
|
||||
"A program with which you can manage biblatex and BibTeX database files
|
||||
without having to edit the raw .bib files"
|
||||
:bind ("C-c e" . ebib))
|
||||
|
||||
|
||||
(use! citar
|
||||
"Citar provides a highly-configurable completing-read front-end to browse
|
||||
and act on BibTeX, BibLaTeX, and CSL JSON bibliographic data, and LaTeX,
|
||||
markdown, and org-cite editing support."
|
||||
:custom
|
||||
(citar-bibliography
|
||||
(or
|
||||
fg42/bibliograhpy-file
|
||||
(list (path-join (fg42/org-home) "bibliography.bib"))))
|
||||
(org-cite-insert-processor 'citar)
|
||||
(org-cite-follow-processor 'citar)
|
||||
(org-cite-activate-processor 'citar)
|
||||
(citar-bibliography org-cite-global-bibliography)
|
||||
:config
|
||||
(setq citar-at-point-function 'embark-act)
|
||||
|
||||
:bind
|
||||
(:map org-mode-map :package org ("C-c i" . #'org-cite-insert))
|
||||
:hook
|
||||
(LaTeX-mode . (lambda ()
|
||||
(require 'citar-latex)
|
||||
(require 'citar-capf)
|
||||
(citar-capf-setup)))
|
||||
(org-mode . (lambda ()
|
||||
(require 'citar-capf)
|
||||
(citar-capf-setup))))
|
||||
|
||||
|
||||
(use! citar-org-roam
|
||||
"A package to provide tighter Citar and Org-Roam integration."
|
||||
:after (citar org-roam)
|
||||
:config (citar-org-roam-mode) )
|
||||
|
||||
|
||||
(defhydra hydra-org-roam (:exit t)
|
||||
"Org Roam"
|
||||
("i" org-roam-node-insert "Insert")
|
||||
("f" org-roam-node-find "Find")
|
||||
("c" org-roam-capture "Capture")
|
||||
("u" org-roam-ui-mode "Web UI"))
|
||||
|
||||
(global-set-key (kbd "C-c o") 'hydra-org-roam/body)
|
||||
|
||||
|
||||
(provide 'fg42/organize)
|
||||
|
|
Loading…
Reference in New Issue