You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

3.5 KiB

Bootstrap

Helpers

  (defun uno-emacs-path (name)
    "Path of NAME relative to user Emacs directory."
    (expand-file-name (locate-user-emacs-file
                       (convert-standard-filename name))))

  (defun uno-path (&optional name)
    "Path of NAME relative to uno directory."
    (uno-emacs-path (concat "uno/" name)))

  (defun uno-assets-path (&optional name)
    "Path of NAME relative to uno assets directory."
    (uno-path (concat "assets/" name)))

  (defun uno-cache-path (&optional name)
    "Path of NAME relative to uno cache directory."
    (uno-emacs-path (concat "cache/" name)))

  (defun uno-private-path (&optional name)
    "Path of NAME relative to uno private directory."
    (uno-path (concat "private/" name)))

Local Customizations (Pre-Bootstrap)

  (defvar uno-local (uno-private-path "local.el")
    "Localized customization file.")

  (defvar uno-local-after-hook nil
    "Hook to run after customizations are done.")

  (load uno-local 'noerror)

Backup Files

Isolate or remove backup files for a clean structure.

  (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))
    bookmark-default-file (uno-cache-path "bookmarks")
    create-lockfiles nil
    nsm-settings-file (uno-cache-path "network-security.data")
    recentf-save-file (uno-cache-path "recentf/list")
    tramp-persistency-file-name (uno-cache-path "tramp/history"))

General

Set up generic and leader key binds that are used throughout. general is loaded first to set up integration with evil before setting up general.

  (use-package general)

  (use-package evil
    :custom
    (evil-want-keybinding nil)
    :init
    (general-evil-setup))

  (use-package general
    :custom
    (general-override-states '(insert
                               emacs
                               hybrid
                               normal
                               visual
                               motion
                               operator
                               replace))
    :init
    (defvar uno-leader-key "SPC"
      "Leader key.")
    (defvar uno-mode-leader-key ","
      "Mode leader key.")
    :config
    (general-create-definer uno-define
      :states '(motion normal visual))
    (general-create-definer uno-leader-define
      :prefix uno-leader-key
      :keymaps 'override
      :states '(motion normal visual))
    (general-create-definer uno-mode-leader-define
      :prefix uno-mode-leader-key
      :keymaps 'override
      :states '(motion normal visual)))

Modules

Traverse through modules and load each one.

  (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)))

Isolate Custom File

  (when (null custom-file)
    (setq custom-file (uno-cache-path "custom.el"))
    (load custom-file 'noerror))

Local Customizations (Post-Bootstrap)

  (run-hooks 'uno-local-after-hook)