chiathrowaway123 · 2022-07-23 15:40
I've followed exactly the instructions here:[https://robert.kra.hn/posts/rust-emacs-setup/](https://robert.kra.hn/posts/rust-emacs-setup/)
I get an initial error that workspace isn't found, but this goes away after a few seconds loading. Then any time I run a command with rustic it complains I don't have cargo, but I can run all cargo commands fine in command line, or using M-x cargo-run etc.
Also when I try to use any snippet, it says company-capf cant use yasnippet. Setting the yas global mode does not fix this either.
So all in all, my attempts to use rust in emacs have been pretty horrible. Is this tutorial just very out of date, or is there a better example setup I could be looking at?
FluidDr1nker · 2022-07-23 16:36
If you are on macos, did you install the `exec-path-from-shell` package? also, check the value of the variable `exec-path`
chiathrowaway123 · 2022-07-23 17:02
hey, I spent a while screwing around with exec path from shell (am indeed on macos), but tbh I never checked the exec path variable. Having done that it seems like no matter what settings I use for exec-path-from-shell, the actual exec-path variable never changes. So I have forced it by hard-coding the .cargo directory into the list. Gross. But works. So the rustic commands work now... maybe I will have another look at rest of it tomorrow. Thanks for your wise suggestion :)
[deleted] · 2022-07-24 02:39
[deleted]
onetom · 2022-07-24 08:16
https://github.com/d12frosted/homebrew-emacs-plus has the prucell/exec-path-from-shell integrated.
u might have better luck with that, than whatever variant you are using
eryx67 · 2022-07-24 13:26
try:
(add-to-list 'exec-path "~/.cargo/bin")
or start emacs from command line.
and check what is changed
Maybe your she'll is not bash or
$HOME/.cargo/bin
is added in .bash_profile, which is not used by interactive she'll only.
PhantomSeahorse · 2022-07-25 13:48
You shouldn’t need to do that though. I’m using ‘rustic ‘ and ‘exec-path-from-shell’ and it has been fine.
flylikeabanana · 2022-07-25 17:10
An alternative to \`exec-path-from-shell\` is to use nix, dired, and the \`emacs-dired\` package. That way, your runtime dependencies are loaded per-project when you visit a file in the project and unloaded when you leave it.
You should be aware that "use nix" isn't exactly a small ask though. There's a steep learning curve, but I think it's worth it for the isolation (and all the other benefits nix provides). Just wanted to make you aware of the alternative.