Hacker News new | ask | show | jobs
by 0xdky 1607 days ago
Another lesson I learned from almost 2+ decades of using Emacs:

Track your customizations in a version control. Using customize package and reading the diff in dot Emacs file has taught me quite a bit about certain aspects of the package.

Side note: It would be awesome if Emacs could do the versioning as part of saving the customizations - build Emacs with libgit2 and make it a native git client.

4 comments

The customize interface is quite useful. It's probably more adequate if you don't have a huge intricate init. With time, custom.el (or init.el if you keep everything in the same file) can get difficult to manage. When that happen, a lot of people opt for something more readable and human friendly, like use-package or a distribution such as doom-emacs.

The author mentions that some things can be hard to do outside of the customize interface. That is true. When that happens, I just use the interface and then move the setting from custom.el to use-package. But that's rare, I can't remember the last time I did that.

Yes. Also, don't put your own stuff in init.el. Put your own stuff in another file, and load it with load-file from init.el. This massively decreases the chances that Emacs will make a mess when it adds or updates its own stuff.
You could probably write it. Emacs is able to track which settings you've _applied_ but not yet saved; that could serve as the linchpin for generating versioned changes.
for a reason I forgot my .emacs.d/ ("hidden" dir) is a symlink to emacsdotd/ (not hidden) and, yup, it's in git. Some are going to say: "why stop there!? version your entire user dir" and I can see the appeal (but haven't tried yet).

I'm one of those who track everything Emacs: including all the packages. When I upgrade packages, I first check that nothing broke then I commit "Bump avy to 20220114" or whatever. This way I can easily share the exact same config on several machines/several user accounts and I know I can easily roll back to a known fully working setup. YMMV.

If by "version your entire user dir" you mean "version all your manually edited configs", that can work.

Init a git repo in your $HOME, add a .gitignore that by default excludes everything then manually add just the files and folders you want to track.

Especially if you want to publish the repo, be careful, because it's <<extremely>> easy to accidentally expose confidential stuff.

Or just use something like GNU stow or chezmoi.