Changing backward-word, forward-word and backward-kill-word

<2023-03-12 Sun>

The default way of navigating text in Emacs is not what a lot of people (including myself) expect it to be. Personally, I find the Emacs way of editing text to be poorly designed in many ways. The package guru-mode makes it possible to learn the intended way to edit text in Emacs, but after trying guru-mode for a while I still did not see the advantage of the default Emacs keybindings.

When I edit text, I tend to use the arrow keys, backward-word (<C-left>), forward-word (<C-right>), and backward-kill-word (<C-backspace>) a lot. This is an effective way to edit text in most "normal" text editors. In Emacs, it's less effective. My suspicion is that backward-word and forward-word were designed for editing paragraphs of English prose, and using these functions to edit any type of code is wrong because they weren't designed for that. That is why I wrote a package to replace these functions with variations that are better for editing code, and still good for editing English.

The major difference between my implementations and the originals is that they are less greedy when jumping over a region that contains a new line, and it makes use of the package mwim. There is a bit of subtlety involved in specifying precisely in what way they are less greedy, but I won't bother explaining. It does exactly what I mean.

1. BBWW (Better BackWard Word)

I decided to move the code snippets that were previously included on this blog post to an actual Emacs package:

BBWW will be available via Melpa soon, but for now you can get it using straight.el.

Keywords: emacs

Modified: 2023-09-30 20:15:10 EDT

Emacs 29.1.50 (Org mode 9.6.1)