Håkon Hægland
Håkon Hægland

Reputation: 40778

View source code for builtin emacs package

How can I view source code for a builtin Emacs package? For instance given lisp code (require 'color), I would be interested in which functions are provided by that package. I googled emacs "color.el" and found the source code. But I wonder if this file can be viewed directly from within Emacs itself? By the way, find . -name 'color*' gives

./share/emacs/24.3/lisp/color.el.gz
./share/emacs/24.3/lisp/color.elc

Upvotes: 7

Views: 1906

Answers (3)

legoscia
legoscia

Reputation: 41618

You can get to the source code in a single command with M-x find-library.

Upvotes: 14

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72815

You can either open the file directly in Emacs. I think .gz files are by default decompressed. Usually, I pick out one function from the package I'm interested in (e.g. org-mode), look up the documentation for that using C-hf org-mode RET and then click on the file name in the documentation buffer. It will take you the source file.

Upvotes: 8

Robin Green
Robin Green

Reputation: 33083

So ./share/emacs/24.3/lisp/color.el.gz is the gzipped source code, and you can open that in emacs by first doing M-x auto-compression-mode, and then visiting that file.

Upvotes: 4

Related Questions