Crafted Emacs November Update

It's been slow… which is a good thing… I think

It's been a surprisingly slow month in Crafted Emacs land. After the release of V2, I sorta expected a flurry of messages or issues related to transitioning to the new release. None of that happened. Naturally, I'm surprised. I'm hoping it means we did a good job with Crafted Emacs on this release.

An interesting discussion…

There was a discussion started on creating per-language modules. The summary is basically we had tried something like that in Crafted Emacs V1, but there are issues trying to do that going forward. We opted to not try to provide per-language modules deliberately while providing a (hopefully) richer crafted-ide module to provide some baseline starting point for most languages. There are gotchas here as noted in the discussion, one of which happens to be the discrepancy between features provided by language mode and the corresponding tree sitter enabled module (ala python-mode vs python-ts-mode). There was a good suggestion of providing example configurations for language modules which could reside in the examples folder. This would be a welcome addition, so if you have one, perhaps consider submitting a PR. Common requests are for Python, Javascript, Rust, Go, and C/C++.

Odd behavior when loading a theme…

There is an odd message that might show up for you from time to time, it looks something like invalid function '(("gnu" . 99) ...). It might say something slightly different after the “invalid function” bit, but looking closely, it appears to be a value set in the custom-set-variables call usually held in the custom.el file. There is a related discussion on the Emacs mailing list here with a very detailed description of what's going on. In Crafted Emacs, we load the custom.el (assuming it exists) very early in the initialization process. There are several reasons for this, we want to load any customizations the user saved through the “Easy Customization” facilities provided out of the box in Emacs; having the values pre-loaded causes no harm when using customize-set-variable; the user could use the custom.el file as their base configuration on a different machine if they needed to spin things up quickly, but didn't have access to their entire Emacs configuration – for example on remote hosts. However, the side-effect is the values get marked as “CHANGED outside Customize”. Which is a surprise since we deliberately use the forms from the built-in customization system. We also save those values at the end of the initialization process to enable the behaviors above. What doesn't happen automatically though, when we use customize-set-variable and later customize-save-customized, neither form causes the values to be loaded again. Even when the values haven't changed from what was saved the last time Emacs was started and this time, the values get marked as “CHANGED”. I thought about calling customize-save-variable which sets the value and writes it to the custom.el file, but that would affect startup time. Not everyone cares about that – those of us who start Emacs once and then run it basically indefinitely don't care so much about startup time. Some people do, and I like for things to start snappily as well. The end result is we load the custom.el file a second time at the end of the initialization process so the values are marked as “SET and SAVED”. Doing so, I haven't been able to get the “invalid function …” error when I decide to change my theme in the middle of a running session.

Yep, that's me optimizing for a corner case. The only time a user would run into that error was when they tried to load a theme after Emacs had already started and after setting some variables with customize-set-variable, but not loading the changes from the custom-set-variables form. Even then, it wasn't a guarantee you'd hit it. Sometimes I had to call load-theme or M-x load-theme several times before I'd hit the error. It's pretty elusive.

And that is the only change to Crafted Emacs since the release.

A non-sequitur topic change…

December is nearly here, and this time of the year in most parts of the world begins celebrations of different holidays. I may (or maybe I won't) get another post out later in December, but in case I don't, on behalf of the Crafted Emacs team we wish you a happy and safe holiday season.

Happy Crafting!

Tags: #emacs