home/dot_doom.d/config.el
2020-05-28 01:20:17 +02:00

122 lines
4.9 KiB
EmacsLisp

;;; ~/.doom.d/config.el -*- lexical-binding: t; -*-
(setq doom-theme 'gruvbox-dark-soft)
;; Set to 2 spaces
(setq default-tab-width 2)
(setq tab-width 2)
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
(setq js2-mode-hook
'(lambda () (progn
(set-variable 'js2-basic-offset 2))))
(setq css-mode-hook
'(lambda () (progn
(set-variable 'css-indent-offset 2))))
(setq typescript-mode-hook
'(lambda () (progn
(set-variable 'typescript-indent-level 2))))
;; Maximize the window upon startup
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(setq doom-font (font-spec :family "Cozette" :size 11))
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))
;; Make Monky communicate via cmdserver
(setq monky-process-type 'cmdserver)
;; Map SPC-g-h to monky-status
(map! :map magit-mode-map :leader "g h" 'monky-status)
;; Enable Mercurial support for git-gutter
(setq git-gutter:handled-backends '(git hg))
;; Org configuration
(after! org
(setq-default org-directory "~/code/personal/org")
(setq-default org-default-notes-file "~/code/personal/org/capture.org")
(setq-default org-todo-keywords
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
(setq-default org-todo-keyword-faces
(quote (("TODO" :foreground "red" :weight bold)
("NEXT" :foreground "blue" :weight bold)
("DONE" :foreground "forest green" :weight bold)
("WAITING" :foreground "orange" :weight bold)
("HOLD" :foreground "magenta" :weight bold)
("CANCELLED" :foreground "forest green" :weight bold)
("MEETING" :foreground "forest green" :weight bold)
("PHONE" :foreground "forest green" :weight bold))))
(setq org-capture-templates
(quote (("t" "todo" entry (file "~/code/personal/org/capture.org")
"* TODO %?\n&U\n%a\n" :clock-in t :clock-resume t)
("r" "respond" entry (file "~/code/personal/org/capture.org")
"* STRT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
("n" "note" entry (file "~/code/personal/org/capture.org")
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
("w" "org-protocol" entry (file "~/code/personal/org/capture.org")
"* TODO Review %c\n%U\n" :immediate-finish t)
("m" "meeting" entry (file "~/code/personal/org/capture.org")
"* PROJ Meeting with %? :MEETING:\n%U" :clock-in t :clock-resume t))))
(setq org-refile-targets (quote ((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9))))
(add-to-list
'ivy-completing-read-handlers-alist
'(org-capture-refile . completing-read-default))
(org-clock-persistence-insinuate)
(setq org-clock-in-switch-to-state 'cf/clock-in-to-next)
(setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
(setq org-clock-into-drawer t)
(setq org-clock-out-remove-zero-time-clocks t)
(setq org-clock-out-when-done t)
(setq org-clock-persist t)
(setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
(setq org-clock-report-include-clocking-task t))
(defun cf/clock-in-to-next (kw)
(when (not (and (boundp 'org-capture-mode) org-capture-mode))
(cond
((and (member (org-get-todo-state) (list "TODO"))
(cf/is-task-p))
"NEXT")
((and (member (org-get-todo-state) (list "NEXT"))
(cf/is-project-p))
"TODO"))))
(defun cf/is-project-p ()
(save-restriction
(widen)
(let ((has-subtask)
(subtree-end (save-excursion (org-end-of-subtree t)))
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
(save-excursion
(forward-line 1)
(while (and (not has-subtask)
(< (point) subtree-end)
(re-search-forward "^\*+ " subtree-end t))
(when (member (org-get-todo-state) org-todo-keywords-1)
(setq has-subtask t))))
(and is-a-task has-subtask))))
(defun bh/is-task-p ()
(save-restriction
(widen)
(let ((has-subtask)
(subtree-end (save-excursion (org-end-of-subtree t)))
(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
(save-excursion
(forward-line 1)
(while (and (not has-subtask)
(< (point) subtree-end)
(re-search-forward "^\*+ " subtree-end t))
(when (member (org-get-todo-state) org-todo-keywords-1)
(setq has-subtask t))))
(and is-a-task (not has-subtask)))))
;; Enable editorconfig
(editorconfig-mode 1)