From 79ec038dc90b3c16ec5727f02be768703cdeaa75 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Thu, 14 Dec 2023 12:30:17 +0100 Subject: [PATCH] . --- emacs/emacs.nix | 70 +--------------------- emacs/init.el | 150 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 108 insertions(+), 112 deletions(-) diff --git a/emacs/emacs.nix b/emacs/emacs.nix index fa76fbd..d2ce50c 100644 --- a/emacs/emacs.nix +++ b/emacs/emacs.nix @@ -2,7 +2,7 @@ { home.file.".emacs.d/early-init.el" = { - enable = false; + enable = true; text = "(setq package-enable-at-startup nil)"; }; home.file.".emacs.d/init.el" = { @@ -29,73 +29,5 @@ enable = true; package = pkgs.emacs29-gtk3; extraConfig = builtins.readFile ./init.el; - extraPackages = epkgs: with epkgs; [ - airline-themes - all-the-icons - cape - catppuccin-theme - cider - circe - clojure-ts-mode - code-review - color-theme-modern - consult - consult-eglot - consult-notes - corfu - corfu-terminal - delight - dhall-mode - editorconfig - eglot - el-patch - embark - embark-consult - evil - evil-cleverparens - evil-collection - evil-easymotion - evil-snipe - forge - geiser - geiser-chicken - geiser-guile - git-gutter - goto-chg - guix - keychain-environment - lsp-scheme - magit - magit-todos - marginalia - moe-theme - nerd-icons-completion - nerd-icons-corfu - nix-mode - nix-ts-mode - orderless - org - org-modern - org-rainbow-tags - org-roam - org-roam-ui - package-lint - pass - password-store - password-store-otp - plan9-theme - powerline - rainbow-delimiters - smartparens - tempel - tree-sitter - tree-sitter-langs - vertico - websocket - wgrep - which-key - xref-union - zig-mode - ]; }; } diff --git a/emacs/init.el b/emacs/init.el index d546e0a..2ca6f51 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -43,19 +43,67 @@ ;;;; Straight.el -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 6)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) -(setq straight-use-package-by-default t) +;; (defvar bootstrap-version) +;; (let ((bootstrap-file +;; (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) +;; (bootstrap-version 6)) +;; (unless (file-exists-p bootstrap-file) +;; (with-current-buffer +;; (url-retrieve-synchronously +;; "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" +;; 'silent 'inhibit-cookies) +;; (goto-char (point-max)) +;; (eval-print-last-sexp))) +;; (load bootstrap-file nil 'nomessage)) +;; (setq straight-use-package-by-default t) + +;;;; Elpaca + +;;;;; Installation + +(defvar elpaca-installer-version 0.6) +(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) +(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) +(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) +(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" + :ref nil + :files (:defaults "elpaca-test.el" (:exclude "extensions")) + :build (:not elpaca--activate-package))) +(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) + (build (expand-file-name "elpaca/" elpaca-builds-directory)) + (order (cdr elpaca-order)) + (default-directory repo)) + (add-to-list 'load-path (if (file-exists-p build) build repo)) + (unless (file-exists-p repo) + (make-directory repo t) + (when (< emacs-major-version 28) (require 'subr-x)) + (condition-case-unless-debug err + (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) + ((zerop (call-process "git" nil buffer t "clone" + (plist-get order :repo) repo))) + ((zerop (call-process "git" nil buffer t "checkout" + (or (plist-get order :ref) "--")))) + (emacs (concat invocation-directory invocation-name)) + ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" + "--eval" "(byte-recompile-directory \".\" 0 'force)"))) + ((require 'elpaca)) + ((elpaca-generate-autoloads "elpaca" repo))) + (progn (message "%s" (buffer-string)) (kill-buffer buffer)) + (error "%s" (with-current-buffer buffer (buffer-string)))) + ((error) (warn "%s" err) (delete-directory repo 'recursive)))) + (unless (require 'elpaca-autoloads nil t) + (require 'elpaca) + (elpaca-generate-autoloads "elpaca" repo) + (load "./elpaca-autoloads"))) +(add-hook 'after-init-hook #'elpaca-process-queues) +(elpaca `(,@elpaca-order)) + +;;;;; use-package integration + +(elpaca elpaca-use-package + (elpaca-use-package-mode) + (setq elpaca-use-package-by-default t)) +(elpaca-wait) ;;;; Package Management Configuration ;; See: https://github.com/radian-software/el-patch @@ -80,6 +128,7 @@ ;;;; Emacs (use-package emacs + :elpaca nil :delight (eldoc-mode " 󰙎") :custom (completion-cycle-threshold 10) @@ -204,7 +253,8 @@ (add-to-list 'default-frame-alist '(alpha-background . 80)) (use-package lambda-line - :straight (:type git :host github :repo "lambda-emacs/lambda-line") + ;;:straight (:type git :host github :repo "lambda-emacs/lambda-line") + :elpaca (:host github :repo "lambda-emacs/lambda-line") :custom (lambda-line-icon-time t) ;; requires ClockFace font (see below) (lambda-line-clockface-update-fontset "ClockFaceRect") ;; set clock icon @@ -240,7 +290,8 @@ (setq mode-line-format (list "%_")))) (use-package lambda-themes - :straight (:type git :host github :repo "lambda-emacs/lambda-themes") + ;;:straight (:type git :host github :repo "lambda-emacs/lambda-themes") + :elpaca (:host github :repo "lambda-emacs/lambda-themes") :custom (lambda-themes-set-italic-comments t) (lambda-themes-set-italic-keywords t) @@ -301,6 +352,7 @@ ;;;; Search, Completion, Execution ;;;;; Preliminary Packages (use-package savehist + :elpaca nil :init (savehist-mode)) @@ -314,11 +366,11 @@ completion-category-overrides '((file (styles basic partial-completion))))) (use-package embark-consult - :after (embark consult) :hook (embark-collect-mode . consult-preview-at-point-mode)) (use-package consult + :elpaca nil ;; Because otherwise, consult and embark-consult block each other :config (require 'consult-flymake) (require 'consult-xref) @@ -499,6 +551,15 @@ Point must be at the beginning of balanced expression (sexp)." (looking-back (rx (or ")" "}" "]")))) ;;;;; Basic +(use-package symex + :custom + (symex-modal-backend 'evil) + :config + (symex-initialize) + :bind + (:map evil-insert-state-map + ("C-s" . #'symex-mode-interface))) + (use-package paredit :hook clojure-mode @@ -648,33 +709,33 @@ Point must be at the beginning of balanced expression (sexp)." :ensure t) ;;;;; Clojure -;; (use-package clojure-ts-mode -;; :delight "" -;; :after tree-sitter -;; :config -;; (require 'sesman) -;; (sesman-install-menu clojure-mode-map) -;; :hook -;; ((clojure-ts-mode . eglot-ensure) -;; (clojure-ts-mode . (lambda () -;; (setq-local sesman-system 'CIDER))) -;; (clojure-ts-mode . (lambda () -;; (sesman-install-menu clojure-mode-map))) -;; (clojurec-ts-mode . (lambda () -;; (sesman-install-menu clojurec-mode-map))) -;; (clojurescript-ts-mode . (lambda () -;; (sesman-install-menu clojurescript-mode-map)))) -;; :mode -;; ("\\.clj\\'" . #'clojure-ts-mode) -;; ("\\.cljc\\'" . #'clojurec-ts-mode) -;; ("\\.cljs\\'" . #'clojurescript-ts-mode) -;; :init -;; (add-to-list 'tree-sitter-major-mode-language-alist -;; '(clojure-ts-mode . clojure)) -;; (add-to-list 'tree-sitter-major-mode-language-alist -;; '(clojurec-ts-mode . clojure)) -;; (add-to-list 'tree-sitter-major-mode-language-alist -;; '(clojurescript-ts-mode . clojure))) +(use-package clojure-ts-mode + :delight "" + :after tree-sitter + :config + (require 'sesman) + (sesman-install-menu clojure-mode-map) + :hook + ((clojure-ts-mode . eglot-ensure) + (clojure-ts-mode . (lambda () + (setq-local sesman-system 'CIDER))) + (clojure-ts-mode . (lambda () + (sesman-install-menu clojure-mode-map))) + (clojurec-ts-mode . (lambda () + (sesman-install-menu clojurec-mode-map))) + (clojurescript-ts-mode . (lambda () + (sesman-install-menu clojurescript-mode-map)))) + :mode + ("\\.clj\\'" . #'clojure-ts-mode) + ("\\.cljc\\'" . #'clojurec-ts-mode) + ("\\.cljs\\'" . #'clojurescript-ts-mode) + :init + (add-to-list 'tree-sitter-major-mode-language-alist + '(clojure-ts-mode . clojure)) + (add-to-list 'tree-sitter-major-mode-language-alist + '(clojurec-ts-mode . clojure)) + (add-to-list 'tree-sitter-major-mode-language-alist + '(clojurescript-ts-mode . clojure))) (use-package cider :delight (cider-mode '(:eval (concat "  [" (cider--modeline-info) "]"))) @@ -716,6 +777,7 @@ Point must be at the beginning of balanced expression (sexp)." ;;;;;; Chicken Scheme (use-package scheme + :elpaca nil :config (setq prettify-symbols-alist '(("lambda" . "λ"))) @@ -801,7 +863,9 @@ Point must be at the beginning of balanced expression (sexp)." ;;;; Communication ;;;;; IRC (use-package rcirc + :elpaca nil :ensure t + :after password-store :custom (rcirc-server-alist `(("liberachat.irc.lyrion.ch"