reddit / emacs

Trouble while setting up Emacs for rust development

juunx · 2022-08-04 15:49
Hello, I'm completely new to Emacs / doomemacs, I was trying to setup my fresh installed doomemacs for rust dev. I did enable rust under :lang and lsp under :tools in my .doom.d/init.el. I also installed rust-analyzer server and added the Path to my .zshrc file. when I try to edit any .rs file I get following error: eldoc error:(file-missing Doing vfork No such file or directory). can anyone tell me how to fix that problem?
PhantomSeahorse · 2022-08-04 18:16
Emacs might not be picking up your shell environment variables. Try the emacs package “exec-path-from-shell”
juunx · 2022-08-04 23:03
Im did try installing exec-path-from-shell. I still getting some errors but I'm also not sure how my .zshrc should look like. I tried it in 2 ways: export PATH="$HOME/.emacs.d/bin:$PATH" export PATH="$HOME/.cargo/bin/rust-analyzer" than I get following error: eldoc error: (file-missing Doing vfork No such file or directory) Error while checking syntax automatically: (file-missing "Searching for program" "No such file or directory" "cargo") ​ export PATH="$HOME/.emacs.d/bin:$PATH" export PATH="$HOME/.cargo/bin/rust-analyzer" export PATH="$HOME/.cargo/bin/cargo Same error. export PATH="$HOME/.emacs.d/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH" error: eldoc error: (file-missing Doing vfork No such file or directory)
TelcDunedain · 2022-08-04 23:21
Looks like you don't have rust installed well. https://rustup.rs/ cargo should already be in the path from a good rust install. It's usually called from your .bashrc with something like - . "$HOME/.cargo/env"
juunx · 2022-08-05 05:41
Well my rust should be installed fine since I can use every command in my terminal also I developed rust in VsCode before. however to make sure there is no problem with my rust installation I did reinstall rust and put export PATH="$HOME/.cargo/bin to my .zshrc since the installer told me too. so from my point of view I just an emacs problem. Note that I'm running macOS 12.5 I don't have an bashrc, I think its because macOS uses zsh as default shell.
TelcDunedain · 2022-08-05 05:55
Ah its the old osx problem... osx doesn't give the graphical programs the same environment as the shell. I can't help much but here is an old fragment from like 10 years ago when I had to use osx briefly - (when (memq window-system '(mac ns)) (exec-path-from-shell-initialize) (exec-path-from-shell-copy-env "GOPATH") )
pajuch · 2022-08-05 09:28
Temporary fix: try opening emacs from terminal so that it adopts the env vars
juunx · 2022-08-05 09:44
Well I've tested a bit and also tired to add the path to my .profile file but did not seem to work as well however I did replaced in my init.el under :lang rust with (rust +lsp) and that somehow seems to work