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 ELisp: Command to Search Web

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, 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 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 Keys: Define Key.

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: