Browse Source

Add blog posts

main
parent
commit
12a2416338
  1. 15
      posts/hello.org
  2. 76
      posts/immutable-emacs.org

15
posts/hello.org

@ -0,0 +1,15 @@
#+TITLE: Hello, world!
#+AUTHOR: Christopher James Hayward
#+DATE: 2021-01-17
#+HUGO_BASE_DIR: ~/.local/source/website
#+HUGO_SECTION: posts
#+begin_src c
#include <stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
#+end_src

76
posts/immutable-emacs.org

@ -0,0 +1,76 @@
#+TITLE: Immutable Emacs
#+AUTHOR: Christopher James Hayward
#+DATE: 2021-01-19
#+HUGO_BASE_DIR: ~/.local/source/website
#+HUGO_SECTION: posts
You can easily create an *Immutable* and *100% Reproducible* custom Emacs configuration with very little effort. My inspiration for this came from the =Emacs From Scratch= series by [[https://youtube.com/c/SystemCrafters][System Crafters]].
* Getting started
Emacs created *lots* of files relative to ~user-emacs-directory~, which are *not* part of this configuration and do not belong in the same directory.
+ Disable lockfiles
+ Disable backup files
To acheive this functionality, before anything else happens we change this directory to ~~/.cache/emacs~, while keeping the old value of ~user-emacs-directory~ in our own variable.
#+begin_src emacs-lisp
(defvar dotfiles/home user-emacs-directory)
(defvar dotfiles/cache "~/.cache/emacs")
(setq create-lockfiles nil
make-backup-files nil
user-emacs-directory dotfiles/cache)
#+end_src
* Package management
[[https://github.com/raxod502/straight.el][Straight]] is a 100% functional package manager for Emacs, with integration for =use-package=, a common way to download / configure / install Emacs packages.
+ Use the development branch
+ Integrate with =use-package=
Apply the configurations prior to bootstrapping the package manager, by setting (writing) to the variables that =straight= will ultimately read from.
#+begin_src emacs-lisp
(setq straight-repository-branch "develop"
straight-use-package-by-default t)
#+end_src
Bootstrap the package manager, downloading, installing, or configuring depending on the state of the configuration. All packages are downloaded and built from source, and can be pinned to specific git commit hashes.
#+begin_src emacs-lisp
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(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))
#+end_src
Complete the integration with =use-package= by installing it with ~straight-use-package~:
#+begin_src emacs-lisp
(straight-use-package 'use-package)
#+end_src
* A E S T H E T I C S
If you've ever looked at default Emacs, you know that it's one of the ugliest GUI applications out of the box. Including a few packages, cherry picked from ~Doom~ can bring Emacs out of the eightes!
#+begin_src emacs-lisp
(use-package all-the-icons)
(use-package doom-modeline :init (doom-modeline-mode 1))
(use-package doom-themes :init (load-theme 'doom-one t))
#+end_src
* Conclusion
Now that the *stateful* and *immutable* files are seperated, and the default look has been improved *slightly* you're left with a clean, immutable, and reproducible Emacs configuration to continue hacking on.
Enjoy it!
Loading…
Cancel
Save