Source Code


A minimal Emacs config that does just enough and nothing more.

Sanemacs sets up a variety of tasteful defaults, MELPA, use-package, and undo-tree to provide for a great out-of-the-box Emacs experience.

Subscribe to Update Notifications via RSS
View Changelog

0.3.3 - Adapting to the removal of "linum-mode" — 2023-12-02

  • linum-mode was removed from Emacs 27. This update prevents sanemacs from calling linum-mode if it does not exist. This fixes the issue of Emacs hanging when started as a daemon on newer versions of Emacs.

0.3.2 - Not hardcoding Emacs config directory — 2022-11-07

0.3.1 - Sane undo tree — 2022-04-04

  • Made undo tree not create files in your working directory by default

0.3.0 - More sane tweaks! — 2020-06-27

  • gc-cons-threadhold for performance

  • sane backward kill word behavior

  • backward kill without copy to clipboard

  • right-click context menu

  • reload-config interactive function

  • Cleaned up the file backups behaviorc

  • Auto revert mode on by default

  • line numbers now show up in the terminal in programming modes

0.2.5 - Fixed terrible Emacs bug, added changelog, added RSS — 2019-08-25

  • Emacs has been plagued with a pretty horrible bug recently, rendering it broken by default. The “Failed to download ‘GNU’ archive” error. (As described here). Now, Sanemacs users do not have to worry about this. 😃

  • Added a changelog to the website

  • Added an RSS feed for the changelog. Subscribe to this to keep track of the latest updates! Link to RSS feed


Step #1: Download sanemacs.el

The first step is to download sanemacs.el and put it into your Emacs configuration directory.

mkdir -p ~/.emacs.d; curl > ~/.emacs.d/sanemacs.el

Step #2: Create or modify

After you have downloaded sanemacs.el, all that's left to do is load it up in your config!

(load "~/.emacs.d/sanemacs.el" nil t)

;;; Your configuration goes below this line.
;;; use-package is already loaded and ready to go!
;;; use-package docs:

View an example Emacs configuration using sanemacs.el


The general rule of keybindings added by Sanemacs is that they may not override default Emacs keybindings. There are four keybindings you should be aware of. Two of which are created by Sanemacs, the other two are from undo-tree. While undo-tree did "override" a default binding, it is appropriate since it is a drop-in replacement that really makes a big difference in the usability of Emacs.

Keybinding Description Emacs command
Control + > Indents a selection by one tab length indent-rigidly-right-to-tab-stop
Control + < De-indents a selection by one tab length indent-rigidly-left-to-tab-stop
Control + / Undo undo-tree-undo
Control + Shift + / Redo undo-tree-redo

"Layers?" (Sane, minimal layers)

If this package gets traction, a project I would like to create is sanemacs-layers. It would be similar how Spacemacs' layers concept but will have different goals.

First, sanemacs-layers would work on any Emacs configuration, sanemacs or not.

Next, it would have a focus on sane configurations that just work, but are flexible. This would entail automatic detection settings to work for your system - configuring your PythonPath automatically as an example.

View sanemacs.el in browser (With code highlighting!)