# crux collects the Emacs commands people keep rewriting by hand

> crux is a package of interactive Emacs Lisp commands for editing, files and buffers, and it deliberately binds no keys so you choose the ones you want. It has just been revived after a two year gap, with v0.6.0 and v0.6.1 both landing in October 2026.

**bbatsov/crux** — A Collection of Ridiculously Useful eXtensions for Emacs

- Repository: https://github.com/bbatsov/crux
- Website: https://emacsredux.com
- Stars: 1,048 · Forks: 52
- Language: Emacs Lisp
- License: not declared
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/bbatsov-crux

## A bag of commands rather than a configuration framework

crux is described as a Collection of Ridiculously Useful eXtensions for Emacs, and the backronym is doing real work in the design. The project bundles many useful interactive commands to enhance the overall Emacs experience. It is not a theme, it is not a mode, and it does not change how your editing feels by itself.

The command set divides along the lines the documentation describes. Most of the commands are related to the editing experience, things like inserting an indented blank line, cleaning up indentation and trailing whitespace in a region, indenting the definition at point, and killing a whole line in either direction. The rest are utility commands that are just useful to have, and the documentation names two of them, crux-open-with and crux-reopen-as-root.

What this is for is a specific kind of Emacs user. If your init file has grown a hundred lines of defun blocks that you copied from blog posts over the years, crux is those lines packaged, named consistently and versioned. If you are happy with stock Emacs behaviour and rarely leave the basics, most of the package will be commands you never call.

The important caveat is that the package does not set up keybindings. Every command starts unbound, and the documentation gives suggested bindings as a table, explicitly as suggestions you are free to change.

## The commands came out of blog posts, then out of Emacs Prelude

The history of the package explains a lot about its shape. The documentation says that many of the functions in crux started life as blog posts on Emacs Redux, then were included in Emacs Prelude, before finally being extracted to crux in a post from January 2016. The author, bbatsov, wrote both the blog and the Prelude project, so this is one person's editing habits formalised and released.

That origin is visible in the command list. The table of suggested keybindings reads like a personal workflow written down: crux-smart-kill-line, described as a first kill to end of line and then a kill of the whole line, crux-smart-open-line-above and crux-smart-open-line for inserting an indented empty line, crux-cleanup-buffer-or-region for fixing indentation and stripping whitespace, crux-eval-and-replace for evaluating a bit of Emacs Lisp and replacing it with the result, crux-transpose-windows for swapping the buffers between two windows, and crux-indent-rigidly-and-copy-to-clipboard for indenting a region and putting it on the clipboard.

It also explains the mixture of the file oriented commands, which are numerous: crux-copy-file-preserve-attributes, crux-rename-file-and-buffer, crux-delete-file-and-buffer, crux-kill-buffer-truename for killing the absolute path of the file in the current buffer, and several commands that open configuration files, including crux-find-user-init-file, crux-find-user-custom-file, crux-find-shell-init-file and crux-find-current-directory-dir-locals-file for the .dir-locals.el of the current directory.

Because the list is long and personal, a reader should expect to adopt maybe a third of it. That is fine, since nothing is bound by default.

## Installing from MELPA with package.el

The requirement is Emacs 28.1 or newer. The package is available on the community maintained package.el repositories, MELPA Stable and MELPA, and the documentation recommends MELPA Stable because it carries the latest stable version, while MELPA has a development snapshot for users who do not mind breakage but do not want to run from a git checkout.

From inside Emacs, you install it with the package-install command, entering the package name and confirming. If the installation does not work, the documentation suggests refreshing the package list first with package-refresh-contents. The alternative for people who prefer to keep this in their config file is the block the documentation gives:

```el
(unless (package-installed-p 'crux)
  (package-refresh-contents)
  (package-install 'crux))
```

That snippet is idempotent, so it can sit in an init file that is shared across several machines without re-installing on every start.

Nothing is bound once it is installed, so the first session after installation looks exactly like before. The first real use is picking a command from the suggested table, binding it yourself, and trying it. A good candidate to start with is crux-smart-open-line, which inserts an empty line and indents it properly, since it replaces a behaviour people usually borrow from an IDE and miss in stock Emacs.

For a first look at the whole set without binding anything, the commands are ordinary interactive commands, so the standard command completion, M-x followed by crux-, will list every one of them with its documentation.

## Why crux refuses to bind keys for you

The documentation gives three reasons for shipping no keybindings, and they are reasonable enough to be worth repeating. Most users probably will not need all the commands, so defining a minor mode that consumes a lot of valuable keybindings would be overkill. Many of the optimal keybindings live in the user space anyway, for example C-c followed by some letter. And everyone has their own preferences when it comes to keybindings.

That third point is the one that decides the design. The suggested bindings in the table are mostly C-c followed by a letter, which is a prefix the user is expected to own, with a few exceptions where a modifier key is used, such as Super-o for crux-smart-open-line-above, Super-j for crux-top-join-line, Super-k for crux-kill-whole-line and Super-r for crux-recentf-find-file. Those Super bindings assume a window manager or keyboard layout that maps the Super key, and on a plain terminal Emacs they are unavailable.

The commands themselves are not opinionated in the same way. Several are conditional on context, which is the kind of detail that separates a considered command from a blunt one. crux-upcase-region applies upcase-region only when transient-mark-mode is on and the region is active, and there are matching downcase and capitalize variants. crux-kill-and-join-forward joins with the following line if you are at the end of a line and otherwise kills the line, and crux-switch-to-previous-buffer toggles between the two most recent buffers on repeated calls. crux-other-window-or-switch-buffer selects the other window, or switches to the most recent buffer if there is only one window.

## Command names that describe the behaviour, not the key

