2019-12-07 20:16:04 +01:00
|
|
|
;;; ~/.doom.d/+org.el -*- lexical-binding: t; -*-
|
|
|
|
;; Org mode configuration
|
|
|
|
;;
|
2022-09-10 03:45:53 +02:00
|
|
|
(setq org-ellipsis " ▼ ")
|
2019-12-26 01:09:55 +01:00
|
|
|
;; Cycle through header visibility
|
2019-12-07 20:16:04 +01:00
|
|
|
(after! evil-org
|
2019-12-26 01:09:55 +01:00
|
|
|
(remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h))
|
2019-12-31 05:56:59 +01:00
|
|
|
;; Disable completion
|
|
|
|
(set-company-backend! 'org-mode nil)
|
|
|
|
;; Turn off line numbers
|
2019-12-07 20:16:04 +01:00
|
|
|
(add-hook 'org-mode-hook (lambda () (display-line-numbers-mode -1)))
|
2020-01-23 14:49:15 +01:00
|
|
|
;; Add Notes to agenda
|
|
|
|
(setq org-agenda-files '("~/Notes"))
|
2019-12-07 20:16:04 +01:00
|
|
|
;; Tailor Org super agenda
|
|
|
|
(use-package! org-super-agenda
|
|
|
|
:after org-agenda
|
|
|
|
:init
|
2022-11-17 15:20:03 +01:00
|
|
|
(setq org-agenda-skip-scheduled-if-done t
|
|
|
|
org-agenda-skip-deadline-if-done t
|
|
|
|
org-agenda-include-deadlines t
|
|
|
|
org-agenda-tags-column 100
|
|
|
|
org-agenda-block-separator nil
|
|
|
|
org-agenda-compact-blocks t)
|
2021-10-19 15:42:57 +02:00
|
|
|
(setq org-super-agenda-groups '((:name "Overdue"
|
2022-11-17 15:20:03 +01:00
|
|
|
:deadline past)
|
|
|
|
(:name "Today"
|
|
|
|
:time-grid t
|
|
|
|
:scheduled today
|
|
|
|
:deadline today)
|
|
|
|
(:name "Important"
|
|
|
|
:priority "A")
|
|
|
|
(:name "Assignments"
|
|
|
|
:tag "labs"
|
|
|
|
:order 10)
|
|
|
|
(:name "Study"
|
|
|
|
:tag "study"
|
|
|
|
:order 10)
|
|
|
|
(:name "Thesis"
|
|
|
|
:tag "thesis"
|
|
|
|
:order 10)
|
|
|
|
(:name "Mails"
|
|
|
|
:tag "mail"
|
|
|
|
:order 10)
|
|
|
|
(:name "Periodic"
|
|
|
|
:tag "periodic"
|
|
|
|
:order 10)))
|
2019-12-07 20:16:04 +01:00
|
|
|
:config
|
2020-04-02 01:42:51 +02:00
|
|
|
(org-super-agenda-mode))
|
2019-12-26 01:09:55 +01:00
|
|
|
;; Add timestamp to DONE task
|
|
|
|
(setq org-log-done 'time)
|
2020-09-22 15:36:52 +02:00
|
|
|
;; Print babel results to the buffer and export them
|
2020-11-01 11:46:42 +01:00
|
|
|
(setq org-babel-default-header-args '((:session . "default") (:results . "output") (:exports . "both")
|
2020-09-22 15:36:52 +02:00
|
|
|
(:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no"))
|
|
|
|
org-babel-default-lob-header-args '((:exports . "both")))
|
2020-01-26 14:06:00 +01:00
|
|
|
;; Enter writeroom-mode in all org files
|
|
|
|
(add-hook 'org-mode-hook 'global-writeroom-mode)
|
2022-03-11 11:54:01 +01:00
|
|
|
(setq writeroom-major-modes '(org-mode))
|
2022-10-01 00:52:30 +02:00
|
|
|
(add-hook 'org-mode-hook 'visual-line-mode)
|
2020-03-09 17:05:02 +01:00
|
|
|
;; Respect LANGUAGE export variable
|
|
|
|
(add-to-list 'org-latex-packages-alist '("AUTO" "babel" t ("pdflatex")))
|
2020-04-02 01:42:51 +02:00
|
|
|
;; Don't evaluate code blocks on export
|
|
|
|
(setq org-export-use-babel nil)
|
2020-07-01 18:54:44 +02:00
|
|
|
;; Speed up agenda startup
|
|
|
|
(setq org-agenda-dim-blocked-tasks nil)
|
2020-10-12 16:35:37 +02:00
|
|
|
;; Open file with folded headlines
|
2022-02-15 00:02:55 +01:00
|
|
|
(setq org-startup-folded t)
|
2021-05-05 14:37:36 +02:00
|
|
|
;; 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}"))))
|
2021-06-24 15:25:24 +02:00
|
|
|
;; Add org-plain-latex
|
|
|
|
(after! ox-latex
|
|
|
|
(add-to-list 'org-latex-classes
|
2022-11-17 15:20:03 +01:00
|
|
|
'("org-plain-latex"
|
|
|
|
"\\documentclass{article}
|
2021-06-24 15:25:24 +02:00
|
|
|
[NO-DEFAULT-PACKAGES]
|
|
|
|
[PACKAGES]
|
|
|
|
[EXTRA]"
|
2022-11-17 15:20:03 +01:00
|
|
|
("\\section{%s}" . "\\section*{%s}")
|
|
|
|
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
|
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
|
|
|
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
|
|
|
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
|
2022-09-10 02:52:37 +02:00
|
|
|
;; Prettify code block export
|
|
|
|
(use-package! engrave-faces-latex
|
|
|
|
:after ox-latex)
|
|
|
|
(setq org-latex-src-block-backend 'engraved)
|
2021-06-27 21:21:23 +02:00
|
|
|
;; Set up bibliography management
|
2022-10-10 16:12:49 +02:00
|
|
|
(setq org-cite-global-bibliography '("~/Documents/Uni/Thesis/docs/bibliography.bib")
|
2022-10-27 14:11:13 +02:00
|
|
|
citar-bibliography org-cite-global-bibliography
|
|
|
|
citar-library-paths '("~/Documents/Uni/Thesis/bibliography"))
|
2021-10-19 15:42:57 +02:00
|
|
|
;; 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))
|
2021-07-02 17:07:10 +02:00
|
|
|
;; Allow referencing by label in org-ref
|
|
|
|
(setq org-latex-prefer-user-labels t)
|
2022-03-21 11:26:26 +01:00
|
|
|
;; Extend pomodoro length to 45/15
|
|
|
|
(setq org-pomodoro-length '45
|
|
|
|
org-pomodoro-short-break-length '15
|
2022-03-21 15:30:41 +01:00
|
|
|
org-pomodoro-long-break-length '30
|
2022-11-01 18:58:17 +01:00
|
|
|
org-pomodoro-audio-player "pw-play"
|
|
|
|
org-pomodoro-time-format "%.2m min"
|
|
|
|
org-pomodoro-keep-killed-pomodoro-time t)
|
2022-11-17 15:17:01 +01:00
|
|
|
;; Define declarative org capture remplates
|
|
|
|
(use-package! doct
|
|
|
|
:commands doct)
|
2022-04-03 18:15:31 +02:00
|
|
|
(setq org-capture-templates
|
2022-11-17 15:17:01 +01:00
|
|
|
(doct `(("Cookbook" :keys "c"
|
|
|
|
:file "~/Notes/Recipes.org"
|
|
|
|
:type entry
|
|
|
|
:template ("%(org-chef-get-recipe-from-url)"))
|
|
|
|
("Reference" :keys "r"
|
|
|
|
:type entry
|
|
|
|
:file "~/Documents/Uni/Thesis/docs/Bibliography.org"
|
|
|
|
:function org-goto
|
|
|
|
:fetch-bibtex (lambda () (org-capture-ref-process-capture))
|
|
|
|
:org-entry (lambda () (org-capture-ref-get-org-entry))
|
|
|
|
:template
|
|
|
|
("%{fetch-bibtex}* %?%{space}%(org-capture-ref-get-bibtex-field :title)"
|
|
|
|
"#+begin_src bibtex"
|
|
|
|
"%(org-capture-ref-get-bibtex-field :bibtex-string)"
|
|
|
|
"#+end_src")))))
|
|
|
|
(setq org-capture-ref-headline-tags nil)
|
2022-04-03 18:15:31 +02:00
|
|
|
;; Fix org-chef scraping
|
|
|
|
(setq org-chef-prefer-json-ld t)
|
2022-04-12 20:25:18 +02:00
|
|
|
;; 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)))
|
|
|
|
"")))
|
2022-10-01 01:00:57 +02:00
|
|
|
;; Save org-download images to an assets directory
|
2022-05-25 20:48:25 +02:00
|
|
|
(after! org-download
|
2022-10-01 01:00:57 +02:00
|
|
|
(setq org-download-image-dir "assets/"
|
2022-06-02 21:05:23 +02:00
|
|
|
org-attach-auto-tag nil))
|
2022-09-10 03:25:32 +02:00
|
|
|
;; Show images by default with a limited width
|
|
|
|
(setq org-startup-with-inline-images t
|
|
|
|
org-image-actual-width 600)
|
2022-09-10 03:45:53 +02:00
|
|
|
;; Use a modern look
|
|
|
|
(use-package! org-modern
|
|
|
|
:hook (org-mode . org-modern-mode)
|
|
|
|
:config
|
|
|
|
(setq org-modern-star ["⁖"]))
|
2022-09-17 12:15:09 +02:00
|
|
|
;; Configure a better split and some default for org-noter
|
|
|
|
(after! org-noter
|
|
|
|
(setq org-noter-always-create-frame nil
|
2022-10-01 00:53:19 +02:00
|
|
|
org-noter-doc-split-fraction '(0.7 . 0.3)
|
2022-11-17 15:17:38 +01:00
|
|
|
org-noter-default-heading-title " "
|
|
|
|
org-noter-separate-notes-from-heading nil))
|
2022-10-11 08:59:45 +02:00
|
|
|
;; Show latex preview automatically and increase its size
|
|
|
|
(setq org-startup-with-latex-preview t
|
|
|
|
org-format-latex-options (plist-put org-format-latex-options :scale 3.0))
|
2022-10-04 09:27:41 +02:00
|
|
|
;; Close tags automatically
|
|
|
|
(after! smartparens
|
|
|
|
(sp-with-modes 'org-mode
|
|
|
|
(sp-local-pair "*" "*")
|
|
|
|
(sp-local-pair "_" "_")
|
|
|
|
(sp-local-pair "/" "/")
|
|
|
|
(sp-local-pair "~" "~")
|
|
|
|
(sp-local-pair "$" "$")))
|
2022-10-10 16:12:21 +02:00
|
|
|
;; Only show a task once if it has a schedule and deadline
|
|
|
|
(setq org-agenda-skip-deadline-prewarning-if-scheduled t)
|
2022-10-11 08:59:59 +02:00
|
|
|
;; Show raw latex when the cursor on the expression
|
|
|
|
(add-hook 'org-mode-hook 'org-fragtog-mode)
|
2022-10-10 16:12:04 +02:00
|
|
|
;; Auto tangle on save
|
|
|
|
(add-hook 'org-mode-hook 'org-auto-tangle-mode)
|
2022-11-17 15:17:01 +01:00
|
|
|
;; Save bibtex to annotated bibliography with category selection
|
|
|
|
(setq org-goto-interface 'outline-path-completion
|
|
|
|
org-goto-max-level 1)
|
|
|
|
(use-package! org-capture-ref)
|