Hot answers tagged

6

This issue occurs if emacs-racer and company-racer are both installed. They are distinct packages and are not compatible. Install only emacs-racer and the function signatures show up as expected.


3

After some research, I was able to solve it by adding this to my init.el: (with-eval-after-load 'rust-mode (define-key rust-mode-map (kbd "C-r") 'my-cargo-run)) (defun my-cargo-run () "Build and run Rust code." (interactive) (cargo-process-run) (let ( (orig-win (selected-window)) (run-win (display-buffer (get-buffer "*Cargo Run*") nil '...


3

I had very similar problem. I use OSX and both cargo and rustc weren't in exec-path. Because I see you have /Users path - I assume u run emacs on OSX too. My solution was exec-path-from-shell plugin. I added to my init.el something like this: (req-package exec-path-from-shell :config (if (eq system-type 'darwin) (exec-path-from-shell-...


3

The "best" way? Dunno. Define your criteria for "best". Looks OK to me, FWIW. But I would probably just do this: (define-key 'rust-mode-map ";" (lambda () ...)) That assumes the mode map is rust-mode-map. Oh, and I would also probably name the command, instead of using an anonymous function -- makes it easier to work with. But it probably doesn't ...


2

An even shorter way: (define-key 'rust-mode-map ";" (kbd "C-q ; RET"))


2

Inside a string, you need to double the backslashes. It makes the regexps look rather ugly, but it's something we have to live with. :-)


2

Hot diggity darn, but minutes later I discovered a crate for that. For future people landing on this question, all I had to do was run cargo install cargo-script and bam you'll be off and org-babel-ing. If you've got Cargo.el installed in your profile, you can evaluate pretty quick using Cargo-run. This may become how I write Rust going forward, if I can ...


2

Since rust-clippy normally works at compile time, it should get integrated into whatever you are using for compiling Rust code in Emacs (e.g. cargo-minor-mode). This is touched on in this blog post on setting up Emacs for Rust, in case you have not seen it already.


2

In general, you can do something like this: (add-hook '<foo>-mode-hook (lambda () (setq tab-width 4))) If you have a single global default you prefer: (setq-default tab-width <number you like>)


1

Okay, seems like I missed part that yasnippet should be enabled. yas-minor-mode fixed it.


1

Even though you've got it in your shell, it looks as though you've not got /usr/local/bin in the PATH environment variable for your Emacs. You could verify this by doing M-x getenv PATH. There might be a better way, but I use a little bit of code like the following in my Emacs init file: (defun add-to-path (dir) "Add DIR to PATH environment variable and ...


1

I think you need to install rust source code and set the RUST_SRC_PATH environment variable. It's the point 4 in "Install from sources" in the racer readme https://github.com/phildawes/racer.


1

Have you tried using M-x term instead of eshell? To my knowledge eshell does not support ncurses anyway.


Only top voted, non community-wiki answers of a minimum length are eligible