Because no keys are defined, the names carry all of the documentation weight, and the naming convention is consistent. Everything is prefixed with crux-, and the names are specific about what happens rather than about where the command came from. crux-visit-term-buffer opens a terminal emulator using ansi-term, while crux-visit-shell-buffer opens a shell buffer using eshell, which gives you two distinct ways to get a prompt and tells you exactly which one you get.

The duplication and comment pair is a good example of a family of commands. crux-duplicate-current-line-or-region duplicates the current line, or the region if one is active, and crux-duplicate-and-comment-current-line-or-region does the same thing and comments the copy, which is the shape of a command you want when you are writing a block of similar lines. crux-ispell-word-then-abbrev fixes a word using ispell and then saves it to the abbrev table, so a correction teaches the abbreviation table as a side effect.

Then there is the group of commands that touch the file system rather than the buffer. crux-open-with opens the currently visited file with an external program, which is the counterpart to editing a file that a tool owns, crux-reopen-as-root edits the currently visited file as root, and crux-sudo-edit does the same for the visited file. These are convenience wrappers around a privileged edit, and they are the parts of the package where the risk sits, since a buffer opened as root and later written back writes with root permissions.

## A GPL 3 badge with no licence file in the repository

The licence situation is worth checking before you add the package to a work setup, and it is not entirely clear from the repository. The README carries a licence badge that reads GPL 3, pointing at a copying page. The repository metadata for the project, however, reports the licence as unknown, and the top level listing of the repository shows no LICENSE file among its entries, which are.elpaignore, the.github directory,.gitignore, CHANGELOG.md, CONTRIBUTING.md, Eldev, README.md, crux.el and the test directory.

So the intent is stated in the README and the file itself is not in the tree. For a package that people install from MELPA and load into their editor, that is a detail with practical weight, since the licence of the code running inside your editor is the kind of thing a compliance checklist asks about. The straightforward step is to check the copying page the badge points to, or to ask the maintainer, before the package enters a corporate environment.

Everything else about the repository is conventional and well organised. There is a CHANGELOG.md, a CONTRIBUTING.md, and a single Elisp file, crux.el, next to the test directory. Eldev is also present at the top level, and the CI workflow is in the.github directory. The.elpaignore file marks files that should not be packaged into the archive MELPA builds, which is how a project keeps its test and development files out of the distributed package.

## Two years of silence, then two releases in two days

The repository is not archived and the last push was on 2026-10-02. The release history explains the shape of that: v0.6.0 on 2026-10-01, v0.6.1 on 2026-10-02, and before them v0.5.0, titled crux 0.5, from 2024-03-04. So the package sat at 0.5 for more than two years and then moved twice in two days.

A jump from 0.5 to 0.6 is a minor version change by the usual conventions, and since the command set is stable and the keybinding policy is unchanged, the risk to an existing user is low. The rule to follow is simply to read the CHANGELOG.md between the two points, because that file is the only account of what changed and the release titles in the list are bare version numbers with no summary.

The broader pattern is worth noticing. The project description leads with a joke about being a collection of ridiculously useful extensions, and the underlying reality is a mature package whose author has been publishing Emacs writing for a long time. The revival in October 2026 suggests a maintainer is present again, and the fact that the two most recent releases came a day apart suggests a small batch of fixes rather than a redesign.

For an Emacs user, the practical question is whether the commands in the table cover the small annoyances that your own config currently works around. If they do, installing crux and deleting your private copies of those functions is a clean trade, because you get the same behaviour with a name you can look up and a maintainer who will fix it when Emacs changes.

## Conclusion

crux is worth installing if your Emacs configuration has grown a private layer of small editing commands, because it replaces that layer with a maintained package that ships the same commands and keeps them consistent across machines. It is the wrong choice if you want a coherent editing model out of the box, since the package is a bag of commands rather than a set of modes, and it is not a replacement for a full configuration framework. Before you add it, read the CHANGELOG.md between v0.5.0 from March 2024 and v0.6.1, since that gap covers a jump in the package version, and remember that crux binds nothing, so every command in the list stays unreachable until you assign a key yourself.

## FAQ

### How do I install crux in Emacs?

crux requires Emacs 28.1 or newer and is available on MELPA Stable and MELPA. You can run M-x package-install and enter crux, refreshing the package list with package-refresh-contents first if the install fails, or add the documented unless block to your config file.

### Does crux set up any keybindings for me?

No. The documentation explains that crux binds nothing out of the box, because most users will not need every command, the best bindings for many of them live in the user space such as C-c followed by a letter, and keybinding preferences differ. The table of commands lists suggested bindings you are free to change.

### What are the most useful crux commands to bind first?

The documentation suggests crux-smart-open-line for inserting an indented empty line, crux-smart-kill-line for a first kill to end of line and then a kill of the whole line, crux-cleanup-buffer-or-region for fixing indentation and trailing whitespace, and crux-open-with or crux-reopen-as-root as utility commands.

### What licence is crux released under?

The README carries a GPL 3 licence badge, but the repository metadata reports the licence as unknown and there is no LICENSE file among the top level entries. Check the copying page the badge points to, or ask the maintainer, if the licence matters for your environment.

### Where did the commands in crux come from?

Many of them began as blog posts on Emacs Redux, were then included in Emacs Prelude, and were finally extracted into crux in a January 2016 post. A list of the related blog posts is available on the tags page of the blog.

## Sources

- [bbatsov/crux on GitHub](https://github.com/bbatsov/crux)
- [Issues](https://github.com/bbatsov/crux/issues)
- [Project website](https://emacsredux.com)
- [README](https://github.com/bbatsov/crux/blob/master/README.md)
- [Releases](https://github.com/bbatsov/crux/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/bbatsov-crux
