;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- ;; Determine if we're in comacs as early as possible ;; even if 'server-name is not set yet (defun bascht/is-comacs() (string= (getenv "EMACS_SERVER_NAME") "comacs")) (setq user-full-name "{{ .me.name }}" user-mail-address "{{ .me.email }}" doom-font (font-spec :family "JetBrains Mono" :size 14) doom-variable-pitch-font (font-spec :family "Iosevka Term" :size 14) doom-theme (if (bascht/is-comacs) 'doom-one-light 'modus-operandi) org-directory "~/Documents/Zettelkasten/" bascht/wzzk "~/WirZwei/Zettelkasten" bascht/wzzk-journals "~/WirZwei/Zettelkasten/journals" display-line-numbers-type nil delete-selection-mode nil writeroom-width 100 ispell-dictionary "en_GB" ispell-aspell-data-dir "/home/bascht/.nix-profile/lib/aspell" ispell-aspell-dict-dir ispell-aspell-data-dir ruby-insert-encoding-magic-comment nil git-gutter-fr+-side (quote left-fringe) helm-org-rifle-show-path t doom-dashboard-ascii-banner-fn #'bascht/doom-dashboard-calvin hl-todo-keyword-faces `(("TODO" warning bold) ("FIXME" error bold) ("HACK" font-lock-constant-face bold) ("REVIEW" font-lock-keyword-face bold) ("NOTE" success bold) ("DEPRECATED" font-lock-doc-face bold) ("REFACTOR" font-lock-comment-face) ("STYLE" ,(doom-color 'yellow)) ("BUG" error bold) ("MAYBE" warning bold)) ) (defun doom-dashboard-draw-ascii-banner-fn () (let* ((banner '( " _ww _a+”D" " y#, _r^ # _*^ y`" " q0 0 a” W*` F ____" " ; #^ Mw` __`. . 4-~~^^`" " _ _P ` /'^ `www=." " , $ +F ` q" " K ] ^K`" " , #_ . ___ r ]," " _*.^ '.__dP^^~#, ,_ *," " ^b / _ `` _F ] ]_" " '___ ' ~~^ ] [" " :` ]b_ ~k_ ,` yl" " #P `*a__ __a~ z~`" " #L _ ^------~^` ,/" " ~-vww*”v_ _/`" " ^”q_ _x”" " __#my..___p/`mma____" " _awP”,`,^”-_”^`._ L L #" " _#0w_^_^,^r___...._ t [],”w" " e^ ]b_x^_~^` __, .]Wy7` x`" " '=w__^9*$P-*MF` ^[_.=" " ^”y qw/”^_____^~9 t" " ]_l ,'^_`..=== x'" " ”>.ak__awwwwWW###r" " ##WWWWWWWWWWWWWW__" " _WWWWWWMM#WWWW_JP^”~-=w_" " .____awwmp_wNw#[w/` ^#, ~b___." " ` ^^^~^”W___ ]Raaaamw~`^``^^~" " ^~”~---~~~~~~`" )) (longest-line (apply #'max (mapcar #'length banner)))) (put-text-property (point) (dolist (line banner (point)) (insert (+doom-dashboard--center +doom-dashboard--width (concat line (make-string (max 0 (- longest-line (length line))) 32))) "\n")) 'face 'doom-dashboard-banner))) (map! :leader (:prefix-map ("l" . "bascht/personal") :desc "Start my daily review" "d" #'bascht/daily-review :desc "Run table formatter" "tf" #'org-table-calc-current-TBLFM (:prefix-map ("c" . "clocks") :desc "Clock in alfatraining" "a" #'bascht/alfatraining-clock-in)) (:prefix-map ("nw" . "WirZwei") :desc "Open todays wzzk" "t" #'bascht/wzzk-find-today :desc "Open yesterdays wzzk" "y" #'bascht/wzzk-find-yesterday :desc "Find file in wzzk" "f" #'bascht/wzzk-find) :desc "Archive subtree" "msa" #'org-archive-subtree :desc "Open yesterdays journal" "njy" #'bascht/goto-yesterdays-journal :desc "Find in Alfaview" "nga" (lambda () (interactive) (bascht/org-file-show-headings "~/Documents/Zettelkasten/CustomerAlfaview.org")) :desc "Find in Knowledgebase" "ngk" (lambda () (interactive) (bascht/org-file-show-headings "~/Documents/Zettelkasten/KnowledgeBase.org")) :desc "Treemacs alternative" "ot" #'+treemacs/toggle :desc "Vterm alternative" "op" #'+vterm/toggle) (map! :after org :map org-mode-map :localleader (:prefix-map ("i" . "Insert") :desc "Link/Image" "l" 'org-insert-link :desc "Item" "o" 'org-toggle-item :desc "Citation" "c" 'org-ref-helm-insert-cite-link :desc "Footnote" "f" 'org-footnote-action :desc "Table" "t" 'org-table-create-or-convert-from-region :desc "Clipboard" "c" 'org-download-clipboard :desc "Structure template" "s" #'org-insert-structure-template :desc "Heading (respecting)" "h" #'org-insert-heading-respect-content :desc "TODO heading" "t" #'org-insert-heading-respect-content)) (map! :after markdown-mode :map evil-markdown-mode-map :n [return] #'bascht/markdown-do) (map! :after mu4e :map mu4e-view-mode-map :vn "T" (lambda () (interactive) (mu4e-view-mark-thread '(refile)))) (map! :after mu4e :map mu4e-headers-mode-map :vn "T" (lambda () (interactive) (mu4e-headers-mark-thread nil '(refile)))) ; Define quick helper switches to switch between languages while ; keeping distinct personal dictionaries for both of them (defun bascht/switch-spellcheck (lang) (interactive) (message lang) (setq ispell-personal-dictionary (concat "~/.local/share/ispell/bascht_" lang ".pws")) (ispell-change-dictionary lang) lang) (defun bascht/switch-spellcheck-to-english () (interactive) (bascht/switch-spellcheck "en_GB") (spell-fu-mode)) (defun bascht/switch-spellcheck-to-german () (interactive) (bascht/switch-spellcheck "de_DE") (spell-fu-mode)) (after! modus-themes (setq modus-themes-syntax '(faint green-strings yellow-comments yellow-alt-syntax) modus-themes-bold-constructs t modus-themes-italic-constructs t modus-themes-fringes 'subtle modus-themes-hl-line '(accented intense) modus-themes-paren-match '(bold intense) modus-themes-prompts '(bold intense) modus-themes-region '(bg-only) modus-themes-org-blocks 'tinted-background modus-themes-mode-line '(accented borderless (padding . 1)) modus-themes-headings '((1 . (rainbow overline background 1.4)) (2 . (rainbow background 1.3)) (3 . (rainbow bold 1.2)) (t . (semilight 1.1))))) ; Don't add #0 #1 #2 #3… workspaces :D (after! persp-mode (setq persp-emacsclient-init-frame-behaviour-override "main")) ; Directly create a matching workspace for the project (when launched with `bin/tn') (defun bascht/switch-to-or-load-workspace (name directory) (interactive) (message "Started workspace switcher") (persp-mode) (if (+workspace-exists-p name) (+workspace-switch name) (progn (+workspace-new name) (+workspace-switch name) (find-file directory) (magit-status-setup-buffer)))) (defun bascht/mu4e-change-from-to-catchall (msg) "Set the From address based on the To address of the original message." (when msg (setq user-mail-address (cond ((mu4e-message-contact-field-matches msg :to "bascht.com") (cdr-safe (car-safe (mu4e-message-field msg :to)))) (t user-mail-address))))) ; Disable spell-fu-mode globally (remove-hook 'text-mode-hook #'spell-fu-mode) (add-to-list 'auto-mode-alist '("\\.txt$" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.journal\\'" . ledger-mode)) (add-hook 'yaml-mode-hook (lambda () (auto-fill-mode -1) (flycheck-select-checker 'yaml-yamllint) )) (add-hook 'git-commit-mode-hook (lambda () (end-of-line) (bascht/switch-spellcheck "en_GB") (evil-insert-state))) (add-hook 'org-capture-mode-hook (lambda () (bascht/switch-spellcheck "de_DE") (evil-insert-state))) (add-hook 'mu4e-compose-pre-hook (lambda () (bascht/mu4e-change-from-to-catchall mu4e-compose-parent-message) (bascht/switch-spellcheck "de_DE") (evil-insert-state))) (defun bascht/markdown-do () "Keep markdown-do from straight away going into gfm-mode and adding checkboxes" (interactive) (cond ((thing-at-point-looking-at markdown-regex-wiki-link) (markdown-follow-wiki-link-at-point)) (t (markdown-do)))) (after! markdown-mode (setq markdown-enable-wiki-links t markdown-wiki-link-search-type '(sub-directories parent-directories) markdown-wiki-link-fontify-missing t markdown-link-space-sub-char " ")) (after! forge (add-to-list 'forge-alist {{- range .magit.forges }} '("{{ .host }}" "{{ .api }}" "{{ .host }}" {{ .type }}) {{- end }})) (after! magit (magit-wip-mode) (magit-todos-mode) (setq magit-log-arguments '("--graph" "--decorate" "--color") magit-delete-by-moving-to-trash nil git-commit-summary-max-length 80)) (defun bascht/file-string (file) "Read the contents of a file and return as a string." (with-current-buffer (find-file-noselect file) (buffer-string))) (setq org-link-abbrev-alist '({{- range .bookmarks -}} ("{{ .name }}" . "{{ .url }}") {{ end -}} )) (custom-set-faces '(mu4e-header-highlight-face ((t (:background "lemon chiffon"))))) (after! dap-mode (unless (display-graphic-p) (set-face-background 'dap-ui-marker-face "orange") (set-face-attribute 'dap-ui-marker-face nil :inherit nil) (set-face-background 'dap-ui-pending-breakpoint-face "lightpink") (set-face-attribute 'dap-ui-verified-breakpoint-face nil :inherit 'dap-ui-pending-breakpoint-face))) (load! "mail.el") (if (not (bascht/is-comacs)) (load! "org.el")) (load! "forge.el")