summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README4
-rw-r--r--modules/tanelorn/packages/emacs.scm41
-rw-r--r--modules/tanelorn/packages/patches/emacs-fix-scheme-indent-function.patch29
-rw-r--r--modules/tanelorn/packages/patches/emacs-fix-transparency.patch23
-rw-r--r--modules/tanelorn/packages/patches/emacs-native-comp-driver-options.patch18
-rw-r--r--modules/tanelorn/packages/patches/emacs-native-comp-pin-packages.patch39
-rw-r--r--modules/tanelorn/packages/patches/emacs-next-disable-jit-compilation.patch19
-rw-r--r--modules/tanelorn/packages/patches/emacs-next-exec-path.patch18
-rw-r--r--modules/tanelorn/packages/patches/emacs-next-native-comp-fix-filenames.patch355
9 files changed, 546 insertions, 0 deletions
diff --git a/README b/README
index a33b8bb..7179040 100644
--- a/README
+++ b/README
@@ -6,6 +6,10 @@ The packages and services found here are optionally free for anyone to use, unde
** Packages
+- *Emacs*:
+
+ - emacs-next-alpha-fix
+
- *Emacs Packages*:
- emacs-jeison
diff --git a/modules/tanelorn/packages/emacs.scm b/modules/tanelorn/packages/emacs.scm
new file mode 100644
index 0000000..bac2db9
--- /dev/null
+++ b/modules/tanelorn/packages/emacs.scm
@@ -0,0 +1,41 @@
+;;; Copyright © 2026 bdunahu <bdunahu@operationnull.com>
+;;;
+;;; SPDX-License-Identifier: GPL-3.0-or-later
+
+(define-module (tanelorn packages emacs)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix download)
+ #:use-module (tanelorn packages)
+ #:use-module (guix packages)
+ #:use-module (gnu packages emacs))
+
+(define-public emacs-next-alpha-fix
+ (let ((commit "509228fc6c026921c67459f21164e0325efc583b")
+ (revision "2")
+ (name "emacs-next-alpha-fix"))
+ (emacs->emacs-next
+ emacs
+ name
+ #:source
+ (origin
+ (inherit (package-source emacs-minimal))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://git.savannah.gnu.org/git/emacs.git")
+ (commit commit)))
+ (file-name (git-file-name name
+ (git-version "31.0.50" revision commit)))
+ (sha256
+ (base32 "04aalyrx5jysk5fhlka98fhfx23sy99zp8j16i0ils20sflyig6n"))
+ (patches
+ (tanelorn-patches "emacs-next-disable-jit-compilation.patch"
+ "emacs-next-exec-path.patch"
+ "emacs-fix-scheme-indent-function.patch"
+ "emacs-native-comp-driver-options.patch"
+ "emacs-next-native-comp-fix-filenames.patch"
+ "emacs-native-comp-pin-packages.patch"
+
+ ;; fixes an issue with alpha-transparency
+ "emacs-fix-transparency.patch"))))))
diff --git a/modules/tanelorn/packages/patches/emacs-fix-scheme-indent-function.patch b/modules/tanelorn/packages/patches/emacs-fix-scheme-indent-function.patch
new file mode 100644
index 0000000..4b7904e
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-fix-scheme-indent-function.patch
@@ -0,0 +1,29 @@
+Fix 'scheme-indent-function' to indent s-expressions starting with a keyword
+properly, like this:
+
+(#:foo 1
+ #:bar 2)
+
+instead of like this:
+
+(#:foo 1
+ #:bar 2)
+
+The fix is made by Mark H Weaver <mhw@netris.org>:
+<http://www.netris.org/~mhw/scheme-indent-function.el>
+
+--- a/lisp/progmodes/scheme.el
++++ b/lisp/progmodes/scheme.el
+@@ -494,6 +494,12 @@ indentation."
+ (> (length function) 3)
+ (string-match "\\`def" function)))
+ (lisp-indent-defform state indent-point))
++ ((and (null method)
++ (> (length function) 1)
++ ;; The '#' in '#:' seems to get lost, not sure why
++ (string-match "\\`:" function))
++ (let ((lisp-body-indent 1))
++ (lisp-indent-defform state indent-point)))
+ ((integerp method)
+ (lisp-indent-specform method state
+ indent-point normal-indent))
diff --git a/modules/tanelorn/packages/patches/emacs-fix-transparency.patch b/modules/tanelorn/packages/patches/emacs-fix-transparency.patch
new file mode 100644
index 0000000..7f18374
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-fix-transparency.patch
@@ -0,0 +1,23 @@
+From d00d59c9d7128ae0668fd876f8c6ed0b4b15e423 Mon Sep 17 00:00:00 2001
+From: Daniel Mendler <mail@daniel-mendler.de>
+Date: Mon, 26 Jan 2026 19:57:31 +0100
+Subject: [PATCH 1/2] configure.ac: Add more system configuration features
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0d7c58d8020..b1b1e2022ca 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -7615,7 +7615,8 @@ AC_DEFUN
+ HARFBUZZ IMAGEMAGICK JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \
+ M17N_FLT MODULES NATIVE_COMP NOTIFY NS OLDXMENU PDUMPER PGTK PNG RSVG SECCOMP \
+ SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER \
+- UNEXEC WEBP X11 XAW3D XDBE XFT XIM XINERAMA XINPUT2 XPM XRANDR XWIDGETS \
++ UNEXEC WEBP X11 XAW3D XCOMPOSITE XCB_SHAPE XDBE XFIXES XFT XIM XINERAMA \
++ XINPUT2 XPM XRANDR XRENDER XSHAPE XSYNC XWIDGETS \
+ X_TOOLKIT ZLIB; do
+
+ case $opt in
diff --git a/modules/tanelorn/packages/patches/emacs-native-comp-driver-options.patch b/modules/tanelorn/packages/patches/emacs-native-comp-driver-options.patch
new file mode 100644
index 0000000..e4ed5a4
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-native-comp-driver-options.patch
@@ -0,0 +1,18 @@
+We substitute this anyway, so let's make it easier to substitute.
+
+--- a/lisp/emacs-lisp/comp.el
++++ b/lisp/emacs-lisp/comp.el
+@@ -203,9 +203,7 @@ and above."
+ :type '(repeat string)
+ :version "28.1")
+
+-(defcustom native-comp-driver-options
+- (cond ((eq system-type 'darwin) '("-Wl,-w"))
+- ((eq system-type 'cygwin) '("-Wl,-dynamicbase")))
++(defcustom native-comp-driver-options nil
+ "Options passed verbatim to the native compiler's back-end driver.
+ Note that not all options are meaningful; typically only the options
+ affecting the assembler and linker are likely to be useful.
+--
+2.38.0
+
diff --git a/modules/tanelorn/packages/patches/emacs-native-comp-pin-packages.patch b/modules/tanelorn/packages/patches/emacs-native-comp-pin-packages.patch
new file mode 100644
index 0000000..dc328f0
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-native-comp-pin-packages.patch
@@ -0,0 +1,39 @@
+Index: emacs-29.4/src/lread.c
+===================================================================
+--- emacs-29.4.orig/src/lread.c
++++ emacs-29.4/src/lread.c
+@@ -1668,9 +1668,34 @@ directories, make sure the PREDICATE fun
+
+ #ifdef HAVE_NATIVE_COMP
+ static bool
++permit_swap_for_eln (Lisp_Object src_name, Lisp_Object eln_name)
++{
++ char *src = SSDATA (src_name), *eln = SSDATA (eln_name);
++ size_t eln_ln = strlen (eln);
++
++ while (*src && *eln && *src == *eln)
++ {
++ ++src; ++eln; --eln_ln;
++ }
++
++ /* After stripping common prefixes, the first directory should be
++ * "lib/" (inside the Guix store) or "native-lisp" (inside Emacs build).
++ * Alternatively, if eln contains "eln-cache", it's likely the user's
++ * cache, which we will also permit. */
++
++ return
++ (eln_ln > 4 && !strncmp (eln, "lib/", 4)) ||
++ (eln_ln > 12 && !strncmp (eln, "native-lisp/", 12)) ||
++ strstr (eln, "eln-cache") != NULL;
++}
++
++static bool
+ maybe_swap_for_eln1 (Lisp_Object src_name, Lisp_Object eln_name,
+ Lisp_Object *filename, int *fd, struct timespec mtime)
+ {
++ if (!permit_swap_for_eln (src_name, eln_name))
++ return false;
++
+ struct stat eln_st;
+ int eln_fd = emacs_open (SSDATA (ENCODE_FILE (eln_name)), O_RDONLY, 0);
+
diff --git a/modules/tanelorn/packages/patches/emacs-next-disable-jit-compilation.patch b/modules/tanelorn/packages/patches/emacs-next-disable-jit-compilation.patch
new file mode 100644
index 0000000..0bac7a2
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-next-disable-jit-compilation.patch
@@ -0,0 +1,19 @@
+Index: emacs-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -5648,8 +5648,12 @@ For internal use. */);
+ doc: /* If non-nil, compile loaded .elc files asynchronously.
+
+ After compilation, each function definition is updated to use the
+-natively compiled one. */);
+- native_comp_jit_compilation = true;
++natively compiled one. This variable is enabled by default upstream,
++but disabled in Guix to better make use of precompiled packages.
++Notably, Guix removes the hashes that prevent inadvertent shadowing
++from the file names of compiled libraries in order to facilitate grafts.
++Enable at your own risk! */);
++ native_comp_jit_compilation = false;
+
+ DEFSYM (Qnative_comp_speed, "native-comp-speed");
+ DEFSYM (Qnative_comp_debug, "native-comp-debug");
diff --git a/modules/tanelorn/packages/patches/emacs-next-exec-path.patch b/modules/tanelorn/packages/patches/emacs-next-exec-path.patch
new file mode 100644
index 0000000..54091af
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-next-exec-path.patch
@@ -0,0 +1,18 @@
+Do not capture the build-time value of $PATH in the 'emacs' executable
+since this can noticeably increase the size of the closure of Emacs
+with things like GCC being referenced.
+
+Index: emacs/lisp/loadup.el
+===================================================================
+--- emacs.orig/lisp/loadup.el
++++ emacs/lisp/loadup.el
+@@ -603,7 +603,8 @@ directory got moved. This is set to be
+ (if (eq system-type 'ms-dos)
+ "b-emacs.pdmp"
+ "bootstrap-emacs.pdmp"))
+- (t (error "Unrecognized dump mode %s" dump-mode)))))
++ (t (error "Unrecognized dump mode %s" dump-mode))))
++ (exec-path nil))
+ (when (and (featurep 'native-compile)
+ (equal dump-mode "pdump"))
+ ;; Don't enable this before bootstrap is completed, as the
diff --git a/modules/tanelorn/packages/patches/emacs-next-native-comp-fix-filenames.patch b/modules/tanelorn/packages/patches/emacs-next-native-comp-fix-filenames.patch
new file mode 100644
index 0000000..ae16fc2
--- /dev/null
+++ b/modules/tanelorn/packages/patches/emacs-next-native-comp-fix-filenames.patch
@@ -0,0 +1,355 @@
+Upstream hashes both the absolute file name and the content of a file
+to derive the name for the natively compiled files. This breaks the
+staged install used in guix, as any $GUIX_PROFILE is distinct from
+the build directory. It also breaks grafts, as hardcoded store file
+names get rewritten; thus changing the file hash.
+
+In addition, this patch changes how native-comp-eln-load-path is
+constructed. Upstream, an entry of the directory “../lisp” is added
+supposedly for bootstrap only, but this directory appears to find its
+way into the actual variable despite attempts to remove it by calling
+‘startup--update-eln-cache’.
+The user-visible procedure ‘startup-redirect-eln-cache’ is kept, as
+packages may require it, but only pushes the new value now.
+
+Index: emacs/src/comp.c
+===================================================================
+--- emacs.orig/src/comp.c
++++ emacs/src/comp.c
+@@ -4279,26 +4279,17 @@ DEFUN ("comp-el-to-eln-rel-filename", Fc
+ Scomp_el_to_eln_rel_filename, 1, 1, 0,
+ doc: /* Return the relative name of the .eln file for FILENAME.
+ FILENAME must exist, and if it's a symlink, the target must exist.
+-If FILENAME is compressed, it must have the \".gz\" extension,
+-and Emacs must have been compiled with zlib; the file will be
+-uncompressed on the fly to hash its contents.
+-Value includes the original base name, followed by 2 hash values,
+-one for the file name and another for its contents, followed by .eln. */)
++FILENAME is resolved relative to `load-path' and only the suffix of
++the first matching path is kept. If FILENAME is not found to be relative
++to any directory `load-path', it is used as-is to construct the return
++value. */)
+ (Lisp_Object filename)
+ {
+ CHECK_STRING (filename);
+
+- /* Resolve possible symlinks in FILENAME, so that path_hash below
+- always compares equal. (Bug#44701). */
+- filename = Fexpand_file_name (filename, Qnil);
+- char *file_normalized = realpath (SSDATA (ENCODE_FILE (filename)), NULL);
+- if (file_normalized)
+- {
+- filename = DECODE_FILE (make_unibyte_string (file_normalized,
+- strlen (file_normalized)));
+- xfree (file_normalized);
+- }
++ Lisp_Object rel_name = filename;
+
++ filename = Fexpand_file_name (filename, Qnil);
+ if (NILP (Ffile_exists_p (filename)))
+ xsignal1 (Qfile_missing, filename);
+
+@@ -4306,64 +4297,55 @@ one for the file name and another for it
+ filename = Fw32_long_file_name (filename);
+ #endif
+
+- Lisp_Object content_hash = comp_hash_source_file (filename);
+-
+- if (suffix_p (filename, ".gz"))
+- filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+-
+- /* We create eln filenames with an hash in order to look-up these
+- starting from the source filename, IOW have a relation
+-
+- /absolute/path/filename.el + content ->
+- eln-cache/filename-path_hash-content_hash.eln.
+-
+- 'dlopen' can return the same handle if two shared with the same
+- filename are loaded in two different times (even if the first was
+- deleted!). To prevent this scenario the source file content is
+- included in the hashing algorithm.
+-
+- As at any point in time no more then one file can exist with the
+- same filename, should be possible to clean up all
+- filename-path_hash-* except the most recent one (or the new one
+- being recompiled).
+-
+- As installing .eln files compiled during the build changes their
+- absolute path we need an hashing mechanism that is not sensitive
+- to that. For this we replace if match PATH_DUMPLOADSEARCH or
+- *PATH_REL_LOADSEARCH with '//' before computing the hash. */
+-
+- if (NILP (loadsearch_re_list))
+- {
+- Lisp_Object sys_re =
+- concat2 (build_string ("\\`[[:ascii:]]+"),
+- Fregexp_quote (build_string ("/" PATH_REL_LOADSEARCH "/")));
+- Lisp_Object dump_load_search =
+- Fexpand_file_name (build_string (PATH_DUMPLOADSEARCH "/"), Qnil);
+-#ifdef WINDOWSNT
+- dump_load_search = Fw32_long_file_name (dump_load_search);
+-#endif
+- loadsearch_re_list = list2 (sys_re, Fregexp_quote (dump_load_search));
+- }
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
++ FOR_EACH_TAIL_SAFE (tail)
+ {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
++ Lisp_Object directory = Ffile_name_as_directory (XCAR (tail));
++ Lisp_Object len = Flength (directory);
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ directory, make_fixnum (0), len,
++ Qnil)))
+ {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil);
++ filename = Fsubstring (filename, len, Qnil);
+ break;
+ }
+ }
+- Lisp_Object separator = build_string ("-");
+- Lisp_Object path_hash = comp_hash_string (filename);
+- filename = concat2 (Ffile_name_nondirectory (Fsubstring (filename, Qnil,
+- make_fixnum (-3))),
+- separator);
+- Lisp_Object hash = concat3 (path_hash, separator, content_hash);
+- return concat3 (filename, hash, build_string (NATIVE_ELISP_SUFFIX));
++
++ if (Ffile_name_absolute_p (filename)) /* no match in load-path */
++ filename = rel_name;
++
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
++
++ if (!NILP (bogus_dirs))
++ {
++ tail = CALLNI (split-string, bogus_dirs, build_string (":"));
++
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object directory = Ffile_name_as_directory (XCAR (tail));
++ Lisp_Object len = Flength (directory);
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ directory, make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, len, Qnil);
++ break;
++ }
++ }
++ }
++
++ if (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
++
++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)),
++ build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
+@@ -4377,13 +4359,7 @@ If BASE-DIR is non-nil, use it as the di
+ non-absolute BASE-DIR is interpreted as relative to `invocation-directory'.
+ If BASE-DIR is omitted or nil, look for the first writable directory
+ in `native-comp-eln-load-path', and use as BASE-DIR its subdirectory
+-whose name is given by `comp-native-version-dir'.
+-If FILENAME specifies a preloaded file, the directory for the .eln
+-file is the \"preloaded/\" subdirectory of the directory determined
+-as described above. FILENAME is considered to be a preloaded file if
+-the value of `comp-file-preloaded-p' is non-nil, or if FILENAME
+-appears in the value of the environment variable LISP_PRELOADED;
+-the latter is supposed to be used by the Emacs build procedure. */)
++whose name is given by `comp-native-version-dir'. */)
+ (Lisp_Object filename, Lisp_Object base_dir)
+ {
+ Lisp_Object source_filename = filename;
+@@ -4431,10 +4407,11 @@ the latter is supposed to be used by the
+ Lisp_Object lisp_preloaded =
+ Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
++ bool preloaded = comp_file_preloaded_p;
+ if (comp_file_preloaded_p
+ || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALLNI (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
++ && !NILP (Fmember (CALLNI (file-name-sans-extension, source_filename),
++ Fmapcar (intern_c_string ("file-name-sans-extension"),
+ CALLNI (split-string, lisp_preloaded))))))
+ base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+@@ -5741,10 +5718,7 @@ The last directory of this list is assum
+ the system *.eln files, which are the files produced when building
+ Emacs. */);
+
+- /* Temporary value in use for bootstrap. We can't do better as
+- `invocation-directory' is still unset, will be fixed up during
+- dump reload. */
+- Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
++ Vnative_comp_eln_load_path = Qnil;
+
+ DEFVAR_LISP ("native-comp-enable-subr-trampolines",
+ Vnative_comp_enable_subr_trampolines,
+Index: emacs/lisp/startup.el
+===================================================================
+--- emacs.orig/lisp/startup.el
++++ emacs/lisp/startup.el
+@@ -520,9 +520,6 @@ DIRS are relative."
+ (defvar native-comp-jit-compilation)
+ (defvar native-comp-enable-subr-trampolines)
+
+-(defvar startup--original-eln-load-path nil
+- "Original value of `native-comp-eln-load-path'.")
+-
+ (defun startup-redirect-eln-cache (cache-directory)
+ "Redirect the user's eln-cache directory to CACHE-DIRECTORY.
+ CACHE-DIRECTORY must be a single directory, a string.
+@@ -533,22 +530,10 @@ to `user-emacs-directory'.
+ For best results, call this function in your early-init file,
+ so that the rest of initialization and package loading uses
+ the updated value."
+- ;; Remove the original eln-cache.
+- (setq native-comp-eln-load-path (cdr native-comp-eln-load-path))
+- ;; Add the new eln-cache.
+ (push (expand-file-name (file-name-as-directory cache-directory)
+ user-emacs-directory)
+ native-comp-eln-load-path))
+
+-(defun startup--update-eln-cache ()
+- "Update the user eln-cache directory due to user customizations."
+- ;; Don't override user customizations!
+- (when (equal native-comp-eln-load-path
+- startup--original-eln-load-path)
+- (startup-redirect-eln-cache "eln-cache")
+- (setq startup--original-eln-load-path
+- (copy-sequence native-comp-eln-load-path))))
+-
+ (defun startup--rescale-elt-match-p (font-pattern font-object)
+ "Test whether FONT-OBJECT matches an element of `face-font-rescale-alist'.
+ FONT-OBJECT is a font-object that specifies a font to test.
+@@ -771,9 +756,6 @@ It is the default value of the variable
+ (unwind-protect
+ (command-line)
+
+- (when (featurep 'native-compile)
+- (startup--update-eln-cache))
+-
+ ;; Do this again, in case .emacs defined more abbreviations.
+ (if default-directory
+ (setq default-directory (abbreviate-file-name default-directory)))
+@@ -1385,12 +1367,6 @@ please check its value")
+ startup-init-directory)))
+ (setq early-init-file user-init-file)
+
+- ;; Amend `native-comp-eln-load-path', since the early-init file may
+- ;; have altered `user-emacs-directory' and/or changed the eln-cache
+- ;; directory.
+- (when (featurep 'native-compile)
+- (startup--update-eln-cache))
+-
+ ;; If any package directory exists, initialize the package system.
+ (and user-init-file
+ package-enable-at-startup
+@@ -1525,12 +1501,6 @@ please check its value")
+ startup-init-directory))
+ t)
+
+- ;; Amend `native-comp-eln-load-path' again, since the early-init
+- ;; file may have altered `user-emacs-directory' and/or changed the
+- ;; eln-cache directory.
+- (when (featurep 'native-compile)
+- (startup--update-eln-cache))
+-
+ (when (and deactivate-mark transient-mark-mode)
+ (with-current-buffer (window-buffer)
+ (deactivate-mark)))
+Index: emacs/lisp/loadup.el
+===================================================================
+--- emacs.orig/lisp/loadup.el
++++ emacs/lisp/loadup.el
+@@ -53,6 +53,14 @@
+ (setq redisplay--inhibit-bidi t)
+
+ (message "Dump mode: %s" dump-mode)
++;; Compensate for native-comp-eln-load-path being empty by Guix' default.
++(and (featurep 'native-compile)
++ dump-mode
++ (setq
++ native-comp-eln-load-path
++ (cons (expand-file-name "../native-lisp" invocation-directory)
++ native-comp-eln-load-path)
++ comp-file-preloaded-p t))
+
+ ;; Add subdirectories to the load-path for files that might get
+ ;; autoloaded when bootstrapping or running Emacs normally.
+@@ -522,27 +530,25 @@ This to have it working when installed o
+ directory got moved. This is set to be a pair in the form of:
+ \(rel-filename-from-install-bin . rel-filename-from-local-bin)."
+ (when (and load--bin-dest-dir load--eln-dest-dir)
+- (setq eln-dest-dir
+- (concat load--eln-dest-dir "native-lisp/" comp-native-version-dir "/"))
++ (setq load--eln-versioned-dest-dir
++ (concat load--eln-dest-dir "native-lisp/" comp-native-version-dir "/"))
+ (maphash (lambda (_ cu)
+ (when (stringp (native-comp-unit-file cu))
+ (let* ((file (native-comp-unit-file cu))
+- (preloaded (equal (substring (file-name-directory file)
+- -10 -1)
+- "preloaded"))
+- (eln-dest-dir-eff (if preloaded
+- (expand-file-name "preloaded"
+- eln-dest-dir)
+- eln-dest-dir)))
++ (native-lisp-needle
++ (regexp-quote (concat "native-lisp/"
++ comp-native-version-dir "/"))))
+ (native-comp-unit-set-file
+ cu
+ (cons
+ ;; Relative filename from the installed binary.
+- (file-relative-name (expand-file-name
+- (file-name-nondirectory
+- file)
+- eln-dest-dir-eff)
+- load--bin-dest-dir)
++ (file-relative-name
++ (expand-file-name
++ (save-match-data
++ (string-match native-lisp-needle file)
++ (substring file (match-end 0)))
++ load--eln-versioned-dest-dir)
++ load--bin-dest-dir)
+ ;; Relative filename from the built uninstalled binary.
+ (file-relative-name file invocation-directory))))))
+ comp-loaded-comp-units-h)))
+@@ -609,7 +615,9 @@ directory got moved. This is set to be
+ (equal dump-mode "pdump"))
+ ;; Don't enable this before bootstrap is completed, as the
+ ;; compiler infrastructure may not be usable yet.
+- (setq native-comp-enable-subr-trampolines t))
++ (setq native-comp-enable-subr-trampolines t
++ ;; We loaded everything we could.
++ comp-file-preloaded-p nil))
+ (message "Dumping under the name %s" output)
+ (condition-case ()
+ (delete-file output)
+Index: emacs/src/Makefile.in
+===================================================================
+--- emacs.orig/src/Makefile.in
++++ emacs/src/Makefile.in
+@@ -567,6 +567,7 @@ shortlisp := $(filter-out ${shortlisp_fi
+ ## We don't really need to sort, but may as well use it to remove duplicates.
+ shortlisp := loaddefs.el loadup.el $(sort ${shortlisp})
+ export LISP_PRELOADED = ${shortlisp}
++export NATIVE_COMP_BOGUS_DIRS =
+ lisp = $(addprefix ${lispsource}/,${shortlisp})
+
+ ## Construct full set of libraries to be linked.