Crafted Emacs Approach to SystemCrafters Livestream
It's been a while since I posted a blog. After reviewing a couple of the more recent SystemCrafters live streams1 it seemed like a good time to add some thoughts on how Crafted Emacs might be used to solve similar problems. I wasn't able to participate live, I still have a day job and have meetings and stuff, so I had to watch them after-the-fact. Something I usually try to do anyway, but I prefer to participate in the streams as they happen.
Crafted Emacs for minimal configuration
In the live stream on 16 November 2024, David talks about his approach to rewriting his configuration. After not using a literate approach for a while, he has returned to using a literate approach to his config. Not my cup of tea, but I totally understand why he would go that route, and he gives reasons why he likes that approach during the stream. He also mentions only using GNU and Non-GNU ELPAs to help minimize his configuration. Crafted Emacs assumes you want every ELPA, but it does prioritize the GNU and Non-GNU ELPAs above MELPA-stable and MELPA. With Emacs 29, you get both GNU and Non-GNU ELPAs by default, so if you choose to limit yourself to just those, you don't need to use the crafted-early-config.el
in your config, but you probably still need to add (require 'package)
to your config if you intend to continue to use any of the crafted-*-packages.el
modules as they need the package-selected-packages
variable to be defined. For the completions David talked about, if you use the crafted-defaults-config.el
module, those are setup by default for you. This includes the following snippet to control the size of the *Completions*
buffer:
(add-to-list 'display-buffer-alist
'("\\*Completions\\*"
(display-buffer-reuse-window display-buffer-pop-up-window)
(inhibit-same-window . t)
(window-height . 10)))
If you are not using that module, but prefer to use the built-in completions (or something like icomplete
, ido
, or fido
) the above snippet will help keep *Completions*
window from taking over the screen. David discusses the completion styles and gives examples, so watch the live stream2 for a good overview of how that variable works.
With all that said, a minimal Crafted Emacs configuration might be something like this:
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (and custom-file
(file-exists-p custom-file))
(load custom-file nil :nomessage))
(load (expand-file-name "~/crafted-emacs/modules/crafted-init-config"))
;; Adjust the path (e.g. to an absolute one)
;; depending where you cloned Crafted Emacs.
;; (load "/path/to/crafted-emacs/modules/crafted-init-config")
;; needed if you want to use any of the crafted-*-packages modules
(require 'package)
(require 'crafted-defaults-config)
(add-to-list 'display-buffer-alist
'("\\*Completions\\*"
(display-buffer-reuse-window display-buffer-pop-up-window)
(inhibit-same-window . t)
(window-height . 10)))
;; Set default coding system (especially for Windows)
(set-default-coding-systems 'utf-8)
(provide 'init)
;;; init.el ends here
You can also take a look at my post where I develop a minimal configuration.
Final thoughts…
Developing a minimal configuration is an interesting challenge. My configuration is not quite as minimal as it used to be, I have added packages over time as needed to be productive with tasks at work. I also have a “default” set of “can't live without” packages I choose to install. David chose to implement the portions of some packages he actually uses rather than install the full package. The pros of just installing the package is reduced cognitive load (someone else does the work of writing and updating features you need) and an ostensibly shorter base configuration. The pros of writing the packages by pulling just the functionality you use and molding it to your configuration as David does is less reliance on external packages. This is quicker to get up and running with just your configuration, which can be handy when on a remote host, or a system with corporate controls that prevent downloading code not vetted by the corporate IT infrastructure.
Regardless of your approach, Crafted Emacs can help you get started with the building blocks you need to be productive quickly. After that, it's up to you to whittle things down or write custom code or whatever to fit your own personal needs.
Happy Crafting!
Tags: #emacs #systemcrafters