diff options
Diffstat (limited to 'init.el')
| -rw-r--r-- | init.el | 143 |
1 files changed, 98 insertions, 45 deletions
| @@ -93,7 +93,7 @@ | |||
| 93 | (concat "SECURE128:+SECURE192:-VERS-ALL" | 93 | (concat "SECURE128:+SECURE192:-VERS-ALL" |
| 94 | (if (and (not +windows+) | 94 | (if (and (not +windows+) |
| 95 | (>= libgnutls-version 30605)) | 95 | (>= libgnutls-version 30605)) |
| 96 | ":+VERS-TLS1.3" | 96 | ":+VERS-TLS1.3:+VERS-TLS1.2" |
| 97 | ":+VERS-TLS1.2")))) | 97 | ":+VERS-TLS1.2")))) |
| 98 | 98 | ||
| 99 | (when +mac+ | 99 | (when +mac+ |
| @@ -101,7 +101,7 @@ | |||
| 101 | mac-command-modifier 'super)) | 101 | mac-command-modifier 'super)) |
| 102 | 102 | ||
| 103 | (when (file-exists-p custom-file) | 103 | (when (file-exists-p custom-file) |
| 104 | (load custom-file)) | 104 | (add-hook 'elpaca-after-init-hook (lambda () (load custom-file 'noerror)))) |
| 105 | 105 | ||
| 106 | (use-package auth-source | 106 | (use-package auth-source |
| 107 | :defer t | 107 | :defer t |
| @@ -148,34 +148,86 @@ | |||
| 148 | w32-pipe-read-delay 0 | 148 | w32-pipe-read-delay 0 |
| 149 | w32-pipe-buffer-size read-process-output-max)) | 149 | w32-pipe-buffer-size read-process-output-max)) |
| 150 | 150 | ||
| 151 | ;; Install straight.el | 151 | ;; Install elpaca |
| 152 | (defvar bootstrap-version) | 152 | (progn |
| 153 | (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) | 153 | (defvar elpaca-installer-version 0.10) |
| 154 | (bootstrap-version 6)) | 154 | (defvar elpaca-directory (expand-file-name "elpaca/" local-dir)) |
| 155 | (unless (file-exists-p bootstrap-file) | 155 | (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) |
| 156 | (message "This might take a long time...") | 156 | (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) |
| 157 | (with-current-buffer | 157 | (defvar elpaca-lock-file (expand-file-name "elpaca-lock.el" shared-dir)) |
| 158 | (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" | 158 | (defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" |
| 159 | 'silent 'inhibit-cookies) | 159 | :ref nil :depth 1 :inherit ignore |
| 160 | (goto-char (point-max)) | 160 | :files (:defaults "elpaca-test.el" (:exclude "extensions")) |
| 161 | (eval-print-last-sexp))) | 161 | :build (:not elpaca--activate-package))) |
| 162 | (load bootstrap-file)) | 162 | (let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) |
| 163 | (build (expand-file-name "elpaca/" elpaca-builds-directory)) | ||
| 164 | (order (cdr elpaca-order)) | ||
| 165 | (default-directory repo)) | ||
| 166 | (add-to-list 'load-path (if (file-exists-p build) build repo)) | ||
| 167 | (unless (file-exists-p repo) | ||
| 168 | (make-directory repo t) | ||
| 169 | (when (<= emacs-major-version 28) (require 'subr-x)) | ||
| 170 | (condition-case-unless-debug err | ||
| 171 | (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) | ||
| 172 | ((zerop (apply #'call-process `("git" nil ,buffer t "clone" | ||
| 173 | ,@(when-let* ((depth (plist-get order :depth))) | ||
| 174 | (list (format "--depth=%d" depth) "--no-single-branch")) | ||
| 175 | ,(plist-get order :repo) ,repo)))) | ||
| 176 | ((zerop (call-process "git" nil buffer t "checkout" | ||
| 177 | (or (plist-get order :ref) "--")))) | ||
| 178 | (emacs (concat invocation-directory invocation-name)) | ||
| 179 | ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" | ||
| 180 | "--eval" "(byte-recompile-directory \".\" 0 'force)"))) | ||
| 181 | ((require 'elpaca)) | ||
| 182 | ((elpaca-generate-autoloads "elpaca" repo))) | ||
| 183 | (progn (message "%s" (buffer-string)) (kill-buffer buffer)) | ||
| 184 | (error "%s" (with-current-buffer buffer (buffer-string)))) | ||
| 185 | ((error) (warn "%s" err) (delete-directory repo 'recursive)))) | ||
| 186 | (unless (require 'elpaca-autoloads nil t) | ||
| 187 | (require 'elpaca) | ||
| 188 | (elpaca-generate-autoloads "elpaca" repo) | ||
| 189 | (load "./elpaca-autoloads"))) | ||
| 190 | (add-hook 'after-init-hook #'elpaca-process-queues) | ||
| 191 | (elpaca `(,@elpaca-order)) | ||
| 192 | (when +windows+ | ||
| 193 | (elpaca-no-symlink-mode))) | ||
| 194 | |||
| 195 | (progn | ||
| 196 | (elpaca elpaca-use-package | ||
| 197 | (elpaca-use-package-mode)) | ||
| 198 | (elpaca-wait)) | ||
| 199 | |||
| 200 | ;; Builtins that I update with elpaca. | ||
| 201 | ;; Consider adding some to elpaca-ignored-dependencies if problems arise. | ||
| 202 | (progn | ||
| 203 | (defun arkta/elpaca-build-with-unload (pkg) | ||
| 204 | (append (butlast (if (file-exists-p (file-name-concat elpaca-builds-directory | ||
| 205 | (symbol-name pkg))) | ||
| 206 | elpaca--pre-built-steps | ||
| 207 | elpaca-build-steps)) | ||
| 208 | (list `(lambda (e) | ||
| 209 | (when (featurep ',pkg) | ||
| 210 | (unload-feature ',pkg t)) | ||
| 211 | (elpaca--continue-build e)) | ||
| 212 | 'elpaca--activate-package))) | ||
| 213 | (use-package seq | ||
| 214 | :ensure `(seq :build ,(arkta/elpaca-build-with-unload 'seq))) | ||
| 215 | (use-package transient | ||
| 216 | :ensure `(transient :build ,(arkta/elpaca-build-with-unload 'transient)))) | ||
| 163 | 217 | ||
| 164 | (defun arkta/update-packages () | 218 | (defun arkta/update-packages () |
| 165 | (interactive) | 219 | (interactive) |
| 166 | (straight-pull-all) | 220 | (elpaca-update-all) |
| 167 | (straight-freeze-versions)) | 221 | (elpaca-write-lock-file elpaca-lock-file)) |
| 168 | 222 | ||
| 169 | (defun arkta/fix-versions () | 223 | (defun arkta/fix-versions () |
| 170 | (interactive) | 224 | (interactive) |
| 171 | ;; Thaw & freeze to make sure we also freeze new stuff | 225 | (elpaca-write-lock-file elpaca-lock-file)) |
| 172 | (straight-thaw-versions) | ||
| 173 | (straight-freeze-versions)) | ||
| 174 | 226 | ||
| 175 | ;; compat | 227 | ;; compat |
| 176 | (use-package compat-30 | 228 | (use-package compat-30 |
| 177 | :if +emacs29+ | 229 | :if +emacs29+ |
| 178 | :straight 'compat) | 230 | :ensure 'compat) |
| 179 | 231 | ||
| 180 | ;; Helper functions | 232 | ;; Helper functions |
| 181 | (defmacro defsetter (name &rest emacs-names) | 233 | (defmacro defsetter (name &rest emacs-names) |
| @@ -203,17 +255,17 @@ | |||
| 203 | (require 'arkta-project) | 255 | (require 'arkta-project) |
| 204 | 256 | ||
| 205 | (use-package ace-window | 257 | (use-package ace-window |
| 206 | :straight t | 258 | :ensure t |
| 207 | :bind (([remap other-window] . ace-window) | 259 | :bind (([remap other-window] . ace-window) |
| 208 | ("C-x o" . ace-window))) | 260 | ("C-x o" . ace-window))) |
| 209 | 261 | ||
| 210 | (use-package amx | 262 | (use-package amx |
| 211 | :straight t | 263 | :ensure t |
| 212 | :config | 264 | :config |
| 213 | (amx-mode +1)) | 265 | (amx-mode +1)) |
| 214 | 266 | ||
| 215 | (use-package company | 267 | (use-package company |
| 216 | :straight t | 268 | :ensure t |
| 217 | :custom | 269 | :custom |
| 218 | (company-format-margin-function #'company-text-icons-margin) | 270 | (company-format-margin-function #'company-text-icons-margin) |
| 219 | (company-text-face-extra-attributes '(:weight bold)) | 271 | (company-text-face-extra-attributes '(:weight bold)) |
| @@ -226,11 +278,11 @@ | |||
| 226 | (global-company-mode +1)) | 278 | (global-company-mode +1)) |
| 227 | 279 | ||
| 228 | (use-package compile | 280 | (use-package compile |
| 229 | :straight '(compile :type built-in) | 281 | :ensure nil |
| 230 | :bind (("C-c k" . compile))) | 282 | :bind (("C-c k" . compile))) |
| 231 | 283 | ||
| 232 | (use-package copyright | 284 | (use-package copyright |
| 233 | :straight '(copyright :type built-in) | 285 | :ensure nil |
| 234 | :init | 286 | :init |
| 235 | (defun arkta/maybe-fix-copyright () | 287 | (defun arkta/maybe-fix-copyright () |
| 236 | (save-mark-and-excursion | 288 | (save-mark-and-excursion |
| @@ -242,13 +294,13 @@ | |||
| 242 | (copyright-year-ranges t)) | 294 | (copyright-year-ranges t)) |
| 243 | 295 | ||
| 244 | (use-package counsel | 296 | (use-package counsel |
| 245 | :straight t | 297 | :ensure t |
| 246 | :after amx | 298 | :after amx |
| 247 | :config | 299 | :config |
| 248 | (counsel-mode +1)) | 300 | (counsel-mode +1)) |
| 249 | 301 | ||
| 250 | (use-package dashboard | 302 | (use-package dashboard |
| 251 | :straight t | 303 | :ensure t |
| 252 | :demand t | 304 | :demand t |
| 253 | :hook (server-after-make-frame . dashboard-open) | 305 | :hook (server-after-make-frame . dashboard-open) |
| 254 | :custom | 306 | :custom |
| @@ -264,12 +316,12 @@ | |||
| 264 | (dashboard-setup-startup-hook)) | 316 | (dashboard-setup-startup-hook)) |
| 265 | 317 | ||
| 266 | (use-package editorconfig | 318 | (use-package editorconfig |
| 267 | :straight t | 319 | :ensure t |
| 268 | :config | 320 | :config |
| 269 | (editorconfig-mode +1)) | 321 | (editorconfig-mode +1)) |
| 270 | 322 | ||
| 271 | (use-package eglot | 323 | (use-package eglot |
| 272 | :straight '(eglot :type built-in) | 324 | :ensure nil |
| 273 | :hook ((gdscript-mode go-ts-mode) . eglot-ensure) | 325 | :hook ((gdscript-mode go-ts-mode) . eglot-ensure) |
| 274 | :custom | 326 | :custom |
| 275 | (eglot-ignored-server-capabilities '(:documentFormattingProvider | 327 | (eglot-ignored-server-capabilities '(:documentFormattingProvider |
| @@ -278,17 +330,21 @@ | |||
| 278 | (eglot-autoshutdown t)) | 330 | (eglot-autoshutdown t)) |
| 279 | 331 | ||
| 280 | (use-package elpher | 332 | (use-package elpher |
| 281 | :straight t | 333 | :ensure t |
| 282 | :commands (elpher) | 334 | :commands (elpher) |
| 283 | :custom (elpher-default-url-type "gemini")) | 335 | :custom (elpher-default-url-type "gemini")) |
| 284 | 336 | ||
| 285 | (use-package envrc | 337 | (use-package envrc |
| 286 | :straight t | 338 | :ensure t |
| 287 | ;; This actually has to be hooked to after-init to be one of the first minor modes enabled | 339 | ;; This actually has to be hooked to after-init to be one of the first minor modes enabled |
| 288 | :hook (after-init . envrc-global-mode)) | 340 | :hook (elpaca-after-init . envrc-global-mode)) |
| 341 | |||
| 342 | (use-package forge | ||
| 343 | :ensure t | ||
| 344 | :after magit) | ||
| 289 | 345 | ||
| 290 | (use-package gcmh | 346 | (use-package gcmh |
| 291 | :straight t | 347 | :ensure t |
| 292 | :custom | 348 | :custom |
| 293 | (gcmh-idle-delay 'auto) | 349 | (gcmh-idle-delay 'auto) |
| 294 | (gcmh-auto-idle-delay-factor 10) | 350 | (gcmh-auto-idle-delay-factor 10) |
| @@ -297,13 +353,13 @@ | |||
| 297 | (gcmh-mode +1)) | 353 | (gcmh-mode +1)) |
| 298 | 354 | ||
| 299 | (use-package ibuffer | 355 | (use-package ibuffer |
| 300 | :straight '(ibuffer :type built-in) | 356 | :ensure nil |
| 301 | :bind (("C-x C-b" . ibuffer) | 357 | :bind (("C-x C-b" . ibuffer) |
| 302 | ([remap list-buffers] . ibuffer))) | 358 | ([remap list-buffers] . ibuffer))) |
| 303 | 359 | ||
| 304 | (use-package ivy | 360 | (use-package ivy |
| 361 | :ensure t | ||
| 305 | :after (counsel swiper) | 362 | :after (counsel swiper) |
| 306 | :straight t | ||
| 307 | :demand t | 363 | :demand t |
| 308 | :bind (("C-c r" . ivy-resume) | 364 | :bind (("C-c r" . ivy-resume) |
| 309 | ("C-c v" . ivy-push-view) | 365 | ("C-c v" . ivy-push-view) |
| @@ -316,28 +372,24 @@ | |||
| 316 | 372 | ||
| 317 | (use-package magit | 373 | (use-package magit |
| 318 | ;; TODO: Do some proper setup | 374 | ;; TODO: Do some proper setup |
| 319 | :straight t | 375 | :ensure t) |
| 320 | :config | ||
| 321 | (use-package forge | ||
| 322 | :straight t | ||
| 323 | :after magit)) | ||
| 324 | 376 | ||
| 325 | (use-package simple | 377 | (use-package simple |
| 326 | :straight (simple :type built-in) | 378 | :ensure nil |
| 327 | :hook ((text-mode . turn-on-auto-fill) | 379 | :hook ((text-mode . turn-on-auto-fill) |
| 328 | (before-save . delete-trailing-whitespace)) | 380 | (before-save . delete-trailing-whitespace)) |
| 329 | :custom | 381 | :custom |
| 330 | (backward-delete-char-untabify-method nil)) | 382 | (backward-delete-char-untabify-method nil)) |
| 331 | 383 | ||
| 332 | (use-package swiper | 384 | (use-package swiper |
| 333 | :straight t | 385 | :ensure t |
| 334 | :bind (([remap isearch-forward] . swiper-isearch) | 386 | :bind (([remap isearch-forward] . swiper-isearch) |
| 335 | ([remap isearch-backward] . swiper-isearch-backward) | 387 | ([remap isearch-backward] . swiper-isearch-backward) |
| 336 | ("C-s" . swiper-isearch) | 388 | ("C-s" . swiper-isearch) |
| 337 | ("C-r" . swiper-isearch-backward))) | 389 | ("C-r" . swiper-isearch-backward))) |
| 338 | 390 | ||
| 339 | (use-package treemacs | 391 | (use-package treemacs |
| 340 | :straight t | 392 | :ensure t |
| 341 | :commands (treemacs treemacs-select-window) | 393 | :commands (treemacs treemacs-select-window) |
| 342 | :custom | 394 | :custom |
| 343 | (treemacs-select-when-already-in-treemacs 'next-or-back) | 395 | (treemacs-select-when-already-in-treemacs 'next-or-back) |
| @@ -345,7 +397,7 @@ | |||
| 345 | ("C-c C-SPC" . treemacs-select-window))) | 397 | ("C-c C-SPC" . treemacs-select-window))) |
| 346 | 398 | ||
| 347 | (use-package treesit | 399 | (use-package treesit |
| 348 | :straight '(treesit :type built-in) | 400 | :ensure nil |
| 349 | :config | 401 | :config |
| 350 | (setq treesit-extra-load-path | 402 | (setq treesit-extra-load-path |
| 351 | (list (expand-file-name "tree-sitter" local-config-dir))) | 403 | (list (expand-file-name "tree-sitter" local-config-dir))) |
| @@ -367,6 +419,7 @@ | |||
| 367 | (toml "https://github.com/ikatyang/tree-sitter-toml.git") | 419 | (toml "https://github.com/ikatyang/tree-sitter-toml.git") |
| 368 | (tsx "https://github.com/tree-sitter/tree-sitter-typescript.git" nil "tsx/src") | 420 | (tsx "https://github.com/tree-sitter/tree-sitter-typescript.git" nil "tsx/src") |
| 369 | (typescript "https://github.com/tree-sitter/tree-sitter-typescript.git" nil "typescript/src") | 421 | (typescript "https://github.com/tree-sitter/tree-sitter-typescript.git" nil "typescript/src") |
| 422 | (typst "https://github.com/uben0/tree-sitter-typst") | ||
| 370 | (yaml "https://github.com/ikatyang/tree-sitter-yaml.git"))) | 423 | (yaml "https://github.com/ikatyang/tree-sitter-yaml.git"))) |
| 371 | (mapc (lambda (spec) | 424 | (mapc (lambda (spec) |
| 372 | (let ((name (car spec))) | 425 | (let ((name (car spec))) |
| @@ -375,5 +428,5 @@ | |||
| 375 | treesit-language-source-alist)) | 428 | treesit-language-source-alist)) |
| 376 | 429 | ||
| 377 | (use-package warnings | 430 | (use-package warnings |
| 378 | :straight '(warnings :type built-in) | 431 | :ensure nil |
| 379 | :custom (warning-suppress-types '((comp)))) | 432 | :custom (warning-suppress-types '((comp)))) |