How to enable syntax highlighting for Odin in Emacs

Date written: 2022.03.08

At the time of writing, Odin is not a popular language. Most people haven't even heard of it. As such, even though a Emacs syntax highlighting file Odin has been made, it isn't part of Emacs. The steps below explain how to enable syntax highlighting in Odin with this file. The steps should be applicable to any syntax highlighting file not turned on by default in Emacs.

Step 1: Download the syntax highlighting file

  1. Visit the odin-mode repo on github, hosted by mattt-b.
  2. Download odin-mode.el to somewhere on your computer.

Step 2: Open your .emacs file

  1. C-h v then user-init-file
  2. The path to the Emacs file will be on the second line.
  3. C-x C-f then type / paste in the path.

Step 3: Modify your .emacs file to load the .el file

  1. Add the line (load "path-to-syntax-file") to your .emacs file where path-to-syntax-file is the path to the .el file you downloaded in Step 1.
  2. Add a comment above the line you added, telling your future self what the line does!
  3. Test it. Open up a new instance of Emacs on a .odin file... and enjoy automatic syntax highlighting!

I couldn't find a concise description of the steps above in once place, so hopefully whoever is reading this finds it helpful.