2023-03-25 Using a thesaurus from within Emacs

Now that I started to devote more time to writing, I need a thesaurus more and more often. What I usually did was to go to my browser and use thesaurus.com – but as we all know, leaving Emacs is always a pain. I fired M-x package-list-packages and it turned out that there are several packages to look up synonyms from the comfort of Emacs.

I tried a few and decided that I like two of them most. (That doesn’t mean that the rest are necessarily bad, you check them out, too!) One of them is mw-thesaurus, which uses the Merriam-Webster thesaurus under the hood. Its main advantage is that it displays a nice Org buffer with examples of use, synonyms, antonyms and related words. The other one is le-thesaurus, which uses https://thesaurus.com/. It has much more bare-bones output, but can replace the word at point with a selected synonym. (Having to select from dozens of options is not the best experience possible, though.)

I’m not sure which one I’m going to use, but the options are there.

(Added over a week later.) It turns out that I use the Merriam-Webster package a bit more often. However, I discovered an issue with it. In order to make the thesaurus buffer look better, it sets org-hide-emphasis-markers to t. The disadvantage is that it is a global variable, and it affects all the Emacs buffers. I commented out the relevant piece of code so that it won’t bother me anymore. The interesting thing, though, is how I found out. It didn’t take me too long to notice that something is messing with org-hide-emphasis-markers. Trouble is, I did not associate it with the thesaurus package at all. So, I fired debug-on-variable-change, gave that variable name… and forgot about it. The next day (or maybe even later) I finally launched the thesaurus code and everything clicked. This is yet another example of how Emacs can be helpful. Imagine you install some plugin for … [insert the name of your favorite editor here] and it starts to change some setting which doesn’t feel obviously related to what it’s doing. How much time and effort would you need to debug this issue? Whereas with Emacs it was a few minutes of work (and a few hours or days waiting for the problem to manifest itself). Of course, the fact that I restart Emacs very rarely helped (though I could have put the debug-on-variable-change in my init.el, too).

Anyway, Emacs – as usual – is a fantastic piece of software that helps users, not hinders them.

CategoryEnglish, CategoryBlog, CategoryEmacs