Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View source code for builtin emacs package

Tags:

emacs

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
like image 326
Håkon Hægland Avatar asked Dec 22 '13 18:12

Håkon Hægland


3 Answers

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

like image 168
legoscia Avatar answered Sep 23 '22 14:09

legoscia


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.

like image 31
Noufal Ibrahim Avatar answered Sep 23 '22 14:09

Noufal Ibrahim


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.

like image 26
Robin Green Avatar answered Sep 22 '22 14:09

Robin Green