From 35978aca9ae9473ef1e2d0eb20980712685e23f0 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Mon, 27 Nov 2023 15:30:15 +0100 Subject: [PATCH] . --- chicken/chicken.nix | 25 +++++----- emacs/init.org | 113 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 12 deletions(-) create mode 100644 emacs/init.org diff --git a/chicken/chicken.nix b/chicken/chicken.nix index a7e5a13..c97c81b 100644 --- a/chicken/chicken.nix +++ b/chicken/chicken.nix @@ -18,16 +18,17 @@ srfi-69 srfi-197 utf8 - ] ++ [ pkgs.chicken ]; - - nixpkgs.overlays = [ - (final: prev: { - chicken = prev.chicken.overrideAttrs (oldAttrs: { - postInstall = (oldAttrs.postInstall or "") + '' - cd `csi -R chicken.platform -p '(chicken-home)'` - curl https://3e8.org/pub/chicken-doc/chicken-doc-repo-5.tgz | sudo tar zx - ''; - }); - }) - ]; + ] ++ (with pkgs; [ + chicken + # (chicken.overrideAttrs (final: previous: { + # assets = fetchurl { + # url = "https://3e8.org/pub/chicken-doc/chicken-doc-repo-5.tgz"; + # sha256 = "sha256-3fwcepem+1xj5UlQ+fCjvjHVtE8LO5co2A0k5gx5cZU="; + # }; + # postInstall = (previous.postInstall or "") + '' + # cd `csi -R chicken.platform -p '(chicken-home)'`; + # tar zxf ${assets}; + # ''; + # })) + ]); } diff --git a/emacs/init.org b/emacs/init.org new file mode 100644 index 0000000..40746e5 --- /dev/null +++ b/emacs/init.org @@ -0,0 +1,113 @@ +#+TITLE: Emacs Init File +#+AUTHOR: Daniel Ziltener + +* Initialization + +** Requirements + +Since I am using ~cl-defun~ in this init file, I need to import ~cl-macs~. + +#+begin_src emacs-lisp + (require 'cl-macs) +#+end_src + +** Personal Information + +#+NAME: pers-info-table +| Name | Mail | +|-----------------+---------------------| +| Daniel Ziltener | dziltener@lyrion.ch | + +#+begin_src emacs-lisp :var input=pers-info-table + (let ((row (car input))) + (setq user-full-name (cl-first row)) + (setq user-mail-address (cl-second row))) +#+end_src + +For storage of passwords, I use [[https://www.passwordstore.org/][pass]]: src_emacs-lisp[]{(auth-source-pass-enable)} + +** Customizations + +Since this init file is version controlled, and I set all customizations +myself in =use-package= blocks, I want Emacs to use a separate file +for authorized =.dir-local= variables and similar stuff. + +#+begin_src emacs-lisp + (setq custom-file "~/.emacs.d/custom.el") + (when (file-exists-p custom-file) + (load custom-file)) +#+end_src + +** Package Manager + +I use =straight.el= as package manager. + +#+NAME: straight-settings +| Setting | Value | +|-------------------------+-------| +| Use Straight as default | f | + +#+begin_src emacs-lisp :var tbl=straight-settings + (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)) + + (let ((settings (car tbl))) + (setq straight-use-package-by-default + (string= "t" (cl-first settings)))) +#+end_src + +* Helper Functions + +Those are meant to reduce code duplication, and add some basic useful features. +The first one is a function to create conditional keybindings. + +#+BEGIN_SRC emacs-lisp + (cl-defun conditional-keybind + "Creates a keybinding that checks `filter-fn`. If it succeeds, + `target-fn` is run, otherwise `fail-fn`. If no fail-fn is given, + `self-insert-command` is run instead. + `target-fn` and `fail-fn` must both be interactive." + (lambda (_prefix) + (interactive "P") + (if (funcall filter-fn) + (call-interactively target-fn) + (call-interactively fail-fn)))) +#+end_src + +* Core Emacs Customization :important: + +#+begin_src emacs-lisp +(use-package emacs + :delight (eldoc-mode " 󰙎") + :custom + (completion-cycle-threshold 10) + (display-time-mode t) + (enable-recursive-minibuffers t) + (enable-remote-dir-locals t) + (global-hl-line-mode t) + (indent-tabs-mode nil) + (menu-bar-mode nil) + (minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt)) + (read-extended-command-predicate #'command-completion-default-include-p) + (recentf-mode t) + (scroll-bar-mode nil) + (tab-always-indent 'complete) + (tool-bar-mode nil) + :custom-face + (default ((t (:weight bold :height 113 :width normal :family "VictorMono Nerd Font")))) + :hook + (minibuffer-setup . cursor-intangible-mode) + :config + (advice-add 'risky-local-variable-p :override #'ignore)) +#+end_src +