Emacs: Lookup Google, Dictionary, Documentation

By Xah Lee. Date: . Last updated: .

This home page of the emacs package “xah-lookup.el”.

This page also shows you how to write emacs commands to lookup the web of the word under cursor.

“xah-lookup.el” gives you the following commands.

You can change the default key, or specify Emacs Eww Web Browser as default. See the file header for how.


github: https://github.com/xahlee/lookup-word-on-internet

Also on MELPA http://melpa.org/#/xah-lookup

〔➤see Emacs: How to Install Packages Using ELPA, MELPA

Command to Lookup Wikipedia

The following shows you how to write your own, to:

Place the following in your emacs init file.

(require 'browse-url) ; in emacs

(defun my-lookup-wikipedia ()
  "Look up the word under cursor in Wikipedia.
If there is a text selection (a phrase), use that.

This command switches you to your browser."
  (let (myWord myUrl)
    (setq myWord
          (if (use-region-p)
              (buffer-substring-no-properties (region-beginning) (region-end))
            (thing-at-point 'word)))

    (setq myWord (replace-regexp-in-string " " "_" myWord))
    (setq myUrl (concat "http://en.wikipedia.org/wiki/" myWord))
    (browse-url myUrl)
    ;; (eww myUrl) ; emacs's own browser

You can setup a key such as F8 for easy access. See: Emacs: How to Define Keys.

You can change the URL in the above definition to other reference sites. Here's the URL syntax for some popular language or reference sites. The “�” should be your search string.

SourceURL Format

Here's a list of online dictionary URLs: Online English Dictionary Tools.

Using a Specific Browser


back to Xah Emacs Packages

Like it? Buy Xah Emacs Tutorial. Thanks.

or, buy something from my keyboard store.