From 7cfc00fd43e96c823ffabc42bbe3af2fd95ebe5d Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Thu, 14 Dec 2023 20:57:10 +0100 Subject: [PATCH] . --- config.scm | 70 +++------- home/emacs/early-init.el | 1 + home/emacs/init.el | 252 +++++++++++++++++++++++++----------- home/home-configuration.scm | 1 + 4 files changed, 203 insertions(+), 121 deletions(-) create mode 100644 home/emacs/early-init.el diff --git a/config.scm b/config.scm index 3822c8f..d1d0049 100644 --- a/config.scm +++ b/config.scm @@ -18,20 +18,11 @@ ;; [[file:config.org::*Modules][Modules:1]] -(use-modules (gnu) - (gnu image) - (gnu services authentication) - (gnu services base) - (gnu services dbus) - (gnu services desktop) - (gnu services linux) - (gnu services networking) - (gnu services pm) - (gnu services virtualization) - (gnu services xorg) - (gnu system nss) - (nongnu packages linux) - (nongnu system linux-initrd)) +ice-9/boot-9.scm:1685:16: In procedure raise-exception: +Wrong type to apply: "gnu" + +Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. +scheme@(guile-user) [1]> ;; Modules:1 ends here ;; Service Modules @@ -42,7 +33,11 @@ ;; [[file:config.org::*Service Modules][Service Modules:1]] -(use-service-modules desktop xorg) +ice-9/boot-9.scm:1685:16: In procedure raise-exception: +Wrong type to apply: "desktop" + +Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. +scheme@(guile-user) [1]> ;; Service Modules:1 ends here ;; Package Modules @@ -62,17 +57,11 @@ ;; [[file:config.org::*Package Modules][Package Modules:1]] -(use-package-modules bootloaders - certs - emacs - emacs-xyz - fonts - pciutils - readline - terminals - version-control - wm - xorg) +ice-9/boot-9.scm:1685:16: In procedure raise-exception: +Wrong type to apply: "bootloaders" + +Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. +scheme@(guile-user) [1]> ;; Package Modules:1 ends here ;; File System @@ -146,13 +135,11 @@ %base-user-accounts)) (packages (append - (list emacs - emacs-desktop-environment - font-terminus - git - hwdata - nss-certs - readline) + ice-9/boot-9.scm:1685:16: In procedure raise-exception: + Wrong type to apply: "emacs" + + Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. + scheme@(guile-user) [1]> %base-packages)) (services (append @@ -169,22 +156,7 @@ (authorized-keys (append (list (plain-file "non-guix.pub" "<>"))))))) - (list - (service tlp-service-type) - (service thermald-service-type - (thermald-configuration - (adaptive? #t))) - (service bluetooth-service-type) - (service earlyoom-service-type - (earlyoom-configuration - (minimum-available-memory 5) - (minimum-free-swap 5))) - (service inputattach-service-type) - (service libvirt-service-type - (libvirt-configuration - (unix-sock-group "libvirt"))) - (service fstrim-service-type) - (service fprintd-service-type)) + nil (list (service greetd-service-type (greetd-configuration diff --git a/home/emacs/early-init.el b/home/emacs/early-init.el new file mode 100644 index 0000000..512068a --- /dev/null +++ b/home/emacs/early-init.el @@ -0,0 +1 @@ +(setq package-enable-at-startup nil) diff --git a/home/emacs/init.el b/home/emacs/init.el index 92370f2..36b9c5c 100644 --- a/home/emacs/init.el +++ b/home/emacs/init.el @@ -12,8 +12,8 @@ ;; hypermedia i18n internal languages lisp local maint mail matching ;; mouse multimedia news outlines processes terminals tex tools unix ;; vc wp -;; Homepage: https://github.com/dziltener@lyrion.ch/init -;; Package-Requires: ((emacs "24.3")) +;; Homepage: https://gitea.lyrion.ch/zilti/guixconfig +;; Package-Requires: ((emacs "29.1")) ;; ;; This file is not part of GNU Emacs. ;; @@ -32,6 +32,8 @@ (when (file-exists-p custom-file) (load custom-file)) +(defvar init-dir (file-name-directory (or load-file-name (buffer-file-name)))) + ;;;; Personal Information Setup (setq user-full-name "Daniel Ziltener" user-mail-address "dziltener@lyrion.ch") @@ -41,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 @@ -78,6 +128,7 @@ ;;;; Emacs (use-package emacs + :elpaca nil :delight (eldoc-mode " 󰙎") :custom (completion-cycle-threshold 10) @@ -106,6 +157,7 @@ ;;;; Org Mode (use-package org + :elpaca (:repo "https://git.savannah.gnu.org/git/emacs/org-mode.git" :branch "emacs-sync") :ensure t :custom (org-babel-load-languages '((emacs-lisp . t) @@ -202,7 +254,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 @@ -238,7 +291,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) @@ -299,6 +353,7 @@ ;;;; Search, Completion, Execution ;;;;; Preliminary Packages (use-package savehist + :elpaca nil :init (savehist-mode)) @@ -312,11 +367,8 @@ 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 + (embark-collect-mode . consult-preview-at-point-mode) :config (require 'consult-flymake) (require 'consult-xref) @@ -328,12 +380,9 @@ ("gb" . 'consult-project-buffer) ("g/" . 'consult-git-grep) ("/" . 'consult-grep) - ("/" . 'consult-line))) - -(use-package embark - :bind - ("C-" . 'embark-act) - ("C-M-" . 'embark-bindings)) + ("/" . 'consult-line)) + ("C-" . 'embark-act) + ("C-M-" . 'embark-bindings)) (use-package wgrep :config @@ -449,6 +498,7 @@ :hook evil-mode (evil-mode . evil-snipe-override-mode) + (evil-mode . evil-snipe-mode) (magit-mode . turn-off-evil-snipe-override-mode) ;; See https://github.com/hlissner/evil-snipe/issues/95 ;; :config @@ -479,6 +529,29 @@ Point must be at the beginning of balanced expression (sexp)." (transpose-sexps 1) (forward-sexp -1)) +(defvar last-sexp nil) + +(defun cc/clone-sexp () + "Clone the sexp right after the cursor." + (interactive) + (call-interactively #'mark-sexp) + (call-interactively #'kill-ring-save) + (call-interactively #'evil-paste-before) + (call-interactively #'forward-char) + (call-interactively #'paredit-newline)) + +(defun cc/slurp-forward () + "Slurps forward when the key is after the closing paren." + (interactive) + (call-interactively #'backward-char) + (call-interactively #'paredit-forward-slurp-sexp)) + +(defun cc/barf-forward () + "Barfs forward even when the key is after the closing paren." + (interactive) + (call-interactively #'backward-char) + (call-interactively #'paredit-forward-barf-sexp)) + (defun looking-at-opening-paren () (looking-at (rx (or "(" "{" "[")))) @@ -486,58 +559,90 @@ Point must be at the beginning of balanced expression (sexp)." (looking-back (rx (or ")" "}" "]")))) ;;;;; Basic -(use-package smartparens - :delight (smartparens-mode " 󰅲 ") +(use-package symex + :custom + (symex-modal-backend 'evil) + :config + (symex-initialize) + :bind + (:map evil-insert-state-map + ("C-ß" . #'symex-mode-interface))) + +(use-package paredit :hook - (smartparens-mode . show-smartparens-mode) - (smartparens-mode . smartparens-strict-mode) - clojure-ts-mode + clojure-mode emacs-lisp-mode scheme-mode - :custom - (sp-undo-pairs-separately t) :config - (add-to-list 'sp-clojure-modes 'clojure-ts-mode) - (add-to-list 'sp-clojure-modes 'clojurec-ts-mode) - (add-to-list 'sp-clojure-modes 'clojurescript-ts-mode) - (add-to-list 'sp-lisp-modes 'clojure-ts-mode) - (add-to-list 'sp-lisp-modes 'clojurec-ts-mode) - (add-to-list 'sp-lisp-modes 'clojurescript-ts-mode) - (sp-local-pair '(emacs-lisp-mode scheme-mode clojure-ts-mode) - "'" nil) - (sp-local-pair '(emacs-lisp-mode scheme-mode clojure-ts-mode) - "`" nil) - (evil-define-key 'insert smartparens-mode-map + (evil-define-key 'insert paredit-mode-map (kbd "r") (conditional-keybind #'looking-at-opening-paren - #'sp-raise-sexp) - (kbd "w") (conditional-keybind #'looking-at-opening-paren + #'paredit-raise-sexp) + (kbd "w") (conditional-keybind #'looking-at-opening-paren #'cc/move-sexp-backward) (kbd "s") (conditional-keybind #'looking-at-opening-paren #'cc/move-sexp-forward) - (kbd "c") (conditional-keybind #'looking-at-opening-paren - #'sp-clone-sexp) - (kbd "m") (conditional-keybind #'looking-at-opening-paren - #'sp-mark-sexp) - (kbd "DEL") (conditional-keybind #'being-past-closing-paren - #'sp-backward-delete-sexp - #'evil-delete-backward-char-and-join) + (kbd "c") (conditional-keybind #'looking-at-opening-paren + #'cc/clone-sexp) (kbd ">") (conditional-keybind #'being-past-closing-paren - (lambda (prefix) - (interactive "P") - (call-interactively #'backward-char) - (call-interactively #'sp-forward-slurp-sexp) - (call-interactively #'sp-forward-sexp) - (call-interactively #'forward-char))) + #'cc/slurp-forward) (kbd "<") (conditional-keybind #'being-past-closing-paren - (lambda (prefix) - (interactive "P") - (call-interactively #'backward-char) - (call-interactively #'sp-forward-barf-sexp) - (call-interactively #'forward-char))))) + #'cc/barf-forward))) -(use-package evil-cleverparens - :after smartparens - :hook smartparens) +;; (use-package smartparens +;; :delight (smartparens-mode " 󰅲 ") +;; :hook +;; (smartparens-mode . show-smartparens-mode) +;; (smartparens-mode . smartparens-strict-mode) +;; clojure-ts-mode +;; emacs-lisp-mode +;; scheme-mode +;; :custom +;; (sp-undo-pairs-separately t) +;; :config +;; (add-to-list 'sp-clojure-modes 'clojure-ts-mode) +;; (add-to-list 'sp-clojure-modes 'clojurec-ts-mode) +;; (add-to-list 'sp-clojure-modes 'clojurescript-ts-mode) +;; (add-to-list 'sp-lisp-modes 'clojure-ts-mode) +;; (add-to-list 'sp-lisp-modes 'clojurec-ts-mode) +;; (add-to-list 'sp-lisp-modes 'clojurescript-ts-mode) +;; ;; TODO: Remove the following three lines once merge request got accepted +;; (load-file (concat init-dir "lib/smartparens-clojure.el")) +;; (load-file (concat init-dir "lib/smartparens-emacs-lisp.el")) +;; (load-file (concat init-dir "lib/smartparens-scheme.el")) +;; (require 'smartparens-clojure) +;; (require 'smartparens-emacs-lisp) +;; (require 'smartparens-scheme) +;; (evil-define-key 'insert smartparens-mode-map +;; (kbd "r") (conditional-keybind #'looking-at-opening-paren +;; #'sp-raise-sexp) +;; (kbd "w") (conditional-keybind #'looking-at-opening-paren +;; #'cc/move-sexp-backward) +;; (kbd "s") (conditional-keybind #'looking-at-opening-paren +;; #'cc/move-sexp-forward) +;; (kbd "c") (conditional-keybind #'looking-at-opening-paren +;; #'sp-clone-sexp) +;; (kbd "m") (conditional-keybind #'looking-at-opening-paren +;; #'sp-mark-sexp) +;; (kbd "DEL") (conditional-keybind #'being-past-closing-paren +;; #'sp-backward-delete-sexp +;; #'evil-delete-backward-char-and-join) +;; (kbd ">") (conditional-keybind #'being-past-closing-paren +;; (lambda (prefix) +;; (interactive "P") +;; (call-interactively #'backward-char) +;; (call-interactively #'sp-forward-slurp-sexp) +;; (call-interactively #'sp-forward-sexp) +;; (call-interactively #'forward-char))) +;; (kbd "<") (conditional-keybind #'being-past-closing-paren +;; (lambda (prefix) +;; (interactive "P") +;; (call-interactively #'backward-char) +;; (call-interactively #'sp-forward-barf-sexp) +;; (call-interactively #'forward-char))))) + +;; (use-package evil-cleverparens +;; :after smartparens +;; :hook smartparens) ;;;;; Visual Aid ;; (use-package rainbow-delimiters @@ -580,7 +685,7 @@ Point must be at the beginning of balanced expression (sexp)." (setq-default eglot-workspace-configuration '((clojure-lsp (maxCompletions . 300)))) (add-to-list 'eglot-server-programs - '((clojure-ts-mode clojurec-ts-mode clojurescript-ts-mode) + '((clojure-mode clojurec-mode clojurescript-mode) "clojure-lsp" :initializationOptions (:preferences @@ -645,9 +750,8 @@ Point must be at the beginning of balanced expression (sexp)." '(clojurescript-ts-mode . clojure))) (use-package cider + :elpaca (:host github :repo "clojure-emacs/cider" :tag "v1.12.0") :delight (cider-mode '(:eval (concat "  [" (cider--modeline-info) "]"))) - :hook - (clojure-ts-mode . cider-mode) :config (evil-define-key 'insert 'cider-mode-map "C-x C-e" #'cider-eval-last-sexp) @@ -679,13 +783,15 @@ Point must be at the beginning of balanced expression (sexp)." (use-package paren-face :hook scheme-mode - emacs-lisp-mode) + emacs-lisp-mode + clojure-ts-mode) (use-package highlight-parentheses :hook prog-mode) ;;;;;; Chicken Scheme (use-package scheme + :elpaca nil :config (setq prettify-symbols-alist '(("lambda" . "λ"))) @@ -771,7 +877,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" diff --git a/home/home-configuration.scm b/home/home-configuration.scm index d86540d..3bf3bbd 100644 --- a/home/home-configuration.scm +++ b/home/home-configuration.scm @@ -134,6 +134,7 @@ ("fuzzel/fuzzel.ini" ,(local-file "./fuzzel/fuzzel.ini")) ("git/config" ,(local-file "./git/config")) ("emacs/init.el" ,(local-file "./emacs/init.el")) + ("emacs/early-init.el" ,(local-file "./emacs/early-init.el")) ("emacs/init.org" ,(local-file "./emacs/init.org")) ("emacs/templates" ,(local-file "./emacs/templates")) ("kitty/kitty.conf" ,(local-file "./kitty/kitty.conf"))