Skip to content

procuteboy/emacs-racer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Racer for Emacs

MELPA MELPA Stable Build Status Coverage Status

This is the official Emacs package for Racer.

Table of Contents

Completion

racer.el supports code completion of variables, functions and modules.

racer completion screenshot

You can also press F1 to pop up a help buffer for the current completion candidate.

Note that due to a limitation of racer, racer.el cannot offer completion for macros.

Find Definitions

racer.el can jump to definition of functions and types.

racer go to definition

You can use M-. to go to the definition, and M-, to go back.

Describe Functions and Types

racer.el can show a help buffer based on the docstring of the thing at point.

racer completion screenshot

Use M-x racer-describe to open the help buffer.

Installation

  1. Install Racer:

    $ cargo install racer
    
  2. Allow Emacs to install packages from MELPA:

    (require 'package)
    (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  3. Install racer: M-x package-install RET racer RET

  4. Download the rust sourcecode, and configure emacs to find your rust source directory:

    (setq racer-rust-src-path "<path-to-rust-srcdir>/src/")
  5. Configure Emacs to activate racer when rust-mode starts:

    (add-hook 'rust-mode-hook #'racer-mode)
    (add-hook 'racer-mode-hook #'eldoc-mode)

    For completions, install company with M-x package-install RET company RET. A sample configuration:

    (add-hook 'racer-mode-hook #'company-mode)
    
    (require 'rust-mode)
    (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
    (setq company-tooltip-align-annotations t)

    For automatic completions, customize company-idle-delay and company-minimum-prefix-length.

  6. Open a rust file and try typing use std::io::B and press TAB.

  7. Place your cursor over a symbol and hit M-. to jump to the definition.

  8. Hit M-, to jump back to the symbol usage location.

Tests

racer.el includes tests. To run them, you need to install Cask, then:

$ cask install
$ cask exec ert-runner

About

Racer support for Emacs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 99.0%
  • Makefile 1.0%