;;; ~/.doom.d/+org.el -*- lexical-binding: t; -*- ;; Org mode configuration ;; (setq org-ellipsis " ▼ ") ;; 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 (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-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 org-agenda-start-day nil org-agenda-span 1 org-agenda-start-on-weekday nil) (setq org-super-agenda-groups '((:name "Overdue" :deadline past :order 0) (:name "Important" :priority "A" :order 1) (:name "Today" :time-grid t :scheduled today :deadline today :order 2) (:name "Assignments" :tag "labs" :order 3) (:name "Mails" :tag "mail" :order 4) (:name "Errands" :tag ("errand" "call") :order 10) (:name "Thesis" :tag "thesis" :order 6) (:discard (:tag ("periodic" "birthday"))))) :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) +zen-text-scale 1.5) (add-hook! 'org-mode-hook 'visual-line-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 org-cite-global-bibliography '("~/Documents/Uni/Thesis/docs/bibliography.bib") citar-bibliography org-cite-global-bibliography citar-library-paths '("~/Documents/Uni/Thesis/bibliography")) ;; 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" org-pomodoro-time-format "%.2m min" org-pomodoro-keep-killed-pomodoro-time t) ;; Define declarative org capture remplates (use-package! doct :commands doct) (setq org-capture-templates (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"))))) ;; 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 an assets directory (after! org-download (setq org-download-image-dir "assets/" org-attach-auto-tag nil)) ;; Show images by default with a limited width (setq org-startup-with-inline-images t org-image-actual-width 600) ;; Use a modern look (use-package! org-modern :hook (org-mode . org-modern-mode) :config (setq org-modern-star ["⁖"])) (add-hook! 'org-agenda-finalize-hook #'org-modern-agenda) ;; Configure a better split and some default for org-noter (after! org-noter (setq org-noter-always-create-frame nil org-noter-doc-split-fraction '(0.7 . 0.3) org-noter-default-heading-title " " org-noter-separate-notes-from-heading nil)) ;; 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)) ;; 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 "$" "$"))) ;; Only show a task once if it has a schedule and deadline (setq org-agenda-skip-deadline-prewarning-if-scheduled t) ;; Show raw latex when the cursor on the expression (add-hook! 'org-mode-hook 'org-fragtog-mode) ;; Auto tangle on save (add-hook! 'org-mode-hook 'org-auto-tangle-mode) ;; 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) ;; HACK Fix search folded sections (setq org-fold-core-style 'overlays) (evil-select-search-module 'evil-search-module 'evil-search)