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

emacs: improve setup hook #82604

Merged
merged 1 commit into from Mar 15, 2020
Merged

Conversation

rycee
Copy link
Member

@rycee rycee commented Mar 14, 2020

  • Add packages installed in a sub-directory of site-lisp, such as mu4e, to EMACSLOADPATH.

  • Add ELPA packages to EMACSLOADPATH.

  • Add each package only once to EMACSLOADPATH. Before, each package would typically be added twice for each transitive dependency leading to a huge variable for a package having many dependencies.

The load path problem with can be observed by running, e.g.,

nix-build --pure -E 'with import ./. {}; emacsWithPackages (epkgs: [(epkgs.trivialBuild {pname="foo";version="0";src=writeText "foo.el" "(require '"'"'ivy)";packageRequires=[epkgs.ivy];})])'

in a Nixpkgs clone with and without this patch applied.

Fixed #78680

- Add packages installed in a sub-directory of site-lisp, such as
  mu4e, to EMACSLOADPATH.

- Add ELPA packages to EMACSLOADPATH.

- Add each package only once to EMACSLOADPATH. Before, each package
  would typically be added twice for each transitive dependency
  leading to a huge variable for a package having many dependencies.

Fixed NixOS#78680
Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ill wait for a emacs users to verify though

@adisbladis adisbladis merged commit d15090d into NixOS:master Mar 15, 2020
@adisbladis
Copy link
Member

Thanks!

@thefloweringash
Copy link
Member

This seems to have broken byte-compilation of some packages with dependencies (?). I think building helm is sufficient to show the difference.

Bad log (current master: 5e37578)

[...]
Generating autoloads for helm-utils.el...
Generating autoloads for helm-utils.el...done
Generating autoloads for helm-x-files.el...
Generating autoloads for helm-x-files.el...done
Wrote /nix/store/is6yy3nvp3av9mmhrmh1ka5zyg4xdy08-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-autoloads.el
Wrote /nix/store/is6yy3nvp3av9mmhrmh1ka5zyg4xdy08-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-autoloads.el
Unable to activate package `helm'.
Required package `async-1.9.4' is unavailable
Parsing tar file...
Parsing tar file...done
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup

With this reverted, the log shows:

[...]
Generating autoloads for helm-utils.el...
Generating autoloads for helm-utils.el...done
Generating autoloads for helm-x-files.el...
Generating autoloads for helm-x-files.el...done
Wrote /nix/store/y3jv0l1dhbi8ndrrcslq4b6x0zjqwsi5-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-autoloads.el
Wrote /nix/store/y3jv0l1dhbi8ndrrcslq4b6x0zjqwsi5-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-autoloads.el
Checking /nix/store/y3jv0l1dhbi8ndrrcslq4b6x0zjqwsi5-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757...
Compiling /nix/store/y3jv0l1dhbi8ndrrcslq4b6x0zjqwsi5-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-adaptive.el...
Compiling /nix/store/y3jv0l1dhbi8ndrrcslq4b6x0zjqwsi5-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-autoloads.el...
Compiling /nix/store/y3jv0l1dhbi8ndrrcslq4b6x0zjqwsi5-emacs-helm-20200325.757/share/emacs/site-lisp/elpa/helm-20200325.757/helm-bookmark.el..

Bad EMACSLOADPATH (current master: 5e37578):

$ echo $EMACSLOADPATH  | tr : '\n' | sort | uniq

/nix/store/1rx6bbd0fcw7h0shz1drrhza1flpvh0w-emacs-26.3/share/emacs/site-lisp
/nix/store/6yrc5i04cgg48c1xw23r6k4q7n9aq2l7-emacs-helm-core-20200306.1417/share/emacs/site-lisp/elpa/helm-core-20200306.1417
/nix/store/g4vvyzk40wm915idfwwaigifw0rd2936-emacs-async-20200113.1745/share/emacs/site-lisp/elpa/async-20200113.1745
/nix/store/qn020lhlgy63lj12d8q55sv4rm6wlfhi-emacs-popup-20160709.1429/share/emacs/site-lisp/elpa/popup-20160709.1429

Good EMACSLOADPATH (current master + revert of 2d2de74)

$ echo $EMACSLOADPATH  | tr : '\n' | sort | uniq

/nix/store/1rx6bbd0fcw7h0shz1drrhza1flpvh0w-emacs-26.3/share/emacs/site-lisp
/nix/store/fxl47vg1hlz0m0v0wrlwygvs86w22z51-emacs-popup-20160709.1429/share/emacs/site-lisp
/nix/store/mj2s5vb156pjsz40gqdb7a7jr52xy71v-emacs-async-20200113.1745/share/emacs/site-lisp
/nix/store/vn6p6ikix8vf6klc81hmrlfa5fa0fr92-emacs-helm-core-20200306.1417/share/emacs/site-lisp

rycee added a commit to rycee/nixpkgs that referenced this pull request Apr 1, 2020
This change fixes byte compilation of, e.g., Helm without breaking
builds using, e.g., `trivialBuild`.

See NixOS#82604 (comment)
@rycee rycee mentioned this pull request Apr 1, 2020
@rycee
Copy link
Member Author

rycee commented Apr 1, 2020

@thefloweringash Please give the above PR a try to see if it resolves your issue. With that change the byte compilation works for me.

rycee added a commit to rycee/nixpkgs that referenced this pull request Apr 1, 2020
This change fixes byte compilation of, e.g., Helm without breaking
builds using, e.g., `trivialBuild`.

See NixOS#82604 (comment)

(cherry picked from commit d3eeaec)
@thefloweringash
Copy link
Member

Commented on the PR. Thanks for the quick fix!

rycee added a commit that referenced this pull request Apr 2, 2020
This change fixes byte compilation of, e.g., Helm without breaking
builds using, e.g., `trivialBuild`.

See #82604 (comment)
@cprussin
Copy link

Would it be possible to get this backported to 20.03? Sorry if that's a dumb question, I'm not sure what the policy is on backporting...

cprussin pushed a commit to cprussin/nixpkgs that referenced this pull request Apr 29, 2020
This change fixes byte compilation of, e.g., Helm without breaking
builds using, e.g., `trivialBuild`.

See NixOS#82604 (comment)

(cherry picked from commit bf486f7)
@cprussin cprussin mentioned this pull request Apr 29, 2020
10 tasks
stigok pushed a commit to stigok/nixpkgs that referenced this pull request Jun 12, 2020
This change fixes byte compilation of, e.g., Helm without breaking
builds using, e.g., `trivialBuild`.

See NixOS#82604 (comment)

(cherry picked from commit bf486f7)
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.

Emacs trivialBuild does not seem to pick up dependencies
5 participants