diff --git a/src/etc/emacs/README.md b/src/etc/emacs/README.md
index 7bfeebeef6ba7..b9f11d881ab25 100644
--- a/src/etc/emacs/README.md
+++ b/src/etc/emacs/README.md
@@ -4,7 +4,10 @@ rust-mode: A major emacs mode for editing Rust source code
`rust-mode` makes editing [Rust](http://rust-lang.org) code with emacs
enjoyable.
-To install, check out this repository and add this to your .emacs
+
+### Manual Installation
+
+To install manually, check out this repository and add this to your .emacs
file:
(add-to-list 'load-path "/path/to/rust-mode/")
@@ -25,3 +28,60 @@ it, and pressing `C-j`:
Rust mode will automatically be associated with .rs and .rc files. To
enable it explicitly, do `M-x rust-mode`.
+
+### package.el installation via Marmalade
+
+It can be more convenient to use Emacs's package manager to handle
+installation for you if you use many elisp libraries. If you have
+package.el but haven't added Marmalade, the community package source,
+yet, add this to ~/.emacs.d/init.el:
+
+```lisp
+(require 'package)
+(add-to-list 'package-archives
+ '("marmalade" . "http://marmalade-repo.org/packages/"))
+(package-initialize)
+```
+
+Then do this to load the package listing:
+
+* M-x eval-buffer
+* M-x package-refresh-contents
+
+If you use a version of Emacs prior to 24 that doesn't include
+package.el, you can get it from http://bit.ly/pkg-el23.
+
+If you have an older ELPA package.el installed from tromey.com, you
+should upgrade in order to support installation from multiple sources.
+The ELPA archive is deprecated and no longer accepting new packages,
+so the version there (1.7.1) is very outdated.
+
+From there you can install rust-mode or any other modes by choosing
+them from a list:
+
+* M-x package-list-packages
+
+Now, to install packages, move your cursor to them and press i. This
+will mark the packages for installation. When you're done with
+marking, press x, and ELPA will install the packages for you (under
+~/.emacs.d/elpa/).
+
+* or using M-x package-install rust-mode
+
+#### Important
+
+In order to have cm-mode properly initialized after compilation prior
+to rust-mode.el compilation you will need to add these `advices` to
+your init file or if you are a melpa user install the `melpa` package.
+
+```lisp
+(defadvice package-download-tar
+ (after package-download-tar-initialize activate compile)
+ "initialize the package after compilation"
+ (package-initialize))
+
+(defadvice package-download-single
+ (after package-download-single-initialize activate compile)
+ "initialize the package after compilation"
+ (package-initialize))
+```
diff --git a/src/etc/emacs/cm-mode.el b/src/etc/emacs/cm-mode.el
index 469bded047ac0..0303f994172cb 100644
--- a/src/etc/emacs/cm-mode.el
+++ b/src/etc/emacs/cm-mode.el
@@ -1,8 +1,13 @@
-;; Wrapper for CodeMirror-style emacs modes. Highlighting is done by
-;; running a stateful parser (with first-class state object) over the
-;; buffer, line by line, using the output to add 'face properties, and
-;; storing the parser state at the end of each line. Indentation is
-;; done based on the parser state at the start of the line.
+;;; cm-mode.el --- Wrapper for CodeMirror-style Emacs modes
+
+;; Version: 0.1.0
+;; Author: Mozilla
+;; Url: https://github.com/mozilla/rust
+;; Highlighting is done by running a stateful parser (with first-class
+;; state object) over the buffer, line by line, using the output to
+;; add 'face properties, and storing the parser state at the end of
+;; each line. Indentation is done based on the parser state at the
+;; start of the line.
(eval-when-compile (require 'cl))
@@ -163,7 +168,7 @@
(cm-schedule-work 0.05)))))
(defun cm-do-some-work ()
- (save-excursion
+ (save-excursion
(condition-case cnd (cm-do-some-work-inner)
(error (print cnd) (error cnd)))))
@@ -174,6 +179,7 @@
;; Entry function
+;;;###autoload
(defun cm-mode (mode)
(set (make-local-variable 'cm-cur-mode) mode)
(set (make-local-variable 'cm-worklist) (list (copy-marker 1)))
@@ -184,3 +190,5 @@
(cm-schedule-work 0.05))
(provide 'cm-mode)
+
+;;; cm-mode.el ends here
diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el
index 94fc9059f483d..562734c9f0ecb 100644
--- a/src/etc/emacs/rust-mode.el
+++ b/src/etc/emacs/rust-mode.el
@@ -1,3 +1,10 @@
+;;; rust-mode.el --- A major emacs mode for editing Rust source code
+
+;; Version: 0.1.0
+;; Author: Mozilla
+;; Package-Requires: ((cm-mode "0.1.0"))
+;; Url: https://github.com/mozilla/rust
+
(require 'cm-mode)
(require 'cc-mode)
@@ -277,6 +284,7 @@
((eq (rust-context-align cx) t) (+ (rust-context-column cx) (if closing -1 0)))
(t (+ base (if closing 0 unit)))))))
+;;;###autoload
(define-derived-mode rust-mode fundamental-mode "Rust"
"Major mode for editing Rust source files."
(set-syntax-table rust-syntax-table)
@@ -293,3 +301,5 @@
(define-key rust-mode-map "{" 'rust-electric-brace)
(provide 'rust-mode)
+
+;;; rust-mode.el ends here