There is a dictionary-mode in Emacs. It used to be a separate package, but now comes as part of Emacs. The usual way to use it is to
(setq dictionary-server "dict.org") in init.el (or equivalents) to tell Emacs to look up dictionary definitions from the internet when used. There are a lot of dictionaries in dict.org. The availability of the full text of the Webster 1913 dictionary within it has been much lauded in the Emacsphere by wordsmiths eager to vary their outpourings' formulations. However, I am not always online. I like to keep as much functionality as possible available to me offline to not become over-reliant on the internet or loose functionality when the internet is unavailable.
The solution is simply to install the
dictd server and the dictionary packages you want on your computer. In Debian, these are available as dictd and a number of packages that supply dictd-dictionary for it. In Arch, dictd is an ordinary package in the community repo, but the dictionaries has to be added through the AUR. The dictd server and related dictionary files are however not available yet for GNU Guix. The Arch Wiki has an excellent page on dictd if you want more information on its usage. Once installed, you can just change the aforementioned
dictionary-server variable from
"localhost" and Emacs will find your installed dictionaries. Depending on the distro, you may also have to
systemctl enable dictd.service and
systemctl start dictd.service to make certain
dictd runs at every startup as well as immediately.
The selection of freely available Norwegian Bokmål dictionaries is rather slim. I only found an English - Norwegian dictionary that seemed slightly useful to me. I wish there was as Norwegian Bokmål - English dictionary as well since that would sometimes be useful for me even if I have a decent English vocabulary. There are some dictionaries from other European languages to Norwegian Bokmål, but I seldom use other languages than English these days. (I used to play opera, cantatas and masses and then those would have been useful to me.) There is also a Norwegian Nynorsk - Norwegian Bokmål dictionary by freedict. It could occasionally be useful when I read very old Nynorsk (Landsmaal). I wish there were a comprehensive Norwegian Bokmål dictionary with word definitions, synonyms, IPA pronunciation, example of usage and expressions. I would use it especially for synonyms and spelling. Since I have lived and worked some years in Denmark and Sweden, my Bokmål spelling isn't as good as it used to be, and ten years of using English as my working language after I returned to Norway did not really improve it either. I naturally blame the morons in the government of Denmark-Norway that decided to support Napoleon for all my current spelling troubles. Or maybe the Swedes that broke up the Kalmar Union should ultimately be to blame? Ok, maybe I need to take some responsibility myself as well…
American English is well covered by the GNU version of the Collaborative International Dictionary of English (
dict-gcide) that includes the full text of the 1913 Webster's Unabridged Dictionary, the 1906 Century Dictionary and some other additions. I also installed WordNet (
dict-wn) for synonyms. It is a pity that Oxford University Press do not release the Oxford English Dictionary or my favourite, the Oxford Advanced Learner's Dictionary, under a free culture license so it could be included as well. I have the Advanced Learner's Dictionary as a paperback in my bookshelf, and there is a website with it available gratis, but leaving Emacs breaks my flow when writing, the internet is not always available and my paperback is only available in my home.) In my opinion, a university should use free culture (or software) licenses for everything they produce, both since they are tax-payer funded and public money is used to create those works, so it is only fair that the tax-payers get access to the works they funded in return, and because the freedoms to study and share information should be the core values of a university. Peer-reviewed journals should be available for free to anyone in open formats and with licenses that secure free sharing of the knowledge they contain in perpetuity, such as Creative Commons Attribution ShareAlike. I used to read journals on Early Music when I was a student since I had access through the university library, but I have no access to that research now unless I pay for very expensive subscriptions. I find it illogical and annoying since I gladly pay my taxes every month to fund, among other public institutions, the universities and colleges that create that research. There are also some good computer term dictionaries like the Jargon File (
dict-jargon), Virtual Entity of Relevant Acronyms (
dict-vera) and the Free On Line Dictionary of Computing (
dict-foldoc) available. With those dictionaries installed, American English and computer terminology is well covered, but I miss a dictionary with both British and American spelling and also IPA pronunciation since I try to stick with British spelling and pronunciation (not always successfully) even if I hear and read a lot of American English. The Oxford Advanced Learner's Dictionary includes all the information I want, but even if it is publicly funded by British tax payers, the information within it is not publicly available in open formats with a free culture license so the British tax payers (and the rest of the world) could use the work they funded. Since these dictionaries are under constant revision, they will never go out of copyright either, so the public will never benefit from funding the work. There are legitimate reasons for copyright law to exist (such as ensuring artists can earn a living), but keeping publicly funded works from being used by the public is not one of them.
I use both M-x
dictionary-search and M-x
dictionary-lookup-definition. The former lets you write in a search term while the latter looks up the word at point. The latter is obviously very useful while reading while the former may be more useful when writing, except if you want to find a synonym while revising your text where the latter becomes useful again. There is no need to change dictionary language for
dictionary-mode unless you have installed too many dictionaries or dictionaries of languages with a lot of collision of vocabulary and spelling. Norwegian and English share a lot of vocabulary, but seldom collide in spelling, so I see no need to exclude any of the relevant dictionaries in either language. If you are overwhelmed with hits, it is possible to change dictionary inside the dictionary-mode buffer to limit the number of entries you get.
Combined with recently setting up
(setq ispell-dictionary "british") in my init.el, I now feel more confident than before when writing text in Emacs, whether in code or not. (Dictionaries for lookup with dictionary mode and dictionaries for spell checking are separate and aspell or hunspell has to be installed with relevant dictionries on your distro for ispell-dictionary to be set to the language you want for spell checking.) It's nice with spell checking for variable names and comments. Maybe I should add a toggle function with a keybinding for
ispell-local-dictionary between "british" and "nb" to avoid the stress of M-xing
ispell-change-dictionary when I occasionally write Norwegian Bokmål. (Or is it "M-xxing" from "to M-x" since consonants are doubled before grammatical endings in English, although not always in American English? Or even "emexxing", "emexing", "emmexxing" or "emexxing" for a more phonetic spelling? Neither a dictionary-lookup-definition nor ispell seems to have anything close to it even if it is one of the most obvious verbs to Emacs users. Maybe my confidence in these tools was premature?)