Clicky

Harry R. Schwartz

Software engineer, nominal scientist, gentleman of the internet. Member, ←Hotline Webring→.

· 1B41 8F2C 23DE DD9C 807E A74F 841B 3DAE 25AE 721B

sensible-defaults.el

Published 23 Nov 2015. Tags: emacs.

Emacs is a terrific editor, but its out-of-the-box experience isn’t great. Some of its default settings feel a bit clunky. There’s no syntax highlighting, users have to type “yes” to confirm actions, and their repos are suddenly littered with files ending with “~”.

There are some great projects to make Emacs more approachable. Prelude provides a terrific selection of preconfigured packages, and Spacemacs offers a great onramp for users coming from Vim.

I’m not crazy about those, though. I kinda feel like they “magically” do too much, and that they might not encourage exploration and modification in the same way that Emacs generally does. I worry that it’s not obvious to users what features are Emacs and what’s coming from the starter kit.

I recently created sensible-defaults.el as an alternative. It’s a minimal set of configuration changes and keybindings: just enough to knock off some of the unnecessarily sharp edges. A user can use as much or as little of it as they’d like, and it’s especially amenable to tweaking and customization since it’s just a set of functions with reasonable names.

(sensible-defaults/delete-trailing-whitespace)
(sensible-defaults/always-highlight-code)
(sensible-defaults/ensure-that-files-end-with-newline)
(sensible-defaults/make-dired-file-sizes-human-readable)

Most users want these kinds of features, but finding them—especially for the new user—isn’t always easy (“why is syntax highlighting called global-font-lock-mode?!”).

If a user wants everything it offers, that’s as easy as:

(load-file "~/.emacs.d/sensible-defaults.el")
(sensible-defaults/use-all-settings)
(sensible-defaults/use-all-keybindings)

Anyway, check it out! It’s got a few nice tricks in it that you might like!