From 12a24163382c6ebac84dd8590e8d6fb05194c6c3 Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Mon, 1 Feb 2021 00:02:16 -0500 Subject: [PATCH] Add blog posts --- posts/hello.org | 15 ++++++++ posts/immutable-emacs.org | 76 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 posts/hello.org create mode 100644 posts/immutable-emacs.org diff --git a/posts/hello.org b/posts/hello.org new file mode 100644 index 0000000..542f817 --- /dev/null +++ b/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 + +int main() { + printf("Hello, world!"); + return 0; +} +#+end_src diff --git a/posts/immutable-emacs.org b/posts/immutable-emacs.org new file mode 100644 index 0000000..05cd3ad --- /dev/null +++ b/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!