Emacs Dictionary Lookup

By Xah Lee. Date: . Last updated: .

addendem: this page is outdated and is kept here for historical purposes.

See this page instead Emacs: Lookup Google, Dictionary, Documentation

This page shows you how to install a package to lookup word definition within emacs.

Emacs Dictionary Client

Torsten Hilbrich has writen a package named dictionary.el that looks up a open source dictionary server at dict.org. Download it at: http://www.myrkr.in-berlin.de/dictionary/index.html.

Follow the installation instructions in the file. Once you installed it, you can put this in your emacs init file:

;; press F8 on keypad to lookup definition
(global-set-key (kbd "<f8>") 'dictionary-lookup-definition)

You can set up the default dictionary to use. You do this by typing 【Alt+x customize-group】, then “dictionary”, then scroll to “Dictionary Default Dictionary”. If you want WordNet to be your default dictionary, put “wn” in the field. Then, click “Save for Future Sessions” at the top, then “Finish”.

To search all available dictionaries on the server, use the keyword *. That's the default behavior. (The result of looking up all dictionaries is sometimes confusing.)

To see a list of available dictionaries, first lookup a word, then move your cursor to the “[Select Dictionary]” and hit Enter. The word before the colon is the keyword to use.

Problems with “dictionary.el”

There are few problems with dictionary.el.

The following wrapper code fixes above problems dictionary_lookup_fix.el.

The command “lookup-word-definition-in-emacs” looks up WordNet, Webster 1913, Moby Thesaurus, and combine their results in one pane. You can change or add more by modifying the code.

You should also setup a hotkey to the command. See: Emacs: How to Define Keys.

Sometimes if there is no result in one of the dictionary, the function will choke. I haven't had time to dig, but for now a work-around is to comment out the following section in dictionary.el:

(unless nomatching
      (beep)
      (insert "Word not found, maybe you are looking "
        "for one of these words\n\n")
      (dictionary-do-matching word
            dictionary
            "."
            'dictionary-display-only-match-result)
      (dictionary-post-buffer))

Problems of dict.org + Emacs

Looking up dict.org within emacs is quite annoying. Here's some problems:

Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs

Ask me question on patreon