alezost / guix.el

Emacs interface for GNU Guix package manager
https://emacs-guix.gitlab.io/website/
GNU General Public License v3.0
139 stars 16 forks source link

"unbound variable" errors #44

Open lafrenierejm opened 3 years ago

lafrenierejm commented 3 years ago

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)
TheCatster commented 3 years ago

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.

oatmealm commented 3 years ago

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
TheCatster commented 3 years ago

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?

IaH0nii3Re commented 3 years ago

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.

oatmealm commented 3 years ago

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.

IaH0nii3Re commented 3 years ago

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

gcentauri commented 3 years ago

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 commented 3 years ago

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.

IaH0nii3Re commented 3 years ago

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)
gcentauri commented 3 years ago

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 commented 3 years ago

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)
declantsien commented 2 years ago

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?

Leirda01 commented 1 year ago

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:

What do you think?