Emacs: restructure and switch from org-roam to denote

This commit is contained in:
Andrew Scott 2024-11-28 12:41:56 -05:00
parent 03e56fe20c
commit 3047f2deb1
Signed by: a
GPG key ID: 7CD5A5977E4931C1
7 changed files with 2945 additions and 1515 deletions

View file

@ -101,20 +101,13 @@
orig_fg))))
;; Fonts
{{- if eq .chezmoi.hostname "helix" }}
(push '(font . "Hack-14") default-frame-alist)
(set-face-font 'default "Hack-14")
(set-face-font 'fixed-pitch "Hack-14")
(set-face-font 'variable-pitch "DejaVu Sans-14")
{{- else }}
(push '(font . "Hack-11") default-frame-alist)
(set-face-font 'default "Hack-11")
(set-face-font 'fixed-pitch "Hack-11")
(set-face-font 'variable-pitch "DejaVu Sans-11")
{{- end }}
;; (set-face-font 'default "Hack-14")
;; (set-face-font 'fixed-pitch "Hack-14")
;; (set-face-font 'variable-pitch "DejaVu Sans-14")
;; Some GUI options
(let ((options '((undecorated . t)
;; Some UI options
(let ((options '((font . "Hack-14")
(undecorated . t)
(menu-bar-lines . 0)
(tool-bar-lines . 0)
(vertical-scroll-bars)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,132 @@
;;; init-denote.el --- denote customizations -*- lexical-binding: t -*-
;; Author: Andrew Scott <git at andyscott dot me>
;; Keywords: denote, convenience, tools
;; URL: https://codeberg.org/andyscott/dotfiles
;; This file is not part of GNU Emacs
;; Copyright (c) 2024 Andrew Scott
;; MIT No Attribution
;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
;; software and associated documentation files (the "Software"), to deal in the Software
;; without restriction, including without limitation the rights to use, copy, modify,
;; merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
;; permit persons to whom the Software is furnished to do so.
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
;; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;;; Commentary:
;; My denote customizations.
;;; Code:
;;;; Denote
(use-package denote
:ensure
(denote :files (:defaults "denote.*el"))
:custom
(denote-directory (expand-file-name "notes" org-directory))
(denote-known-keywords '("emacs" "projects") "Change default keywords")
;; TODO: Make a decision about links
;; (denote-org-store-link-to-heading 'context "Store denote links with headings")
(denote-prompts '(file-type title keywords) "Add `file-type'")
(denote-templates `((algo-practice . ,(concat "#+url:\n"
"#+difficulty:\n"
"#+topics:\n\n"
"* Tasks\n\n"
"* Input\n\n"
"* Notes\n\n"
"* Solution"))) "Add templates")
:bind
;; (:map dired-mode-map
;; ("" . denote-dired-rename-marked-files-using-front-matter)
;; ("" . denote-dired-rename-marked-files-with-keywords)
;; ("" . denote-dired-rename-files))
;; (:map org-mode-map
;; ("" . denote-org-extras-backlinks-for-heading)
;; ("" . denote-org-extras-dblock-insert-links)
;; ("" . denote-org-extras-dblock-insert-backlinks)
;; ("" . denote-org-extras-link-to-heading) ; Prompt for file/heading, add link at point
;; ("" . denote-org-store-link-to-heading) ; Create CUSTOM_ID to heading and store link
;; )
(:prefix-map as/denote-prefix-map
:prefix "C-c d")
(:map as/denote-prefix-map
;; Creating notes
("n" . denote)
("r" . denote-region)
("t" . denote-template)
;; Dired
("d" . denote-sort-dired)
;; Opening/creating
("f" . denote-open-or-create)
("F" . denote-open-or-create-with-command)
;; Linking
("a" . denote-add-links) ; Link to all notes matching a regex
("b" . denote-backlinks) ; Create a buffer with backlinks
("l" . denote-link) ; Insert a link to another note
("L" . denote-link-or-create) ; Link to the target file, creating the file if needed
("C-l" . denote-link-after-creating) ; Create a file in the background, then link to it in the current file
("C-f" . denote-find-backlink) ; Use minibuffer completion to find backlinks
;; Renaming
("C" . denote-change-file-type-and-front-matter)
("R" . denote-rename-file)
;; Silos
("s n" . denote-silo-extras-create-note)
("s f" . denote-silo-extras-open-or-create)
("s F" . denote-silo-extras-select-silo-then-command))
:hook
(dired-mode . denote-dired-mode)
(text-mode . denote-fontify-links-mode-maybe)
:config
(denote-rename-buffer-mode))
;;;;; Consult Notes
(use-package consult-notes
:custom
(consult-notes-file-dir-sources
`(("Org" ?o ,org-directory)
("Projects" ?r ,(expand-file-name "projects" org-directory))) "Note locations w/ narrowing key")
;; (consult-notes-org-headings-files '("~/path/to/file1.org"
;; "~/path/to/file2.org") "Files for `consult-org-headings-mode'")
:bind
(:map as/denote-prefix-map
("c" . consult-notes)
("a" . consult-notes-search-in-all-notes))
:config
;; (consult-notes-org-headings-mode)
(consult-notes-denote-mode))
;;;;; Citar + Denote
(use-package citar-denote
:if
(and (elpaca-installed-p 'denote)
(elpaca-installed-p 'citar))
:custom
(citar-denote-keyword "bib")
(citar-denote-file-type 'org)
(citar-denote-title-format-authors 2)
:bind
(:map as/denote-prefix-map
("C-c a" . citar-denote-add-citekey)
("C-c d" . citar-denote-dwim)
("C-c f" . citar-denote-open-note))
:config
(citar-denote-mode))
(provide 'init-denote)
;;; init-denote.el ends here

View file

@ -0,0 +1,86 @@
;;;;; Org Roam
(use-package org-roam
:ensure
(org-roam :files (:defaults "extensions/*"))
:after
(org)
:custom
(org-roam-database-connector 'sqlite-builtin "Use built-in sqlite")
(org-roam-directory
(file-name-as-directory (expand-file-name "roam" org-directory)) "Set org-roam directory")
(org-roam-db-gc-threshold most-positive-fixnum "Limit GC during sync")
:bind
(:prefix-map as/org-roam-prefix-map
:prefix "C-c r")
(:map as/org-roam-prefix-map
("a" . org-roam-alias-add)
("A" . org-roam-alias-remove)
("b" . org-roam-buffer-display-dedicated)
("c" . org-roam-capture)
("f" . org-roam-node-find)
("i" . org-roam-node-insert)
("s" . org-roam-db-sync))
:config
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-direction)
(direction . right)
(window-width . 0.33)
(window-height . fit-window-to-buffer)))
(add-to-list 'org-roam-capture-templates
'("r" "reference" plain
"%?"
:target
(file+head "references/${citar-citekey}.org"
"#+title: ${note-title}\n")
:empty-lines 1
:unnarrowed t
))
(add-to-list 'org-roam-capture-templates
`("p" "project" plain (file ,(concat org-roam-directory
"/templates/projects.org"))
:target
(file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+filetags: :projects:")
:empty-lines 1
:unnarrowed t))
(add-to-list 'org-roam-capture-templates
`("j" "job" plain (file ,(concat org-roam-directory
"/templates/job_applications.org"))
:target
(file+head "projects/job_applications/%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+filetags: :job_search:")
:empty-lines 1
:unnarrowed t))
(org-roam-db-autosync-mode))
;;;;;; Org Roam UI
(use-package org-roam-ui
:if
(elpaca-installed-p 'org-roam)
:after
(org-roam)
:custom
(org-roam-ui-follow nil "Don't update UI when point moves")
:bind
(:map as/org-roam-prefix-map
("u" . org-roam-ui-open)))
;;;;;; Citar + Roam
(use-package citar-org-roam
:if
(and (elpaca-installed-p 'citar)
(elpaca-installed-p 'org-roam))
:after
(citar org-roam)
:custom
(citar-org-roam-capture-template-key "r" "Define which template to use")
(citar-org-roam-note-title-template "${title} by ${author}" "Default note title")
(citar-org-roam-subdir "references" "Default note directory")
:config
;; NOTE: Trying `citar-denote'
;; (citar-org-roam-mode)
)

View file

@ -1,4 +1,4 @@
;;; org-mode.el --- org-mode customizations -*- lexical-binding: t -*-
;;; init-org.el --- org-mode customizations -*- lexical-binding: t -*-
;; Author: Andrew Scott <git at andyscott dot me>
;; Keywords: org, convenience, tools
@ -29,167 +29,259 @@
;;; Code:
(use-package citar
:after (oc)
:config
(setopt citar-bibliography org-cite-global-bibliography
citar-library-paths '("~/Nextcloud/Library/"))
;; (when (elpaca-installed-p 'citar-embark)
;; (setopt citar-at-point-function 'embark-act))
:hook (org-mode . citar-capf-setup))
;;;; Org
(use-package citar-embark
:after (citar embark)
:config (citar-embark-mode))
;;;;; Org Mode
(use-package citar-org-roam
:after (citar org-roam)
:config
(setopt citar-org-roam-capture-template-key "r"
citar-org-roam-note-title-template "${title} - ${author}"
citar-org-roam-subdir "references")
(citar-org-roam-mode))
(use-feature org
:custom
;;;;;; `org.el'
(org-directory (expand-file-name "~/Nextcloud/Documents/org"))
(org-adapt-indentation nil "No, see `org-indent-mode'")
(org-agenda-files (append
(directory-files org-directory t "\\`[^.].*\\.org\\'" t nil)
(directory-files (expand-file-name "projects" org-directory) t "\\`[^.].*\\.org\\'" t nil)))
(org-archive-location
(expand-file-name "archive/%s_archive::" org-directory) "Set location and format for archives")
(org-blank-before-new-entry '((heading . t)
(plain-list-item . auto)) "Heading: always, List: maybe")
(org-deadline-warning-days 5 "Decrease warning time")
(org-default-notes-file
(expand-file-name "inbox.org" org-directory) "Default file for `org-capture'")
;; FIXME: `org-superstar' doesn't like this?
;; (org-ellipsis " >> " "Until I can stop using ... myself...")
(org-enforce-todo-checkbox-dependencies t "Use checkboxes as blockers")
(org-hide-emphasis-markers t "Hide markers for italics/bold etm.")
(org-insert-heading-respect-content t "Add headlines to end of subtree")
(org-log-done 'time "Add timestamp when item completed")
(org-log-into-drawer t "Hide logs in a drawer")
(org-log-redeadline 'note "Require a note if deadline changes")
;; (org-M-RET-may-split-line nil "Don't split when adding headings/items")
(org-pretty-entities t "Use UTF-8 for entities")
(org-pretty-entities-include-sub-superscripts nil "Don't mess with underscores")
(org-reverse-note-order t "Add/refile at the beginning")
(org-special-ctrl-a/e t "Once: Move point around headline text, Twice: move point normally")
;; (org-special-ctrl-k t "Change behavior of `kill-line' depending on position")
(org-startup-folded 'show2levels "Show two headings only")
(org-startup-indented t "Turn on `org-indent-mode' automatically")
(org-startup-numerated t "Turn on `org-num-mode' automatically")
(org-tags-column 0 "Put tags right after headline")
;; (org-tags-exclude-from-inheritance '("projects"
;; "JobApplications"
;; "Hybrid"
;; "Remote"
;; "InOffice") "Don't tag every headline")
(org-todo-keywords '((sequence "TODO(t)"
"NEXT(x)"
"PROG(p)"
"WAIT(w@/!)"
"|"
"DONE(d)"
"WONT(n@/!)")
(sequence "IDEA(i)" "|")) "Add NEXT, PROG, WAIT, WONT, IDEA")
(org-todo-repeat-to-state "TODO" "Reset to TODO regardless of previous state")
(use-package citeproc
:after (oc))
;;;;;; `org-agenda.el'
(org-agenda-block-separator ?- "Use simple hyphens")
(org-agenda-skip-deadline-if-done t "Don't show deadline when already done")
;; (org-agenda-skip-scheduled-if-deadline-is-shown nil "Show deadlines and schedules")
(org-agenda-skip-scheduled-if-done t "Don't show scheduled when already done")
(org-agenda-start-on-weekday nil "Start with today")
(org-agenda-start-with-log-mode '(clock closed state) "Show all logged items")
(org-agenda-tags-column 0 "Put tags right after headline")
(use-feature oc
:after (org)
:config
(setopt org-cite-export-processors '((latex biblatex)
(t csl))
org-cite-global-bibliography '("~/Nextcloud/Library/bib/library.bib"))
(when (elpaca-installed-p 'citar)
(setopt org-cite-activate-processor 'citar
org-cite-follow-processor 'citar
org-cite-insert-processor 'citar)))
;; REVIEW: Is this useful data to keep?
;; :PROPERTIES:
;; :CREATED: %U
;; :END:
(use-feature oc-csl
:after (citeproc oc)
:config
(let ((zotero_styles (expand-file-name
"Zotero/styles/" (or (getenv "XDG_DATA_HOME") "~/.local/share/"))))
(if (file-directory-p zotero_styles)
(setopt org-cite-csl-styles-dir zotero_styles))))
;;;;;; `org-capture.el'
(org-capture-templates
`(("i" "Inbox")
("in" "Note"
entry (file+headline "inbox.org" "Notes")
"** %?"
:empty-lines 1)
(use-package org
("it" "Task" entry (file+headline "inbox.org" "Tasks")
"** TODO [#B] %?
%i\n%a"
:empty-lines 1)
("d" "Denote"
plain (file denote-last-path)
#'denote-org-capture
:no-save t
:immediate-finish nil
:kill-buffer t
:jump-to-captured t)
("j" "Job Application"
entry (file+olp "projects/jobs.org" "Applications")
"*** TODO [#A] %^{Job Title} %^{Company} %?\nSCHEDULED: %t\n
**** Find Contacts at %\\2\nSCHEDULED: %t\n"
:clock-in t
:clock-keep t
:jump-to-captured t
:empty-lines 1)))
;;;;;; `org-clock.el'
(org-clock-in-resume t "Resume if clock already started")
(org-clock-in-switch-to-state "PROG" "Switch items to In-Progress")
(org-clock-persist t "Save clock if Emacs is closed")
(org-clock-rounding-minutes 5 "Round to 5 minutes")
(org-clock-string-limit 30 "Don't crowd the mode line")
;;;;;; `org-faces.el' - Custom Settings
(org-fontify-quote-and-verse-blocks t "Make #+begin_quote etm. look nicer")
(org-todo-keyword-faces '(("TODO" . (:inherit dired-mark :inverse-video t))
("PROG" . (:inherit match :inverse-video t))
("NEXT" . (:inherit dired-special :inverse-video t))
("WAIT" . (:inherit shadow :inverse-video t))
("WONT" . (:inherit org-done))
("DONE" . (:inherit org-done))
("IDEA" . (:inherit bold :inverse-video t))))
(org-priority-faces '((?A . (:inherit error :weight semibold :inverse-video t))
(?B . (:inherit warning :weight semibold :inverse-video t))
(?C . (:inherit mode-line-inactive :weight semibold :inverse-video t))))
;;;;;; `org-fold.el'
(org-fold-catch-invisible-edits 'show-and-error "Abort edit, show point & throw error")
;;;;;; `org-goto.el'
(org-goto-interface 'outline-path-completion "Use completion interface")
;;;;;; `org-id.el'
(org-id-link-to-org-use-id 'create-if-interactive "Only if I say so")
(org-id-locations-file
(locate-user-emacs-file "org-id-locations") "Don't use a hidden file")
(org-id-method 'ts "Timestamps instead of UUID")
(org-id-ts-format "%Y%m%dT%H%M%S%z" "True ISO 8601 timestamp")
;;;;;; `org-keys.el'
(org-mouse-1-follows-link 'double "Otherwise timestamps automatically open agenda")
(org-return-follows-link t "Follow links on RET")
(org-use-extra-keys t "Graphical users like useful keybinds too")
;;;;;; `org-list.el'
(org-list-allow-alphabetical t "A. a. B. b. C. c. ...")
(org-list-demote-modify-bullet '(("+" . "-")
("-" . "+")
("*" . "+")) "Alternating bullets")
;;;;;; `org-num.el'
(org-num-face 'org-level-6 "Use consistent face for num-mode")
;;;;;; `org-refile.el'
(org-outline-path-complete-in-steps nil "Not needed with completion")
(org-refile-allow-creating-parent-nodes 'confirm "Ask before creating new nodes")
(org-refile-targets '((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 2)) "Current file: 3 levels, Agenda files: 2 levels")
(org-refile-use-outline-path 'file "Include filename in path")
;;;;;; `org-src.el'
(org-edit-src-content-indentation 0 "Don't indent after #+begin")
:custom-face
;;;;;; `org-faces.el' - Custom Faces
;; Headlines
(org-level-1 ((t (:inherit outline-1 :height 1.3))))
(org-level-2 ((t (:inherit outline-2 :height 1.2))))
(org-level-3 ((t (:inherit outline-3 :height 1.1))))
;; (org-level-4 ((t (:inherit outline-4 :height 1.2))))
;; (org-level-5 ((t (:inherit outline-5 :height 1.1))))
;; Ensure monospace Keywords/Tags/Blocks
(org-block ((t (:inherit fixed-pitch)))) ; inherited by `org-code'
(org-block-begin-line ((t (:inherit fixed-pitch))))
(org-block-end-line ((t (:inherit (org-block-begin-line fixed-pitch)))))
(org-checkbox ((t (:inherit (org-todo fixed-pitch)))))
(org-checkbox-statistics-todo ((t (:inherit (org-todo fixed-pitch)))))
(org-date ((t (:inherit fixed-pitch))))
(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
(org-drawer ((t (:inherit fixed-pitch))))
(org-indent ((t (:inherit (org-hide fixed-pitch)))))
(org-link ((t (:foreground "dark cyan" :underline t))))
(org-list-dt ((t (:inherit fixed-pitch))))
(org-meta-line ((t (:inherit (fixed-pitch)))))
(org-property-value ((t (:inherit fixed-pitch))))
(org-special-keyword ((t (:inherit fixed-pitch))))
(org-table ((t (:inherit fixed-pitch))))
(org-tag ((t (:inherit (fixed-pitch) :height 0.8))))
(org-verbatim ((t (:inherit fixed-pitch))))
:bind
(:map global-map
("C-c a" . org-agenda)
("C-c c" . org-capture)
("C-c l" . org-store-link))
(:prefix-map as/org-prefix-map
:prefix "C-c o")
(:map as/org-prefix-map
("a" . org-agenda) ; `org-agenda.el'
("c" . org-capture) ; `org-capture.el'
("g" . org-clock-goto) ; `org-clock.el'
("H" . consult-org-agenda) ; `consult-org.el'
("l" . org-store-link) ; `ol.el'
("m" . org-tags-view)) ; `org-agenda.el'
(:map org-mode-map
("C-c o c" . as/org-set-created-property)
("C-c o d" . org-priority-down)
("C-c o h" . consult-org-heading) ; `consult-org.el'
("C-c o l" . embark-org-copy-link-target) ; `embark-org.el'
("C-c o L" . org-toggle-link-display) ; `ol.el'
("C-c o s" . org-insert-subheading)
("C-c o u" . org-priority-up)
("C-c o y" . org-todo-yesterday))
:demand t
:hook
(org-mode . (lambda ()
(setq-local fill-column 100)
(variable-pitch-mode)
(visual-line-fill-column-mode)))
:config
;; General options TODO: Comment various options more descriptively
(setopt org-agenda-block-separator nil
;; org-agenda-files (list org-directory)
org-agenda-files (directory-files-recursively org-directory "org$")
org-agenda-skip-deadline-if-done nil
org-agenda-skip-scheduled-if-deadline-is-shown t
org-agenda-skip-scheduled-if-done nil
org-agenda-start-on-weekday nil
org-agenda-tags-column 0
org-archive-location (expand-file-name "archive/%s_archive.org::" org-directory)
org-blank-before-new-entry '((heading . auto)
(plain-list-item . auto))
org-deadline-warning-days 5
org-enforce-todo-dependencies t
org-fold-catch-invisible-edits 'show-and-error
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-fontify-todo-headline t
org-goto-interface 'outline-path-completion
org-hide-emphasis-markers t
org-insert-heading-respect-content t
org-log-done 'time
org-log-into-drawer t
org-log-redeadline 'time
org-log-refile 'note
org-log-reschedule 'time
org-outline-path-complete-in-steps nil
org-pretty-entities t
org-refile-allow-creating-parent-nodes 'confirm
org-refile-targets '((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 2))
org-refile-use-outline-path 'file
org-return-follows-link t
org-reverse-note-order t ; Add/refile notes at the beginning of an entry
org-special-ctrl-a/e t
org-src-preserve-indentation t
org-startup-folded 'fold
org-tags-column 0
org-todo-keywords '((sequence "TODO(t)"
"NEXT(n)"
"PROG(p)"
"|"
"DONE(d!)"
"WONT(w@/!)")
(sequence "IDEA(i)" "|"))
org-todo-keyword-faces '(("TODO" . (dired-mark))
("PROG" . (success))
("NEXT" . (dired-special))
("WONT" . (org-done)))
org-todo-repeat-to-state "TODO")
(defun as/org-set-created-property ()
"Add a CREATED property to org headlines with the current time"
(interactive)
(org-entry-put nil "CREATED" (format-time-string (org-time-stamp-format t t nil) (current-time)))))
(setq org-capture-templates
`(
("i" "Inbox" entry (file "roam/inbox.org")
"* %?"
:empty-lines 1
)
;;;;; Appearance
("j" "Log Entry"
entry (file+datetree "log.org")
"** %?"
:empty-lines 1)
;;;;;; Org Appear
("n" "Note"
entry (file+headline "inbox.org" "Notes")
"** %?
:PROPERTIES:
:CREATED: %U
:END:"
:empty-lines 1)
(use-package org-appear
:custom
(org-appear-autoentities t "Toggle markers automatically")
(org-appear-autolinks 'just-brackets "Only show brackets, not target")
(org-appear-autosubmarkers t "Toggle sub/superscript markers automatically")
(org-appear-trigger 'on-change "Only auto-toggle if changed or selected")
:hook
(org-mode . org-appear-mode))
("t" "Todo" entry (file+headline "inbox.org" "Tasks")
"** TODO [#B] %?
:PROPERTIES:
:CREATED: %U
:END:
%i\n%a
Notes: "
:empty-lines 1)
)
)
;;;;;; Org Superstar
;; Headline appearance
(custom-set-faces
'(org-level-1 ((t (:inherit outline-1 :height 1.5))))
'(org-level-2 ((t (:inherit outline-2 :height 1.4))))
'(org-level-3 ((t (:inherit outline-3 :height 1.3))))
'(org-level-4 ((t (:inherit outline-4 :height 1.2))))
'(org-level-5 ((t (:inherit outline-5 :height 1.1)))))
:hook (org-mode . org-indent-mode)
:init
(setopt org-directory "~/Nextcloud/Documents/org")
(bind-keys :prefix-map as/org-prefix-map
:prefix "C-c o"
("n" . org-metadown)
("p" . org-metaup)
("f" . org-shiftmetaright)
("b" . org-shiftmetaleft)
("v" . org-tags-view)
("y" . org-todo-yesterday)
("l" . org-toggle-link-display)
("C-n" . org-priority-down)
("C-p" . org-priority-up)))
(use-package org-superstar
:custom
(org-superstar-headline-bullets-list '(?◉ ?🞛 ?○ ?▷ ?✸ ?✿) "Customize bullets")
(org-indent-mode-turns-on-hiding-stars nil "Required by `org-superstar-leading-bullet'")
(org-superstar-leading-bullet ?\s "Replace leading stars with 1 whitespace char")
(org-superstar-hide-leading-stars t "Enable hiding")
(org-superstar-special-todo-items t "Replace todo checkboxes")
(org-superstar-todo-bullet-alist '(("TODO" . ?☐)
("NEXT" . ?☐)
("PROG" . ?☐)
("WAIT" . ?☐)
("DONE" . ?☑)
("WONT" . ?☑)) "Customize todo checkboxes")
:hook (org-mode . org-superstar-mode))
;;;;; Agenda
;;;;;; Org Agenda
(use-feature org-agenda
:after (org)
:after
(org)
:bind
(:map org-agenda-mode-map
("C-c C-r" . as/org-agenda-reconcile-inbox-item))
:config (setopt org-agenda-start-with-log-mode '(clock closed state))
:init
("C-c C-r" . as/org-agenda-reconcile-inbox-item)
("C-c C-y" . org-agenda-todo-yesterday)
("C-c o p" . org-pomodoro))
:config
(defun as/org-agenda-reconcile-inbox-item ()
"Process and refile an org-agenda item"
(interactive)
@ -200,319 +292,282 @@ Notes: "
(org-agenda-schedule nil nil))
(org-agenda-refile nil nil t))))
(use-package org-appear
:config
(setopt org-appear-autoentities t
org-appear-autolinks nil
org-appear-autosubmarkers t
org-appear-trigger 'on-change)
:hook (org-mode . org-appear-mode))
(use-feature org-clock
:after (org)
:config
(setopt org-clock-in-resume t
org-clock-in-switch-to-state "PROG"
org-clock-persist t
org-clock-rounding-minutes 5))
(use-package org-edna
:config (setopt org-edna-finder-use-cache t)
:hook (org-mode . org-edna-mode))
(use-feature org-habit
:after (org)
;; REVIEW: do I need to add to modules if it loads after org anyway?
:init (add-to-list 'org-modules 'org-habit t))
(use-feature org-id
:after (org)
:config
(setopt org-id-link-to-org-use-id t
org-id-locations-file (locate-user-emacs-file "org-id-locations")
org-id-method 'ts
org-id-ts-format "%Y%m%dT%H%M%S.%2N%z")
;; REVIEW: do I need to add to modules if it loads after org anyway?
:init (add-to-list 'org-modules 'org-id t))
(use-package org-modern
:disabled t
:config
(setopt org-modern-block-name nil
org-modern-priority nil
org-modern-symbol "DejaVu Sans"
org-modern-todo nil
org-modern-tag nil
org-modern-timestamp nil)
:hook
(org-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda))
(use-package org-noter
:after (org)
:config
(setopt org-noter-notes-search-path (list (concat org-directory "/roam")))
(org-noter-enable-org-roam-integration))
(use-package org-pomodoro
:after (org-clock)
:commands (org-pomodoro)
:config
;; (defun as/org-pomodoro-started-todo-update ()
;; "Update todo state when starting a pomodoro"
;; (when (or (string= org-state "NEXT")
;; (string= org-state "TODO"))
;; (org-todo "PROG")))
;; (defun as/org-todo-state-maybe-update-pomodoro ()
;; "Update or start a pomodoro when changing todo state
;; REVIEW: This could be updated to always trigger a pomodoro change, like when
;; changing state to PROG. This has the added benefit of making the above function
;; redundent, as I could just use `org-todo' as a single start and end point for
;; all pomodoros"
;; (when (and (or (string= org-state "TODO")
;; (string= org-state "DONE"))
;; (org-pomodoro-active-p))
;; (org-pomodoro-kill)))
;; (add-to-list 'org-after-todo-state-change-hook #'as/org-todo-state-change-maybe-kill-pomodoro)
;; (add-to-list 'org-pomodoro-started-hook #'as/org-pomodoro-started-todo-update)
(setopt alert-user-configuration ; Send mesages to libnotify
'((((:category . "org-pomodoro")) libnotify nil))
org-pomodoro-audio-player (executable-find "pw-cat")
org-pomodoro-keep-killed-pomodoro-time t
org-pomodoro-length 50
org-pomodoro-short-break-length 10
org-pomodoro-manual-break t)
:init
;; (defun as/org-pomodoro-todo-state-trigger ()
;; "Starts or stops a pomodoro when todo state changes"
;; (cond
;; ((when (string= org-state "PROG")
;; (if (org-pomodoro-active-p)
;; ((org-pomodoro-kill)
;; (org-pomodoro nil))
;; (org-pomodoro nil)))
;; ((when (and (or (string= org-state "DONE") (string= org-state "TODO"))
;; (org-pomodoro-active-p))
;; (org-pomodoro-kill))))))
;; (with-eval-after-load 'org-clock
;; (add-to-list 'org-after-todo-state-change-hook #'as/org-pomodoro-todo-state-trigger))
)
(use-package org-roam
:after (org)
:bind
(:map as/org-prefix-map
("r i" . org-roam-node-insert)
("r f" . org-roam-node-find)
("r c" . org-roam-capture)
;; REVIEW: Not sure if I really need these?
;; ("r b" . org-roam-buffer-toggle)
;; ("r d" . org-roam-buffer-display-dedicated)
;; ("r a a" . org-roam-alias-add)
;; ("r a r" . org-roam-alias-remove)
;; ("r r a" . org-roam-ref-add)
;; ("r r r" . org-roam-ref-remove)
)
:config
(setopt org-roam-database-connector 'sqlite-builtin)
(setq org-roam-db-gc-threshold most-positive-fixnum) ; doesn't like the new `setopt'
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-direction)
(direction . right)
(window-width . 0.33)
(window-height . fit-window-to-buffer)))
(add-to-list 'org-roam-capture-templates
'("r" "reference" plain
"%?"
:target
(file+head "references/${citar-citekey}.org"
"#+title: Notes on: ${note-title}\n")
:empty-lines 1
:unnarrowed t
))
(add-to-list 'org-roam-capture-templates
`("p" "project" plain (file ,(concat org-roam-directory
"/templates/projects.org"))
:target
(file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+filetags: projects")
:empty-lines 1
:unnarrowed t))
(org-roam-db-autosync-mode)
:ensure (org-roam :files (:defaults "extensions/*"))
:init
(setopt org-roam-directory (file-name-as-directory (expand-file-name "roam" org-directory))))
;;;;;; Org Super Agenda
(use-package org-super-agenda
:hook (org-agenda-mode . org-super-agenda-mode)
:hook
(org-agenda-mode . org-super-agenda-mode)
:init
(setq org-agenda-custom-commands
'(("w" "Work agenda"
'(("u" "Super agenda"
((agenda "" ((org-agenda-prefix-format " %?-12t %s")
((agenda "" ((org-agenda-prefix-format " %-12t% s%?-6e")
;;(org-agenda-prefix-format " %?-12t %s")
(org-agenda-remove-tags t)
(org-agenda-skip-function '(org-agenda-skip-entry-if
'todo '("WONT")))
(org-agenda-span 'day)
(org-habit-show-habits nil)))
(org-agenda-span 'day)))
(alltodo "" ((org-agenda-overriding-header "")
(org-agenda-prefix-format " %?-12t %s")
(alltodo "" ((org-agenda-overriding-header "\nI'M DOING IT...")
(org-agenda-prefix-format " %-20T")
;; (org-agenda-prefix-format " %?-12t %s")
(org-agenda-remove-tags t)
(org-super-agenda-groups
'((:discard
(:deadline future
:scheduled future
:category ("house" "me" "notes")))
(:name "Done"
:log state
'(
(:name "Done Today" ; FIXME
:todo "DONE"
:order 90)
:log t
:order 95)
(:name "Overdue"
:deadline past
:scheduled past
:order 1)
(:name "Inbox"
:category ("inbox" "phone_inbox")
:order 9)
(:name "Important"
:priority "A"
:order 0)
(:name "In-Progress"
:todo "PROG"
:order 2)
(:name "Next"
:todo "NEXT"
:order 3)
(:name "Today"
:deadline today
:scheduled today
:time-grid t
:order 4)
(:name "Research"
:tag "research"
:order 7)
(:name "Project Backlog"
:and (:todo "TODO" :tag "projects")
:order 5)
(:name "General Backlog"
:and (:todo "TODO" :priority "B")
:order 8)
(:name "Less Important"
:priority<= "C"
(:name "Waiting"
:todo "WAIT"
:order 80)
))))))
("y" "My agenda"
((agenda "" ((org-agenda-prefix-format " %?-12t %s")
(org-agenda-remove-tags t)
(org-agenda-skip-function '(org-agenda-skip-entry-if
'todo '("WONT") 'regexp '("job")))
(org-agenda-span 3)))
(alltodo "" ((org-agenda-overriding-header "")
(org-agenda-prefix-format " %?-12t %s")
(org-agenda-remove-tags t)
(org-super-agenda-groups
'((:discard
(:not
(:category ("house" "me" "notes"))))
;; (:discard
;; (:deadline future :scheduled future))
(:name "Overdue"
:deadline past
:scheduled past
:order 1)
(:name "Upcoming"
:deadline future
:scheduled future
:order 99)
(:name "Inbox"
:category ("inbox" "phone_inbox")
:order 8)
(:name "Done"
:todo "DONE"
:order 99)
(:name "Important"
(:name "High Priority"
:priority "A"
:order 0)
(:name "In-Progress"
:todo "PROG"
:order 2)
(:name "Next"
:todo "NEXT"
:order 3)
(:name "Household"
:tag "chores"
:order 6)
(:name "Routine"
:and (:habit t :not (:tag "chores"))
:order 5)
(:name "Today"
(:name "Now"
:todo ("PROG" "NEXT")
:order 10)
(:name "Today's Personal Tasks"
:and (:deadline today :tag "personal")
:and (:scheduled today :tag "personal")
:order 20)
(:name "Today's Household Tasks"
:and (:deadline today :tag "household")
:and (:scheduled today :tag "household")
:order 30)
(:name "Today's Projects"
:deadline today
:scheduled today
:time-grid t
:order 4)
;; (:name "Personal projects"
;; :categery "me"
;; :order 9)
:order 15)
(:name "Research"
:tag "research"
:order 7)
:order 45)
(:name "General Backlog"
:and (:todo "TODO" :priority "B")
(:name "Personal Backlog"
:and (:todo "TODO" :tag "personal")
:and (:todo "TODO" :tag "job_search")
:order 40)
(:name "Household Backlog"
:and (:todo "TODO" :tag "household")
:order 50)
(:name "Less Important"
:priority<= "C"
:order 85)
)))))))))
(:name "Project Backlog"
:todo "TODO"
:order 35)
(use-package org-superstar
;; :disabled t
(:name "Inbox"
:tag "inbox"
:order 90)
)))))
)))
)
;;;;; Contacts
;; Last commit before requiring org 9.7: 048942e8063044accca7a5c42b81a1e27b7a0876
(use-package org-contacts
:ensure
(org-contacts :repo "https://repo.or.cz/org-contacts.git" :ref "048942e8")
:custom
(org-contacts-files
`(,(expand-file-name "contacts.org" org-directory)) "Set single contacts file")
:commands
(org-contacts org-contacts-agenda))
;;;;; Navigation
;;;;; Notes
;;;;;; Org Noter
(use-package org-noter
:custom
(org-noter-notes-search-path
`(,(expand-file-name "notes" org-directory)) "Note paths (non-recursive)")
:bind
("C-c n n" . org-noter)
(:map dired-mode-map
("C-c n n" . org-noter-start-from-dired))
:hook
(dired-mode . org-noter-enable-update-renames))
;;;;;; Org Remark
(use-package org-remark
:custom
(org-remark-line-ellipsis "---" "Default '...' is too similar to folded headlines")
(org-remark-notes-file-name
(expand-file-name "org-remark.org" org-directory) "Default too similar to `marginalia.el'")
:bind
("C-c n m" . org-remark-mark)
("C-c n l" . org-remark-mark-line)
(:map org-remark-mode-map
("C-c n o" . org-remark-open)
("C-c n ]" . org-remark-view-next)
("C-c n [" . org-remark-view-prev)
("C-c n r" . org-remark-remove)
("C-c n d" . org-remark-delete))
:init
(org-remark-global-tracking-mode)
:hook
(elpaca-after-init . org-remark-global-tracking-mode)
(nov-mode . org-remark-nov-mode))
;;;;; Org Citations
;;;;;; Org Cite
(use-feature oc
:custom
(org-cite-export-processors '((latex biblatex)
(t csl)) "Use biblatex for LaTeX, csl for everything else")
(org-cite-global-bibliography
`(,(expand-file-name "~/Nextcloud/Library/Bibliography/Library.bib")) "Set bib files")
:defer t
:config
(setopt org-indent-mode-turns-on-hiding-stars nil
org-superstar-headline-bullets-list '("" "🞛" "" "")
org-superstar-leading-bullet ?\s
org-superstar-special-todo-items t)
:hook (org-mode . org-superstar-mode))
(when (elpaca-installed-p 'citar)
(setopt org-cite-activate-processor 'citar
org-cite-follow-processor 'citar
org-cite-insert-processor 'citar)))
;;;;;; Org Cite CSL
(use-feature oc-csl
:if
(elpaca-installed-p 'citeproc)
:after
(citeproc oc)
:config
(let ((zotero_styles (expand-file-name
"Zotero/styles/" (or (getenv "XDG_DATA_HOME") "~/.local/share/"))))
(if (file-directory-p zotero_styles)
(setopt org-cite-csl-styles-dir zotero_styles))))
;;;;;; Citar
(use-package citar
:custom
(citar-bibliography
`(,(expand-file-name "~/Nextcloud/Library/Bibliography/Library.bib")) "Set bib files")
(citar-library-paths
`(,(expand-file-name "~/Nextcloud/Library/")) "Set paths to sources")
:bind
("C-c n c" . citar-create-note)
:hook
(org-mode . citar-capf-setup)
:config
(when (elpaca-installed-p 'citar-embark)
(setopt citar-at-point-function 'embark-act)))
;;;;;; Citar + Embark
(use-package citar-embark
:if
(and (elpaca-installed-p 'citar)
(elpaca-installed-p 'embark))
:after
(citar embark)
:config
(citar-embark-mode))
;;;;;; Citeproc
;; Dependency for other packages
(use-package citeproc
:defer t)
;;;;; Project Management
;;;;;; Org Edna
(use-package org-edna
:custom
(org-edna-finder-use-cache t "Improve performance with caching")
:bind
(:map org-mode-map
("C-c o e" . org-edna-edit))
:hook
(org-mode . org-edna-mode))
;;;;; Time Management
;;;;;; Org Clock
(use-feature org-clock
:after
(org)
:config
(defun as/save-after-org-clock-in (&rest r)
"Save org buffer after clocking in"
(with-current-buffer
(org-clocking-buffer)
(save-buffer)))
(defun as/save-after-org-clock-out (func &rest r)
"Save org buffer after clocking out of a task
`:around' is used here in the event the current buffer is not the same as
`org-clocking-buffer'. Thanks to @mocompute for the idea:
<https://mocompute.codeberg.page/item/2024/2024-10-03-org-clock-out-save-buffer.html>"
(let ((buffer (org-clocking-buffer)))
(apply func r)
(when buffer (with-current-buffer buffer (save-buffer)))))
(advice-add #'org-clock-in :after #'as/save-after-org-clock-in)
(advice-add #'org-clock-out :around #'as/save-after-org-clock-out))
;;;;;; Org Pomodoro
(use-package org-pomodoro
:after
(org-clock)
:custom
(alert-user-configuration
'((((:category . "org-pomodoro")) libnotify nil)) "Send alerts to libnotify")
(org-pomodoro-audio-player
(concat (executable-find "pw-cat") " -p --volume 0.25") "Use PipeWire & reduce volume")
(org-pomodoro-clock-breaks t "Include break time")
(org-pomodoro-format "%s" "Only display the timer")
(org-pomodoro-keep-killed-pomodoro-time t "Log manually ended clocks")
(org-pomodoro-length 50 "Increase pomodoro time")
(org-pomodoro-long-break-frequency 2 "Decrease long break frequency")
(org-pomodoro-manual-break t "Require manually clocking out")
(org-pomodoro-short-break-length 10 "Increase short break length")
:bind
(:map org-mode-map
("C-c o p" . org-pomodoro))
:commands
(org-pomodoro))
;;;;;; Org Timeblock
(use-package org-timeblock
:custom
(org-timeblock-new-task-time 'pick "Ask me for new time")
(org-timeblock-show-future-repeats 'next "Only show next repeat")
(org-timeblock-scale-options (cons 7 20) "Start at 7:00, end at 20:00")
(org-timeblock-span 3 "Number of days to display")
:bind
(:map as/org-prefix-map
("t" . org-timeblock))
:config
(setopt org-timeblock-new-task-time 'pick
org-timeblock-show-future-repeats 'next
org-timeblock-scale-options (cons 7 20)
org-timeblock-span 3))
("b" . org-timeblock)))
(provide 'init-org)
;;; org-mode.el ends here
;;; init-org.el ends here

View file

@ -0,0 +1,490 @@
;;; org-mode.el --- org-mode customizations -*- lexical-binding: t -*-
;; Author: Andrew Scott <git at andyscott dot me>
;; Keywords: org, convenience, tools
;; URL: https://codeberg.org/andyscott/dotfiles
;; This file is not part of GNU Emacs
;; Copyright (c) 2024 Andrew Scott
;; MIT No Attribution
;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
;; software and associated documentation files (the "Software"), to deal in the Software
;; without restriction, including without limitation the rights to use, copy, modify,
;; merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
;; permit persons to whom the Software is furnished to do so.
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
;; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;;; Commentary:
;; My org-mode customizations.
;;; Code:
(use-feature org
:bind
(:map as/org-prefix-map
("a" . org-agenda)
("c" . org-capture)
("d" . org-priority-down)
("h" . consult-org-heading)
("l" . org-store-link)
("s" . org-insert-subheading)
("u" . org-priority-up)
("y" . org-todo-yesterday)
("C-h" . consult-org-agenda)
("C-l" . embark-org-copy-link-target) ; `embark'
("M-l" . org-toggle-link-display) ; `ol'
("t" . org-tags-view)) ; `org-agenda'
(:map org-mode-map
;; supposed to be set by `org-use-extra-keys'
;; and still overwritten with `org-insert-drawer' when `org' is loaded
("C-c C-x d" . org-metadown))
:config
;; General options TODO: Comment various options more descriptively
(setopt org-adapt-indentation nil
org-agenda-files (directory-files-recursively org-directory "org$")
org-archive-location (expand-file-name "archive/%s_archive.org::" org-directory)
org-blank-before-new-entry '((heading . t)
(plain-list-item . t))
org-deadline-warning-days 5
org-default-notes-file (expand-file-name "inbox.org" org-directory)
org-enforce-todo-checkbox-dependencies t
org-fontify-done-headline t
org-fontify-todo-headline nil
org-goto-interface 'outline-path-completion ; `org-goto'
org-hide-emphasis-markers t
org-insert-heading-respect-content t
org-log-done 'time
org-log-into-drawer t
org-log-redeadline 'time
org-M-RET-may-split-line nil
org-pretty-entities t
org-pretty-entities-include-sub-superscripts nil
org-reverse-note-order t ; Add/refile notes at the beginning of an entry
org-special-ctrl-a/e t
org-special-ctrl-k t
org-startup-folded 'content
org-tags-column 0
org-todo-keywords '((sequence "TODO(t)"
"NEXT(x)"
"PROG(p)"
"WAIT(w@/!)"
"|"
"DONE(d!)"
"WONT(n@/!)")
(sequence "IDEA(i)" "|"))
org-todo-repeat-to-state "TODO")
:defer 3
:hook
(org-mode . org-indent-mode)
(org-mode . variable-pitch-mode)
:init
(bind-keys :prefix-map as/org-prefix-map
:prefix "C-c o")
(setopt org-directory "~/Nextcloud/Documents/org"
org-use-extra-keys t))
;;; Built-in Packages:
(use-feature oc
:after (org)
:config
(setopt org-cite-export-processors '((latex biblatex)
(t csl))
org-cite-global-bibliography '("~/Nextcloud/Library/bib/library.bib"))
(when (elpaca-installed-p 'citar)
(setopt org-cite-activate-processor 'citar
org-cite-follow-processor 'citar
org-cite-insert-processor 'citar)))
(use-feature oc-csl
:after (citeproc oc)
:config
(let ((zotero_styles (expand-file-name
"Zotero/styles/" (or (getenv "XDG_DATA_HOME") "~/.local/share/"))))
(if (file-directory-p zotero_styles)
(setopt org-cite-csl-styles-dir zotero_styles))))
(use-feature org-agenda
:after (org)
:bind
(:map org-agenda-mode-map
("C-c C-r" . as/org-agenda-reconcile-inbox-item))
:config
(setopt org-agenda-block-separator ?-
org-agenda-skip-deadline-if-done nil
org-agenda-skip-scheduled-if-deadline-is-shown nil
org-agenda-skip-scheduled-if-done nil
org-agenda-start-on-weekday nil
org-agenda-start-with-log-mode '(clock closed state)
org-agenda-tags-column 0)
(defun as/org-agenda-reconcile-inbox-item ()
"Process and refile an org-agenda item"
(interactive)
(org-with-wide-buffer
(org-agenda-set-tags)
(org-agenda-priority)
(if (y-or-n-p "Schedule item?")
(org-agenda-schedule nil nil))
(org-agenda-refile nil nil t))))
(use-feature org-capture
:after (org)
:config
(setq org-capture-templates ; `org-capture'
`(
("i" "Inbox"
entry (file+headline "inbox.org" "Ideas")
"** IDEA %?"
:empty-lines 1
)
("j" "Log Entry"
entry (file+datetree "log.org")
"** %?"
:empty-lines 1)
("n" "Note"
entry (file+headline "inbox.org" "Notes")
"** %?
:PROPERTIES:
:CREATED: %U
:END:"
:empty-lines 1)
("t" "Todo" entry (file+headline "inbox.org" "Tasks")
"** TODO [#B] %?
:PROPERTIES:
:CREATED: %U
:END:
%i\n%a
Notes: "
:empty-lines 1)
)
)
)
(use-feature org-clock
:after (org)
:config
(setopt org-clock-in-resume t
org-clock-in-switch-to-state "PROG"
org-clock-persist t
org-clock-rounding-minutes 5
org-clock-string-limit 20))
(use-feature org-faces
:after (org)
:config
(setopt org-fontify-quote-and-verse-blocks t
org-todo-keyword-faces '(("TODO" . (:inherit dired-mark :inverse-video t))
("PROG" . (:inherit match :inverse-video t))
("NEXT" . (:inherit dired-special :inverse-video t))
("WAIT" . (:inherit shadow :inverse-video t))
("WONT" . (:inherit org-done))
("DONE" . (:inherit org-done))
("IDEA" . (:inherit bold :inverse-video t)))
org-priority-faces '((?A . (:inherit error :weight semibold :inverse-video t))
(?B . (:inherit warning :weight semibold :inverse-video t))
(?C . (:inherit mode-line-inactive :weight semibold :inverse-video t))))
:custom-face
;; Headlines
(org-level-1 ((t (:inherit outline-1 :height 1.5))))
(org-level-2 ((t (:inherit outline-2 :height 1.4))))
(org-level-3 ((t (:inherit outline-3 :height 1.4))))
(org-level-4 ((t (:inherit outline-4 :height 1.2))))
(org-level-5 ((t (:inherit outline-5 :height 1.1))))
;; Ensure monospace Keywords/Tags/Blocks
(org-block ((t (:inherit fixed-pitch)))) ; inherited by `org-code'
(org-block-begin-line ((t (:inherit fixed-pitch))))
(org-block-end-line ((t (:inherit (org-block-begin-line fixed-pitch)))))
(org-checkbox ((t (:inherit (org-todo fixed-pitch)))))
(org-checkbox-statistics-todo ((t (:inherit (org-todo fixed-pitch)))))
(org-date ((t (:inherit fixed-pitch))))
(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
(org-drawer ((t (:inherit fixed-pitch))))
(org-indent ((t (:inherit (org-hide fixed-pitch)))))
(org-link ((t (:foreground "dark cyan" :underline t))))
(org-list-dt ((t (:inherit fixed-pitch))))
(org-meta-line ((t (:inherit (fixed-pitch)))))
(org-property-value ((t (:inherit fixed-pitch))))
(org-special-keyword ((t (:inherit fixed-pitch))))
(org-table ((t (:inherit fixed-pitch))))
(org-tag ((t (:inherit (fixed-pitch) :height 0.8))))
(org-verbatim ((t (:inherit fixed-pitch)))))
(use-feature org-fold
:after (org)
:config (setopt org-fold-catch-invisible-edits 'show-and-error))
(use-feature org-habit
:after (org))
(use-feature org-id
:after (org)
:config
(setopt org-id-link-to-org-use-id t
org-id-locations-file (locate-user-emacs-file "org-id-locations")
org-id-method 'ts
org-id-ts-format "%Y%m%dT%H%M%S.%2N%z"))
(use-feature org-keys
:after (org)
:config
(setopt org-return-follows-link t))
(use-feature org-list
:after (org)
:config (setopt org-list-demote-modify-bullet '(("+" . "-")
("-" . "+")
("*" . "+"))))
(use-feature org-refile
:after (org)
:config
(setopt org-log-refile 'note
org-outline-path-complete-in-steps nil
org-refile-allow-creating-parent-nodes 'confirm
org-refile-targets '((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 2))
org-refile-use-outline-path 'file))
(use-feature org-src
:after (org)
:config
(setopt org-edit-src-content-indentation 0
org-src-preserve-indentation t
org-src-tab-acts-natively t))
;;; 3rd-party Packages:
(use-package citar
:after (oc)
:config
(setopt citar-bibliography org-cite-global-bibliography
citar-library-paths '("~/Nextcloud/Library/"))
;; (when (elpaca-installed-p 'citar-embark)
;; (setopt citar-at-point-function 'embark-act))
:hook (org-mode . citar-capf-setup))
(use-package citar-embark
:after (citar embark)
:config (citar-embark-mode))
(use-package citar-org-roam
:after (citar org-roam)
:config
(setopt citar-org-roam-capture-template-key "r"
citar-org-roam-note-title-template "${title} - ${author}"
citar-org-roam-subdir "references")
(citar-org-roam-mode))
(use-package citeproc
:defer t)
(use-package org-appear
:bind
(:prefix-map as/org-appear
:prefix "C-c C-q")
:config
(setopt org-appear-autoentities t
org-appear-autolinks nil
org-appear-autosubmarkers t
org-appear-trigger 'on-change)
:hook (org-mode . org-appear-mode))
(use-package org-edna
:bind
(:map as/org-prefix-map
("e" . org-edna-edit))
:config (setopt org-edna-finder-use-cache t)
:hook (org-mode . org-edna-mode))
(use-package org-noter
:disabled t
:after (org)
:config
(setopt org-noter-notes-search-path (list (concat org-directory "/roam")))
(org-noter-enable-org-roam-integration))
(use-package org-pomodoro
:after (org-clock)
:bind
(:map as/org-prefix-map
("m" . org-pomodoro))
:commands (org-pomodoro)
:config
(setopt alert-user-configuration ; Send messages to libnotify
'((((:category . "org-pomodoro")) libnotify nil))
org-pomodoro-audio-player (concat (executable-find "pw-cat") " -p")
org-pomodoro-keep-killed-pomodoro-time t
org-pomodoro-length 50
org-pomodoro-long-break-frequency 2
org-pomodoro-manual-break t
org-pomodoro-short-break-length 10))
(use-package org-roam
;; :after (org)
:bind
(:map as/org-roam-prefix-map
("b" . org-roam-buffer-display-dedicated)
("c" . org-roam-capture)
("f" . org-roam-node-find)
("i" . org-roam-node-insert))
:config
(setopt org-roam-database-connector 'sqlite-builtin
org-roam-directory (file-name-as-directory (expand-file-name "roam" org-directory)))
(setq org-roam-db-gc-threshold most-positive-fixnum) ; doesn't like the new `setopt'
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-direction)
(direction . right)
(window-width . 0.33)
(window-height . fit-window-to-buffer)))
(add-to-list 'org-roam-capture-templates
'("r" "reference" plain
"%?"
:target
(file+head "references/${citar-citekey}.org"
"#+title: ${note-title}\n")
:empty-lines 1
:unnarrowed t
))
(add-to-list 'org-roam-capture-templates
`("p" "project" plain (file ,(concat org-roam-directory
"/templates/projects.org"))
:target
(file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+filetags: :projects:")
:empty-lines 1
:unnarrowed t))
(org-roam-db-autosync-mode)
:ensure (org-roam :files (:defaults "extensions/*"))
:init
(bind-keys :prefix-map as/org-roam-prefix-map
:prefix "C-c r"))
(use-package org-super-agenda
:hook (org-agenda-mode . org-super-agenda-mode)
:init
(setq org-agenda-custom-commands
'(("u" "Super agenda"
((agenda "" ((org-agenda-prefix-format " %-12t% s%?-6e")
;;(org-agenda-prefix-format " %?-12t %s")
(org-agenda-remove-tags t)
(org-agenda-skip-function '(org-agenda-skip-entry-if
'todo '("WONT")))
(org-agenda-span 'day)))
(alltodo "" ((org-agenda-overriding-header "\nI'M DOING IT...")
(org-agenda-prefix-format " %-20T")
;; (org-agenda-prefix-format " %?-12t %s")
(org-agenda-remove-tags t)
(org-super-agenda-groups
'(
(:name "Done Today" ; FIXME
:todo "DONE"
:log t
:order 95)
(:name "Overdue"
:deadline past
:scheduled past
:order 1)
(:name "Waiting"
:todo "WAIT"
:order 80)
(:name "Upcoming"
:deadline future
:scheduled future
:order 99)
(:name "High Priority"
:priority "A"
:order 5)
(:name "Now"
:todo ("PROG" "NEXT")
:order 10)
(:name "Personal"
:and (:deadline today :tag "personal")
:and (:scheduled today :tag "personal")
:order 30)
(:name "Household"
:and (:deadline today :tag "household")
:and (:scheduled today :tag "household")
:order 35)
(:name "Today"
:deadline today
:scheduled today
:order 15)
(:name "Project Backlog"
:and (:todo "TODO" :tag "projects")
:order 20)
(:name "Research"
:tag "research"
:order 40)
(:name "Personal Backlog"
:and (:todo "TODO" :tag "personal")
:and (:todo "TODO" :tag "job_search")
:order 45)
(:name "Household Backlog"
:and (:todo "TODO" :priority<= "B" :tag "household")
:order 50)
(:name "Inbox"
:tag "inbox"
:order 90)
)))))
))))
(use-package org-superstar
:config
(if org-odd-levels-only
(setopt org-superstar-headline-bullets-list '(?◉ ?- ?🞛 ?- ?○ ?- ?▷ ?- ?✸ ?- ?✿ ?-))
(setopt org-superstar-headline-bullets-list '(?◉ ?🞛 ?○ ?▷ ?✸ ?✿)))
(setopt org-indent-mode-turns-on-hiding-stars nil ; needed for `org-superstar-leading-bullet'
org-superstar-leading-bullet ?\s
org-superstar-hide-leading-stars t
org-superstar-special-todo-items t
org-superstar-todo-bullet-alist '(("TODO" . ?☐)
("NEXT" . ?☐)
("PROG" . ?☐)
("WAIT" . ?☐)
("DONE" . ?☑)
("WONT" . ?☑)))
:hook (org-mode . org-superstar-mode))
(use-package org-timeblock
:bind
(:map as/org-prefix-map
("b" . org-timeblock))
:config
(setopt org-timeblock-new-task-time 'pick
org-timeblock-show-future-repeats 'next
org-timeblock-scale-options (cons 7 20)
org-timeblock-span 3))
(provide 'init-org)
;;; org-mode.el ends here