guix.el icon indicating copy to clipboard operation
guix.el copied to clipboard

"unbound variable" errors

Open lafrenierejm opened this issue 3 years ago • 13 comments

First, thank you for the package! When it's all working it's a joy to use. Unfortunately, right now I am encountering an error.

If I execute M-x guix-package-by-name immediately after starting a fresh Emacs instance, I get the following error (as copied from *Messages*):

guix-geiser-eval: Error in evaluating guile expression: While executing meta-command: error: %max-returned-list-size: unbound variable

Attempting to run the same command again in the same Emacs instance gives me a slightly different error:

guix-geiser-eval: Error in evaluating guile expression: While executing meta-command: error: package-names*: unbound variable

This is with emacs 27.2 and emacs-guix 0.5.2-4.8ce6d21 installed via Guix on Guix System. Nothing in my Emacs config should be relevant except the use-package declarations to load the packages:

(use-package geiser-guile)

(use-package guix)

lafrenierejm avatar May 16 '21 18:05 lafrenierejm

I have the same exact issue, except I am running Emacs 28.05 native-comp (but also on Guix System). I've tried playing with different ideas but still have those two errors.

TheCatster avatar May 18 '21 18:05 TheCatster

Same here on any command. Emacs 28.x native-comp.

if: Error in evaluating guile expression: While executing meta-command:
error: package-names*: unbound variable

oatmealm avatar May 21 '21 10:05 oatmealm

If it’s occurring for the author on version 27, I think we can rule out native comp as the root of the cause. Could this have to do somehow with Guix 1.3.0?

TheCatster avatar May 21 '21 11:05 TheCatster

building emacs-guix in my own guix channel with emacs-geiser version 0.16 emacs-geiser-guile version 0.17 solved the problem in GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0). I have submitted patches to guix, but they have not been accepted yet.

IaH0nii3Re avatar May 22 '21 17:05 IaH0nii3Re

Hi. Would appreciate if you could share your setup. I've just picked up Guix couple of days ago and still trying to wrap my head around. Thought guix.el would be very helpful at this stage.

oatmealm avatar May 22 '21 18:05 oatmealm

Use it at your own risk. Add to channels.scm file.

    (cons*
     (channel
      (name 'rrr)
      (url "https://git.sr.ht/~akagi/rrr")
      (introduction
       (make-channel-introduction
        "794d6e5eb362bfcf81ada12b6a49a0cd55c8e031"
        (openpgp-fingerprint
         "FF72 877C 4F21 FC4D 467D  20C4 DCCB 5255 2098 B6C1"))))
     %default-channels)

After successful guix pull try to install guix.el with guix package -i emacs-rrr-guix

IaH0nii3Re avatar May 22 '21 19:05 IaH0nii3Re

just bumped into this problem. i'm running guix on top of my os. i have geiser, guile, emacs-guix all installed via guix. geiser 0.16 geiser-guile 0.17 guix-0.5.2-4.8ce6d21

any other thoughts?

gcentauri avatar Jul 26 '21 05:07 gcentauri

FWIW i managed to get it working after making sure i had installed guile and guix in my profile, logged out and logged back in to ensure the GUILE_LOAD_PATH was being set in my environment. i'm still having an issue where (require 'guix) isn't loading any of the functions until i manually load the autoloads file.

gcentauri avatar Jul 26 '21 06:07 gcentauri

FWIW i managed to get it working after making sure i had installed guile and guix in my profile, logged out and logged back in to ensure the GUILE_LOAD_PATH was being set in my environment. i'm still having an issue where (require 'guix) isn't loading any of the functions until i manually load the autoloads file.

Paste this into your Emacs init file:

(require 'guix-emacs)

(add-to-list 'load-path "~/.guix-profile/share/emacs/site-lisp")

(guix-emacs-autoload-packages)

IaH0nii3Re avatar Jul 26 '21 09:07 IaH0nii3Re

Paste this into your Emacs init file:

(require 'guix-emacs)

(add-to-list 'load-path "~/.guix-profile/share/emacs/site-lisp")

(guix-emacs-autoload-packages)

i don't have emacs installed via guix. i suppose i can just do that :P

gcentauri avatar Jul 26 '21 21:07 gcentauri

Ah, I found the missing piece. I was installing from the git repo with straight and needed this:

Now all you need, is to add ‘elisp’ directory to the Emacs ‘load-path’ and to load the generated autoloads. This can be done by adding the following code into your Emacs init file.

     (add-to-list 'load-path "/path/to/emacs-guix/elisp")
     (require 'guix-autoloads nil t)

gcentauri avatar Jul 27 '21 01:07 gcentauri

I have the exactly same issue when using guix.el on Guix System. Fixed it by removing these lines from my emacs init.el

(with-eval-after-load 'geiser-guile
  (add-to-list 'geiser-guile-load-path "~/src/nonguix")
  (add-to-list 'geiser-guile-load-path "~/src/guix"))

I assume geiser-guile-load-path should buffer/dir local?

declantsien avatar Mar 07 '22 08:03 declantsien

I had the same issue both on Guix System and foreign Guix, and removing the explicit additions to geiser-guile-load-path indeed fixed it.

I then wondered as to why I did this in the first place, and found the answer lying in the Guix documentation about the perfect setup.

My assumption is that Geiser uses the GUILE_LOAD_PATH environment variable unless geiser-guile-load-path is set, in which case it only uses the latter.

The GUILE_LOAD_PATH directory contains various Guix related scheme files defining the modules that guix.el needs. ~/src/guix (it usually contains the Guix source repository) doesn't directly exposes those files, explaining the errors.

Furthermore, the Guix source repository already have an .dir-locals file that set guile-geiser-load-path for the current project.

But as it is already handled in this file, I don't see why we should manually configure geiser-guile-load-path, and I think that a proper solution would be to remove this notice in the Guix upstream documentation.

We could also update the emacs-guix documentation to explain this, suggesting one of the following if manually setting geiser-guile-load-path is ever required:

  • also add /run/current-system/profile/share/guile/site/3.0 (somewhat fragile: what about guile updates?) or
  • include the GUILE_LOAD_PATH environment variable in geiser-guile-load-path (probably better but don't know for sure).

What do you think?

Leirda01 avatar Mar 01 '23 01:03 Leirda01