#+TITLE: Bootstrap #+AUTHOR: Juan Placencia * Helpers #+BEGIN_SRC emacs-lisp (defun uno-emacs-path (name) (expand-file-name (locate-user-emacs-file (convert-standard-filename name)))) (defun uno-path (name) (uno-emacs-path (concat "uno/" name))) (defun uno-assets-path (name) (uno-path (concat "assets/" name))) (defun uno-cache-path (name) (uno-emacs-path (concat "cache/" name))) #+END_SRC * Backup Files Isolate or remove backup files for a clean structure. #+BEGIN_SRC emacs-lisp (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) auto-save-list-file-prefix (uno-cache-path "auto-save-list/.saves-") backup-directory-alist `((".*" . ,temporary-file-directory)) create-lockfiles nil recentf-save-file (uno-cache-path "recentf/list") tramp-persistency-file-name (uno-cache-path "tramp/history")) #+END_SRC * Straight + Use Package Run bootstrap code for =straight= and have =use-package= ready. #+BEGIN_SRC emacs-lisp (setq straight-use-package-by-default t) (let ((bootstrap-file (uno-emacs-path "straight/repos/straight.el/bootstrap.el")) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (use-package general) #+END_SRC * General Set up general and leader key binds that are used throughout. #+BEGIN_SRC emacs-lisp (use-package evil :custom (evil-want-keybinding nil) :init (general-evil-setup)) (use-package general :init (defvar uno-leader-key "SPC" "Leader key.") (defvar uno-mode-leader-key "," "Mode leader key.") :config (general-create-definer uno-define :states 'motion) (general-create-definer uno-leader-define :prefix uno-leader-key :states 'motion) (general-create-definer uno-mode-leader-define :prefix uno-mode-leader-key :states 'motion) (uno-leader-define "" nil) (uno-mode-leader-define "" nil)) #+END_SRC * Modules #+BEGIN_SRC emacs-lisp (let* ((uno-module-directory (uno-path "modules/")) (uno-module-files (directory-files-recursively uno-module-directory "\\.org$" nil t))) (dolist (file (reverse uno-module-files)) (org-babel-load-file file))) #+END_SRC * Isolate Custom File #+BEGIN_SRC emacs-lisp (when (null custom-file) (setq custom-file (uno-cache-path "custom.el")) (load custom-file 'noerror)) #+END_SRC