;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- ;; Place your private configuration here! Remember, you do not need to run 'doom ;; sync' after modifying this file! ;; Some functionality uses this to identify you, e.g. GPG configuration, email ;; clients, file temp+bindingslates and snippets. It is optional. (setq user-full-name "Matt Nish-Lapidus" user-mail-address "matt@emenel.ca") ;; See 'C-h v doom-font' for documentation and more examples of what they ;; accept. For example: (setq doom-font (font-spec :family "JetBrains Mono" :size 14)) (setq fancy-splash-image (concat doom-user-dir "splash.png")) (setq doom-theme 'doom-monokai-pro) ;; This determines the style of line numbers in effect. If set to `nil', line ;; numbers are disabled. For relative line numbers, set this to `relative'. (setq display-line-numbers-type 'relative) (setq scroll-preserve-screen-position t) (setq global-hl-line-modes nil) (setq locale-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (prefer-coding-system 'utf-8) (setq org-directory "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Primary") (setq treesit-extra-load-path '("~/Source/_src/tree-sitter-module/dist/")) ;; Modeline ;; - add current workspace name ;; - add major mode icon (after! doom-modeline (setq doom-modeline-persp-name t doom-modeline-major-mode-icon t) (setq doom-modeline-total-line-number t)) (defun +default/insert-snippet () (interactive) (cond ((modulep! :completion vertico) (call-interactively #'consult-yasnippet)) (t (call-interactively #'yas-insert-snippet)))) ;; set default frame size on launch (setq default-frame-alist '( (left . 0) (top . 0) (height . 48) (width . 160))) (defun mnl/frame-center () "Center the current frame." (interactive) (let* ((dw (display-pixel-width)) (dh (display-pixel-height)) (f (selected-frame)) (fw (frame-pixel-width f)) (fh (frame-pixel-height f)) (x (- (/ dw 2) (/ fw 2))) (y (- (/ dh 2) (/ fh 2)))) (message (format "dw %d dh %d fw %d fh %d x %d y %d" dw dh fw fh x y)) (set-frame-position f x y))) ;; some global settings (setq tab-always-indent t) ; don't autocomplete with tab (+global-word-wrap-mode +1) ; default to soft word wrap (delete-selection-mode 1) ; delete stuff! (setq delete-active-region t) ; delete selected stuff! (setq shell-file-name (executable-find "bash")) (after! vterm (setq-default vterm-shell (executable-find "fish")) (setq-default explicit-shell-file-name (executable-find "fish")) (setq vterm-kill-buffer-on-exit t) (after! meow (meow-vterm-enable))) ;; remove org agenda from the splash screen (assoc-delete-all "Open org-agenda" +doom-dashboard-menu-sections) ;; reduce which-key waiting (after! which-key (setq which-key-idle-delay 0.3)) ;; some defaults for cursor size, scrolling, and buffer handling (setq x-stretch-cursor t kill-buffer-delete-auto-save-files t scroll-conservatively 0) ;; nicer resizing (cond ((string-equal system-type "darwin") (setq frame-resize-pixelwise t window-resize-pixelwise t))) ;; tabs! i like them ;; (setq-default indent-tabs-mode t) (setq-default tab-width 2) ;; import all my customized keybindings based on doom evil mode, but without evil. (load! "bindings.el") (after! treemacs (setq treemacs-follow-mode t) (setq treemacs-project-follow-mode t)) (after! anzu (global-anzu-mode)) (global-so-long-mode 1) (after! parinfer-rust-mode (setq parinfer-rust-auto-download t) (setq parinfer-rust-preferred-mode "smart")) (setq dap-ui-variable-length 200) ;; smart tabs set modes (after! smart-tabs-mode (smart-tabs-insinuate 'c 'javascript 'python)) ;; Add consult-line searches to isearch history (both regular and regex) -- can now use meow 'n' to continue search as well as isearch (advice-add #'consult-line :after (lambda (&rest _) (when consult--line-history (add-to-history 'regexp-search-ring (car consult--line-history) regexp-search-ring-max) (add-to-history 'search-ring (car consult--line-history) search-ring-max)))) ;; bibliography file location (after! citar (setq! citar-bibliography '("/Users/emenel/Zotero/lib.bib")) (setq! citar-notes-paths '("/Users/emenel/Library/Mobile Documents/iCloud~md~obsidian/Documents/Primary/Sources")) (setq! citar-file-note-extensions '("md"))) ;; svelte support (add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode)) (setq web-mode-engines-alist '(("svelte" . "\\.svelte\\'"))) ;; web-mode settings (add-hook! web-mode (web-mode-toggle-current-element-highlight)) (after! web-mode (setq web-mode-markup-indent-offset 2) (setq web-mode-css-indent-offset 2) (setq web-mode-code-indent-offset 2)) (after! markdown-mode (setq markdown-list-indent-width 2) (setq markdown-enable-wiki-links t)) ;; fix centaur tabs to show at the right times and add my muscle memory keybind (after! centaur-tabs (setq centaur-tabs-set-bar 'right) (setq centaur-tabs-cycle-scope 'tabs) (map! :map centaur-tabs-mode-map "s-M-" 'centaur-tabs-forward "s-M-" 'centaur-tabs-backward)) ;; use kitty for terminal-here (setq terminal-here-mac-terminal-command '("kitty" "@" "launch" "--type=tab")) ;; set project paths and ignore buffers (setq projectile-project-search-path '(("~/Source" . 2))) (setq projectile-globally-ignored-buffers '("*scratch*" "*lsp-log*")) ;; ignoring buffers by their major mode (setq projectile-globally-ignored-modes '("erc-mode" "help-mode" "completion-list-mode" "Buffer-menu-mode" "gnus-.*-mode" "occur-mode")) ;; mouse support for vertico buffers (after! vertico (vertico-mouse-mode)) ;; sly (after! sly (setq sly-lisp-implementations '((sbcl ("sbcl" "--dynamic-space-size" "12000")) (ciel ("sbcl" "--core" "/Users/emenel/quicklisp/local-projects/CIEL/ciel-core" "--eval" "(in-package :ciel-user)" "--dynamic-space-size" "2600")))) (setq sly-default-lisp 'sbcl) (setq sly-complete-symbol-function 'sly-flex-completions)) ;; make esc close completion from corfu (map! :map corfu-map [escape] 'corfu-quit) ;; cl-collider cl-patterns emacs helpers TODO: test this (after! lisp-mode (defun cl-patterns-helpers-load () (interactive) (sly-eval-async '(cl:namestring (asdf:system-source-directory (asdf:find-system 'cl-patterns))) (lambda (path) (load (concat path "res/emacs/cl-patterns-helpers") nil nil nil t) (load (concat path "res/emacs/cl-patterns-skeletons") nil nil nil t))) (define-key sly-mode-map (kbd "C-c p") 'cl-patterns-play-or-end-context-or-select-pdef) (define-key sly-mode-map (kbd "C-c P") 'cl-patterns-play-or-stop-context-or-select-pdef) (define-key sly-mode-map (kbd "C-c s") 'cl-patterns-stop-all) (define-key sly-doc-map (kbd "s") 'cl-patterns-supercollider-documentation) (add-hook! 'sly-connected-hook 'cl-patterns-helpers-load))) (set-popup-rule! "*sly-description*" :side 'right :size '0.52) (use-package! ajrepl :after janet-mode :config (add-hook 'a-janet-mode-hook #'ajrepl-interaction-mode)) (after! lsp-mode (setq lsp-signature-render-documentation nil) (add-to-list 'lsp-language-id-configuration '(a-janet-mode . "janet")) (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection "janet-lsp") :activation-fn (lsp-activate-on "janet") :server-id 'janet-ls))) (after! lisp-markup (add-hook! 'lisp-mode 'lisp-markup-minor-mode)) (add-to-list 'auto-mode-alist '("\\.lsx\\'" . lisp-mode)) ;; adding supercollider path (setq exec-path (append exec-path '("/Applications/SuperCollider.app/Contents/MacOS/"))) ;; tidal cycles! ;; (setq tidal-boot-script-path "~/.cabal/share/aarch64-osx-ghc-9.4.2/tidal-1.9.3/BootTidal.hs") ;; add platformio to ino files (add-to-list 'auto-mode-alist '("\\.ino\\'" . arduino-mode)) (add-to-list 'auto-mode-alist '("\\.ino\\'" . platformio-mode)) (after! gcode-mode (add-hook! 'gcode-mode-hook 'eldoc-mode)) (load! "obsidian-config.el") (add-hook 'window-setup-hook #'mnl/frame-center) (custom-set-faces! '(line-number :foreground "#424242")) ;; mu4e (set-email-account! "matt@emenel.ca" '((mu4e-sent-folder . "/matt@emenel.ca/Sent") (mu4e-drafts-folder . "/matt@emenel.ca/Drafts") (mu4e-trash-folder . "/matt@emenel.ca/Trash") (mu4e-refile-folder . "/matt@emenel.ca/Archive") (mu4e-spam-folder . "/matt@emenel.ca/Spam") (smtpmail-smtp-user . "matt@emenel.ca") (user-mail-address . "matt@emenel.ca") ;; only needed for mu < 1.4 (smtpmail-default-smtp-server . "smtp.fastmail.com") (smtpmail-smtp-server . "smtp.fastmail.com") (smtpmail-local-domain . "fastmail.com")) t) (set-email-account! "admin@studyoftime.org" '((mu4e-sent-folder . "/admin@studyoftime.org/Sent") (mu4e-drafts-folder . "/admin@studyoftime.org/Drafts") (mu4e-trash-folder . "/admin@studyoftime.org/Trash") (mu4e-refile-folder . "/admin@studyoftime.org/Archive") (mu4e-spam-folder . "/admin@studyoftime.org/Spam") (smtpmail-smtp-user . "admin@studyoftime.org") (user-mail-address . "admin@studyoftime.org") ;; only needed for mu < 1.4 (smtpmail-default-smtp-server . "smtp.dreamhost.com") (smtpmail-smtp-server . "smtp.dreamhost.com") (smtpmail-local-domain . "dreamhost.com")) t) (defun message-insert-signature-at-point () "Insert signature at point." (interactive) (setq message-signature "Matt Nish-Lapidus\nhttps://emenel.ca") (save-restriction (narrow-to-region (point) (point)) (message-insert-signature) (newline)) (setq message-signature nil)) (use-package! consult-mu :defer-incrementally mu4e :custom (consult-mu-maxnum 200) ;;show preview when pressing any keys (consult-mu-preview-key 'any) (consult-mu-mark-previewed-as-read nil) ;;mark email as read when selected. ;; (consult-mu-mark-viewed-as-read t) (consult-mu-use-wide-reply t) (consult-mu-headers-template (lambda () (concat "%f" (number-to-string (floor (* (frame-width) 0.15))) "%s" (number-to-string (floor (* (frame-width) 0.5))) "%d13" "%g" "%x"))) (consult-mu-action #'consult-mu--view-action) :config (setq consult-mu-saved-searches-dynamics '("#flag:unread")) (setq consult-mu-saved-searches-async '("#flag:unread")) ;; require embark actions for marking, replying, forwarding, etc. directly from minibuffer (require 'consult-mu-embark) ;; require extra module for composing (e.g. for interactive attachment) as well as embark actions (require 'consult-mu-compose) (require 'consult-mu-compose-embark) ;; require extra module for searching contacts and runing embark actions on contacts (require 'consult-mu-contacts) (require 'consult-mu-contacts-embark) ;; change the prefiew key for compose so you don't open a preview of every file when selecting files to attach (setq consult-mu-compose-preview-key "M-o") ;; pick a key to bind to consult-mu-compose-attach in embark-file-map (setq consult-mu-embark-attach-file-key "C-a") (setq consult-mu-contacts-ignore-list '("^.*no.*reply.*")) (setq consult-mu-contacts-ignore-case-fold-search t) (consult-mu-compose-embark-bind-attach-file-key) ;; choose if you want to use dired for attaching files (choice of 'always, 'in-dired, or nil) (setq consult-mu-compose-use-dired-attachment 'in-dired)) (use-package! mu4e :defer-incrementally t :config ;; Run mu4e in the background to sync mail periodically ;; (mu4e t) ;; tell meow to start mu4e in motion state (pushnew! meow-mode-state-list '(mu4e-main-mode . motion)) (setq mu4e-update-interval 300 mu4e-headers-auto-update t) (setq mu4e-index-cleanup t mu4e-index-lazy-check nil mu4e-show-images t message-kill-buffer-on-exit t mu4e-enable-async-operations t) (setq message-citation-line-format "On %e %B %Y at %R %Z, %f wrote:\n") (setq message-citation-line-function 'message-insert-formatted-citation-line) (add-hook 'mu4e-thread-mode-hook #'mu4e-thread-fold-all) (set-popup-rule! "*mu4e overview*" :side 'left :size '0.25) (setq mu4e-bookmarks nil) (setq sendmail-program "/opt/homebrew/bin/msmtp" send-mail-function 'smtpmail-send-it message-sendmail-f-is-evil t message-sendmail-extra-arguments '("--read-envelope-from") message-send-mail-function 'message-send-mail-with-sendmail) (setq mu4e-compose-format-flowed t) (setq message-signature nil) (add-hook! 'mu4e-compose-mode-hook (use-hard-newlines -1) ;; (message-add-header "CC:") (message-goto-body) (message-insert-signature-at-point) (message-goto-body)) ;; (setq mu4e-bookmarks ;; '((:name "Unread messages" :query "flag:unread AND NOT flag:trashed" :key ?i) ;; (:name "Today's messages" :query "date:today..now" :key ?t) ;; (:name "The Boss" :query "from:stallman" :key ?s) ;; (:name "Last 7 days" :query "date:7d..now" :hide-unread t :key ?w) ;; (:name "Messages with images" :query "mime:image/*" :key ?p))) (mu4e-bookmark-define (concat "flag:unread" " and not maildir:/matt@emenel.ca/Spam" " and not maildir:/matt@emenel.ca/Trash" " and not maildir:/admin@studyoftime.org/Spam" " and not maildir:/admin@studyoftime.org/Trash") "All Unread" ?U) (mu4e-bookmark-define (concat "flag:unread" " and not maildir:/matt@emenel.ca/Spam" " and not maildir:/matt@emenel.ca/Trash" " and not maildir:/matt@emenel.ca/Archive" " and not maildir:/admin@studyoftime.org/Spam" " and not maildir:/admin@studyoftime.org/Trash" " and not maildir:/admin@studyoftime.org/Archive") "Inboxes Unread" ?u) ;; inboxes (mu4e-bookmark-define (concat "maildir:/matt@emenel.ca/Inbox" " or maildir:/admin@studyoftime.org/Inbox") "All Inboxes" ?i) (setq mu4e-maildir-shortcuts '((:maildir "/matt@emenel.ca/Inbox" :key ?1 :name "Inbox/matt@emenel.ca") (:maildir "/matt@emenel.ca/Sent" :key ?2 :name "Sent/matt@emenel.ca") (:maildir "/matt@emenel.ca/Spam" :key ?3 :name "Spam/matt@emenel.ca") (:maildir "/admin@studyoftime.org/Inbox" :key ?4 :name "Inbox/admin@studyoftime.org") (:maildir "/admin@studyoftime.org/Sent" :key ?5 :name "Sent/admin@studyoftime.org") (:maildir "/admin@studyoftime.org/Spam" :key ?6 :name "Spam/admin@studyoftime.org"))) (setq mu4e-alert-email-notification-types '(count)) (add-hook! mu4e-compose-mode (ws-butler-mode -1))) (use-package! kbd-mode) (server-start)