Files
dotfiles/emacs/init.el-macos-current

268 lines
7.7 KiB
Plaintext

;; -*- lexical-binding: t; -*-
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(setq-default indent-tabs-mode nil)
;;; Local CLHS browsing!
(load "~/quicklisp/clhs-use-local.el" t)
(setq default-directory "~/")
(use-package sly
:ensure t
:custom
(inferior-lisp-program "sbcl")
:hook ((lisp-mode . sly-mode)
(lisp-mode . set-common-lisp-style)))
(use-package elisp-mode
:custom
(lisp-indent-function 'lisp-indent-function))
(setq-default c-basic-offset 4)
(set-face-attribute 'default nil :font "Iosevka Custom 12")
;(set-face-attribute 'default nil :font "APL386 Unicode 12")
(use-package use-package
:init
(setq use-package-always-ensure t))
(use-package projectile
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-enable-caching t)
(projectile-mode 1))
(use-package paredit
:ensure t
:hook ((clojure-mode
scheme-mode
sex-mode
lisp-mode
emacs-lisp-mode) . paredit-mode))
(use-package vertico
:init (vertico-mode))
(use-package consult
:preface
(defvar consult-prefix-map (make-sparse-keymap))
(fset 'consult-prefix-map consult-prefix-map)
:bind (:map ctl-x-map ("c" . consult-prefix-map)
:map consult-prefix-map
("r" . consult-recent-file)
("o" . consult-outline)
("i" . consult-imenu)
("g" . consult-grep))
:custom
(consult-preview-key nil)
:init
(setq completion-in-region-function #'consult-completion-in-region))
(use-package marginalia
:bind (("M-A" . marginalia-cycle))
:init (marginalia-mode))
(use-package magit
:delight
:custom
(magit-bury-buffer-function
(lambda (kill) (kill-buffer)))
:bind
(:map mode-specific-map
:prefix-map magit-prefix-map
:prefix "m"
("b" . #'magit-blame-addition)
("B" . #'magit-branch-create)
("c" . #'magit-checkout)
("C" . #'magit-commit-create)
("f" . #'magit-find-file)
("l" . #'magit-log-buffer-file)))
(use-package orderless
:demand t
:config
(setq completion-styles '(orderless partial-completion)
completion-category-defaults nil
completion-category-overrides '((file (styles . (partial-completion)))
(eglot (styles . (orderless flex))))))
(use-package corfu
:bind
(([C-tab] . #'completion-at-point))
:init
(global-corfu-mode))
(use-package org
:bind (("C-c a" . org-agenda)
("C-c c" . org-capture))
:config
(setq org-log-done t)
(setq org-image-actual-width nil))
(use-package org-journal
:init (setq
org-journal-file-type 'yearly
org-journal-dir "~/dev/journal")
:hook (org-journal-mode . (lambda ()
(set-fill-column 80)
(auto-fill-mode))))
(use-package reverse-im
:config
(reverse-im-activate "russian-computer"))
;;; Eglot
(use-package eglot
:hook ((c-mode c++-mode objc-mode) .
'eglot-ensure)
:config
(setopt eglot-ignored-server-capabilities (list :documentOnTypeFormattingProvider))
(add-to-list 'eglot-server-programs
'((c++-mode c-mode objc-mode) .
("/Library/Developer/CommandLineTools/usr/bin/clangd" "--header-insertion=never" "--clang-tidy" "--fallback-style=\"{ BasedOnStyle: LLVM, IndentWidth: 4, Standard: c++20 }\""))))
(defmacro global-set-keys (&rest map)
(let (a)
(dolist (key-action map)
(push `(global-set-key ,(car key-action) ,(cdr key-action))
a))
`(progn ,@a)))
(global-set-keys
([insert] . 'delete-selection-mode) ;; Overwrite mode
((kbd "M-o") . 'other-window) ;; Instead of C-x o
((kbd "C-[ C-[ C-[") . nil)
((kbd "C-x /") . #'replace-string)
((kbd "C-x w") . #'switch-to-buffer-other-window)
((kbd "C-c l") . "λ"))
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(transient-mark-mode -1)
(winner-mode 1)
(electric-indent-mode -1)
(setq default-input-method "russian-computer"
browse-url-browser-function 'browse-url-firefox
browse-url-firefox-new-window-is-tab t
browse-url-firefox-program "/Applications/Firefox.app/Contents/MacOS/firefox"
ring-bell-function 'ignore
mouse-yank-at-point t
inhibit-startup-screen t
column-number-mode t
cmake-tab-width 4)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(put 'narrow-to-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(add-hook 'nxml-mode-hook
(lambda ()
(setq nxml-child-indent 4
nxml-attribute-indent 4)))
(add-hook 'mhtml-mode-hook
(lambda ()
(local-unset-key (kbd "M-o"))))
(c-add-style "my-style"
'("k&r"
(c-basic-offset . 4)
(c-offsets-alist . ((case-label . 0)
(inlambda . 0)
(inline-open . 0)
(innamespace . 0)))))
(add-hook 'c-mode-common-hook
(lambda ()
(c-set-style "my-style")))
(c-add-style "my-java"
'("java"
(c-offsets-alist . ((inline-open . 0)
(substatement-open . 0)))))
(add-hook 'java-mode-hook
(lambda ()
(c-set-style "my-java")))
(add-to-list 'auto-mode-alist '("\\.mm\\'" . objc-mode))
(load-theme 'modus-operandi t)
(set-face-attribute 'fringe nil :background "#f0f0f0" :foreground "#6d6d6d")
(define-advice kill-ring-save (:before (beg end &optional region) pulse-kill-save)
(save-mark-and-excursion
(let ((beg (if region (region-beginning) beg))
(end (if region (region-end) end)))
(pulse-momentary-highlight-region beg end 'region))))
(use-package quelpa
:demand t
:custom (quelpa-update-melpa-p nil))
(use-package quelpa-use-package
:demand t)
(use-package gdscript-mode
:custom (gdscript-godot-executable "/Applications/Godot.app/Contents/MacOS/Godot"))
(use-package geiser
:bind (:map geiser-repl-mode-map
("C-a" . move-beginning-of-line)))
(use-package markdown-mode
:ensure t
:mode ("README\\.md\\'" . gfm-mode)
:init (setq markdown-command "multimarkdown")
:bind (:map markdown-mode-map
("C-c C-e" . markdown-do)))
(use-package auth-source
:ensure nil
:custom (auth-sources '(macos-keychain-internet macos-keychain-generic "~/.authinfo")))
(use-package asana
:load-path "~/dev/asana.el"
:commands (asana asana-my-tasks))
(use-package agent-shell
:ensure t)
(add-to-list 'exec-path "/Users/ex/dev/dsh/node_modules/.bin/")
(setq agent-shell-anthropic-authentication
(agent-shell-anthropic-make-authentication :login t)
agent-shell-deepseek-authentication
(agent-shell-deepseek-make-authentication :api-key ":)")
agent-shell-deepseek-environment
(agent-shell-make-environment-variables
"DEEPSEEK_API_KEY" ":)"))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(ag agent-shell cmake-mode consult corfu elisp-mode gdscript-mode
geiser-chicken glsl-mode go-mode ht magit marginalia
markdown-mode orderless org-journal paredit plz projectile
puni quelpa quelpa-use-package reverse-im sly vertico vterm
yasnippet)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)