Skip to content

mohsenmoqadam/rust_on_emacs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

If you use Linux or BSD terminal for coding (like me), probably you use Emacs, so here you find the steps for configuring Emacs for developing RUST applications.

1. Install RUST

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

After installation, run the below command:

source "$HOME/.cargo/env"

And then check the RUST version by below command:

rustc --version

For more information about the above command, please see the RUST website.

2. Emacs Configuration

  • Install build-essential:

    sudo apt install build-essential git -y
  • Install RUST source code:

    rustup component add rust-src
  • Install rust-analyzer server:

    git clone https://github.com/rust-analyzer/rust-analyzer.git -b release
    cd rust-analyzer
    cargo xtask install --server
  • update ~/.emacs: Add the below configuration to your .emacs:

    (setq package-archives
        '(("gnu" . "https://elpa.gnu.org/packages/")
          ("melpa" . "https://melpa.org/packages/")))
  • Install Emacs packages: use-package

    M-x: As you know, On Debian, first press Esc and then press x.

    : Is the Enter Key.

    M-x package-refresh-contents ↩
    M-x package-install ↩ use-package ↩
  • Update ~/.emacs:

    copy this file to your ~/.emacs

3. Create an example and check your emacs:

cargo new hello_world
cd hello_world/
emacs -nw src/main.rs

For the first time, wait a while for Emacs to be ready to use (depending on your internet speed).

and the final result😋: Screenshot

Releases

No releases published

Packages

No packages published