This commit is contained in:
Daniel Ziltener 2023-11-27 15:30:15 +01:00
parent 8b669d32b9
commit 35978aca9a
Signed by: zilti
GPG key ID: B38976E82C9DAE42
2 changed files with 126 additions and 12 deletions

View file

@ -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};
# '';
# }))
]);
}

113
emacs/init.org Normal file
View file

@ -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