Commit graph

110 commits

Author SHA1 Message Date
Lin Jian 3e025f1393 emacsWithPackages: add a note for EMACSNATIVELOADPATH 2023-08-25 17:42:21 +00:00
Lin Jian 7f8cd3d8f9 emacsWithPackages: remove redundant colons 2023-08-25 17:42:21 +00:00
Lin Jian d380784357 emacsWithPackages: fix logic of adding EMACSNATIVELOADPATH
Without this change, EMACSNATIVELOADPATH will not be added if
EMACSLOADPATH is added.
2023-08-25 17:42:21 +00:00
Shea Levy c7417f5a3c
Merge pull request #250577 from shlevy/nix-buffer-new-emacs
nixBufferBuilders fixes
2023-08-24 08:53:56 -04:00
Shea Levy bf7a81d8dd
nixBufferBuilders: Don't assume the user has used eshell 2023-08-18 04:49:33 -04:00
Shea Levy 994f2560d0
Fix nixBufferBuilders for newer emacs 2023-08-17 10:38:37 -04:00
Artturin b93da3f4b7 treewide: overrideScope' -> overrideScope
`lib.makeScope` `overrideScope'` has been renamed to `overrideScope`

`fd --type f | xargs sd --string-mode "overrideScope'" "overrideScope"`
2023-08-14 18:46:47 +03:00
Felix Buehler 6672dde558 treewide: use optionalAttrs instead of 'else {}' 2023-06-25 11:01:34 -03:00
adisbladis 5f253d2521 emacs: add back support in wrapper for using passthru.treeSitter
The API was changed in https://github.com/NixOS/nixpkgs/pull/235859.
2023-06-20 02:30:04 +12:00
adisbladis 3ef5accbff emacs: add back support in wrapper for using passthru.nativeComp
The API was changed in https://github.com/NixOS/nixpkgs/pull/235859.
2023-06-20 02:29:20 +12:00
Anderson Torres 5d68e9014c build-support/emacs: synchronize with emacs' modified attributes 2023-06-07 23:26:31 -03:00
Lin Jian 133075787b emacs.pkgs.trivialBuild: generate autoload file 2023-05-12 20:42:09 -03:00
Adam Joseph 6c209e862e emacs: path fixes resulting from libgccjit changes
The Nix-driven bootstrap of gcc resulted in some changes to the
structure of the `libgccjit` outpaths, and also added an additional
output (`libgcc`) to `gcc`.

This commit makes the corresponding changes in the `emacs`
derivation in order to not break emacs.

Emacs is the only user of `libgccjit` in nixpkgs at the moment.
2023-04-02 13:49:54 -07:00
Chris Hodapp 1a8edfe192
emacs: Add basic tree-sitter support (#219559)
This commit adds basic support for tree-sitter in the emacs build,
such that (if the user opts into tree-sitter support), tree-sitter
will be enabled and binary library files for tree-sitter can be
included in the `lib` directory of packages passed to
`emacsWithPackages`. The libraries will be aggregated and included in
treesit-extra-load-path.

The previous pattern for this in the community was to add tree-sitter
libaries by patching emacs's `RUNPATH` with `patchelf` in a post-fixup
phase. However, this has the substantial drawback that two different
emacs installations with different lists of available tree-sitter
libraries must be entirely separate builds. By supplying the
tree-sitter libraries in the wrapping layer of `emacsWithpackages`, it
becomes possible to share a single, more-cacheable "core emacs".

This support defaults to "on" only in emacs 29 and up, since previous
versions do not support tree-sitter out of the box.
2023-03-15 16:51:29 +13:00
Lin Jian 4f65cecd45
emacs: remove warning of xargs when doing AOT native-comp
Before, there is a warning:

xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value

According to the  manual[1], swap -I and -n can remove this warning.

[1]: https://www.gnu.org/software/findutils/manual/html_node/find_html/Conflicting-xargs-options.html
2022-10-04 02:53:55 +08:00
Osama Rebach eff9931ef8
package-build: don't use mtime when creating tarballs 2022-09-18 10:02:53 +01:00
Osama Rebach b82454134d
update package-build: 35017a2 -> c3c535e 2022-09-18 10:02:53 +01:00
Thomas Tuegel 017fa2d7a0
emacsWithPackages: Rely on package.el for autoloads
The builtin `package.el` functionality is necessary and sufficient to handle
autoloads in the Emacs wrapper.
2022-07-11 20:22:20 -05:00
Tad Fisher b4e4982e6c
emacsPackages.melpaBuild: Update package-build, avoid monkey-patch 2022-05-23 12:52:17 -07:00
Mario Rodas f73ff5c229 emacsWrapper: add missing variable substitutions to Darwin app 2022-04-22 04:20:00 +00:00
Daniel Nagy 0f316e5553
emacsWrapper: fix mishandling of empty package list
The native compiler of emacs does not handle empty files well.

This arose in https://github.com/NixOS/nixpkgs/pull/168954 .
2022-04-19 21:12:45 +02:00
Daniel Nagy 4489718d8f
emacsWrapper: preload autoloads
This commits changes the Emacs wrapper, in order to preload all autoload
definitions when built with additional packages. The list of all
definitions is generated at build-time. Packages do not need to
be (require)d for them to work.

Before this change, a code like

```sh
nix-shell -I "nixpkgs=$PWD" -p "emacs.pkgs.withPackages(e:[e.magit])" \
          --run "emacs -Q -nw -f magit"
```

will fail with the message `Symbol’s function definition is void: magit`

After the change, the same code above will open Emacs with magit
enabled.

A slightly longer startup time of ~10ms was detected in local, informal
experiments.

More information on autoloading:
https://www.gnu.org/software/emacs/manual/html_node/eintr/Autoload.html
2022-04-17 14:36:24 +02:00
adisbladis 4192dce538 melpa2nix: Ignore large file warnings
While we haven't encountered any problems related to this in MELPA
it's just a matter of time (this just happened for an ELPA package
(phps-mode)).
2021-12-19 08:07:18 -08:00
adisbladis 9a86a53ec5 emacs: Ignore large file warnings for native compilation
This was blocking building phps-mode with native compilation enabled.
2021-12-19 08:05:28 -08:00
Robert Helgesson 3247e75741
emacs: resolve wrapper load-path at build time
Since the included package set is determined at build time we can also
generate the `subdirs.el` file at build time. This improves startup
time somewhat since we don't have to traverse the directory to add to
`load-path`.

