• Stars
    star
    167
  • Rank 220,294 (Top 5 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created over 8 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Emacs Minor Mode for Cargo, Rust's Package Manager.

cargo.el

Cargo mode for Emacs. This package gives you a set of key combinations to perform Cargo tasks within your Rust projects.

NOTICE

Currently I'm not using Rust, nor will I in the (near) future. I've lost track of all the Rust / Cargo features available and can't keep up-to-date with new ones. I'll be doing selective bug fixes and continue reviewing / merging pull requests.

Installation

This package can be installed through melpa:

M-x package-install cargo

Usage

Add cargo-minor-mode to your rust-mode-hook

(add-hook 'rust-mode-hook 'cargo-minor-mode)

You will now have the following key combinations at your disposal:

Keybinding Command
C-c C-c C-e cargo-process-bench
C-c C-c C-b cargo-process-build
C-c C-c C-l cargo-process-clean
C-c C-c C-d cargo-process-doc
C-c C-c C-v cargo-process-doc-open
C-c C-c C-n cargo-process-new
C-c C-c C-i cargo-process-init
C-c C-c C-r cargo-process-run
C-c C-c C-x cargo-process-run-example
C-c C-c C-s cargo-process-search
C-c C-c C-t cargo-process-test
C-c C-c C-u cargo-process-update
C-c C-c C-c cargo-process-repeat
C-c C-c C-f cargo-process-current-test
C-c C-c C-o cargo-process-current-file-tests
C-c C-c C-m cargo-process-fmt
C-c C-c C-k cargo-process-check
C-c C-c C-S-k cargo-process-clippy
C-c C-c C-a cargo-process-add
C-c C-c C-S-d cargo-process-rm
C-c C-c C-S-u cargo-process-upgrade
C-c C-c C-S-a cargo-process-audit
C-c C-c C-S-r cargo-process-script
C-c C-c C-w cargo-process-watch
C-c C-c C-S-f cargo-find-dependency

Before executing the task, Emacs will prompt you to save any modified buffers associated with the current Cargo project. Setting compilation-ask-about-save to nil makes Emacs save modified buffers without asking.

To change prefix (default C-c C-c) use:

 (define-key cargo-mode-map (kbd ...) 'cargo-minor-mode-command-map)

Variables

Commands can be adjusted by changing their command variable. Here's a list of commands and their default value.

(setq cargo-process--command-bench "bench")
(setq cargo-process--command-build "build")
(setq cargo-process--command-clean "clean")
(setq cargo-process--command-doc "doc")
(setq cargo-process--command-doc-open "doc --open")
(setq cargo-process--command-new "new")
(setq cargo-process--command-init "init")
(setq cargo-process--command-run "run")
(setq cargo-process--command-run-bin "run --bin")
(setq cargo-process--command-run-example "run --example")
(setq cargo-process--command-search "search")
(setq cargo-process--command-test "test")
(setq cargo-process--command-current-test "test")
(setq cargo-process--command-current-file-tests "test")
(setq cargo-process--command-update "update")
(setq cargo-process--command-fmt "fmt")
(setq cargo-process--command-check "check")
(setq cargo-process--command-clippy "clippy")
(setq cargo-process--command-add "add")
(setq cargo-process--command-rm "rm")
(setq cargo-process--command-upgrade "upgrade")
(setq cargo-process--command-audit "audit -f")
(setq cargo-process--command-script "script")
(setq cargo-process--command-watch "watch -x build")

Advanced usage

If you invoke the prefix argument C-u before calling any of the functions, you may edit the Cargo command before it is run. This allows you to add flags like --release, for example.

Processes run via Cargo mode make use of compilation mode. This mode provides features like jumping to errors or killing runaway processes. By default, in compilation mode, C-c C-k is bound to the command kill-compilation.

Notes

In order to run cargo-process-fmt you need to have the rustfmt package installed.

rustup component add rustfmt-preview

In order to run cargo-process-check you need to have the cargo-check package installed.

cargo install cargo-check

In order to run cargo-process-clippy you need to have the clippy package installed.

cargo install clippy

In order to run cargo-process-script you need to have the cargo-script package installed.

cargo install cargo-script

In order to run cargo-process-{add,rm,upgrade} you need to have the cargo-edit package installed.

cargo install cargo-edit

For completion in cargo-process-add, configure cargo-process-favorite-crates.

In order to run cargo-process-audit you need to have the audit package installed.

cargo install cargo-audit

In order to run cargo-process-watch you need to have the watch package installed.

cargo install cargo-watch

More Repositories

1

gungnir

A fully featured, data-driven database library for Clojure.
Clojure
160
star
2

exrm_docker

DEPRECATED: Exrm plugin to dockerize your Elixir release
Elixir
50
star
3

hiccup-cli

Command line tool / Emacs plugin to convert HTML to Hiccup syntax.
Emacs Lisp
43
star
4

tauri-cljs

DEPRECATED: Leiningen template for Tauri and Clojurescript
Clojure
31
star
5

transpose-mark

Emacs libary for transposing data using the mark
Emacs Lisp
17
star
6

gram

A server-side rendering framework based on Hotwire
Clojure
9
star
7

clj-turbo

Clojure wrapper for Turbo
Clojure
9
star
8

clj-stimulus

Clojure wrapper for Stimulus
Clojure
8
star
9

.emacs.d

My Emacs configurations
Emacs Lisp
6
star
10

spec-signature

Write spec signatures for functions
Clojure
5
star
11

indy

A customizable indentation minor mode for Emacs
Emacs Lisp
5
star
12

snaplet-coffee

A Haskell Snaplet based off of snaplet-fay, but for coffeescript
Haskell
5
star
13

LazyCasts

A collection of LazyCasts code used in episodes.
Haskell
4
star
14

integrant-tools

A library with helper functions, reader tags, and init-keys for Integrant
Clojure
3
star
15

duct-gungnir

Duct library for Gungnir
Clojure
3
star
16

feit

WIP Clojure game engine
Clojure
2
star
17

.spacemacs.d

Emacs Lisp
2
star
18

gungnir.ui

UI helpers for the Gungnir library
Clojure
2
star
19

duct-middleware-anti-forgery

Duct middleware for anti forgery (CSRF)
Clojure
2
star
20

ArcadiaGodotNetwork

Multiplayer network management in ArcadiaGodot
Clojure
2
star
21

gungnir-playground

Example code for the Gungnir library.
Clojure
2
star
22

murk

Murk is an Elixir data type validation library.
Elixir
2
star
23

haskell-coffee

Haskell library that provides functions for using the coffeescript compiler
Haskell
1
star
24

cljs-auto

A tool to automatically convert EDN files to Clojurescript, and automatically require namespaces
Clojure
1
star
25

.doom.d

Emacs Lisp
1
star
26

keydox

Keyword metadata through EDN files
1
star
27

duct-drawbridge

Duct handler / middleware for Drawbridge
Clojure
1
star
28

advent-of-code

Clojure
1
star
29

krita-fill-discontiguous

Python
1
star
30

lumber

Phoenix Channel interface builder, input / output type checker, and Elm Channel code generator.
Elixir
1
star
31

lita-global-command

Global Command Extension for your Lita Robot routes.
Ruby
1
star