2
votes

Emacs (from https://emacsformacosx.com/) and Agda (via homebrew) both install gracefully. However when launching Emacs after running agda-mode setup I receive the following error:

Warning (initialization): An error occurred while loading ‘/Users/user/.emacs’:

File is missing: Cannot open load file, No such file or directory, /Users/user/zsh:1: command not found: agda-mode

Terminal version of Emacs loads Agda-mode properly and I tried exec-path-from-shell -library without success.

My .emacs has the following content:

(package-initialize)
(load-file
 (let ((coding-system-for-read 'utf-8))
   (shell-command-to-string "agda-mode locate")))
(when (memq window-system '(mac ns x))
  (exec-path-from-shell-initialize))

Does anyone have the same issue / knows how to fix it or where it comes from? Thanks in advance!

1
How does the relevant part of your .emacs look like?viam0Zah
The full content is (package-initialize) (load-file (let ((coding-system-for-read 'utf-8)) (shell-command-to-string "agda-mode locate"))) (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize))Matti Alanen
Please excuse me for formatting. Couldn't find a way to enforce newlines.Matti Alanen
NB, you can always edit your original question. I've added the config to it now.viam0Zah
I believe it's an issue about the GUI Emacs having a different copy of PATH where adga-mode is missing. Have you tried comparing what PATH looks like when you print it in the terminal and from GUI Emacs? You mention you tried exec-path-from-shell and it didn't work. Does it change the value of PATH?viam0Zah

1 Answers

2
votes

Had the same problem on MacOS Catalina and GNU emacs. It turned out to be a path problem like @viam0Zah suggested. Here's what fixed it for me:

In the terminal, ran echo $PATH and compared to agda-mode locate to figure out what path is required to find agda-mode. For me, it was /Users/aransil/.cabal/bin.

In GNU emacs, used (shell-command-to-string "echo $PATH") to verify that the path variable is different and doesn't include /Users/aransil/.cabal/bin.

Back in the terminal, edited ~/.zshenv by adding the line export PATH=/Users/aransil/.cabal/bin:$PATH

Restarted GNU emacs