rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 176 forks source link

`(cargo-locate-project)` returns 101 over tramp #442

Closed Jemoka closed 1 year ago

Jemoka commented 2 years ago

Hi everyone! Thanks so much for the great support for Rust on emacs.

(rust-test) (rust-build) etc. or any other function that calls (cargo-locate-project) fails when called over a file on tramp (remote file access protocol.) This renders rust-mode unable to build with a workflow involving remote files.

Some version info, in case it is necessary:

  1. rust-mode 1.0.2
  2. emacs 28.0.91
  3. host machine: macOS 11.6, rust 1.58.1 (db9d1b20b 2022-01-20)
  4. remote machine: Arch Linux with systemd 249 (249.2-1-arch), rust 1.56.1 (59eed8a2a 2021-11-01)

And here's the error:

rust-buffer-project: ‘cargo locate-project’ returned 101 status: error: could not find `Cargo.toml` in `/Users/houliu` or any parent directory

Thank you very much!

brotzeit commented 2 years ago

Does it work when you set (setq rust-cargo-bin "~/.cargo/bin/cargo") in your config ?

Jemoka commented 2 years ago

it unfortunately doesn't, because ~ defaults to local machine and not tramp.

Jemoka commented 2 years ago

Hey folks! Just wanted to ask if there's any forward motion on this topic? Thanks so much!

brotzeit commented 2 years ago

449 it's not ideal, but at least you should now be able to run cargo commands remotely.

Jemoka commented 2 years ago

Got it, thank you very much. Feel free to close if there is no further progress; I will reopen if I see anything with #449. Thanks so much for your help!

brotzeit commented 2 years ago

I'll keep the issue open until there's a better fix.

brotzeit commented 1 year ago

Can you also open a pr with your fix here ? Drop the file-remote-p condition in rust-buffer-project and replace call-process with process-file ?

Jemoka commented 1 year ago

Sure, work just started pretty heavily for me but I will do this when the weekend hits. Thanks so much!

brotzeit commented 1 year ago

I forgot I wrote this and added it to https://github.com/rust-lang/rust-mode/pull/457 :D

But thanks for the issue.