For example,

``` sh-session
$ bench './emacs-old -Q --batch --kill' './emacs-new -Q --batch --kill'
benchmarking bench/./emacs-old -Q --batch --kill
time                 72.77 ms   (71.66 ms .. 73.65 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 72.49 ms   (72.06 ms .. 72.92 ms)
std dev              746.5 μs   (582.4 μs .. 1.008 ms)

benchmarking bench/./emacs-new -Q --batch --kill
time                 40.56 ms   (40.24 ms .. 40.86 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 40.30 ms   (40.12 ms .. 40.51 ms)
std dev              401.9 μs   (311.1 μs .. 555.8 μs)
```

The change does not actually affect the content of `load-path`:

``` sh-session
$ diff -s <(./emacs-old --batch --eval '(prin1 load-path)' | sed -E 's!/nix/store/[[:alnum:]]{32}-!!g') \
          <(./emacs-new --batch --eval '(prin1 load-path)' | sed -E 's!/nix/store/[[:alnum:]]{32}-!!g')
Files /dev/fd/63 and /dev/fd/62 are identical
```

So in principle the only observable effect should be the improved
startup time.
2021-11-14 22:31:48 +01:00
Felix Buehler 829ed287f0 elpa-packages: deprecate phases 2021-08-16 21:34:58 +02:00
adisbladis f09a770d9c
Merge pull request #130021 from neosimsim/fix-emacs-override-examples
emacs: fix overrideScope' examples
2021-08-04 03:08:33 -05:00
Thomas Tuegel 88cd726556
Merge pull request #128786 from pjones/pjones-fix-elpa-src
elpaBuild: Delay src evaluation so it can be overridden
2021-07-21 09:58:26 -05:00
Matthew Bauer ff327f36db
Merge pull request #127980 from matthewbauer/darwin-emacs-native-comp
Add gcc for emacs wrapper so native-comp works
2021-07-15 20:03:57 -05:00
Alexander Ben Nasrallah c81250a1d3 emacs: fix overrideScope' examples 2021-07-12 16:48:10 +02:00
Alyssa Ross 9140d4b06f
emacs.pkgs.melpaBuild: package-build: 2018-10-05 -> 2021-04-13
I think this is due an update.  I've chosen to update to the latest
version that has been merged into Melpa.

Unfortunately we now need to hack around it trying to run VCS
commands.

