doom.d/+org.el

117 lines
4.8 KiB
EmacsLisp

;;; ~/.doom.d/+org.el -*- lexical-binding: t; -*-
;; Org mode configuration
;;
(setq org-ellipsis ""
org-superstar-headline-bullets-list '(""))
;; Cycle through header visibility
(after! evil-org
(remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h))
;; Disable completion
(set-company-backend! 'org-mode nil)
;; Turn off line numbers
(add-hook 'org-mode-hook (lambda () (display-line-numbers-mode -1)))
;; Add Notes to agenda
(setq org-agenda-files '("~/Notes"))
;; Tailor Org super agenda
(use-package! org-super-agenda
:after org-agenda
:init
(setq org-super-agenda-groups '((:name "Overdue"
:deadline past)
(:name "Today"
:scheduled today
:deadline today)
(:name "Important"
:priority "A")
(:name "Assignments"
:tag "labs"
:order 10)
(:name "Exams"
:tag "exams"
:order 10)))
:config
(org-super-agenda-mode))
;; Add timestamp to DONE task
(setq org-log-done 'time)
;; Print babel results to the buffer and export them
(setq org-babel-default-header-args '((:session . "default") (:results . "output") (:exports . "both")
(:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no"))
org-babel-default-lob-header-args '((:exports . "both")))
;; Enter writeroom-mode in all org files
(add-hook 'org-mode-hook 'global-writeroom-mode)
(setq writeroom-major-modes '(org-mode))
;; Respect LANGUAGE export variable
(add-to-list 'org-latex-packages-alist '("AUTO" "babel" t ("pdflatex")))
;; Don't evaluate code blocks on export
(setq org-export-use-babel nil)
;; Speed up agenda startup
(setq org-agenda-dim-blocked-tasks nil)
;; Open file with folded headlines
(setq org-startup-folded t)
;; Add tufte-handout to LaTeX classes
(after! ox-latex
(add-to-list 'org-latex-classes
'("tufte-handout"
"\\documentclass{tufte-handout}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
;; Add org-plain-latex
(after! ox-latex
(add-to-list 'org-latex-classes
'("org-plain-latex"
"\\documentclass{article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
;; Prettify code block export
(use-package! engrave-faces-latex
:after ox-latex)
(setq org-latex-src-block-backend 'engraved)
;; Set up bibliography management
(setq citar-bibliography '("~/Documents/Education/Bibliography/references.bib"))
;; Add citeproc and metadata-file options to ox-pandoc
(after! ox-pandoc
(add-to-list 'org-pandoc-valid-options 'citeproc)
(add-to-list 'org-pandoc-valid-options 'metadata-file))
;; Allow referencing by label in org-ref
(setq org-latex-prefer-user-labels t)
;; Extend pomodoro length to 45/15
(setq org-pomodoro-length '45
org-pomodoro-short-break-length '15
org-pomodoro-long-break-length '30
org-pomodoro-audio-player "pw-play")
;; Define capture templates
(setq org-capture-templates
'(("c" "Cookbook" entry (file "~/Notes/Recipes.org")
"%(org-chef-get-recipe-from-url)"
:empty-lines 1)))
;; Fix org-chef scraping
(setq org-chef-prefer-json-ld t)
;; Get the current state of org-pomodoro
(defun bergheim/org-clock-status ()
"Return the org time status - including any pomodoro activity"
(if (and (featurep 'org-pomodoro) (org-pomodoro-active-p))
(cl-case org-pomodoro-state
(:pomodoro
(format "%d min" (/ (org-pomodoro-remaining-seconds) 60)))
(:short-break
(format "Short break: %d min" (/ (org-pomodoro-remaining-seconds) 60)))
(:long-break
(format "Long break: %d min" (/ (org-pomodoro-remaining-seconds) 60)))
(:overtime
(format "Overtime! %d min" (/ (org-pomodoro-remaining-seconds) 60))))
(if (org-clocking-p)
(format "%s" (org-duration-from-minutes (org-clock-get-clocked-time)))
"")))
;; Save org-download images to ~/.cache
(after! org-download
(setq org-download-image-dir "~/.cache/org-download"
org-attach-id-dir "~/.cache/org-attach"
org-attach-auto-tag nil))