unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to use Guix.el from Git?
@ 2015-11-22 12:14 Mathieu Lirzin
  2015-11-22 17:09 ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Lirzin @ 2015-11-22 12:14 UTC (permalink / raw)
  To: guix-devel

Hi,

I would like to use the Guix.el from the Git repository of Guix, but I
fail at configuring it.  I use Guix 0.9.0 built from source ontop of
Debian and installed with standard the “/usr/local” prefix.

It works perfectly with Guix.el from “/usr/local/share/emacs/site-lisp”
with the configuration describe in the manual:

  (add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
  (require 'guix-init)

But when I try to replace this with the “Hacking” configuration from the
manual:

  (let ((dir "~/src/gnu/guix/emacs"))
    (add-to-list 'load-path dir)
    (setq guix-load-path dir))
  (require 'guix-init nil t)

I get this error when launching ‘M-x guix’:

--8<---------------cut here---------------start------------->8---
Backtrace:
In ice-9/boot-9.scm:
 157: 9 [catch #t #<catch-closure b12d60> ...]
In unknown file:
   ?: 8 [apply-smob/1 #<catch-closure b12d60>]
In ice-9/boot-9.scm:
  63: 7 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 6 [eval # #]
In ice-9/boot-9.scm:
2401: 5 [save-module-excursion #<procedure e2a740 at ice-9/boot-9.scm:4045:3 ()>]
4050: 4 [#<procedure e2a740 at ice-9/boot-9.scm:4045:3 ()>]
In unknown file:
   ?: 3 [load-compiled/vm "/home/mthl/.cache/guile/ccache/2.0-LE-8-2.0/home/mthl/src/gnu/guix/emacs/guix-helper.scm.go"]
In ice-9/boot-9.scm:
1724: 2 [%start-stack load-stack #<procedure d96580 at ice-9/boot-9.scm:1745:2 ()>]
1729: 1 [#<procedure d937b0 ()>]
In unknown file:
   ?: 0 [primitive-load-path "guix-main"]

ERROR: In procedure primitive-load-path:
ERROR: In procedure primitive-load-path: Unable to find file "guix-main" in load path
--8<---------------cut here---------------end--------------->8---

Am I missing something?

TIA,

--
Mathieu Lirzin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use Guix.el from Git?
  2015-11-22 12:14 How to use Guix.el from Git? Mathieu Lirzin
@ 2015-11-22 17:09 ` Alex Kost
  2015-11-22 18:20   ` Mathieu Lirzin
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Kost @ 2015-11-22 17:09 UTC (permalink / raw)
  To: Mathieu Lirzin; +Cc: guix-devel

Mathieu Lirzin (2015-11-22 15:14 +0300) wrote:

> Hi,
>
> I would like to use the Guix.el from the Git repository of Guix, but I
> fail at configuring it.  I use Guix 0.9.0 built from source ontop of
> Debian and installed with standard the “/usr/local” prefix.
>
> It works perfectly with Guix.el from “/usr/local/share/emacs/site-lisp”
> with the configuration describe in the manual:
>
>   (add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
>   (require 'guix-init)
>
> But when I try to replace this with the “Hacking” configuration from the
> manual:
>
>   (let ((dir "~/src/gnu/guix/emacs"))
>     (add-to-list 'load-path dir)
>     (setq guix-load-path dir))
>   (require 'guix-init nil t)

Hm, all I can say: this configuration works for me.

> I get this error when launching ‘M-x guix’:
>
>
> Backtrace:
> In ice-9/boot-9.scm:
>  157: 9 [catch #t #<catch-closure b12d60> ...]
> In unknown file:
>    ?: 8 [apply-smob/1 #<catch-closure b12d60>]
> In ice-9/boot-9.scm:
>   63: 7 [call-with-prompt prompt0 ...]
> In ice-9/eval.scm:
>  432: 6 [eval # #]
> In ice-9/boot-9.scm:
> 2401: 5 [save-module-excursion #<procedure e2a740 at ice-9/boot-9.scm:4045:3 ()>]
> 4050: 4 [#<procedure e2a740 at ice-9/boot-9.scm:4045:3 ()>]
> In unknown file:
>    ?: 3 [load-compiled/vm "/home/mthl/.cache/guile/ccache/2.0-LE-8-2.0/home/mthl/src/gnu/guix/emacs/guix-helper.scm.go"]
> In ice-9/boot-9.scm:
> 1724: 2 [%start-stack load-stack #<procedure d96580 at ice-9/boot-9.scm:1745:2 ()>]
> 1729: 1 [#<procedure d937b0 ()>]
> In unknown file:
>    ?: 0 [primitive-load-path "guix-main"]
>
> ERROR: In procedure primitive-load-path:
> ERROR: In procedure primitive-load-path: Unable to find file "guix-main" in load path

So Guix REPL is dead after this, right?  It looks like your
"~/src/gnu/guix/emacs" is not appended to guile %load-path (it is done
in `guix-start-repl' by cons-ing `guix-load-path' to
`geiser-guile-load-path').

Could you check "C-h v guix-load-path" to be sure that its value is
really "~/src/gnu/guix/emacs".  Also just in case, show the value of
`guix-helper-file' variable.

-- 
Alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use Guix.el from Git?
  2015-11-22 17:09 ` Alex Kost
@ 2015-11-22 18:20   ` Mathieu Lirzin
  2015-11-22 21:05     ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Lirzin @ 2015-11-22 18:20 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Hi Alex,

Alex Kost <alezost@gmail.com> writes:

> Mathieu Lirzin (2015-11-22 15:14 +0300) wrote:
>
[...]
>> ERROR: In procedure primitive-load-path:
>> ERROR: In procedure primitive-load-path: Unable to find file "guix-main" in load path
>
> So Guix REPL is dead after this, right?

It is.

>  It looks like your "~/src/gnu/guix/emacs" is not appended to guile
> %load-path (it is done in `guix-start-repl' by cons-ing
> `guix-load-path' to `geiser-guile-load-path').
>
> Could you check "C-h v guix-load-path" to be sure that its value is
> really "~/src/gnu/guix/emacs".  

--8<---------------cut here---------------start------------->8---
guix-load-path is a variable defined in `guix-backend.el'.
Its value is "~/src/gnu/guix/emacs"
--8<---------------cut here---------------end--------------->8---

>
> Also just in case, show the value of `guix-helper-file' variable.

--8<---------------cut here---------------start------------->8---
guix-helper-file is a variable defined in `guix-backend.el'.
Its value is "/home/mthl/src/gnu/guix/emacs/guix-helper.scm"
--8<---------------cut here---------------end--------------->8---

These two variables helped me figure out that the problem was the use of
“~” in:

  (let ((dir "~/src/gnu/guix/emacs"))
    ...

When changing it with “/home/mthl” it works!  To avoid this kind of
mistake in the future, a simple fix would be to change the example in
the documentation, with:

  (let ((dir "/absolute/path/to/your-guix-git-tree/emacs"))
    ...

But is there a way to change the implementation to let users use
relative path?

Thanks,

--
Mathieu Lirzin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use Guix.el from Git?
  2015-11-22 18:20   ` Mathieu Lirzin
@ 2015-11-22 21:05     ` Alex Kost
  2015-11-22 21:15       ` Mathieu Lirzin
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Kost @ 2015-11-22 21:05 UTC (permalink / raw)
  To: Mathieu Lirzin; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

Mathieu Lirzin (2015-11-22 21:20 +0300) wrote:

[...]
> guix-load-path is a variable defined in `guix-backend.el'.
> Its value is "~/src/gnu/guix/emacs"
>
>>
>> Also just in case, show the value of `guix-helper-file' variable.
>
>
> guix-helper-file is a variable defined in `guix-backend.el'.
> Its value is "/home/mthl/src/gnu/guix/emacs/guix-helper.scm"
>
> These two variables helped me figure out that the problem was the use of
> “~” in:
>
>   (let ((dir "~/src/gnu/guix/emacs"))
>     ...

Ouch, my bad, sorry.  Yes, IIUC Guile %load-path should contain absolute
directories, and as Geiser does not expand the contents of
`geiser-guile-load-path', this "~/..." string literally goes to
%load-path.

> When changing it with “/home/mthl” it works!  To avoid this kind of
> mistake in the future, a simple fix would be to change the example in
> the documentation, with:
>
>   (let ((dir "/absolute/path/to/your-guix-git-tree/emacs"))
>     ...
>
> But is there a way to change the implementation to let users use
> relative path?

Yes, the fix is easy.  The patch is attached, could you confirm that it
works?

Thank you for finding the root of this bug!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-Expand-guix-load-path.patch --]
[-- Type: text/x-diff, Size: 1133 bytes --]

From 9788f62b319392f261a73704135f36536b1560e0 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sun, 22 Nov 2015 23:36:39 +0300
Subject: [PATCH] emacs: Expand 'guix-load-path'.

Reported by Mathieu Lirzin <mthl@gnu.org> at
<http://lists.gnu.org/archive/html/guix-devel/2015-11/msg00585.html>.

* emacs/guix-backend.el (guix-start-repl): Expand 'guix-load-path' to
  avoid relative directory name in Guile %load-path.
---
 emacs/guix-backend.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el
index e7c158b..82383e4 100644
--- a/emacs/guix-backend.el
+++ b/emacs/guix-backend.el
@@ -202,7 +202,7 @@ this address (it should be defined by
   ;; A mix of the code from `geiser-repl--start-repl' and
   ;; `geiser-repl--to-repl-buffer'.
   (let ((impl 'guile)
-        (geiser-guile-load-path (cons guix-load-path
+        (geiser-guile-load-path (cons (expand-file-name guix-load-path)
                                       geiser-guile-load-path))
         (geiser-repl-startup-time guix-repl-startup-time))
     (with-current-buffer buffer
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: How to use Guix.el from Git?
  2015-11-22 21:05     ` Alex Kost
@ 2015-11-22 21:15       ` Mathieu Lirzin
  2015-11-23  8:35         ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Lirzin @ 2015-11-22 21:15 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> writes:

> Mathieu Lirzin (2015-11-22 21:20 +0300) wrote:
>
>> When changing it with “/home/mthl” it works!  To avoid this kind of
>> mistake in the future, a simple fix would be to change the example in
>> the documentation, with:
>>
>>   (let ((dir "/absolute/path/to/your-guix-git-tree/emacs"))
>>     ...
>>
>> But is there a way to change the implementation to let users use
>> relative path?
>
> Yes, the fix is easy.  The patch is attached, could you confirm that it
> works?

The patch works perfectly!

Thank you,

--
Mathieu Lirzin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use Guix.el from Git?
  2015-11-22 21:15       ` Mathieu Lirzin
@ 2015-11-23  8:35         ` Alex Kost
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Kost @ 2015-11-23  8:35 UTC (permalink / raw)
  To: Mathieu Lirzin; +Cc: guix-devel

Mathieu Lirzin (2015-11-23 00:15 +0300) wrote:

> Alex Kost <alezost@gmail.com> writes:
>
>> Mathieu Lirzin (2015-11-22 21:20 +0300) wrote:
>>
>>> When changing it with “/home/mthl” it works!  To avoid this kind of
>>> mistake in the future, a simple fix would be to change the example in
>>> the documentation, with:
>>>
>>>   (let ((dir "/absolute/path/to/your-guix-git-tree/emacs"))
>>>     ...
>>>
>>> But is there a way to change the implementation to let users use
>>> relative path?
>>
>> Yes, the fix is easy.  The patch is attached, could you confirm that it
>> works?
>
> The patch works perfectly!

Pushed, thank you!

-- 
Alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-23  8:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-22 12:14 How to use Guix.el from Git? Mathieu Lirzin
2015-11-22 17:09 ` Alex Kost
2015-11-22 18:20   ` Mathieu Lirzin
2015-11-22 21:05     ` Alex Kost
2015-11-22 21:15       ` Mathieu Lirzin
2015-11-23  8:35         ` Alex Kost

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).