Bowmansarrow

systemcrafters

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

Footnotes

1 See this one and this one for context.

2 Start here for completion styles

Crafted Emacs V2 Announcement

Crafted Emacs V2 is released! The current master branch is now updated to reflect the new approach to assisting getting your configuration up to speed. Info files exist, so feel free to C-h i m Crafted Emacs RET to read the manual from the comfort of Emacs!

There is a transition guide:

See the v1 to v2 transition guide

This is a breaking change for anyone using Crafted Emacs V1. For those wishing to track the former version of Crafted Emacs, that can be done by following the craftedv1 branch, which was the former master branch. This version will likely not see much in the way of maintenance, and is provided for legacy purposes and to assist those who may need to take some time to transition to v2.

The branches used during development of v2 have been deleted. The new master branch is the currently supported and official release of Crafted Emacs. Additionally, many issues have been closed. The ones remaining exist because they were topics we either planned for future release or document some decision.

If you have questions, feel free to create issues (best approach) or see if one of the maintainers is in the Emacs – System Crafters channel.

Happy Crafting!

Tags: #emacs

Crafted Emacs V2 Pre-release Announcement

After the RC1 announcement last month, we have had a flurry of small tasks and things to fix. Those are now done and we are ready to release Crafted Emacs V2.

We will be releasing Crafted Emacs V2 on Friday, 20 October 2023.

This will be a breaking change for anyone using Crafted Emacs V1 (the current version from the master branch). We will be moving branches around in git, which will likely add to the confusion, but after Friday this week, there will be a craftedv1 branch for those who wish to stay with the starter kit version of Crafted Emacs. This version will likely not see much in the way of maintenance, and is provided for legacy purposes and to assist those who may need to take some time to transition to v2.

After Friday, the branches used during development of v2 will cease to exist. Thus if you are tracking the alpha, beta, or RC1 branches, those will disappear. The new master branch will be the currently supported and official release of Crafted Emacs. Additionally, many (most) of the issues still outstanding will be closed as no-longer applicable since most were opened against v1 and are really old with no further discussion occurring on them.

Make sure to take a look at the v1 to v2 transition guide. N.B. This link work for the rest of this week, but not after the release. I'll post another blog entry with an updated link on Friday. If you have questions, feel free to create issues (best approach) or see if one of the maintainers is in the Emacs – System Crafters channel.

Happy Crafting!

Tags: #emacs

Another month has passed, more development for the next version of Crafted Emacs! Picking up from last month, I've been working on the plans for the modules I outlined before.

  • crafted-defaults-config is now a more complete starting point, and is the combination of the crafted-mastering-emacs and crafted-windows modules. Those have both been marked for deletion.
  • crafted-ide-config and crafted-ide-packages have both been updated. The latter includes packages like Mickey Petersen's Combobulate package, aggressive-indent, editorconfig, and ibuffer-project. Additionally, there is code to handle both Emacs prior to and post Emacs 29 for tree-sitter and eglot inclusion. crafted-ide-config now configures those packages with the same attention to pre-/post-Emacs 29. Language specific modules were deleted.
  • crafted-writing (thanks to the suggestion from the #systemcrafters IRC channel for the name) now combines the former crafted-editing, crafted-latex, and crafted-pdf-tools modules, as well as additional settings for writing… well… things!
  • I leveraged the compat package to smooth the path toward adoption of Emacs 29. I use keymap-set and keymap-set-global for any key bindings in modules, including references in comments. However, as that package is meant for package authors and not configuration authors, there is no provision for moving to use setopt in place of customize-set-variable.
  • I removed the configuration for use-short-answers as its use is discouraged in documentation.
  • Customizations are now saved to the custom-file after the Emacs finishes initialization.
  • I found a way to set the crafted-emacs-home variable in case it isn't set by the user. I'm not checking for an environment variable value yet, that is still on the todo list. But now, just loading the crafted-init-config module is sufficient to set the load-path so the other modules can be simply required.

On that last point, an example init.el file might look like this structurally:

(when (file-exists-p custom-file)
  (load custom-file :noerror :nomessage))

(load "/path/to/crafted-emacs/modules/crafted-init-config" :noerror :nomessage)

;; -- below not needed when using Guix to manage packages --
;; add any packages to the `package-selected-packages' list
;; for example:
(require 'crafted-ide-packages)

;; install packages as necessary
(package-install-selected-packages :noconfirm)
;; -- above not needed when using Guix to manage packages --

;; add any crafted configure modules
(require 'crafted-defaults-config)
(require 'crafted-ide-config)

;; any personal configuration, for example:
(keymap-set "C-c '" #'imenu)

When using GNU Guix to manage your Emacs packages, the bits related to adding packages to the package-selected-packages list and then installing them is not needed. The same might be true if you use some other tool like straight.el to install packages. I continue to eschew using use-package, this does not prevent the user from doing so in the “personal configuration” section in the example above. In fact it may be possible to use use-package everywhere once the crafted-init-config file is loaded.

While I feel like I'm making progress, there is still much to do. From my list last month, I haven't begun to touch the documentation or examples. I have a few articles to read and test ideas for a more usable completion experience out-of-the-box using built-in facilities. This work will be in the crafted-defaults-config module. The intention is to be able to load just that one module and have a nicely working Emacs configuration. Enhancements come from adding any additional modules, like crafted-writing-config, crafted-completion-config, etc.

More to follow next month, but I feel like I'm getting closer to something I could turn into a beta. I'll probably start to focus more on the documentation and examples so I can do just that sooner rather than later.

Tags: #emacs