A Better Emacs Mercury Experience

λ June 27, 2019
Tags: emacs, mercury

Up until this point I have been using the stock mercury mode that magically seemed to activate when I opened a file (but not until forcing .m files to call up that mode as it default to Objective-C) but the indenting felt ugly here and there, especially if-then-else or ( -> ; ) as I prefer.

I am note sure how the internet gods led me to find Metal Mercury Mode but I thank them that they did. I think I was trying to find Mercury related packages from the package browser and then I did a search and lo! I found it!

Metal Mercury Mode

The installation procedure matched perfectly my standard ~/emacs.d configuration and within two minutes I had git cloned, installed and tried it out and wow, I think I love it already. I opened a file I created with the old mercury mode and hit indent-region on the whole buffer and not only did it look better, there is a bonus of being able to use:

CTRL-C c   Compile the buffer
CTRL-C r   Run the current buffer

When you compile the buffer it opens another frame and leaves the cursor in that window which at first felt irritating but then I realised that I only have to move the cursor to an error line and press RETURN and the cursor moves to the correct line in the source buffer. This is great stuff!

Many thanks to the author. A simple but effective addition to my Mercury world.

Comments