home/dot_doom.d/config.el
2021-10-14 10:57:08 +02:00

167 lines
6.1 KiB
EmacsLisp

;;; ~/.doom.d/config.el -*- lexical-binding: t; -*-
(load-theme 'doom-fairy-floss t)
;; 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 "Fantasque Sans Mono" :size 17))
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))
;; Configure some lsp-mode stuff
(after! lsp-mode
(setq lsp-headerline-breadcrumb-enable t)
(setq lsp-ui-sideline-show-code-actions nil))
;; 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))
;; Load auth keys from .authinfo
(setq auth-sources '("~/.authinfo"))
;; Enable editorconfig
(editorconfig-mode 1)
;; mu4e config
(set-email-account! "posteo"
'((mu4e-sent-folder . "/Sent")
(mu4e-drafts-folder . "/Drafts")
(mu4e-trash-folder . "/Trash")
(mu4e-refile-folder . "/INBOX")
(smtpmail-smtp-user . "mokou@posteo.net")
(user-mail-address . "mokou@posteo.de"))
t)
(map! :map global-map :leader "M" 'mu4e)
;; use https://github.com/grobian/html2text
(setq mu4e-html2text-command "html2text")
(setq rustic-lsp-server 'rls)
;; Org configuration
(after! org
(add-to-list 'org-modules 'org-habit)
(setq-default org-directory "~/code/personal/org")
(setq-default org-default-notes-file "~/code/personal/org/inbox.org")
(setq-default org-todo-keywords
(quote ((sequence "TODO(t)" "DONE(d)" "WAITING(w@/!)"))))
(setq-default org-todo-keyword-faces
(quote (("TODO" :foreground "tomato" :weight bold)
("DONE" :foreground "forest green" :weight bold)
("WAITING" :foreground "chocolate" :weight bold))))
(setq org-capture-templates
(quote (("t" "todo" entry (file "~/code/personal/org/inbox.org")
"* TODO %?\n%U\n" :clock-in t :clock-resume t)
("n" "note" entry (file "~/code/personal/org/inbox.org")
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t))))
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
(org-clock-persistence-insinuate)
(setq org-clock-in-switch-to-state 'cf/clock-in-to-next)
(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)
(setq org-agenda-dim-blocked-tasks nil)
(setq org-agenda-compact-blocks t)
(setq org-archive-location "~/code/personal/org/_archive.org::")
(setq org-agenda-custom-commands
(quote ((" " "Agenda"
((agenda "" nil)
(tags "REFILE"
((org-agenda-overriding-header "Tasks to Refile")
(org-tags-match-list-sublevels nil)))
(tags-todo "-CANCELLED+WAITING|HOLD/!"
((org-agenda-overriding-header (concat "Waiting Tasks"))
(org-agenda-skip-function 'cf/skip-non-tasks)
(org-tags-match-list-sublevels nil)
(org-agenda-todo-ignore-scheduled cf/hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-deadlines cf/hide-scheduled-and-waiting-next-tasks))))
nil)))))
(map! :map global-map :leader "a" 'org-agenda)
(map! :map org-mode-map :leader "m c p" 'org-pomodoro)
(defvar cf/hide-scheduled-and-waiting-next-tasks 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 "WAITING"))
(cf/is-task-p))
"TODO"))))
(defun cf/find-project-task ()
(save-restriction
(widen)
(let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point))))
(while (org-up-heading-safe)
(when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
(setq parent-task (point))))
(goto-char parent-task)
parent-task)))
(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 cf/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)))))
(defun cf/skip-non-tasks ()
(save-restriction
(widen)
(let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
(cond
((cf/is-task-p)
nil)
(t
next-headline)))))