2021-04-11 23:53:27 +02:00
|
|
|
;;; -*- lexical-binding: t; -*-
|
2020-03-26 20:03:25 +01:00
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun +aspen/org-setup ()
|
2022-07-11 16:30:17 +02:00
|
|
|
(setq-local truncate-lines -1)
|
|
|
|
(display-line-numbers-mode -1)
|
|
|
|
(line-number-mode -1))
|
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(add-hook 'org-mode-hook #'+aspen/org-setup)
|
2022-07-11 16:30:17 +02:00
|
|
|
|
2020-03-26 20:03:25 +01:00
|
|
|
(defun notes-file (f)
|
|
|
|
(concat org-directory (if (string-prefix-p "/" f) "" "/") f))
|
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun aspen/org-project-tag->key (tag)
|
2020-09-02 00:36:16 +02:00
|
|
|
(s-replace-regexp "^project__" "" tag))
|
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun aspen/org-project-tag->name (tag)
|
2020-09-02 00:36:16 +02:00
|
|
|
(s-titleized-words
|
2024-02-12 04:00:40 +01:00
|
|
|
(s-join " " (s-split "_" (aspen/org-project-tag->key tag)))))
|
2020-09-02 00:36:16 +02:00
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun aspen/org-project-tag->keys (tag)
|
2020-09-02 00:36:16 +02:00
|
|
|
(s-join "" (cons "p"
|
|
|
|
(-map (lambda (s) (substring-no-properties s 0 1))
|
2024-02-12 04:00:40 +01:00
|
|
|
(s-split "_" (aspen/org-project-tag->key tag))))))
|
2020-09-02 00:36:16 +02:00
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun aspen/org-projects->agenda-commands (project-tags)
|
2020-09-02 00:36:16 +02:00
|
|
|
(loop for tag in project-tags
|
2024-02-12 04:00:40 +01:00
|
|
|
collect `(,(aspen/org-project-tag->keys tag)
|
|
|
|
,(aspen/org-project-tag->name tag)
|
2020-09-02 00:36:16 +02:00
|
|
|
tags-todo
|
|
|
|
,tag)))
|
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun aspen/org-projects ()
|
2020-09-02 00:36:16 +02:00
|
|
|
(loop for (tag) in
|
|
|
|
(org-global-tags-completion-table
|
|
|
|
(directory-files-recursively "~/notes" "\\.org$"))
|
|
|
|
when (s-starts-with-p "project__" tag)
|
|
|
|
collect tag))
|
|
|
|
|
|
|
|
(comment
|
2024-02-12 04:00:40 +01:00
|
|
|
(aspen/org-projects->agenda-commands (aspen/org-projects))
|
2020-09-02 00:36:16 +02:00
|
|
|
)
|
|
|
|
|
2020-03-26 20:03:25 +01:00
|
|
|
(setq
|
|
|
|
org-directory (expand-file-name "~/notes")
|
|
|
|
+org-dir (expand-file-name "~/notes")
|
|
|
|
org-default-notes-file (concat org-directory "/inbox.org")
|
|
|
|
+org-default-todo-file (concat org-directory "/inbox.org")
|
2020-07-07 00:53:46 +02:00
|
|
|
org-agenda-files (directory-files-recursively
|
|
|
|
"~/notes" "\\.org$")
|
2020-03-26 20:03:25 +01:00
|
|
|
org-refile-targets '((org-agenda-files :maxlevel . 3))
|
|
|
|
org-outline-path-complete-in-steps nil
|
|
|
|
org-refile-use-outline-path t
|
|
|
|
org-file-apps `((auto-mode . emacs)
|
|
|
|
(,(rx (or (and "." (optional "x") (optional "htm") (optional "l") buffer-end)
|
|
|
|
(and buffer-start "http" (optional "s") "://")))
|
|
|
|
. "firefox %s")
|
|
|
|
(,(rx ".pdf" buffer-end) . "apvlv %s")
|
|
|
|
(,(rx "." (or "png"
|
|
|
|
"jpg"
|
|
|
|
"jpeg"
|
|
|
|
"gif"
|
|
|
|
"tif"
|
|
|
|
"tiff")
|
|
|
|
buffer-end)
|
|
|
|
. "feh %s"))
|
|
|
|
org-log-done 'time
|
|
|
|
org-archive-location "~/notes/trash::* From %s"
|
|
|
|
org-cycle-separator-lines 2
|
|
|
|
org-hidden-keywords '(title)
|
|
|
|
org-tags-column -130
|
2021-07-30 17:24:50 +02:00
|
|
|
org-ellipsis "…"
|
2020-03-26 20:03:25 +01:00
|
|
|
org-imenu-depth 9
|
|
|
|
org-capture-templates
|
|
|
|
`(("t" "Todo" entry
|
|
|
|
(file +org-default-todo-file)
|
|
|
|
"* TODO %?\n%i"
|
|
|
|
:kill-buffer t)
|
|
|
|
|
2020-07-17 00:39:27 +02:00
|
|
|
("m" "Email" entry
|
|
|
|
(file +org-default-todo-file)
|
2021-11-08 17:57:37 +01:00
|
|
|
"* TODO [[%L][%:subject]] :email:\n%i")
|
2020-07-17 00:39:27 +02:00
|
|
|
|
2020-03-26 20:03:25 +01:00
|
|
|
("n" "Notes" entry
|
|
|
|
(file +org-default-todo-file)
|
|
|
|
"* %U %?\n%i"
|
|
|
|
:prepend t
|
|
|
|
:kill-buffer t)
|
|
|
|
|
|
|
|
("c" "Task note" entry
|
|
|
|
(clock)
|
2020-08-14 00:35:56 +02:00
|
|
|
"* %U %?\n%i[%l[Context]]\n"
|
2020-03-26 20:03:25 +01:00
|
|
|
:kill-buffer t
|
|
|
|
:unnarrowed t)
|
|
|
|
|
|
|
|
("p" "Projects")
|
|
|
|
("px" "Xanthous" entry
|
|
|
|
(file+headline ,(notes-file "xanthous.org") "Backlog")
|
|
|
|
"* TODO %?\nContext %a\nIn task: %K")
|
2020-07-23 18:38:44 +02:00
|
|
|
("pt" "Tvix" entry
|
|
|
|
(file+headline ,(notes-file "tvix.org") "Tvix TODO")
|
|
|
|
"* TODO %?\nContext %a\nIn task: %K")
|
2020-08-20 18:31:51 +02:00
|
|
|
("pw" "Windtunnel" entry
|
2024-01-18 16:28:42 +01:00
|
|
|
(file+headline ,(notes-file "windtunnel.org") "Inbox")
|
2020-09-14 17:37:21 +02:00
|
|
|
"* TODO %i%?\nContext: %a\nIn task: %K")
|
2020-03-26 20:03:25 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
org-capture-templates-contexts
|
2024-02-12 04:00:40 +01:00
|
|
|
`(("px" ((in-file . "/home/aspen/code/depot/users/aspen/xanthous/.*")))
|
2023-11-06 16:59:48 +01:00
|
|
|
("e" ((in-mode . "notmuch-show-mode"))))
|
2020-03-26 20:03:25 +01:00
|
|
|
|
|
|
|
org-deadline-warning-days 1
|
|
|
|
org-agenda-skip-scheduled-if-deadline-is-shown 'todo
|
|
|
|
org-todo-keywords '((sequence "TODO(t)" "ACTIVE(a)" "|" "DONE(d)" "RUNNING(r)")
|
|
|
|
(sequence "NEXT(n)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)"))
|
|
|
|
org-agenda-custom-commands
|
2023-07-05 21:37:38 +02:00
|
|
|
`(("i" "Inbox" tags "inbox")
|
2020-03-26 20:03:25 +01:00
|
|
|
("r" "Running jobs" todo "RUNNING")
|
|
|
|
("w" "@Work" tags-todo "@work")
|
|
|
|
("n" . "Next...")
|
2023-07-05 21:37:38 +02:00
|
|
|
("nw" "Next @Work" tags-todo "@work&next")
|
|
|
|
("nt" "Next tooling" tags-todo "tooling")
|
2020-09-02 00:36:16 +02:00
|
|
|
|
|
|
|
("p" . "Project...")
|
2024-02-12 04:00:40 +01:00
|
|
|
,@(aspen/org-projects->agenda-commands (aspen/org-projects)))
|
2020-05-18 17:32:07 +02:00
|
|
|
|
2020-06-03 22:29:50 +02:00
|
|
|
org-agenda-dim-blocked-tasks nil
|
|
|
|
org-enforce-todo-dependencies nil
|
|
|
|
|
2020-05-18 17:32:07 +02:00
|
|
|
org-babel-clojure-backend 'cider)
|
2020-06-23 16:25:02 +02:00
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun +aspen/insert-work-template ()
|
2020-06-23 16:25:02 +02:00
|
|
|
(interactive)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line)
|
|
|
|
(insert "#+TODO: TODO(t) NEXT(n) ACTIVE(a) | DONE(d) PR(p) RUNNING(r) TESTING(D)
|
|
|
|
#+TODO: BLOCKED(b) BACKLOG(l) PROPOSED(o) | CANCELLED(c)
|
|
|
|
#+FILETAGS: @work
|
|
|
|
#+FILETAGS: @work
|
|
|
|
#+PROPERTY: Effort_ALL 0 4:00 8:00 12:00 20:00 32:00
|
|
|
|
#+PROPERTY: ESTIMATE_ALL 0 1 2 3 5 8
|
|
|
|
#+PROPERTY: STORY-TYPE_ALL Feature Bug Chore
|
|
|
|
#+PROPERTY: NOBLOCKING t
|
|
|
|
#+COLUMNS: %TODO %40ITEM(Task) %17EFFORT(Estimated){:} %CLOCKSUM(Time Spent) %17STORY-TYPE(Type) %TAGS"))
|
|
|
|
|
2024-02-12 04:00:40 +01:00
|
|
|
(defun +aspen/insert-org-template ()
|
2020-06-23 16:25:02 +02:00
|
|
|
(interactive)
|
|
|
|
(pcase (buffer-file-name)
|
2024-02-12 04:00:40 +01:00
|
|
|
((s-contains "/work/") (+aspen/insert-work-template))))
|
2020-06-23 16:25:02 +02:00
|
|
|
|
|
|
|
;;; TODO: this doesn't work?
|
2024-02-12 04:00:40 +01:00
|
|
|
(define-auto-insert "\\.org?$" #'aspen/insert-org-template t)
|
2020-09-14 19:10:41 +02:00
|
|
|
|
|
|
|
(defun forge--post-submit-around---link-pr-to-org-item
|
|
|
|
(orig)
|
|
|
|
(let ((cb (funcall orig)))
|
|
|
|
(lambda (value headers status req)
|
|
|
|
(prog1 (funcall cb value headers status req)
|
2024-02-12 04:00:40 +01:00
|
|
|
(aspen/at-org-clocked-in-item
|
2020-09-18 15:40:10 +02:00
|
|
|
(let ((url (alist-get 'html_url value))
|
2020-09-14 19:10:41 +02:00
|
|
|
(number (alist-get 'number value)))
|
|
|
|
(org-set-property
|
|
|
|
"pull-request"
|
2020-10-26 18:31:15 +01:00
|
|
|
(org-make-link-string
|
|
|
|
url
|
|
|
|
(format "%s/%s/%d"
|
|
|
|
(->> value
|
|
|
|
(alist-get 'base)
|
|
|
|
(alist-get 'repo)
|
|
|
|
(alist-get 'name))
|
|
|
|
(->> value
|
|
|
|
(alist-get 'base)
|
|
|
|
(alist-get 'repo)
|
|
|
|
(alist-get 'owner)
|
|
|
|
(alist-get 'login))
|
|
|
|
number)))))))))
|
2020-09-14 19:10:41 +02:00
|
|
|
|
|
|
|
(advice-add
|
|
|
|
#'forge--post-submit-callback
|
|
|
|
:around #'forge--post-submit-around---link-pr-to-org-item)
|
2021-06-05 17:02:23 +02:00
|
|
|
|
|
|
|
(set-face-foreground 'org-block +solarized-s-base00)
|
|
|
|
(setq whitespace-global-modes '(not org-mode magit-mode vterm-mode))
|
|
|
|
(setf (alist-get 'file org-link-frame-setup) 'find-file-other-window)
|
|
|
|
(set-face-foreground 'org-block +solarized-s-base00)
|
|
|
|
|
|
|
|
;; (add-hook! org-mode
|
|
|
|
;; (set-company-backend! 'org-mode
|
|
|
|
;; '(:separate company-ob-postgresql
|
|
|
|
;; company-dabbrev
|
|
|
|
;; company-yasnippet
|
|
|
|
;; company-ispell)))
|