This commit is contained in:
Daniel Ziltener 2024-07-12 21:32:57 +02:00
parent 12e26b4448
commit 6708c3c569
Signed by: zilti
GPG key ID: B38976E82C9DAE42
3 changed files with 362 additions and 383 deletions

View file

@ -22,97 +22,50 @@
;; Description ;; Description
;; ;;
;;; Code: ;;; Code:
;;;; Requirements ;;; Requirements
;; Since I am using `cl-defun` in this init file, I need to require ;; Since I am using `cl-defun` in this init file, I need to require
;; `cl-macs`. ;; `cl-macs`.
(require 'cl-macs) (require 'cl-macs)
;;;; Early Variables ;;; Early Variables
(setq custom-file "~/.config/emacs/custom.el") (setq custom-file "~/.config/emacs/custom.el")
(when (file-exists-p custom-file) (when (file-exists-p custom-file)
(load custom-file)) (load custom-file))
(defvar init-dir (file-name-directory (or load-file-name (buffer-file-name)))) (defvar init-dir (file-name-directory (or load-file-name (buffer-file-name))))
;;;; Personal Information Setup ;;; Package Management
;;;; Repositories
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;;;; VC
;; This will be unnecessary starting at Emacs 30
(unless (package-installed-p 'vc-use-package)
(package-vc-install "https://github.com/slotThe/vc-use-package"))
(setopt use-package-always-ensure t)
(require 'vc-use-package)
;;; Personal Information Setup
(setq user-full-name "Daniel Ziltener" (setq user-full-name "Daniel Ziltener"
user-mail-address "dziltener@lyrion.ch") user-mail-address "dziltener@lyrion.ch")
;; I use `pass` as password storage. ;; I use `pass` as password storage.
(auth-source-pass-enable) (auth-source-pass-enable)
;;;; Straight.el ;;; Package Management Configuration
;; (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 ;; See: https://github.com/radian-software/el-patch
(use-package el-patch) (use-package el-patch)
;;;;; Guix Management ;;;; Guix Management
(use-package guix) (use-package guix
:after magit-popup)
;;;; Helper Functions ;;; Helper Functions
(cl-defun conditional-keybind (cl-defun conditional-keybind
(filter-fn target-fn (filter-fn target-fn
&optional (fail-fn #'self-insert-command)) &optional (fail-fn #'self-insert-command))
@ -126,10 +79,9 @@
(call-interactively target-fn) (call-interactively target-fn)
(call-interactively fail-fn)))) (call-interactively fail-fn))))
;;;; Emacs ;;; Emacs
(use-package emacs (use-package emacs
:elpaca nil :after org
:delight (eldoc-mode " 󰙎")
:custom :custom
(completion-cycle-threshold 10) (completion-cycle-threshold 10)
(display-time-mode t) (display-time-mode t)
@ -137,43 +89,87 @@
(enable-remote-dir-locals t) (enable-remote-dir-locals t)
(fill-column 100) (fill-column 100)
(global-hl-line-mode t) (global-hl-line-mode t)
(global-prettify-symbols-mode t)
(indent-tabs-mode nil) (indent-tabs-mode nil)
(menu-bar-mode nil) (menu-bar-mode nil)
(minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt)) (minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt))
(native-comp-async-report-warnings-errors nil)
(read-extended-command-predicate #'command-completion-default-include-p) (read-extended-command-predicate #'command-completion-default-include-p)
(recentf-mode t) (recentf-mode t)
(pixel-scroll-precision-large-scroll-height 30)
(scroll-bar-mode nil) (scroll-bar-mode nil)
(tab-always-indent 'complete) (tab-always-indent 'complete)
(tool-bar-mode nil) (tool-bar-mode nil)
(newsticker-url-list-defaults nil)
(newsticker-url-list
'(("Tagesschau" "https://www.tagesschau.de/index~atom.xml" nil nil nil)
("NZZ Neuste" "https://www.nzz.ch/recent.rss" nil nil nil)
("SRF News" "https://www.srf.ch/news/bnf/rss/1646" nil nil nil)
("SRF Wissen" "https://www.srf.ch/bnf/rss/630" nil nil nil)
("Deutschlandfunk Nachrichten" "https://www.deutschlandfunk.de/nachrichten-100.rss" nil nil nil)
("Deutschlandfunk Wissen" "https://www.deutschlandfunk.de/wissen-106.rss" nil nil nil)
("RBB" "https://www.rbb24.de/aktuell/index.xml/feed=rss.xml" nil nil nil)
("Guix" "https://guix.gnu.org/feeds/blog.atom" nil nil nil)
("Mastering Emacs" "https://www.masteringemacs.org/feed" nil nil nil)
("Schiene.de" "https://www.schiene.de/feed/" nil nil nil)
("Anil Dash Blog" "https://www.anildash.com/feed.xml" nil nil nil)
("Karl Voit's Blog" "https://karl-voit.at/feeds/lazyblorg-all.atom_1.0.links-and-content.xml" nil nil nil)
("Vaxry's Blog" "https://blog.vaxry.net/feed" nil nil nil)))
:custom-face :custom-face
;;(default ((t (:weight bold :height 113 :width normal :family "VictorMono Nerd Font")))) (default ((t (:weight normal :height 110 :family "MonaspiceXe Nerd Font Mono"))))
(default ((t (:weight regular :height 105 :width narrow :family "MonaspiceXe Nerd Font Mono")))) (fixed-pitch ((t (:weight normal :height 110 :family "MonaspiceXe Nerd Font Mono"))))
(variable-pitch ((t (:weight normal :height 135 :family "MonaspiceXe Nerd Font Propo"))))
:hook :hook
(minibuffer-setup . cursor-intangible-mode) (minibuffer-setup . cursor-intangible-mode)
:config :config
(setq xref-backend-functions (list))
(advice-add 'risky-local-variable-p :override #'ignore) (advice-add 'risky-local-variable-p :override #'ignore)
(global-display-fill-column-indicator-mode t) (global-display-fill-column-indicator-mode t)
(pixel-scroll-precision-mode 1)) (pixel-scroll-precision-mode 1))
;;;; Org Mode (defun set-buffer-variable-pitch ()
(interactive)
(variable-pitch-mode t)
(setq line-spacing 3)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit 'fixed-pitch)
(set-face-attribute 'org-block nil :inherit 'fixed-pitch)
;; investigate: this face does not exist
;;(set-face-attribute 'org-block-background nil :inherit 'fixed-pitch)
)
(use-package outline-minor
:ensure nil
:bind
(:map evil-normal-state-map
("zoc" . #'outline-cycle-buffer))
:hook
clojure-mode
scheme-mode
emacs-lisp-mode)
;;; Org Mode
(use-package org (use-package org
:elpaca (:repo "https://git.savannah.gnu.org/git/emacs/org-mode.git" :branch "emacs-sync") :vc (:fetcher "https://git.savannah.gnu.org/git/emacs/org-mode.git" :rev "emacs-sync")
:preface
(defun cc/org-local-stuff ()
(setq-local visual-fill-column-center-text t))
:after visual-fill-column :after visual-fill-column
:ensure t
:custom :custom
(org-babel-load-languages '((emacs-lisp . t) (org-babel-load-languages '((emacs-lisp . t)
(scheme . t))) (scheme . t)
(visual-fill-column-center-text t) (shell . t)))
:hook :hook
(org-mode . org-indent-mode) (org-mode . org-indent-mode)
(org-src-mode . hack-local-variables) (org-src-mode . hack-local-variables)
(org-mode . visual-line-mode) (org-mode . visual-line-mode)
(org-mode . set-buffer-variable-pitch)
:config :config
(setq org-directory "~/org") (setq org-directory "~/org")
(add-to-list 'org-modules 'collector)) ;;(add-to-list 'org-modules 'collector)
)
(use-package org-roam (use-package org-roam
:ensure t
:custom :custom
(org-roam-directory "~/org/roam") (org-roam-directory "~/org/roam")
:config :config
@ -184,11 +180,9 @@
(consult-notes-org-roam-mode t)) (consult-notes-org-roam-mode t))
(use-package websocket (use-package websocket
:ensure t
:after org-roam) :after org-roam)
(use-package org-roam-ui (use-package org-roam-ui
:ensure t
:after org-roam :after org-roam
:custom :custom
(org-roam-ui-sync-theme t) (org-roam-ui-sync-theme t)
@ -197,16 +191,15 @@
(org-roam-ui-open-on-start t)) (org-roam-ui-open-on-start t))
(use-package org-modern (use-package org-modern
:ensure t
:hook :hook
((org-mode . org-modern-mode) (org-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda))) (org-agenda-finalize . org-modern-agenda))
(use-package org-rainbow-tags (use-package org-rainbow-tags
:hook :hook
(org-mode . org-rainbow-tags-mode)) (org-mode . org-rainbow-tags-mode))
;;;; Design ;;; Design
(use-package color-theme-modern) (use-package color-theme-modern)
(use-package moe-theme) (use-package moe-theme)
(use-package catppuccin-theme (use-package catppuccin-theme
@ -222,42 +215,14 @@
) )
(use-package unicode-fonts (use-package unicode-fonts
:ensure t
:config :config
(unicode-fonts-setup)) (unicode-fonts-setup))
(use-package ligature
:config
(ligature-set-ligatures
't
'( ;; SS01
"==" "===" "=/=" "!=" "!==" "/=" "/==" "~~" "=~" "!~"
;; SS02
">=" "<="
;; SS03
"->" "<-" "=>" "<!--" "-->" "<~" "<~~" "~>" "~~>" "<~>"
;; SS04
"</" "/>" "</>" "/\\" "\\/"
;; SS05
"|>" "<|"
;; SS06
"##" "###"
;; SS07
"***" "/*" "*/" "/*/" "(*" "*)" "(*)"
;; SS08
".=" ".-" "..<"
;; CALT
"//" "///" "&&" "!!" "??" "?." "?:" "||" "::" ":::" ";;" ".." "..." "=!=" "#=" ":=" "=:" "=:="
":>" ">:" "<:" ":<" "..=" "..-"
))
(global-ligature-mode t))
(set-frame-parameter nil 'alpha-background 90) (set-frame-parameter nil 'alpha-background 90)
(add-to-list 'default-frame-alist '(alpha-background . 90)) (add-to-list 'default-frame-alist '(alpha-background . 90))
(use-package lambda-line (use-package lambda-line
;;:straight (:type git :host github :repo "lambda-emacs/lambda-line") :vc (:fetcher github :repo "lambda-emacs/lambda-line")
:elpaca (:host github :repo "lambda-emacs/lambda-line")
:custom :custom
(lambda-line-icon-time t) ;; requires ClockFace font (see below) (lambda-line-icon-time t) ;; requires ClockFace font (see below)
(lambda-line-clockface-update-fontset "ClockFaceRect") ;; set clock icon (lambda-line-clockface-update-fontset "ClockFaceRect") ;; set clock icon
@ -293,8 +258,7 @@
(setq mode-line-format (list "%_")))) (setq mode-line-format (list "%_"))))
(use-package lambda-themes (use-package lambda-themes
;;:straight (:type git :host github :repo "lambda-emacs/lambda-themes") :vc (:fetcher github :repo "lambda-emacs/lambda-themes")
:elpaca (:host github :repo "lambda-emacs/lambda-themes")
:custom :custom
(lambda-themes-set-italic-comments t) (lambda-themes-set-italic-comments t)
(lambda-themes-set-italic-keywords t) (lambda-themes-set-italic-keywords t)
@ -303,34 +267,33 @@
;; load preferred theme ;; load preferred theme
(load-theme 'lambda-dark)) (load-theme 'lambda-dark))
;;;;; Long line handling ;;;; Long line handling
(use-package visual-fill-column (use-package visual-fill-column
:custom :custom
(visual-fill-column-enable-sensible-window-split t) (visual-fill-column-enable-sensible-window-split t)
:hook :hook
(prog-mode . visual-line-mode) (prog-mode . visual-line-mode)
visual-line-mode) visual-line-mode
;; :config
;; (add-hook 'prog-mode-hook #'visual-line-mode)
;; (add-hook 'visual-line-mode-hook #'visual-fill-column-mode)
)
(use-package adaptive-wrap (use-package adaptive-wrap
:config :config
(setq-default adaptive-wrap-extra-indent 4) (setq-default adaptive-wrap-extra-indent 4)
;;(add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)
:hook :hook
(visual-line-mode . adaptive-wrap-prefix-mode)) (visual-line-mode . adaptive-wrap-prefix-mode))
;;;; Security
(use-package keychain-environment
:init
(keychain-refresh-environment))
(use-package pass)
(use-package password-store) (use-package password-store)
(use-package password-store-otp) (use-package password-store-otp)
;;;; Evil Mode (use-package pass)
;;; Evil Mode
(use-package evil (use-package evil
;; :after evil-leader
:ensure t
:init :init
(setq evil-want-keybinding nil (setq evil-want-keybinding nil
evil-emacs-state-tag " 󰯸 " evil-emacs-state-tag " 󰯸 "
@ -342,6 +305,7 @@
:config :config
(evil-set-leader 'normal (kbd "<SPC>")) (evil-set-leader 'normal (kbd "<SPC>"))
(evil-set-leader 'normal (kbd "z") t) (evil-set-leader 'normal (kbd "z") t)
(evil-ex-define-cmd "q" 'delete-frame)
(evil-mode 1) (evil-mode 1)
:bind :bind
(:map evil-normal-state-map (:map evil-normal-state-map
@ -358,10 +322,10 @@
:init :init
(evil-collection-init)) (evil-collection-init))
;;;; Search, Completion, Execution ;;; Search, Completion, Execution
;;;;; Preliminary Packages ;;;; Preliminary Packages
(use-package savehist (use-package savehist
:elpaca nil :ensure nil
:init :init
(savehist-mode)) (savehist-mode))
@ -380,6 +344,8 @@
:config :config
(require 'consult-flymake) (require 'consult-flymake)
(require 'consult-xref) (require 'consult-xref)
:custom
(xref-show-xrefs-function #'consult-xref)
:bind :bind
(:map evil-normal-state-map (:map evil-normal-state-map
("<leader><SPC>" . 'consult-find) ("<leader><SPC>" . 'consult-find)
@ -421,11 +387,15 @@
:commands :commands
which-key-setup-minibuffer which-key-setup-minibuffer
:init :init
(which-key-setup-minibuffer)) (which-key-setup-minibuffer)
:config
(which-key-mode t))
;;;;; Code Completion ;;;; Code Completion
(use-package cape (use-package cape
:preface :config
(require 'cape-char)
(require 'cape-keyword)
(defun my/capf () (defun my/capf ()
(setq completion-at-point-functions (setq completion-at-point-functions
(list (cape-capf-super (list (cape-capf-super
@ -436,11 +406,35 @@
#'cape-line #'cape-line
#'cape-emoji #'cape-emoji
#'cape-keyword)))) #'cape-keyword))))
:config (defun my/eglot-capf ()
(setq completion-at-point-functions
(list (cape-capf-super
#'eglot-completion-at-point
#'tempel-complete
#'cape-dabbrev
#'cape-file
#'cape-dict
#'cape-line
#'cape-emoji
#'cape-keyword))))
(defun my/geiser-capf ()
(setq completion-at-point-functions
(list (apply #'cape-capf-super
(append geiser-capf--capfs
(list
#'tempel-complete
#'cape-dabbrev
#'cape-file
#'cape-dict
#'cape-line
#'cape-emoji
#'cape-keyword))))))
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
:hook :hook
(org-mode . my/capf) (org-mode . my/capf)
(prog-mode . my/capf)) (prog-mode . my/capf)
(eglot-managed-mode . my/eglot-capf)
(geiser-mode . my/geiser-capf))
(defun my/corfu-combined-sort (candidates) (defun my/corfu-combined-sort (candidates)
"Sort CANDIDATES using both display-sort-function and corfu-sort-function." "Sort CANDIDATES using both display-sort-function and corfu-sort-function."
@ -468,6 +462,8 @@
:commands :commands
global-corfu-mode global-corfu-mode
:init :init
(require 'corfu-popupinfo)
(require 'corfu-history)
(global-corfu-mode) (global-corfu-mode)
(corfu-popupinfo-mode 1) (corfu-popupinfo-mode 1)
(corfu-history-mode 1)) (corfu-history-mode 1))
@ -486,10 +482,12 @@
(use-package tempel) (use-package tempel)
(use-package xref-union (use-package xref-union
:custom
(xref-union-excluded-backends (lambda (b) (eq b #'etags--xref-backend)))
:hook :hook
cider-connected) cider-mode)
;;;; Basic Navigation ;;; Basic Navigation
(use-package goto-chg (use-package goto-chg
:bind :bind
(:map evil-normal-state-map (:map evil-normal-state-map
@ -497,15 +495,17 @@
("g;" . 'goto-last-change-reverse))) ("g;" . 'goto-last-change-reverse)))
(use-package evil-snipe (use-package evil-snipe
:delight (evil-snipe-local-mode " 󰓾 ") :after evil-easymotion
:custom :custom
(evil-snipe-scope 'whole-visible) (evil-snipe-scope 'whole-visible)
(evil-snipe-repeat-scope 'whole-buffer) (evil-snipe-repeat-scope 'whole-buffer)
(evil-snipe-spillover-scope 'whole-buffer) (evil-snipe-spillover-scope 'whole-buffer)
(evil-snipe-tab-increment t) (evil-snipe-tab-increment t)
:commands
evil-snipe-override-mode
:init
(evil-snipe-override-mode 1)
:hook :hook
evil-mode
(evil-mode . evil-snipe-override-mode)
(magit-mode . turn-off-evil-snipe-override-mode) (magit-mode . turn-off-evil-snipe-override-mode)
;; See https://github.com/hlissner/evil-snipe/issues/95 ;; See https://github.com/hlissner/evil-snipe/issues/95
;; :config ;; :config
@ -516,11 +516,12 @@
) )
(use-package evil-easymotion (use-package evil-easymotion
:after evil
:config :config
(evilem-default-keybindings "<leader>")) (evilem-default-keybindings "<leader>"))
;;;; Lisp Navigation and Editing ;;; Lisp Navigation and Editing
;;;;; Helper Functions ;;;; Helper Functions
(defun cc/move-sexp-backward () (defun cc/move-sexp-backward ()
"Move balanced expression (sexp) to the right of point backward one sexp. "Move balanced expression (sexp) to the right of point backward one sexp.
Point must be at the beginning of balanced expression (sexp)." Point must be at the beginning of balanced expression (sexp)."
@ -565,22 +566,13 @@ Point must be at the beginning of balanced expression (sexp)."
(defun being-past-closing-paren () (defun being-past-closing-paren ()
(looking-back (rx (or ")" "}" "]")))) (looking-back (rx (or ")" "}" "]"))))
;;;;; Basic ;;;; Basic
(use-package symex
:custom
(symex-modal-backend 'evil)
:config
(symex-initialize)
:bind
(:map evil-insert-state-map
("C-ß" . #'symex-mode-interface)))
(use-package paredit (use-package paredit
:hook
clojure-ts-mode
emacs-lisp-mode
scheme-mode
:config :config
;; (add-hook 'clojure-ts-mode-hook #'paredit-mode)
;; (add-hook 'emacs-lisp-mode-hook #'paredit-mode)
;; (add-hook 'scheme-mode-hook #'paredit-mode)
(evil-define-key 'insert paredit-mode-map (evil-define-key 'insert paredit-mode-map
(kbd "r") (conditional-keybind #'looking-at-opening-paren (kbd "r") (conditional-keybind #'looking-at-opening-paren
#'paredit-raise-sexp) #'paredit-raise-sexp)
@ -593,71 +585,20 @@ Point must be at the beginning of balanced expression (sexp)."
(kbd ">") (conditional-keybind #'being-past-closing-paren (kbd ">") (conditional-keybind #'being-past-closing-paren
#'cc/slurp-forward) #'cc/slurp-forward)
(kbd "<") (conditional-keybind #'being-past-closing-paren (kbd "<") (conditional-keybind #'being-past-closing-paren
#'cc/barf-forward))) #'cc/barf-forward))
:hook
clojure-ts-mode
clojure-mode
emacs-lisp-mode
scheme-mode)
;; (use-package smartparens ;;;; Visual Aid
;; :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 ;; (use-package rainbow-delimiters
;; :hook ;; :hook
;; emacs-lisp-mode ;; emacs-lisp-mode
;; scheme-mode) ;; scheme-mode)
;;;; Programming ;;; Programming
(use-package editorconfig (use-package editorconfig
:delight editorconfig-mode :delight editorconfig-mode
:commands :commands
@ -666,166 +607,111 @@ Point must be at the beginning of balanced expression (sexp)."
(editorconfig-mode 1)) (editorconfig-mode 1))
(use-package flymake (use-package flymake
:ensure nil
:delight '(:eval (cons "" (flymake--mode-line-counters)))) :delight '(:eval (cons "" (flymake--mode-line-counters))))
(use-package eglot (use-package eglot
:preface :ensure nil
(defun my/eglot-capf ()
(setq completion-at-point-functions
(list (cape-capf-super
#'eglot-completion-at-point
#'tempel-complete
#'cape-dabbrev
#'cape-file
#'cape-dict
#'cape-line
#'cape-emoji
#'cape-keyword))))
:custom :custom
(eglot-connect-timeout 90) (eglot-connect-timeout 90)
(eglot-autoshutdown t) (eglot-autoshutdown t)
(eglot-report-progress t) (eglot-report-progress t)
:config :config
(defun eglot-mode () (add-to-list 'eglot-server-programs '(scheme-mode . ("chicken-lsp-server")))
(eglot-inlay-hints-mode +1)
(my/eglot-capf))
(setq-default eglot-workspace-configuration (setq-default eglot-workspace-configuration
'((clojure-lsp (maxCompletions . 300)))) '((clojure-lsp (maxCompletions . 300))))
(add-to-list 'eglot-server-programs
'((clojure-mode clojurec-mode clojurescript-mode)
"clojure-lsp"
:initializationOptions
(:preferences
(:includeInlayParameterNameHints
"all"
:includeInlayParameterNameHintsWhenArgumentMatchesName
t
:includeInlayFunctionParameterTypeHints
t
:includeInlayVariableTypeHints
t
:includeInlayVariableTypeHintsWhenTypeMatchesName
t
:includeInlayPRopertyDeclarationTypeHints
t
:includeInlayFunctionLikeReturnTypeHints
t
:includeInlayEnumMemberValueHints
t))))
:hook :hook
(clojure-mode . eglot-ensure)
(eglot-managed-mode . (lambda () (eglot-managed-mode . (lambda ()
(add-hook 'before-save-hook (add-hook 'before-save-hook
(lambda () (lambda ()
(call-interactively #'eglot-format-buffer)) (call-interactively #'eglot-format-buffer))
nil 'local))) nil 'local)))
(eglot-managed-mode . eglot-inlay-hints-mode) (eglot-managed-mode . eglot-inlay-hints-mode))
(eglot-managed-mode . my/eglot-capf))
(use-package consult-eglot (use-package consult-eglot
:after (consult eglot)) :after (consult eglot))
(use-package tree-sitter ;;;; Clojure
:ensure t) (use-package clojure-mode
;;;;; Clojure
(use-package clojure-ts-mode
:preface :preface
(defun embark-eglot-rename (from to) (defun embark-eglot-rename (from to)
"Renames the symbol at point." "Renames the symbol at point."
(interactive "sRename: \nsRename %s to: ") (interactive "sRename: \nsRename %s to: ")
(funcall-interactively #'eglot-rename to)) (funcall-interactively #'eglot-rename to))
:delight "" :delight ""
:after (tree-sitter embark) :after (embark cider)
:config :config
(require 'sesman)
(sesman-install-menu clojure-mode-map)
(defvar-keymap embark-clj-identifier-map (defvar-keymap embark-clj-identifier-map
:parent embark-identifier-map :parent embark-identifier-map
"c" #'embark-eglot-rename) "c" #'embark-eglot-rename)
(add-to-list 'embark-keymap-alist '(identifier . embark-clj-identifier-map)) (add-to-list 'embark-keymap-alist '(identifier . embark-clj-identifier-map))
:hook :hook
((clojure-ts-mode . eglot-ensure) (clojure-mode . (lambda ()
(clojure-ts-mode . prettify-symbols-mode) (setq-local prettify-symbols-alist
(clojure-ts-mode . (lambda () '(("fn" . "λ")
(setq-local sesman-system 'CIDER) ("comp" . "")
(setq-local prettify-symbols-alist '(("fn" . "λ"))))) ("and" . "")
(clojure-ts-mode . (lambda () ("or" . "")
(sesman-install-menu clojure-mode-map))) ("not" . "¬"))))))
(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 (use-package cider
:elpaca (:host github :repo "clojure-emacs/cider" :tag "v1.12.0") ;;:elpaca (:host github :repo "clojure-emacs/cider" :tag "v1.12.0")
:delight (cider-mode '(:eval (concat "  [" (cider--modeline-info) "]"))) :delight (cider-mode '(:eval (concat "  [" (cider--modeline-info) "]")))
:config :config
(evil-define-key 'insert 'cider-mode-map
"C-x C-e" #'cider-eval-last-sexp)
(evil-define-key 'normal 'cider-mode-map (evil-define-key 'normal 'cider-mode-map
(kbd "<localleader>ce") #'cider-eval-sexp-at-point)) (kbd "<localleader>ce") #'cider-eval-sexp-at-point))
;;;;; Scheme ;;;; Scheme
(use-package geiser (use-package geiser
:preface
(defun my/geiser-capf ()
(setq completion-at-point-functions
(append geiser-capf--capfs
(list (cape-capf-super
#'tempel-complete
#'cape-dabbrev
#'cape-file
#'cape-dict
#'cape-line
#'cape-emoji
#'cape-keyword)))))
:custom :custom
(geiser-chicken-match-limit 200) (geiser-chicken-match-limit 200)
:config :config
(defalias 'run-geiser 'geiser) (defalias 'run-geiser 'geiser))
:hook
(geiser-mode . my/geiser-capf))
(use-package paren-face (use-package paren-face
:hook :hook
scheme-mode scheme-mode
emacs-lisp-mode emacs-lisp-mode
clojure-ts-mode) clojure-ts-mode
;; :config
;; (add-hook 'scheme-mode-hook #'paren-face-mode)
;; (add-hook 'emacs-lisp-mode-hook #'paren-face-mode)
;; (add-hook 'clojure-ts-mode-hook #'paren-face-mode)
)
(use-package highlight-parentheses (use-package highlight-parentheses
:hook prog-mode) :custom
(highlight-parentheses-highlight-adjacent t)
(highlight-parentheses-colors '("yellow" "light gray" "dark gray" "dim gray"))
:hook
prog-mode
;; :config
;; (add-hook 'prog-mode-hook #'highlight-parentheses-mode)
)
;;;;;; Chicken Scheme ;;;;; Chicken Scheme
(use-package scheme (use-package scheme
:elpaca nil :ensure nil
:hook :hook
(scheme-mode . eglot-ensure) (scheme-mode . eglot-ensure)
(scheme-mode . prettify-symbols-mode)
(scheme-mode . (lambda () (scheme-mode . (lambda ()
(setq-local prettify-symbols-alist (setq-local prettify-symbols-alist
'(("lambda" . "λ")))))) '(("lambda" . "λ")
("compose" . "")
("and" . "")
("or" . "")
("not" . "¬"))))))
(defun flymake-chicken-init () (defun flymake-chicken-init ()
(add-hook 'flymake-diagnostic-functions (add-hook flymake-diagnostic-functions
#'flymake-chicken-backend nil t) flymake-chicken-backend nil t)
(flymake-mode)) (flymake-mode))
(use-package geiser-chicken) (use-package geiser-chicken)
;;;;;; Guile ;;;;; Guile
(use-package geiser-guile (use-package geiser-guile
:config :config
@ -842,13 +728,16 @@ Point must be at the beginning of balanced expression (sexp)."
;; :config ;; :config
;; (add-hook 'flymake-diagnostic-functions #'flymake-chicken-backend nil t)) ;; (add-hook 'flymake-diagnostic-functions #'flymake-chicken-backend nil t))
;;;; Other Languages ;;; Other Languages
(use-package zig-mode (use-package zig-mode
:hook :hook
(zig-mode . eglot-ensure) (zig-mode . eglot-ensure)
:mode ("\\.zig\\'" . zig-mode)) :mode ("\\.zig\\'" . zig-mode))
(use-package nix-mode
:mode ("\\.nix\\'" . nix-mode))
;; (use-package lsp-tailwindcss ;; (use-package lsp-tailwindcss
;; :init ;; :init
;; (setq lsp-tailwindcss-add-on-mode t ;; (setq lsp-tailwindcss-add-on-mode t
@ -862,43 +751,90 @@ Point must be at the beginning of balanced expression (sexp)."
:hook :hook
((dhall-mode . lsp))) ((dhall-mode . lsp)))
;;;; Version Control ;;; Version Control
;;;;; Git ;;;; Git
;; Magit requires 'transient' >= 0.5.0, but due to bad defaults, Emacs' package manager refuses to
;; upgrade this and other built-in packages to higher releases from GNU Elpa.
(use-package transient
:init
(progn (unload-feature 'transient t)
(require 'transient)))
;; To fix this, you have to add this to your init file:
;; (setq package-install-upgrade-built-in t)
;; You must also make sure the updated version is loaded, by evaluating the `progn` form below.
(use-package magit (use-package magit
:autoload :after magit-popup
magit) :init
(progn (unload-feature 'transient t)
(require 'transient)))
(use-package hl-todo)
(use-package magit-todos (use-package magit-todos
:after magit :after (magit hl-todo)
:hook :hook
(magit-mode . magit-todos-mode)) (magit-mode . magit-todos-mode))
(use-package magit-popup)
(use-package forge (use-package forge
:after magit :after magit
:config :config
(advice-add 'magit :after (lambda (&rest _args) (advice-add 'magit :after (lambda (&rest _args)
(call-interactively #'forge-pull)))) (call-interactively #'forge-pull))))
(use-package code-review
:after forge
:custom
(code-review-auth-login-marker 'forge))
(use-package git-gutter (use-package git-gutter
:delight git-gutter-mode :hook
:hook prog-mode) prog-mode
;; :config
;; (add-hook 'prog-mode-hook #'git-gutter-mode)
)
;;; File Formats
;;;; Beancount
(use-package beancount
:vc (:fetcher github :repo "beancount/beancount-mode"))
;;;; Asciidoc
(use-package adoc-mode
:hook
(adoc-mode . visual-line-mode)
(adoc-mode . (lambda () (setq-local visual-fill-column-center-text t))))
;;;; LaTeX ;;; LaTeX
;; https://github.com/politza/pdf-tools/#known-problems ;; https://github.com/politza/pdf-tools/#known-problems
(add-hook 'TeX-after-compilation-finished-functions (add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer) #'TeX-revert-document-buffer)
;;;; Communication ;;; Communication
;;;;; IRC
;;;; E-Mail
(use-package gnus
:custom
(message-send-mail-function 'message-send-mail-with-sendmail)
(sendmail-program "msmtp")
(message-sendmail-f-is-evil t)
(message-sendmail-extra-arguments '("--read-envelope-from")))
(use-package piem
:vc (piem :url "https://git.kyleam.com/piem"))
(use-package git-email
:vc (:fetcher codeberg :repo "martianh/git-email")
:after (magit piem)
:init
(require 'git-email-magit)
(require 'git-email-gnus)
(require 'git-email-piem))
(use-package notmuch)
(use-package consult-notmuch)
;;;; IRC
(use-package rcirc (use-package rcirc
:elpaca nil :ensure nil
:ensure t
:after password-store :after password-store
:custom :custom
(rcirc-server-alist (rcirc-server-alist
@ -921,7 +857,7 @@ Point must be at the beginning of balanced expression (sexp)."
:encryption tls :encryption tls
:channels ())))) :channels ()))))
;;;; Wrapping Up ;;; Wrapping Up
(use-package envrc (use-package envrc
:config :config
(envrc-global-mode)) (envrc-global-mode))

View file

@ -40,30 +40,54 @@ for authorized =.dir-local= variables and similar stuff.
** Package Manager ** Package Manager
I use =straight.el= as package manager. Most packages are being installed using =Guix=, for the few remaining ones that have to be fetched from Git, I use
[[https://github.com/progfolio/elpaca][Elpaca]].
#+NAME: straight-settings #+begin_src emacs-lisp
| Setting | Value | (defvar elpaca-installer-version 0.6)
|-------------------------+-------| (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
| Use Straight as default | f | (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))
#+end_src
#+begin_src emacs-lisp :var tbl=straight-settings A few additional lines are necessary to integrate it with =use-package=:
(defvar bootstrap-version) #+begin_src emacs-lisp
(let ((bootstrap-file (elpaca elpaca-use-package
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (elpaca-use-package-mode)
(bootstrap-version 6)) (setq elpaca-use-package-by-default nil))
(unless (file-exists-p bootstrap-file) (elpaca-wait)
(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))
(let ((settings (car tbl)))
(setq straight-use-package-by-default
(string= "t" (cl-first settings))))
#+end_src #+end_src
* Helper Functions * Helper Functions
@ -86,15 +110,32 @@ The first one is a function to create conditional keybindings.
* Core Emacs Customization :important: * Core Emacs Customization :important:
#+begin_src emacs-lisp Enabled core modes:
#+NAME: enabled-core-modes
- display-time-mode
- global-hl-line-mode
- global-prettify-symbols-mode
- recentf-mode
Disabled core modes:
#+NAME: disabled-core-modes
- indent-tabs-mode
- menu-bar-mode
- scroll-bar-mode
- tool-bar-mode
#+begin_src emacs-lisp :var enabled=enabled-core-modes :var disabled=disabled-core-modes
(use-package emacs (use-package emacs
:delight (eldoc-mode " 󰙎")
:custom :custom
(completion-cycle-threshold 10) (completion-cycle-threshold 10)
(display-time-mode t) (display-time-mode t)
(enable-recursive-minibuffers t) (enable-recursive-minibuffers t)
(enable-remote-dir-locals t) (enable-remote-dir-locals t)
(fill-column 100)
(global-hl-line-mode t) (global-hl-line-mode t)
(global-prettify-symbols-mode t)
(indent-tabs-mode nil) (indent-tabs-mode nil)
(menu-bar-mode nil) (menu-bar-mode nil)
(minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt)) (minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt))
@ -111,3 +152,5 @@ The first one is a function to create conditional keybindings.
(advice-add 'risky-local-variable-p :override #'ignore)) (advice-add 'risky-local-variable-p :override #'ignore))
#+end_src #+end_src
** Sending Mail

View file

@ -30,8 +30,6 @@ args@{ config, pkgs, split-monitor-workspaces, flatpaks, ... }:
iconv iconv
kteatime kteatime
lagrange lagrange
libffi
libgccjit
liquidprompt liquidprompt
kdePackages.dolphin kdePackages.dolphin
kdePackages.ksshaskpass kdePackages.ksshaskpass
@ -39,6 +37,7 @@ args@{ config, pkgs, split-monitor-workspaces, flatpaks, ... }:
libuuid libuuid
lm_sensors lm_sensors
gnumake gnumake
mattermost
# (nerdfonts.override { fonts = [ "VictorMono" "MPlus" ]; }) # (nerdfonts.override { fonts = [ "VictorMono" "MPlus" ]; })
nerdfonts nerdfonts
nixd nixd
@ -57,6 +56,8 @@ args@{ config, pkgs, split-monitor-workspaces, flatpaks, ... }:
signal-desktop signal-desktop
slurp slurp
space-cadet-pinball space-cadet-pinball
lutris
steam
sqlite sqlite
stow stow
swappy swappy
@ -174,14 +175,13 @@ args@{ config, pkgs, split-monitor-workspaces, flatpaks, ... }:
packages = [ packages = [
"flathub:app/com.github.tchx84.Flatseal//stable" "flathub:app/com.github.tchx84.Flatseal//stable"
"flathub:app/com.usebottles.bottles//stable" "flathub:app/com.usebottles.bottles//stable"
"flathub:app/com.valvesoftware.Steam//stable"
"flathub:app/info.beyondallreason.bar//stable" "flathub:app/info.beyondallreason.bar//stable"
]; ];
}; };
services.syncthing = { services.syncthing = {
enable = true; enable = true;
tray.enable = true; # tray.enable = true;
}; };
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;