Browse Source

Refactor README

main
parent
commit
1b9cbc85f3
  1. 173
      README.org
  2. 105
      init.el

173
README.org

@ -13,125 +13,44 @@
#+ATTR_LATEX: :width 420px #+ATTR_LATEX: :width 420px
[[./docs/images/desktop-alt.png]] [[./docs/images/desktop-alt.png]]
Portable *GNU Emacs*[fn:1] dotfiles. Built for Life, Liberty, and the Open Road.
Portable [[https://gnu.org/software/emacs][GNU/Emacs]][fn:1] dotfiles. Built for Life, Liberty, and the Open Road.
+ 100% Literate + 100% Literate
+ 100% Immutable + 100% Immutable
+ 100% Reproducible + 100% Reproducible
* What is it?
* Init
From the documentation[fn:1]:
#+begin_quote
*An extensible, customizable, free/libre text editor -- and more*
At its core is an interpreter for *Emacs Lisp*[fn:2], a dialect of the Lisp programming language with extensions to support text editing.
#+end_quote
To highlight some of the features available out of the box:
+ Content aware editing modes
+ Complete built-in documentation
+ Full unicode support for all human languages
+ Packaging sysystem for third party extensions
+ Wide range of functionality beyond text editing
* How does it work?
1. *Emacs* reads the configuration at ~$HOME/.emacs.d/init.el~ at startup
2. *This file* outputs some startup code to that location
1. Defines all of the options for hosts
2. Runs some required startup code
3. Loads the host definition file at ~$HOME/.emacs.d/host/$HOSTNAME~
4. Loads the enabled modules in ~dotfiles/modules~
** Options
Here's a complete list of all of the options configurable for each host, and their default values.
+ All variables prefixed with ~dotfiles/~
+ Initialized prior to loading of packages or hosts
This project makes heavy use of modern features and libraries. Since [[https://orgmode.org/worg/org-contrib/babel/intro.html][Org-babel]][fn:2]'s used during the initialization, [[https://orgmode.org][Org-mode]][fn:3] must load prior to importing any custom modules. My solution includes the introduction of some early intitialization code written in [[https://gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]][fn:4].
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar dotfiles/home user-emacs-directory
"Original value of `user-emacs-directory'.")
(defvar dotfiles/cache (expand-file-name "~/.cache/emacs")
"Redirection target of `user-emacs-directory'.")
(defvar dotfiles/browser (getenv "BROWSER")
"Default system web browser.")
(defvar dotfiles/language (getenv "LANG")
"Default system dictionary language.")
(defconst dotfiles/modules-p
'(core
editor
shell
email
terminal
encryption
desktop
writing
website
capture
projects
development
interface
dashboard)
"All of the available modules.")
(defvar dotfiles/modules dotfiles/modules-p
"All of the enabled modules.")
(defvar dotfiles/font "Fira Code"
"Unified system font family.")
(defvar dotfiles/font-size 96
"Unified system font size.")
(defvar dotfiles/idle 0.0
"Delay time before offering suggestions and completions.")
(defvar dotfiles/leader-key "SPC"
"All powerful leader key.")
(defvar dotfiles/leader-key-global
(concat "C-" dotfiles/leader-key)
"Global prefix for the leader key.")
(defvar dotfiles/projects
(expand-file-name "~/.local/source/")
"Location of source code projects.")
(defvar dotfiles/passwords
(expand-file-name "~/.password-store/")
"Location of local password store.")
(defvar dotfiles/public-key
"37AB1CB72B741E478CA026D43025DCBD46F81C0F"
"GPG key to encrypt org files for.")
(load-file "~/.emacs.d/bin/options.el")
(load-file "~/.emacs.d/bin/cleanup.el")
(load-file "~/.emacs.d/bin/packages.el")
#+end_src #+end_src
** Startup
** Load host definition
This project makes heavy use of modern features and libraries. Since *Babel's* [fn:3] used in initialization, *Org* [fn:4] must load prior to importing any of custom modules. This introduces a unique *chicken or the egg* [fn:5] problem. My solution included some initialization code in *Emacs Lisp* [fn:2] called before using any *Babel* [fn:3] APIs.
Begin the process by loading any host specific option overrides. The host configuration tangles, and loads (if it exist) using the systems name. If a host definition doesn't exist the default values remain.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(load-file "~/.emacs.d/bin/cleanup.el")
(load-file "~/.emacs.d/bin/packages.el")
(let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
(when (file-exists-p host-file)
(org-babel-load-file host-file)))
#+end_src #+end_src
* Getting started
** Load enabled modules
*How to install*
All of the modules in ~dotfiles/modules~ load after the host overrides. By default, all of the packages defined in ~dotfiles/modules-p~ load. Override this behaviour in a host configuration file.
1. Clone ~git clone git@github.com:chayward1/dotfiles.git ~/.emacs.d~
2. Run ~emacs --mm --debug-init~
#+begin_src emacs-lisp
(dolist (m dotfiles/modules)
(let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
(when (file-exists-p mod-file)
(org-babel-load-file mod-file))))
#+end_src
** Hosts
* Hosts
Each host machines configuration loaded immediately after declaring the options, before applying any configuration. This allows system to system control while remaining immutable. Override any of the available options configurations in a host file. Here's some examples to get started: Each host machines configuration loaded immediately after declaring the options, before applying any configuration. This allows system to system control while remaining immutable. Override any of the available options configurations in a host file. Here's some examples to get started:
@ -141,15 +60,7 @@ Each host machines configuration loaded immediately after declaring the options,
+ [[file:hosts/acernitro.org][Acernitro]] + [[file:hosts/acernitro.org][Acernitro]]
+ [[file:hosts/virtualbox.org][Virtualbox]] + [[file:hosts/virtualbox.org][Virtualbox]]
Begin the process by loading any host specific overrides. The host configuration tangles, and loads (if it exist) using the systems name.
#+begin_src emacs-lisp
(let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
(when (file-exists-p host-file)
(org-babel-load-file host-file)))
#+end_src
** Modules
* Modules
Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Here are all of the available modules, also listed in the variable ~dotfiles/modules-p~. Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Here are all of the available modules, also listed in the variable ~dotfiles/modules-p~.
@ -167,19 +78,41 @@ Breaking down the project into logical units or chapters to keep the code more m
+ [[file:modules/interface.org][Interface]] + [[file:modules/interface.org][Interface]]
+ [[file:modules/dashboard.org][Dashboard]] + [[file:modules/dashboard.org][Dashboard]]
By default all of the modules will load, override the variable ~dotfiles/modules~ in a host configuration.
* Options
#+begin_src emacs-lisp
(dolist (m dotfiles/modules)
(let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
(when (file-exists-p mod-file)
(org-babel-load-file mod-file))))
#+end_src
Here's a complete list of all of the options configurable for each host, and their default values.
+ All variables prefixed with ~dotfiles/~
+ Initialized prior to loading of packages or hosts
| Name | Default | Description |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/home | ~/.emacs.d | Original value of `user-emacs-directory'. |
| dotfiles/cache | ~/.cache/emacs | Redirection target of `user-emacs-directory'. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/browser | $BROWSER | Default system web browser. |
| dotfiles/language | $LANG | Default system dictionary language. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/modules-p | (...) | All of the available modules. |
| dotfiles/modules | dotfiles/modules-p | ALl of the enabled modules. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/font | Fira Code | Unified system font family. |
| dotfiles/font-size | 96 | Unified system font size. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/idle | 0.0 | Delay time before offering suggestions and completions. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/leader-key | SPC | All powerful leader key. |
| dotfiles/leader-key-global | C-(dotfiles/leader) | Global prefix for the leader key. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/projects | ~/.local/source | Location of source code projects. |
| dotfiles/passwords | ~/.password-store | Location of local password store. |
|----------------------------+---------------------+---------------------------------------------------------|
| dotfiles/public-key | (...) | GPG key to encrypt org files for. |
* Resources * Resources
[fn:1] https://gnu.org/software/emacs [fn:1] https://gnu.org/software/emacs
[fn:2] https://gnu.org/software/emacs/manual/html_node/elisp/index.html
[fn:3] https://orgmode.org/worg/org-contrib/babel/intro.html
[fn:4] https://orgmode.org
[fn:2] https://orgmode.org/worg/org-contrib/babel/intro.html
[fn:3] https://orgmode.org
[fn:4] https://gnu.org/software/emacs/manual/html_node/elisp/index.html
[fn:5] https://en.wikipedia.org/wiki/Chicken_or_the_egg [fn:5] https://en.wikipedia.org/wiki/Chicken_or_the_egg

105
init.el

@ -1,115 +1,24 @@
;; Options
;; Init
;; Here's a complete list of all of the options configurable for each host, and their default values.
;; + All variables prefixed with ~dotfiles/~
;; + Initialized prior to loading of packages or hosts
(defvar dotfiles/home user-emacs-directory
"Original value of `user-emacs-directory'.")
(defvar dotfiles/cache (expand-file-name "~/.cache/emacs")
"Redirection target of `user-emacs-directory'.")
(defvar dotfiles/browser (getenv "BROWSER")
"Default system web browser.")
(defvar dotfiles/language (getenv "LANG")
"Default system dictionary language.")
(defconst dotfiles/modules-p
'(core
editor
shell
email
terminal
encryption
desktop
writing
website
capture
projects
development
interface
dashboard)
"All of the available modules.")
(defvar dotfiles/modules dotfiles/modules-p
"All of the enabled modules.")
(defvar dotfiles/font "Fira Code"
"Unified system font family.")
(defvar dotfiles/font-size 96
"Unified system font size.")
(defvar dotfiles/idle 0.0
"Delay time before offering suggestions and completions.")
(defvar dotfiles/leader-key "SPC"
"All powerful leader key.")
(defvar dotfiles/leader-key-global
(concat "C-" dotfiles/leader-key)
"Global prefix for the leader key.")
(defvar dotfiles/projects
(expand-file-name "~/.local/source/")
"Location of source code projects.")
(defvar dotfiles/passwords
(expand-file-name "~/.password-store/")
"Location of local password store.")
(defvar dotfiles/public-key
"37AB1CB72B741E478CA026D43025DCBD46F81C0F"
"GPG key to encrypt org files for.")
;; Startup
;; This project makes heavy use of modern features and libraries. Since *Babel's* [fn:3] used in initialization, *Org* [fn:4] must load prior to importing any of custom modules. This introduces a unique *chicken or the egg* [fn:5] problem. My solution included some initialization code in *Emacs Lisp* [fn:2] called before using any *Babel* [fn:3] APIs.
;; This project makes heavy use of modern features and libraries. Since [[https://orgmode.org/worg/org-contrib/babel/intro.html][Org-babel]][fn:2]'s used during the initialization, [[https://orgmode.org][Org-mode]][fn:3] must load prior to importing any custom modules. My solution includes the introduction of some early intitialization code written in [[https://gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]][fn:4].
(load-file "~/.emacs.d/bin/options.el")
(load-file "~/.emacs.d/bin/cleanup.el") (load-file "~/.emacs.d/bin/cleanup.el")
(load-file "~/.emacs.d/bin/packages.el") (load-file "~/.emacs.d/bin/packages.el")
;; Hosts
;; Each host machines configuration loaded immediately after declaring the options, before applying any configuration. This allows system to system control while remaining immutable. Override any of the available options configurations in a host file. Here's some examples to get started:
;; + [[file:hosts/localhost.org][Termux]]
;; + [[file:hosts/gamingpc.org][Gamingpc]]
;; + [[file:hosts/raspberry.org][Raspberry]]
;; + [[file:hosts/acernitro.org][Acernitro]]
;; + [[file:hosts/virtualbox.org][Virtualbox]]
;; Load host definition
;; Begin the process by loading any host specific overrides. The host configuration tangles, and loads (if it exist) using the systems name.
;; Begin the process by loading any host specific option overrides. The host configuration tangles, and loads (if it exist) using the systems name. If a host definition doesn't exist the default values remain.
(let ((host-file (concat dotfiles/home "/hosts/" system-name ".org"))) (let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
(when (file-exists-p host-file) (when (file-exists-p host-file)
(org-babel-load-file host-file))) (org-babel-load-file host-file)))
;; Modules
;; Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Here are all of the available modules, also listed in the variable ~dotfiles/modules-p~.
;; + [[file:modules/core.org][Core]]
;; + [[file:modules/editor.org][Editor]]
;; + [[file:modules/email.org][Email]]
;; + [[file:modules/encryption.org][Encryption]]
;; + [[file:modules/shell.org][Shell]]
;; + [[file:modules/desktop.org][Desktop]]
;; + [[file:modules/writing.org][Writing]]
;; + [[file:modules/website.org][Website]]
;; + [[file:modules/capture.org][Capture]]
;; + [[file:modules/projects.org][Projects]]
;; + [[file:modules/development.org][Development]]
;; + [[file:modules/interface.org][Interface]]
;; + [[file:modules/dashboard.org][Dashboard]]
;; Load enabled modules
;; By default all of the modules will load, override the variable ~dotfiles/modules~ in a host configuration.
;; All of the modules in ~dotfiles/modules~ load after the host overrides. By default, all of the packages defined in ~dotfiles/modules-p~ load. Override this behaviour in a host configuration file.
(dolist (m dotfiles/modules) (dolist (m dotfiles/modules)

Loading…
Cancel
Save