Subject: bug#22550: (require 'magit) produces error: "no such file or directory" "dash"

From: Alex Kost <[email-masked]>
Date: Thu, 04 Feb 2016 23:00:36 +0300

myglc2 (2016-02-04 18:16 +0300) wrote:

[...]
> glc4@g1 ~$ echo $EMACSLOADPATH
> :/etc/emacs
>
> If I set it to match what you say ...
>
> glc4@g1 ~$ EMACSLOADPATH=/etc/emacs/site-start.el
> glc4@g1 ~$ emacs

No, no, it is expected; I meant ":/etc/emacs" is the default value,
sorry for the confusion.

[...]
> Note: below, I have EMACSLOADPATH=:/etc/emacs
>
>>> (require 'magit)
>>>
>>> ... generates this traceback ...
[...]
>> Yes, the problem is: currently only a user profile is "inspected" for
>> emacs packages, but not a system profile.  I didn't realize people could
>> install emacs packages globally, but apparently we should also check the
>> system profile as well.  Thanks for reporting!
>>
>>> Adding emac-dash to config.h.scm does not change the behavior.
>>
>> There is no need to install emacs-dash explicitly, as magit "propagates"
>> this library.  You can do "M-x guix-edit magit" to see that "dash" is in
>> "propagated-inputs".
>
> When I do  "M-x guix-edit" I get ...
>
> M-x guix-edit [No match]
>
> ... which is what lead me to believe I needed to fix load-path

No, there is no need to fix load-path; on GuixSD it should work
out-of-the-box; it doesn't work currently because there is a bug
introduced several days ago (see below).

>> Now could you try this after starting Emacs:
>>
>>   M-: (guix-emacs-load-autoloads "/run/current-system/profile")
>>
>> and check that "M-x magit-status" works after that?
>
> YES! That makes everything work.

Thanks for confirmation!

> So, should I put ...
>
> '(guix-emacs-load-autoloads "/run/current-system/profile")'
>
> ... in init.el, in which case guix INFO should say so.

Well, you can do it as a temporary workaround, but we'll fix it soon (I
mean the system profile will also be inspected for emacs packages), so
it will not be necessary in the closest future.

> Or, is there something wrong with EMACSLOADPATH?

Yes, I mean it's not a problem on your side, but it's bug in GuixSD. I
think we should change this value from ":/etc/emacs" to "/etc/emacs:".
The problem with the current EMACSLOADPATH is that "/etc/emacs" value is
appended to 'load-path' variable, but it should be prepended to it, so
that the proper "site-lisp.el" will be found.

Sorry, this bug was introduced recently and you are the first who faced
it :-)

Right now I can't check it, but I think if you start emacs like this:

  EMACSLOADPATH=/etc/emacs: emacs

you'll get "M-x guix-…" commands.  Could you confirm?

So to recap, you found 2 issues:

1. Emacs packages installed in a system profile are not automatically
   added to 'load-path'.

2. With the current EMACSLOADPATH, a wrong "site-lisp.el" is loaded, so
   "M-x guix-…" commands are not autoloaded.

Both are easy to fix, thanks again for reporting!

-- 
Alex