My Emacs configuration with thirty-something leaf packages seems fine
after the rebuild.
2021-07-06 16:07:13 +00:00
Peter Jones 46d4bb5d01
elpaBuild: Delay src evaluation so it can be overridden
This change allows ELPA packages to have their src attribute updated
by overrideAttrs.  Without this change the installPhase references the
original src attribute and overriding is not possible.
2021-06-30 07:54:11 -07:00
Matthew Bauer 8bc10fbc56 Add gcc for emacs wrapper so native-comp works
On macos, we don’t have a gcc executable by default, which is required
for some reason when compiling site-start.
2021-06-23 23:02:11 -05:00
Mauricio Collares 67bbabc0a4 emacs: adapt to renamed native-comp variables 2021-05-06 16:47:21 -03:00
midchildan 7208e57cf6
emacsWithPackages: prevent the UI showing prematurely during startup
This change makes the wrapper script avoid displaying echo area messages
during startup. This helps prevent split second UI glitches early in the
startup process. The messages itself will still be logged and therefore
will not hamper inspection for debugging purposes.
2021-02-25 22:30:40 +09:00
Mauricio Collares ca4db1bc79
emacs: add currently compiling package dirs to load-path
Co-authored-by: Tad Fisher <tadfisher@gmail.com>
2021-02-19 16:46:31 +01:00
Daniël de Kok f46bfb972d emacs.pkgs.trivialBuild: add missing stdenv argument
Fix fallout of #110687 (generic.nix requires stdenv).
2021-01-26 16:15:03 +01:00
Pavol Rusnak a6ce00c50c
treewide: remove stdenv where not needed 2021-01-25 18:31:47 +01:00
adisbladis 4003f8cbc7
treewide: emacsPackages -> emacs.pkgs & emacsWithPackages -> emacs.pkgs.withPackages
The previous names are now aliases and shouldn't be used anywhere inside nixpkgs.
2021-01-13 17:13:10 +01:00
Alyssa Ross 0f06d94a20 emacs: fix accidental double wrapper (Darwin)
This was already fixed on non-Darwin, but the fix missed that it was
also reintroduced for the Darwin code path at the same time.

Fixes: dd5d2482c9 ("emacs: Fix accidental double wrapping")
2021-01-08 05:45:15 +00:00
Matthieu Le brazidec (r3v2d0g) bfec6c34b4
emacs: replace 'emacs.nativeComp' in wrapper with 'nativeComp' 2020-12-20 21:15:18 +01:00
adisbladis dd5d2482c9
emacs: Fix accidental double wrapping
This makeWrapper invocation found it's way back via a rebase.
2020-12-17 02:44:37 +01:00
Tad Fisher a7cb8e36ac
emacs: Add comp-eln-load-path infrastructure 2020-12-16 19:45:07 +01:00
Mario Rodas eb9751c6d6 emacsWithPackages: fix application wrapper on darwin 2020-12-12 04:20:00 +00:00
adisbladis 316094b8ab
Merge pull request #106606 from alyssais/elpa-meta
emacsPackages.elpaBuild: pass through meta
2020-12-11 00:22:42 +01:00
adisbladis 1ad3b14759
Merge pull request #106608 from alyssais/melpa-homepage
emacsPackages.melpaPackages: HTTPS for homepages
2020-12-11 00:10:01 +01:00
Alyssa Ross 23d4bfb666
emacsWithPackages: don't tell sub-Emacs about pkgs
If I'm running an Emacs executable from emacsWithPackages as my main
programming environment, and I'm hacking on Emacs, or the Emacs
packaging in Nixpkgs, or whatever, I don't want the Emacs packages
from the wrapper to show up in the load path of that child Emacs.  It
results in differing behaviour depending on whether the child Emacs is
run from Emacs or from, for example, an external terminal emulator,
which is very surprising.

To avoid this, pass another environment variable containing the
wrapper site-lisp path, and use that value to remove the corresponding
entry in EMACSLOADPATH, so it won't be propagated to child Emacsen.
2020-12-10 22:52:31 +00:00
Alyssa Ross 0127013b0f
emacsWithPackages: mutate EMACSLOADPATH correctly
An empty entry in EMACSLOADPATH gets filled with the default value.
This is presumably why the wrapper inserted a colon after the entry it
added for the dependencies.  But this naive approach wasn't always
correct.

For example, if the user ran emacs with EMACSLOADPATH=foo, the wrapper
would insert the default value (by adding the trailing `:') even
though the user was trying to expressly opt out of it.

To do this correctly, here I've replaced makeWrapper with a bespoke
script that will actually parse the EMACSLOADPATH provided in the
environment (if given), and insert the wrapper's load path just before
the default value.  If EMACSLOADPATH is given but contains no default
value, we respect that and don't add the wrapped dependencies at all.
If no EMACSLOADPATH is given, we insert the wrapped dependencies
before the default value, just like before.  In this way, the wrapped
Emacs should now behave as if the wrapped dependencies were part of
Emacs's default load-path value.
2020-12-10 22:35:57 +00:00
Alyssa Ross 00a246c5ce
emacsPackages.melpaPackages: HTTPS for homepages 2020-12-10 22:15:21 +00:00
Alyssa Ross 5016fdb269
emacsPackages.elpaBuild: pass through meta
Previously, meta wasn't being passed through at all, because it's
removed from args without being used anywhere.  This made it so that
rcirc-menu wasn't being marked as broken even though it was supposed
to be.

This patch copies the meta handling from melpaBuild, including the
default home page (adapted for ELPA).
2020-12-10 22:03:20 +00:00