Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mu: correctly install mu4e by moving it to emacs' load-path. #31722

Closed
wants to merge 3 commits into from
Closed

mu: correctly install mu4e by moving it to emacs' load-path. #31722

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 16, 2017

Motivation for this change

After installing mu, mu4e was not available to Emacs. People were already asking on Reddit how to solve this.

The issue was caused because the mu4e-*.el files were installed into $out/share/emacs/site-lisp/mu4e instead of $out/share/emacs/site-lisp.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@matthewbauer
Copy link
Member

So if this works for people I'm not against merging it, but I think the problem is a little deeper than just mu4e. There are quite a lot of Emacs derivations that will put themselves in subdirectories of site-lisp like JDEE for instance. Something like normal-top-level-add-subdirs-to-load-path is probably needed in site-start.el

@ghost
Copy link
Author

ghost commented Nov 16, 2017

@matthewbauer I agree. Additionally, moving all emacs-lisp files into share/emacs/site-lisp/ will cause name collisions sooner or later. Anyway: we solve the problem by its root, I'd suggest to merge this work-around.

@ghost
Copy link
Author

ghost commented Nov 17, 2017

What do the maintainers think? @antono @the-kenny @peterhoeg

@peterhoeg
Copy link
Member

Are you sure it's not the same as #18146 (comment) ?

@thblt
Copy link
Contributor

thblt commented Nov 17, 2017

Are you sure it's not the same as #18146 (comment) ?

I can confirm than on NixOS with emacs and mu4e installed from nix-env, emacs -q (not -Q) is unable to find mu4e when (require)d. In my config, I use the following bit of magic to correctly locate mu4e:

(eval-and-compile (let ((mu4epath
                          (concat
                           (file-name-directory
                            (file-truename
                             (executable-find "mu")))
                           "../share/emacs/site-lisp/mu4e")))
                     (when (and
                            (string-prefix-p "/nix/store/" mu4epath)
                            (file-directory-p mu4epath))
                       (message "Adding %s to load-path" (file-truename mu4epath))
                       (add-to-list 'load-path (file-truename mu4epath)))))

It works because only mu4e is concerned, but probably wouldn't scale well.

@the-kenny
Copy link
Contributor

@matthewbauer is right. The correct solution is to adapt our site-start.el used in our emacs derivation. It does the following right now:

;;; NixOS specific load-path
(setq load-path
      (append (reverse (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
                               (split-string (or (getenv "NIX_PROFILES") ""))))
              load-path))

We should extend it to traverse one (or more?) levels into subdirectories and add them to load-path too.

Note that this file isn't evaluated when Emacs is either started via -q or -Q (which is expected).

@ghost
Copy link
Author

ghost commented Nov 17, 2017

I'm closing this pull-request. Primarily, because this is not the good solution. Secondly, I should not have used my master-branch because it pushed another unrelated commit to it.

Does anybody want to implement the changes in site-start.el and create a pull-request? I can do it, too.

@ghost ghost closed this Jan 4, 2018
@ghost
Copy link
Author

ghost commented Jan 4, 2018

I closed this PR (because it only solved the symptoms instead of the root problem) and created an issue for the root problem at #33412.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants