(let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".el")))
(when (file-exists-p mod-file)
(load-file mod-file))))
Here's a complete list of all of the options configurable for each host, and their default values. If a host configuration does not exist, these values will be used in place.
#+begin_src emacs-lisp
(defvar dotfiles/browser
(getenv "BROWSER")
"The default browser used by the system.")
#+end_src
* Hosts
All of the available modules are defined in the ~dotfiles/modules-available~ constant.
Each host system that runs Emacs has a file defined in the =hosts/= sub directory, following the pattern of ~$HOSTNAME.el~. All of the configurations are defined within this file, the values of which are read from by the other modules during startup and installation. This does *not* cover hosts that are controlled via =TRAMP=, as that will be covered in another section.
#+begin_src emacs-lisp
(defconst dotfiles/modules-available
'(core desktop writing projects interface)
"All of the available modules for hosts to load.")
Add the modules you want to initialize to the ~dotfiles/modules~ variable.
#+begin_src emacs-lisp
(defvar dotfiles/modules
dotfiles/modules-available
"Enabled modules, modify this in your host configuration.")
#+end_src
The first configuration, which was built using the Ubuntu 20.04 LTS server edition. I decided to incorporate =flatpaks= into this build. Setting the ~$BROWSER~ variable is required in the desktop module. Set the browser to the flatpak borwser currently installed, this could change to chromium, firefox, or any other browser by changing this environment variable.
Specify the emacs home, and the cache directory.
#+begin_src emacs-lisp
(setenv "BROWSER" "flatpak run org.mozilla.firefox")
(defvar dotfiles/home
user-emacs-directory
"Original value of `user-emacs-directory'.")
#+end_src
Add the modules you want to initialize to the ~dotfiles/modules~ variable.
Used to seperate the immutable configuration from the stateful package files.
#+begin_src emacs-lisp
(defvar dotfiles/modules '(core
desktop
writing
projects
interface))
(defvar dotfiles/cache
(expand-file-name "~/.cache/emacs")
"Where `user-emacs-directory' will be redirected.")
#+end_src
Specify the ~home~ and ~cache~ directories.
Functionality like =completion= and =hints= can be delayed to avoid popups for common manuevers.
#+begin_src emacs-lisp
(defvar dotfiles/cache "~/.cache/emacs")
(defvar dotfiles/home user-emacs-directory)
(defvar dotfiles/idle
0.0
"Length of time to wait before offering completions.")
#+end_src
Functionality like =completion= and =hints= can be delayed to avoid popups for common manuevers. Adjust this value to your personal taste.
Required for the all powerful leader key.
#+begin_src emacs-lisp
(defvar dotfiles/idle 0.0)
(defvar dotfiles/leader-key
"SPC"
"Custom leader key for custom actions.")
#+end_src
Avoid the infamous *Emacs pinky* by binding =SPC= as a leader key, utilizing the thumb instead of the weaker pinky finger. You may change this value if you want to use something else.
The desktop module requires the global leader key to be set.
#+begin_src emacs-lisp
(defvar dotfiles/leader-key "SPC")
(defvar dotfiles/leader-key-global "C-SPC")
(defvar dotfiles/leader-key-global
(concat "C-" dotfiles/leader-key)
"Global leader key available everywhere.")
#+end_src
Define where the source repositories are stored, for integration with the *Projects* module.
#+begin_src emacs-lisp
(defvar dotfiles/src "~/.local/source/")
(defvar dotfiles/projects
(expand-file-name "~/.local/source/")
"Location where source code projects are stored.")
#+end_src
Secret keys and passwords are stored in a seperate repository.
(let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".el")))
(when (file-exists-p mod-file)
(load-file mod-file))))
#+end_src
* Hosts
Each host system that runs Emacs has a file defined in the =hosts/= sub directory, following the pattern of ~$HOSTNAME.el~. All of the configurations are defined within this file, the values of which are read from by the other modules during startup and installation. This does *not* cover hosts that are controlled via =TRAMP=, as that will be covered in another section.
The first configuration, which was built using the Ubuntu 20.04 LTS server edition. I decided to incorporate =flatpaks= into this build, which required overriding the ~$BROWSER~ environment variable.
#+begin_src emacs-lisp
(setq dotfiles/browser "flatpak run org.mozilla.firefox")
#+end_src
+ Set the browser to the flatpak browser currently installed
- firefox
- chromium
- any other browser
* Modules
Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundemental requirement to achieve the goal of modularity. Incorporating just the =core= module on a build server to build literate programming projects is just one example of what can be achieved.