We all know how to use git commit --amend to fix up the very last commit.
How beautiful would it be to have a command like:

git commit --amend=3

to extend this power to fix up the 3rd to last — or any other past — commit?

Enter git fixup.

So you want to code in F# with Emacs?
I can relate, I also love both. Oh dear, if I love them!

So, presto! Let’s make Emacs your next F# IDE!

In our exploration of the ways to navigate back to previous buffer positions, Registers can be seen as mark ring items with an assigned name, so that they can be conveniently accessed by that name in an arbitrary order.
But in fact they are much, much more:

  • They can be persisted so they survive reboots.
  • They can resurrect killed buffers.
  • Other than buffer positions, they can contain snippets of text, keyboard macros, windows layouts and even custom values.

Playing Hansel and Gretel is just the excuse to happily slip into yet another rabbit hole.
Let’s go!

A cool trick not everybody knows with Visual Studio and JetBrains’ IDEs is that it is possible to navigate back to previous positions with Ctrl -.

A similar trick also works with Bash:

cd -

and with Git:

git checkout -

Neat, right?
Of course, there are way more powerful tools built around this idea (such as z, autojump and zoxide). And — did you doubt? — similar powerful features in Emacs too. Let’s explore them.

Rings — fixed sized variables acting as circular buffers — are a beautiful idea: one day I will eventually write something about how undoing changes is handled in Emacs with the undo-ring. I find outrageous that other editors have not followed the same idea.

In the previous installment we learnt how to surround a region with hard-coded <<< and >>>. Let’s learn now how to interactively ask arguments to the user and to go beyond hard-coded delimiters.

  1. Select a region.
  2. Let Emacs surround it with custom delimiters.
  3. Profit.
  • When a file of type Y is opened, Emacs sets a specific major mode.
  • Each major mode is equipped with a hook, a variable holding a list of functions.
  • After that major mode is activated, all the functions in its hook are run.
  • If you add a function to the mode’s hook it will be run for that kind of file.
  • You can use `add-hook` for that.

Therefore, just use:

(add-hook '<major-mode>-hook #'<function-you-wish-to-trigger>)

For example, to have line numbers in your Python files, use:

(add-hook 'python-mode-hook #'display-line-numbers-mode)