0

I recently installed Racket (using Guix) and installed a couple packages (gregor-lib and pollen). When launching from my terminal, it all works as intended. Inside Emacs however, both racket-mode REPL and Racket launched from the shell (M-x shell) fail to find the packages. For example:

> (require gregor)
; standard-module-name-resolver: collection not found
;   for module path: gregor
;   collection: "gregor"
;   in collection directories:
;    $HOME/.racket/8.0/collects
;    /gnu/store/c4w9cviyaif57ssdrnw7phfjzd0asvlh-racket-8.0/share/racket/collects/
;    ... [164 additional linked and package directories]
; -----
; Can't suggest packages to install, because pkg/db get-catalogs is '().
; To configure:
; 1. Start DrRacket.
; 2. Choose "File | Package Manager".
; 3. Click "Available from Catalog".
; 4. When prompted, click "Update".
; -----

I have checked and both the system terminal and Emacs find Racket at $HOME/.guix-profile/bin/racket, however the function (find-user-pkgs-dir) gives:

  • From whithin Emacs: $HOME/.racket/8.0/pkgs (doesn't matter if it's a shell buffer or a REPL buffer).
  • From my system terminal: $HOME/.local/share/racket/8.0/pkgs (this is where raco installed the packages).

The question thus is:

How to tell Emacs/racket-mode to load Racket packages from $HOME/.local/share/racket/8.0/pkgs/ rather than $HOME/.racket/8.0/pkgs/?

Edits
  1. Launching emacs from the console gives the same problem.
  2. plocate says the libraries are installed in $HOME/.local/share/racket/8.0/pkgs/<package>/, however for package pollen it also gives $HOME/.racket/8.0/pkgs/pollen, I suspect here's where Emacs is looking into (I ran raco pkg install pollen from a terminal within Emacs and it is importable now).

The question now I guess is:

How to tell Emacs to load Racket packages from $HOME/.local/share/racket/8.0/pkgs/ rather than $HOME/.racket/8.0/pkgs/?

3
  • Maybe start with using the locate command to find where the gregor-lib package is installed Jul 11 at 10:42
  • I know nothing about racket, but... how are you starting Emacs? If you haven't done so already, run it from the same terminal in which you have successfully tested your scenario, and see if you get a different result than before. (If it's succesful, then your problem is probably that you have crucial environment config in your shell config file, and you're not normally starting Emacs in that same environment.)
    – phils
    Jul 11 at 10:58
  • I edited the question to adress your comments
    – Adrian
    Jul 12 at 8:57
0

Well, this is not like it answers my real question (why Emacs loads a different path than my terminal) but at least this makes it work:

  • The variable PLTADDONDIR controls what addon-dir racket loads. By setting it, both the terminal and Emacs load the same path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.