[PATCH emacs-team 0/2] Think ahead when compiling

  • Done
  • quality assurance status badge
Details
4 participants
  • Andrew Tropin
  • Liliana Marie Prikler
  • Mekeor Melire
  • Suhail
Owner
unassigned
Submitted by
Liliana Marie Prikler
Severity
normal
L
L
Liliana Marie Prikler wrote on 18 Nov 2023 14:42
(address . guix-patches@gnu.org)
cover.1700314926.git.liliana.prikler@gmail.com
Hi Guix,

this series (hopefully) makes it so that everything we need to be natively
compiled in Emacs a) is natively compiled, and b) is found in the right
location. Please check that you no longer get gratuitous writes to your
local eln-cache when trying this out.

Cheers

Fixes: emacs-build-system … mismatching hashes https://bugs.gnu.org/66864

Liliana Marie Prikler (2):
gnu: emacs: Build trampolines.
gnu: emacs: Don't hash file names in native compilation.

gnu/local.mk | 1 +
gnu/packages/emacs.scm | 6 +-
.../emacs-native-comp-fix-filenames.patch | 93 +++++++++++++++++++
3 files changed, 99 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch


base-commit: 60c97924e9519361494aaf0686e28eb831a42315
--
2.41.0
L
L
Liliana Marie Prikler wrote on 18 Nov 2023 14:38
[PATCH emacs-team 2/2] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
f38d16e04962f76bc74503a105065c1a30d51ff7.1700314926.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 93 +++++++++++++++++++
3 files changed, 95 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (125 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 8d817379a7..e878551b37 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1111,6 +1111,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-highlight-stages-add-gexp.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 55eab48c25..822d15cc94 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -110,6 +110,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..f461bc8a78
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,93 @@
+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.
+
+Index: emacs-29.1/src/comp.c
+===================================================================
+--- emacs-29.1.orig/src/comp.c
++++ emacs-29.1/src/comp.c
+@@ -4399,8 +4399,8 @@ FILENAME must exist, and if it's a symli
+ 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. */)
++Value includes the original base name, followed by a hash of its
++content, followed by .eln. */)
+ (Lisp_Object filename)
+ {
+ CHECK_STRING (filename);
+@@ -4423,64 +4423,26 @@ 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
++ /* We create eln filenames with a 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.
++ filename.el + content -> eln-cache/filename-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.
++ 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. */
++ Lisp_Object content_hash = comp_hash_source_file (filename);
++ Lisp_Object separator = build_string ("-");
+
+- 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));
+- }
++ if (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
+- {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, 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));
++ return concat3 (filename, content_hash, build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
--
2.41.0
A
A
Andrew Tropin wrote on 18 Nov 2023 16:44
Re: [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
87cyw72hiy.fsf@trop.in
On 2023-11-18 14:42, Liliana Marie Prikler wrote:

Toggle quote (24 lines)
> Hi Guix,
>
> this series (hopefully) makes it so that everything we need to be natively
> compiled in Emacs a) is natively compiled, and b) is found in the right
> location. Please check that you no longer get gratuitous writes to your
> local eln-cache when trying this out.
>
> Cheers
>
> Fixes: emacs-build-system … mismatching hashes <https://bugs.gnu.org/66864>
>
> Liliana Marie Prikler (2):
> gnu: emacs: Build trampolines.
> gnu: emacs: Don't hash file names in native compilation.
>
> gnu/local.mk | 1 +
> gnu/packages/emacs.scm | 6 +-
> .../emacs-native-comp-fix-filenames.patch | 93 +++++++++++++++++++
> 3 files changed, 99 insertions(+), 1 deletion(-)
> create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch
>
>
> base-commit: 60c97924e9519361494aaf0686e28eb831a42315

Toggle snippet (20 lines)
$ rm -r ~/.config/emacs/eln-cache/29.1-09dbbf4e
$ guix time-machine --branch=emacs-team -- shell emacs-pgtk emacs-magit --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
(require 'magit)
C-x C-c
$ ls ~/.config/emacs/eln-cache/29.1-09dbbf4e
dash-6c86c585-82fea3ab.eln magit-log-58eeae71-b655dbfb.eln magit-section-6e195547-0461e8af.eln
git-commit-927a864a-05a352a6.eln magit-margin-ec1cc1e9-b1c0e957.eln magit-sequence-40a35869-1b719931.eln
magit-7056b331-38ef85d9.eln magit-merge-0070f654-7bc0ed2b.eln magit-stash-06fe9f6e-f2a708b65jGJrl.eln.tmp
magit-autorevert-54dea36c-bf1f5ea3.eln magit-mode-5ad95198-31fbb927.eln magit-status-70fcb10a-f6654216.eln
magit-base-cd520092-751fcac2.eln magit-notes-17dfe23c-ce57b283.eln magit-tag-e968dc8c-f7b42d89.eln
magit-bisect-8f9f6b8f-6fbb9bc2.eln magit-process-3e9d760a-410e523c.eln magit-transient-1d163154-ba4b9651.eln
magit-branch-b9c8386b-b362e334.eln magit-pull-1f116009-3bf3af7f.eln magit-wip-99682fc2-0371c052.eln
magit-clone-28b35658-e3db2e06.eln magit-push-08e42ed4-b67bbe05.eln magit-worktree-8f50ba9f-7b120e5d.eln
magit-commit-18780595-ac089f0e.eln magit-reflog-4106970e-69fc9edb.eln subr--trampoline-6d616b652d70726f63657373_make_process_0.eln
magit-diff-278da2fe-8132fe46.eln magit-refs-1e67efee-ab4fef69.eln transient-29183598-be63c251.eln
magit-fetch-5ba6406a-029daf61.eln magit-remote-55bccbe3-bb4a4595.eln with-editor-415da08e-ddc1b93b.eln
magit-files-1ee9fbef-d629cbfc.eln magit-repos-a48553be-da9ca79c.eln
magit-git-736caf3b-1398a0cc.eln magit-reset-902f52f7-709d5f56.eln

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmVY28UACgkQIgjSCVjB
3rDAZg/8CHlTWflVbLuAmXhFMKzrDiciXHbvync86H2N8G/+zvZxot5fvekMgN3J
m9pEkW4DWsWH3G3z/fddZFdR0AHooVAD4cCw6WCso+8rk22KesIPafLJ/U05bPO3
XXZ7H75wlCjGt4rOMJcMWJe1XEaLX+cCiDjqRNdMSZDSrHYxU2mZFG7gJeSRXdJg
cibV8u12mhV/SYs/zWwXdA0PxVhZvhKRer/sHyxJ6L+hmeNUgfDgxfGCXiNViGcV
aardAYb6UucWqWLEnJF4Fiypgh1TKC+6tq3kBCvpexFzb0TAVPfjF25tEQ2MIYj5
9PBUWLLbxFvLZbnXsjtK0zlUyQaEBYV5Kr8MDRkr1Cv8oY/Gz09hOKvFin8EKGc/
HrrmUR0Z7oYN+JAD8minI+dbKpNmjEd8hCWs0ZQ5pu+oe97OxbjaGaURUo3bDV3B
75fBG4LNstcVHJKBBnxfr2Qka2i3IxVjHkQlSqt5n+eFv4+42kH7p2SG3R1U7v/W
oQavS82du3iFXuROLsWsQ2tgU/5gUgcQva5ehmXhUGc+CTxT2Uy2yGPCo4Xu3Og2
ZeVRysGzdcedAevHWGSUIZK3XgFfz9xGXrvQqvRgeEafCReKTNF2X39s9HqXA3bV
EsRuRPdLA4iQGhOy82mfp/H4Frf64cUYzMhB2IGRI9q8BdUGN0I=
=j5wO
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 18 Nov 2023 16:51
(address . cox.katherine.e+guix@gmail.com)
17be83c41a55ccf5c74451fd031eab75dfe0eb70.camel@gmail.com
Am Samstag, dem 18.11.2023 um 19:44 +0400 schrieb Andrew Tropin:
Toggle quote (64 lines)
> On 2023-11-18 14:42, Liliana Marie Prikler wrote:
>
> > Hi Guix,
> >
> > this series (hopefully) makes it so that everything we need to be
> > natively compiled in Emacs a) is natively compiled, and b) is found
> > in the right location.  Please check that you no longer get
> > gratuitous writes to your local eln-cache when trying this out.
> >
> > Cheers
> >
> > Fixes: emacs-build-system … mismatching hashes
> > <https://bugs.gnu.org/66864>
> >
> > Liliana Marie Prikler (2):
> >   gnu: emacs: Build trampolines.
> >   gnu: emacs: Don't hash file names in native compilation.
> >
> >  gnu/local.mk                                  |  1 +
> >  gnu/packages/emacs.scm                        |  6 +-
> >  .../emacs-native-comp-fix-filenames.patch     | 93
> > +++++++++++++++++++
> >  3 files changed, 99 insertions(+), 1 deletion(-)
> >  create mode 100644 gnu/packages/patches/emacs-native-comp-fix-
> > filenames.patch
> >
> >
> > base-commit: 60c97924e9519361494aaf0686e28eb831a42315
>
> --8<---------------cut here---------------start------------->8---
> $ rm -r ~/.config/emacs/eln-cache/29.1-09dbbf4e
> $ guix time-machine --branch=emacs-team -- shell emacs-pgtk emacs-
> magit --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
> (require 'magit)
> C-x C-c
> $ ls ~/.config/emacs/eln-cache/29.1-09dbbf4e
> dash-6c86c585-82fea3ab.eln              magit-log-58eeae71-
> b655dbfb.eln      magit-section-6e195547-0461e8af.eln
> git-commit-927a864a-05a352a6.eln        magit-margin-ec1cc1e9-
> b1c0e957.eln   magit-sequence-40a35869-1b719931.eln
> magit-7056b331-38ef85d9.eln             magit-merge-0070f654-
> 7bc0ed2b.eln    magit-stash-06fe9f6e-f2a708b65jGJrl.eln.tmp
> magit-autorevert-54dea36c-bf1f5ea3.eln  magit-mode-5ad95198-
> 31fbb927.eln     magit-status-70fcb10a-f6654216.eln
> magit-base-cd520092-751fcac2.eln        magit-notes-17dfe23c-
> ce57b283.eln    magit-tag-e968dc8c-f7b42d89.eln
> magit-bisect-8f9f6b8f-6fbb9bc2.eln      magit-process-3e9d760a-
> 410e523c.eln  magit-transient-1d163154-ba4b9651.eln
> magit-branch-b9c8386b-b362e334.eln      magit-pull-1f116009-
> 3bf3af7f.eln     magit-wip-99682fc2-0371c052.eln
> magit-clone-28b35658-e3db2e06.eln       magit-push-08e42ed4-
> b67bbe05.eln     magit-worktree-8f50ba9f-7b120e5d.eln
> magit-commit-18780595-ac089f0e.eln      magit-reflog-4106970e-
> 69fc9edb.eln   subr--trampoline-
> 6d616b652d70726f63657373_make_process_0.eln
> magit-diff-278da2fe-8132fe46.eln        magit-refs-1e67efee-
> ab4fef69.eln     transient-29183598-be63c251.eln
> magit-fetch-5ba6406a-029daf61.eln       magit-remote-55bccbe3-
> bb4a4595.eln   with-editor-415da08e-ddc1b93b.eln
> magit-files-1ee9fbef-d629cbfc.eln       magit-repos-a48553be-
> da9ca79c.eln
> magit-git-736caf3b-1398a0cc.eln         magit-reset-902f52f7-
> 709d5f56.eln
> --8<---------------cut here---------------end--------------->8---
Oof.
M
M
Mekeor Melire wrote on 22 Nov 2023 13:09
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87o7fmyohc.fsf@posteo.de
2023-11-18 14:42 liliana.prikler@gmail.com:

Toggle quote (2 lines)
> Hi Guix,

Hello and thank you for your efforts on this issue.

Toggle quote (4 lines)
> Liliana Marie Prikler (2):
> gnu: emacs: Build trampolines.
> gnu: emacs: Don't hash file names in native compilation.

It seems like this is a series of two commits but I only received one, namely the second one ("2/2"). Is it just me or did the first commit went missing for everyone?

Also, are these commits still on emacs-team branch? Andrew's command (guix time-machine --branch=emacs-team -- shell ...) made me assume that these commits were pushed to emacs-team branch, but I can't find them there.

I'd be glad to try this patch-series out - at some point, when I have more time.
L
L
Liliana Marie Prikler wrote on 22 Nov 2023 18:39
(name . Mekeor Melire)(address . mekeor@posteo.de)
243d8344190823ba30365f10fb05345f7e93d710.camel@gmail.com
Am Mittwoch, dem 22.11.2023 um 12:09 +0000 schrieb Mekeor Melire:
Toggle quote (21 lines)
> 2023-11-18 14:42 liliana.prikler@gmail.com:
>
> > Hi Guix,
>
> Hello and thank you for your efforts on this issue.
>
> > Liliana Marie Prikler (2):
> >   gnu: emacs: Build trampolines.
> >   gnu: emacs: Don't hash file names in native compilation.
>
> It seems like this is a series of two commits but I only received
> one, namely the second one ("2/2"). Is it just me or did the first
> commit went missing for everyone?
>
> Also, are these commits still on emacs-team branch? Andrew's command
> (guix time-machine --branch=emacs-team -- shell ...) made me assume
> that these commits were pushed to emacs-team branch, but I can't find
> them there.
>
> I'd be glad to try this patch-series out - at some point, when I have
> more time.
These are commits submitted to the emacs-branch – they are not
upstreamed yet.

I'll have a v2 up hopefully soon; things sadly aren't as smooth as I'd
assumed.

Cheers
L
L
Liliana Marie Prikler wrote on 25 Nov 2023 09:18
[PATCH emacs-team v2 3/3] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
28de2575a98876bed2c1c2762871639733d75a9f.1700900541.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 25 Nov 2023 12:13
[PATCH emacs-team v3 1/3] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)
84c0bc8c4e65af2241b9dd15f494fdc7eedd83d1.1700910860.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (20 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index b9d9e2b891..55eab48c25 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -327,7 +327,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls

base-commit: 60c97924e9519361494aaf0686e28eb831a42315
--
2.41.0
L
L
Liliana Marie Prikler wrote on 25 Nov 2023 12:13
[PATCH emacs-team v3 2/3] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
daf346bcc21247579cb4a10d48c7c4407a7b7283.1700910860.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 197 ++++++++++++++++++
3 files changed, 199 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (229 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 8d817379a7..e878551b37 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1111,6 +1111,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-highlight-stages-add-gexp.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 55eab48c25..822d15cc94 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -110,6 +110,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..714b707e47
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,197 @@
+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.
+
+Index: emacs-29.1/src/comp.c
+===================================================================
+--- emacs-29.1.orig/src/comp.c
++++ emacs-29.1/src/comp.c
+@@ -4396,26 +4396,18 @@ 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. Further, if the NATIVE_COMP_BOGUS_DIRS environment variable is set,
++the first matching prefix mentioned in it will be stripped as well. */)
+ (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);
+
+@@ -4423,64 +4415,53 @@ 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.
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- '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))
++ FOR_EACH_TAIL_SAFE (tail)
+ {
+- 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 lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
+ {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil);
++ filename = Fsubstring (filename, Fadd1 (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))
++ filename = rel_name;
++
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
++
++ if (!NILP (bogus_dirs))
++ {
++ tail = CALL2I (split-string, bogus_dirs, build_string (":"));
++
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (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,
+@@ -4494,13 +4475,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;
+@@ -4541,19 +4516,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+Index: emacs-29.1/src/Makefile.in
+===================================================================
+--- emacs-29.1.orig/src/Makefile.in
++++ emacs-29.1/src/Makefile.in
+@@ -553,6 +553,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.
--
2.41.0
L
L
Liliana Marie Prikler wrote on 25 Nov 2023 12:13
[PATCH emacs-team v3 3/3] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
2460e8aa5efadac8e330bce567a1a2547c2393e7.1700910860.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 8 Dec 2023 12:16
[PATCH v4 4/5] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)
31685a8dadad82f6b7a217149599f639fff0d99b.1702036387.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 9bb07663ee..80b3136284 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16461,6 +16461,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 8 Dec 2023 12:45
[PATCH v4 5/5] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)
9fc90ad975d9a3e5180259ec29a62013a4d16d17.1702036387.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 80b3136284..1655dee647 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1566,7 +1566,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
A
A
Andrew Tropin wrote on 27 Dec 2023 12:00
Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
87le9fzz9c.fsf@trop.in
On 2023-11-25 12:13, Liliana Marie Prikler wrote:

Toggle quote (26 lines)
> * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.
>
> Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
> ---
> gnu/packages/emacs.scm | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index b9d9e2b891..55eab48c25 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -327,7 +327,10 @@ (define-public emacs-no-x
> (string-append
> "-B" #$(this-package-input "libgccjit") "/lib/")
> (string-append
> - "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
> + "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
> + (add-after 'build 'build-trampolines
> + (lambda* (#:key make-flags #:allow-other-keys)
> + (apply invoke "make" "trampolines" make-flags)))))))
> (inputs
> (modify-inputs (package-inputs emacs-minimal)
> (prepend gnutls
>
> base-commit: 60c97924e9519361494aaf0686e28eb831a42315

Applied the patch series v4 to emacs-team branch, removed all eln files
in ~/.cache/emacs and ~/.config/emacs, executed

Toggle snippet (5 lines)
./pre-inst-env guix shell emacs-pgtk emacs-magit \
--pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
# M-S-: (require 'magit) RET

*Warnings*:
Toggle snippet (7 lines)
... # the same content as in the listing below +
? Warning (comp): /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/eieio.el.gz: Error: error Uncompression program `sh' not found
? Warning (comp): /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/comp.el.gz: Error: error Uncompression program `sh' not found
...


Modified the command
Toggle snippet (5 lines)
./pre-inst-env guix shell emacs-pgtk emacs-magit bash \
--pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
# M-S-: (require 'magit) RET

*Warnings*:
Toggle snippet (16 lines)
? Warning (comp): dash.el:615:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:628:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:645:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1059:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1219:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1272:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1320:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1335:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1341:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:1523:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:2254:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
? Warning (comp): dash.el:2613:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:2632:2: Warning: docstring wider than 80 characters
? Warning (comp): dash.el:3318:2: Warning: docstring wider than 80 characters

*Native-compile-log*:
Toggle snippet (3 lines)
Compiling /home/bob/.config/emacs/eln-cache/29.1-5c9913f6/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln...

*Async-native-compile-log*:
Toggle snippet (270 lines)
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/bytecomp.el.gz...
uncompressing bytecomp.el.gz...
uncompressing bytecomp.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-extra.el.gz...
uncompressing cl-extra.el.gz...
uncompressing cl-extra.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-loaddefs.el.gz...
uncompressing cl-loaddefs.el.gz...
uncompressing cl-loaddefs.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-lib.el.gz...
uncompressing cl-lib.el.gz...
uncompressing cl-lib.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/help-mode.el.gz...
uncompressing help-mode.el.gz...
uncompressing help-mode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/gv.el.gz...
uncompressing gv.el.gz...
uncompressing gv.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-macs.el.gz...
uncompressing cl-macs.el.gz...
uncompressing cl-macs.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-seq.el.gz...
uncompressing cl-seq.el.gz...
uncompressing cl-seq.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/rx.el.gz...
uncompressing rx.el.gz...
uncompressing rx.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/subr-x.el.gz...
uncompressing subr-x.el.gz...
uncompressing subr-x.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/icons.el.gz...
uncompressing icons.el.gz...
uncompressing icons.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/warnings.el.gz...
uncompressing warnings.el.gz...
uncompressing warnings.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/comp-cstr.el.gz...
uncompressing comp-cstr.el.gz...
uncompressing comp-cstr.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/comp.el.gz...
uncompressing comp.el.gz...
uncompressing comp.el.gz...done
Compiling /gnu/store/zxbk6xmbk8if4r7h0bfwrw5nq925drrb-emacs-dash-2.19.1/share/emacs/site-lisp/dash-2.19.1/dash.el...

In -map-when:
dash.el:615:2: Warning: docstring wider than 80 characters

In -map-first:
dash.el:628:2: Warning: docstring wider than 80 characters

In -map-last:
dash.el:645:2: Warning: docstring wider than 80 characters

In -only-some?:
dash.el:1059:2: Warning: docstring wider than 80 characters

In -update-at:
dash.el:1219:2: Warning: docstring wider than 80 characters

In -split-with:
dash.el:1272:2: Warning: docstring wider than 80 characters

In -separate:
dash.el:1320:2: Warning: docstring wider than 80 characters

In -partition-all-in-steps:
dash.el:1335:2: Warning: docstring wider than 80 characters

In -partition-in-steps:
dash.el:1341:2: Warning: docstring wider than 80 characters

In --zip-with:
dash.el:1523:2: Warning: docstring wider than 80 characters

In -let:
dash.el:2254:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)

In -union:
dash.el:2613:2: Warning: docstring wider than 80 characters

In -intersection:
dash.el:2632:2: Warning: docstring wider than 80 characters

In -prodfn:
dash.el:3318:2: Warning: docstring wider than 80 characters
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/eieio.el.gz...
uncompressing eieio.el.gz...
uncompressing eieio.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/eieio-core.el.gz...
uncompressing eieio-core.el.gz...
uncompressing eieio-core.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/byte-opt.el.gz...
uncompressing byte-opt.el.gz...
uncompressing byte-opt.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/crm.el.gz...
uncompressing crm.el.gz...
uncompressing crm.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cursor-sensor.el.gz...
uncompressing cursor-sensor.el.gz...
uncompressing cursor-sensor.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/format-spec.el.gz...
uncompressing format-spec.el.gz...
uncompressing format-spec.el.gz...done
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-section.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-base.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-git.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/kmacro.el.gz...
uncompressing kmacro.el.gz...
uncompressing kmacro.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/edmacro.el.gz...
uncompressing edmacro.el.gz...
uncompressing edmacro.el.gz...done
Compiling /gnu/store/j8ai3gdi0nyhngpid3rxaqhy1a9xp22i-emacs-transient-0.4.3-0.cc0fa80/share/emacs/site-lisp/transient-0.4.3-0.cc0fa80/transient.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-mode.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/ansi-color.el.gz...
uncompressing ansi-color.el.gz...
uncompressing ansi-color.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/server.el.gz...
uncompressing server.el.gz...
uncompressing server.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/ring.el.gz...
uncompressing ring.el.gz...
uncompressing ring.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/ansi-osc.el.gz...
uncompressing ansi-osc.el.gz...
uncompressing ansi-osc.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/comint.el.gz...
uncompressing comint.el.gz...
uncompressing comint.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/pcomplete.el.gz...
uncompressing pcomplete.el.gz...
uncompressing pcomplete.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/shell.el.gz...
uncompressing shell.el.gz...
uncompressing shell.el.gz...done
Compiling /gnu/store/qy0xb7bikh5bghwqskw5wnylbk7ikjkz-emacs-with-editor-3.3.2/share/emacs/site-lisp/with-editor-3.3.2/with-editor.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/calendar/time-date.el.gz...
uncompressing time-date.el.gz...
uncompressing time-date.el.gz...done
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-process.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-transient.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-margin.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/filenotify.el.gz...
uncompressing filenotify.el.gz...
uncompressing filenotify.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/autorevert.el.gz...
uncompressing autorevert.el.gz...
uncompressing autorevert.el.gz...done
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-autorevert.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/add-log.el.gz...
uncompressing add-log.el.gz...
uncompressing add-log.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/pcvs-util.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mailheader.el.gz...
uncompressing pcvs-util.el.gz...
uncompressing pcvs-util.el.gz...done
uncompressing mailheader.el.gz...
uncompressing mailheader.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/gmm-utils.el.gz...
uncompressing gmm-utils.el.gz...
uncompressing gmm-utils.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mail-utils.el.gz...
uncompressing mail-utils.el.gz...
uncompressing mail-utils.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mailabbrev.el.gz...
uncompressing mailabbrev.el.gz...
uncompressing mailabbrev.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/ietf-drums.el.gz...
uncompressing ietf-drums.el.gz...
uncompressing ietf-drums.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-util.el.gz...
uncompressing mm-util.el.gz...
uncompressing mm-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc2045.el.gz...
uncompressing rfc2045.el.gz...
uncompressing rfc2045.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc2047.el.gz...
uncompressing rfc2047.el.gz...
uncompressing rfc2047.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc2231.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mail-parse.el.gz...
uncompressing rfc2231.el.gz...
uncompressing rfc2231.el.gz...done
uncompressing mail-parse.el.gz...
uncompressing mail-parse.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-encode.el.gz...
uncompressing mm-encode.el.gz...
uncompressing mm-encode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-bodies.el.gz...
uncompressing mm-bodies.el.gz...
uncompressing mm-bodies.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-decode.el.gz...
uncompressing mm-decode.el.gz...
uncompressing mm-decode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/text-property-search.el.gz...
uncompressing text-property-search.el.gz...
uncompressing text-property-search.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/gnus-util.el.gz...
uncompressing gnus-util.el.gz...
uncompressing gnus-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/epg-config.el.gz...
uncompressing epg-config.el.gz...
uncompressing epg-config.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc6068.el.gz...
uncompressing rfc6068.el.gz...
uncompressing rfc6068.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/epg.el.gz...
uncompressing epg.el.gz...
uncompressing epg.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/derived.el.gz...
uncompressing derived.el.gz...
uncompressing derived.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/epa.el.gz...
uncompressing epa.el.gz...
uncompressing epa.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/password-cache.el.gz...
uncompressing password-cache.el.gz...
uncompressing password-cache.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mml-sec.el.gz...
uncompressing mml-sec.el.gz...
uncompressing mml-sec.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mml.el.gz...
uncompressing mml.el.gz...
uncompressing mml.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc822.el.gz...
uncompressing rfc822.el.gz...
uncompressing rfc822.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/dired.el.gz...
uncompressing dired.el.gz...
uncompressing dired.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/net/puny.el.gz...
uncompressing puny.el.gz...
uncompressing puny.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/yank-media.el.gz...
uncompressing yank-media.el.gz...
uncompressing yank-media.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/net/mailcap.el.gz...
uncompressing mailcap.el.gz...
uncompressing mailcap.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/sendmail.el.gz...
uncompressing sendmail.el.gz...
uncompressing sendmail.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/message.el.gz...
uncompressing message.el.gz...
uncompressing message.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/log-edit.el.gz...
uncompressing log-edit.el.gz...
uncompressing log-edit.el.gz...done
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/git-commit.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/easy-mmode.el.gz...
uncompressing easy-mmode.el.gz...
uncompressing easy-mmode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/diff-mode.el.gz...
uncompressing diff-mode.el.gz...
uncompressing diff-mode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/diff.el.gz...
uncompressing diff.el.gz...
uncompressing diff.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/smerge-mode.el.gz...
uncompressing smerge-mode.el.gz...
uncompressing smerge-mode.el.gz...done
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-diff.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/imenu.el.gz...
uncompressing imenu.el.gz...
uncompressing imenu.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/progmodes/which-func.el.gz...
uncompressing which-func.el.gz...
uncompressing which-func.el.gz...done
Compiling /gnu/store/bz2lz2pf5il825aqcs
This message was truncated. Download the full message here.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmWMA78ACgkQIgjSCVjB
3rBmtQ//SCKRd7DW+YVx3o1GeMNQZS0AhQqIjlTTKbt67WkQIOcOr2ax/dRa9Xhv
eVoEjxB3zXhE9bgy3qkDGDgzm7p98+F2RQQiqS0fUhjaTnJv39ROPv7J0WIp2QVO
eEsW87TAX0mQf2+jeQyAE9xjougoxxPcMy4INtrUUWt03XCIXeWK35LWuGJmjiNF
mG2CijwJxLwx5WgyWJENFY8HncQ88EZdq7f81ivMALNUd/qJZ1RMrJOAIljZnfzY
4Fht1ikDWHRqDCtfrV9Sy6J3tiHuWVIQ3nB/dSVGJD/W4VnwHHJiksQJ7UO1CBp1
TP6eDFcohYt/4xkB6DOgrmNwYaY3+j0OxBfX87Kn5JBjD7VszlWyn59EVp9EpPeb
md+mq4DLnQq0iln1iXXQYN4pyRcnJFzcYPhTpPtn+DJPzoiWz4eVmI7Eg3VPyDgk
rC4t6/p1adQGWSfH2zNTo0X4q4LTewNxACRRO9zGpKkLszCCt+8Ts0kTmQ+EeoY5
MAaZIAlFePfjdN/hmgp+uBjdqUHyqIlT/gdS/f4jfgnKCYN/d/qdWgN1Lbmh7rrH
JrjJMditWlK00JrLHrQtQ4dqBWxjnIZKzCd4g78d+lmxdMhhn0HK6pYnnMGBy1Ur
LPf5jbv+tkdh1mlnCX7+XtoHk2JdqR4vCr2B/oKT7o9zoxLE5yU=
=TjG2
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 27 Dec 2023 17:40
f798b6c95d005119fd6b80bebfea1ed1e6418167.camel@gmail.com
Am Mittwoch, dem 27.12.2023 um 14:00 +0300 schrieb Andrew Tropin:
Toggle quote (42 lines)
> On 2023-11-25 12:13, Liliana Marie Prikler wrote:
>
> > * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-
> > trampolines’.
> >
> > Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
> > ---
> >  gnu/packages/emacs.scm | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> > index b9d9e2b891..55eab48c25 100644
> > --- a/gnu/packages/emacs.scm
> > +++ b/gnu/packages/emacs.scm
> > @@ -327,7 +327,10 @@ (define-public emacs-no-x
> >                      (string-append
> >                       "-B" #$(this-package-input "libgccjit")
> > "/lib/")
> >                      (string-append
> > -                     "-B" #$(this-package-input "libgccjit")
> > "/lib/gcc/"))))))))))
> > +                     "-B" #$(this-package-input "libgccjit")
> > "/lib/gcc/"))))))
> > +            (add-after 'build 'build-trampolines
> > +              (lambda* (#:key make-flags #:allow-other-keys)
> > +                (apply invoke "make" "trampolines" make-
> > flags)))))))
> >      (inputs
> >       (modify-inputs (package-inputs emacs-minimal)
> >         (prepend gnutls
> >
> > base-commit: 60c97924e9519361494aaf0686e28eb831a42315
>
> Applied the patch series v4 to emacs-team branch, removed all eln
> files
> in ~/.cache/emacs and ~/.config/emacs, executed
>
> --8<---------------cut here---------------start------------->8---
> ./pre-inst-env guix shell emacs-pgtk emacs-magit \
> --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
> # M-S-: (require 'magit) RET
> --8<---------------cut here---------------end--------------->8---
You're missing --with-input=emacs-minimal=emacs. You are not natively
compiling emacs-magit atm.


Cheers
A
A
Andrew Tropin wrote on 27 Dec 2023 19:27
87wmszfql8.fsf@trop.in
On 2023-12-27 17:40, Liliana Marie Prikler wrote:

Toggle quote (46 lines)
> Am Mittwoch, dem 27.12.2023 um 14:00 +0300 schrieb Andrew Tropin:
>> On 2023-11-25 12:13, Liliana Marie Prikler wrote:
>>
>> > * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-
>> > trampolines’.
>> >
>> > Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
>> > ---
>> >  gnu/packages/emacs.scm | 5 ++++-
>> >  1 file changed, 4 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
>> > index b9d9e2b891..55eab48c25 100644
>> > --- a/gnu/packages/emacs.scm
>> > +++ b/gnu/packages/emacs.scm
>> > @@ -327,7 +327,10 @@ (define-public emacs-no-x
>> >                      (string-append
>> >                       "-B" #$(this-package-input "libgccjit")
>> > "/lib/")
>> >                      (string-append
>> > -                     "-B" #$(this-package-input "libgccjit")
>> > "/lib/gcc/"))))))))))
>> > +                     "-B" #$(this-package-input "libgccjit")
>> > "/lib/gcc/"))))))
>> > +            (add-after 'build 'build-trampolines
>> > +              (lambda* (#:key make-flags #:allow-other-keys)
>> > +                (apply invoke "make" "trampolines" make-
>> > flags)))))))
>> >      (inputs
>> >       (modify-inputs (package-inputs emacs-minimal)
>> >         (prepend gnutls
>> >
>> > base-commit: 60c97924e9519361494aaf0686e28eb831a42315
>>
>> Applied the patch series v4 to emacs-team branch, removed all eln
>> files
>> in ~/.cache/emacs and ~/.config/emacs, executed
>>
>> --8<---------------cut here---------------start------------->8---
>> ./pre-inst-env guix shell emacs-pgtk emacs-magit \
>> --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
>> # M-S-: (require 'magit) RET
>> --8<---------------cut here---------------end--------------->8---
> You're missing --with-input=emacs-minimal=emacs. You are not natively
> compiling emacs-magit atm.

Right, thank you!

Toggle snippet (5 lines)
./pre-inst-env guix shell bash emacs-pgtk emacs-magit \
--with-input=emacs-minimal=emacs-pgtk --pure \
-E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q

*Native-compile-log*:
Toggle snippet (3 lines)
Compiling /home/bob/.config/emacs/eln-cache/29.1-5c9913f6/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln...

*Async-native-compile-log*:
Toggle snippet (285 lines)
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/bytecomp.el.gz...
uncompressing bytecomp.el.gz...
uncompressing bytecomp.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-extra.el.gz...
uncompressing cl-extra.el.gz...
uncompressing cl-extra.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-loaddefs.el.gz...
uncompressing cl-loaddefs.el.gz...
uncompressing cl-loaddefs.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-lib.el.gz...
uncompressing cl-lib.el.gz...
uncompressing cl-lib.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/help-mode.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/gv.el.gz...
uncompressing help-mode.el.gz...
uncompressing help-mode.el.gz...done
uncompressing gv.el.gz...
uncompressing gv.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-macs.el.gz...
uncompressing cl-macs.el.gz...
uncompressing cl-macs.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cl-seq.el.gz...
uncompressing cl-seq.el.gz...
uncompressing cl-seq.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/rx.el.gz...
uncompressing rx.el.gz...
uncompressing rx.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/subr-x.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/icons.el.gz...
uncompressing subr-x.el.gz...
uncompressing subr-x.el.gz...done
uncompressing icons.el.gz...
uncompressing icons.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/warnings.el.gz...
uncompressing warnings.el.gz...
uncompressing warnings.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/comp-cstr.el.gz...
uncompressing comp-cstr.el.gz...
uncompressing comp-cstr.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/comp.el.gz...
uncompressing comp.el.gz...
uncompressing comp.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/eieio.el.gz...
uncompressing eieio.el.gz...
uncompressing eieio.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/eieio-core.el.gz...
uncompressing eieio-core.el.gz...
uncompressing eieio-core.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/byte-opt.el.gz...
uncompressing byte-opt.el.gz...
uncompressing byte-opt.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/crm.el.gz...
uncompressing crm.el.gz...
uncompressing crm.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/cursor-sensor.el.gz...
uncompressing cursor-sensor.el.gz...
uncompressing cursor-sensor.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/format-spec.el.gz...
uncompressing format-spec.el.gz...
uncompressing format-spec.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/kmacro.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/edmacro.el.gz...
uncompressing kmacro.el.gz...
uncompressing kmacro.el.gz...done
uncompressing edmacro.el.gz...
uncompressing edmacro.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/ansi-color.el.gz...
uncompressing ansi-color.el.gz...
uncompressing ansi-color.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/server.el.gz...
uncompressing server.el.gz...
uncompressing server.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/ring.el.gz...
uncompressing ring.el.gz...
uncompressing ring.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/ansi-osc.el.gz...
uncompressing ansi-osc.el.gz...
uncompressing ansi-osc.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/comint.el.gz...
uncompressing comint.el.gz...
uncompressing comint.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/pcomplete.el.gz...
uncompressing pcomplete.el.gz...
uncompressing pcomplete.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/shell.el.gz...
uncompressing shell.el.gz...
uncompressing shell.el.gz...done
Compiling /gnu/store/6i4g4pn4nl2zka6771i4zr9ljxrxlbyj-emacs-with-editor-3.3.2/share/emacs/site-lisp/with-editor-3.3.2/with-editor.el...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/calendar/time-date.el.gz...
uncompressing time-date.el.gz...
uncompressing time-date.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/filenotify.el.gz...
uncompressing filenotify.el.gz...
uncompressing filenotify.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/autorevert.el.gz...
uncompressing autorevert.el.gz...
uncompressing autorevert.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/add-log.el.gz...
uncompressing add-log.el.gz...
uncompressing add-log.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/pcvs-util.el.gz...
uncompressing pcvs-util.el.gz...
uncompressing pcvs-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mailheader.el.gz...
uncompressing mailheader.el.gz...
uncompressing mailheader.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/gmm-utils.el.gz...
uncompressing gmm-utils.el.gz...
uncompressing gmm-utils.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mail-utils.el.gz...
uncompressing mail-utils.el.gz...
uncompressing mail-utils.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mailabbrev.el.gz...
uncompressing mailabbrev.el.gz...
uncompressing mailabbrev.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/ietf-drums.el.gz...
uncompressing ietf-drums.el.gz...
uncompressing ietf-drums.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-util.el.gz...
uncompressing mm-util.el.gz...
uncompressing mm-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc2045.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc2047.el.gz...
uncompressing rfc2045.el.gz...
uncompressing rfc2045.el.gz...done
uncompressing rfc2047.el.gz...
uncompressing rfc2047.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc2231.el.gz...
uncompressing rfc2231.el.gz...
uncompressing rfc2231.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/mail-parse.el.gz...
uncompressing mail-parse.el.gz...
uncompressing mail-parse.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-encode.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-bodies.el.gz...
uncompressing mm-encode.el.gz...
uncompressing mm-encode.el.gz...done
uncompressing mm-bodies.el.gz...
uncompressing mm-bodies.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mm-decode.el.gz...
uncompressing mm-decode.el.gz...
uncompressing mm-decode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/text-property-search.el.gz...
uncompressing text-property-search.el.gz...
uncompressing text-property-search.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/gnus-util.el.gz...
uncompressing gnus-util.el.gz...
uncompressing gnus-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/epg-config.el.gz...
uncompressing epg-config.el.gz...
uncompressing epg-config.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc6068.el.gz...
uncompressing rfc6068.el.gz...
uncompressing rfc6068.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/epg.el.gz...
uncompressing epg.el.gz...
uncompressing epg.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/derived.el.gz...
uncompressing derived.el.gz...
uncompressing derived.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/epa.el.gz...
uncompressing epa.el.gz...
uncompressing epa.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/password-cache.el.gz...
uncompressing password-cache.el.gz...
uncompressing password-cache.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mml-sec.el.gz...
uncompressing mml-sec.el.gz...
uncompressing mml-sec.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/mml.el.gz...
uncompressing mml.el.gz...
uncompressing mml.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/rfc822.el.gz...
uncompressing rfc822.el.gz...
uncompressing rfc822.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/dired.el.gz...
uncompressing dired.el.gz...
uncompressing dired.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/net/puny.el.gz...
uncompressing puny.el.gz...
uncompressing puny.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/yank-media.el.gz...
uncompressing yank-media.el.gz...
uncompressing yank-media.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/net/mailcap.el.gz...
uncompressing mailcap.el.gz...
uncompressing mailcap.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/mail/sendmail.el.gz...
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/gnus/message.el.gz...
uncompressing sendmail.el.gz...
uncompressing sendmail.el.gz...done
uncompressing message.el.gz...
uncompressing message.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/log-edit.el.gz...
uncompressing log-edit.el.gz...
uncompressing log-edit.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/easy-mmode.el.gz...
uncompressing easy-mmode.el.gz...
uncompressing easy-mmode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/diff-mode.el.gz...
uncompressing diff-mode.el.gz...
uncompressing diff-mode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/diff.el.gz...
uncompressing diff.el.gz...
uncompressing diff.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/smerge-mode.el.gz...
uncompressing smerge-mode.el.gz...
uncompressing smerge-mode.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/imenu.el.gz...
uncompressing imenu.el.gz...
uncompressing imenu.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/progmodes/which-func.el.gz...
uncompressing which-func.el.gz...
uncompressing which-func.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-vars.el.gz...
uncompressing url-vars.el.gz...
uncompressing url-vars.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/map.el.gz...
uncompressing map.el.gz...
uncompressing map.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/json.el.gz...
uncompressing json.el.gz...
uncompressing json.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/auth-source.el.gz...
uncompressing auth-source.el.gz...
uncompressing auth-source.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-parse.el.gz...
uncompressing url-parse.el.gz...
uncompressing url-parse.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-handlers.el.gz...
uncompressing url-handlers.el.gz...
uncompressing url-handlers.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-util.el.gz...
uncompressing url-util.el.gz...
uncompressing url-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-domsuf.el.gz...
uncompressing url-domsuf.el.gz...
uncompressing url-domsuf.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/generate-lisp-file.el.gz...
uncompressing generate-lisp-file.el.gz...
uncompressing generate-lisp-file.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-cookie.el.gz...
uncompressing url-cookie.el.gz...
uncompressing url-cookie.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-history.el.gz...
uncompressing url-history.el.gz...
uncompressing url-history.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-methods.el.gz...
uncompressing url-methods.el.gz...
uncompressing url-methods.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-expand.el.gz...
uncompressing url-expand.el.gz...
uncompressing url-expand.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-privacy.el.gz...
uncompressing url-privacy.el.gz...
uncompressing url-privacy.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url-proxy.el.gz...
uncompressing url-proxy.el.gz...
uncompressing url-proxy.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/url/url.el.gz...
uncompressing url.el.gz...
uncompressing url.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/net/browse-url.el.gz...
uncompressing browse-url.el.gz...
uncompressing browse-url.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/emacs-lisp/package.el.gz...
uncompressing package.el.gz...
uncompressing package.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-init.el.gz...
uncompressing ediff-init.el.gz...
uncompressing ediff-init.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-help.el.gz...
uncompressing ediff-help.el.gz...
uncompressing ediff-help.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-diff.el.gz...
uncompressing ediff-diff.el.gz...
uncompressing ediff-diff.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-wind.el.gz...
uncompressing ediff-wind.el.gz...
uncompressing ediff-wind.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-mult.el.gz...
uncompressing ediff-mult.el.gz...
uncompressing ediff-mult.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf
This message was truncated. Download the full message here.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmWMbKMACgkQIgjSCVjB
3rABgA//b5FPMGvOZo2qttqi7H2etfn4JheQCsT/droxhAZ6nS++OyXBfyPd+ick
5VtikS9ltYBNYMa+NbpGo8FBGIuEmUkv10CzeYUuPFN94MMjhVO7taEO3lKaNLwo
SCBGgX5p4ykCz/XytdCLhNbtAJf1Kcbf2c+mkz06PkKfxJvW/4IREv1tqbaDeMFo
4q0AV9hKxAnyFonjr4HrmH5QetZDX8vGVUU/kE9/MAelMUhP0ub+b/J3ciep7Byr
lC85tWE6NcLTEjFSub9r+UXn4V1mih4S1V3NaHOykZrliAgS+O8mVkok8hazvFmQ
KcWayP9L/B8pFNMcbbHM4WI0PJfix7adTakDKbe90KnD0KildUTr4SmGIEkxFORq
y6ySpxpTxe3wAhWeOSiHk457d0WGhW2NnNPoLqKR48GP8vYAFIhyNsEEZF4bani/
RoJY/JbPG/ZEFaI8J001p5WQXf01O0HpiZe9zP15qfqkXf48Xjx0ImasPcF7BVYs
q5uyag9xA/sTQ/wed3qXruBa8xg+WehHtkiKyEDq2IYrtQ+bITTQ9brk/nn9gETM
4cKVIUcXkAYS5gekwLZ56r99ZH4tq1uRsttg3I/43VVMmGAVVKlsHqdXUWTflwDE
j8ZYVv3cXD6na2budNpSu4N7mUmByehGIo/WqrwdUBe+E740Mjg=
=PUy8
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 27 Dec 2023 21:03
8269b690abfe4011b01a59d35f24a5b6ca938f29.camel@gmail.com
Am Mittwoch, dem 27.12.2023 um 21:27 +0300 schrieb Andrew Tropin:
Toggle quote (49 lines)
> On 2023-12-27 17:40, Liliana Marie Prikler wrote:
>
> > Am Mittwoch, dem 27.12.2023 um 14:00 +0300 schrieb Andrew Tropin:
> > > On 2023-11-25 12:13, Liliana Marie Prikler wrote:
> > >
> > > > * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-
> > > > trampolines’.
> > > >
> > > > Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
> > > > ---
> > > >  gnu/packages/emacs.scm | 5 ++++-
> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> > > > index b9d9e2b891..55eab48c25 100644
> > > > --- a/gnu/packages/emacs.scm
> > > > +++ b/gnu/packages/emacs.scm
> > > > @@ -327,7 +327,10 @@ (define-public emacs-no-x
> > > >                      (string-append
> > > >                       "-B" #$(this-package-input "libgccjit")
> > > > "/lib/")
> > > >                      (string-append
> > > > -                     "-B" #$(this-package-input "libgccjit")
> > > > "/lib/gcc/"))))))))))
> > > > +                     "-B" #$(this-package-input "libgccjit")
> > > > "/lib/gcc/"))))))
> > > > +            (add-after 'build 'build-trampolines
> > > > +              (lambda* (#:key make-flags #:allow-other-keys)
> > > > +                (apply invoke "make" "trampolines" make-
> > > > flags)))))))
> > > >      (inputs
> > > >       (modify-inputs (package-inputs emacs-minimal)
> > > >         (prepend gnutls
> > > >
> > > > base-commit: 60c97924e9519361494aaf0686e28eb831a42315
> > >
> > > Applied the patch series v4 to emacs-team branch, removed all eln
> > > files
> > > in ~/.cache/emacs and ~/.config/emacs, executed
> > >
> > > --8<---------------cut here---------------start------------->8---
> > > ./pre-inst-env guix shell emacs-pgtk emacs-magit \
> > > --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
> > > # M-S-: (require 'magit) RET
> > > --8<---------------cut here---------------end--------------->8---
> > You're missing --with-input=emacs-minimal=emacs.  You are not
> > natively compiling emacs-magit atm.
>
> Right, thank you!
Turns out you also need to do this with emacs-no-x due to emacs-libgit.

Friendly reminder that we don't have build system/packaging utilities
to easily replace emacs versions yet, so magit might not have been the
wisest choice to showcase here.

More worryingly, it appears you're recompiling Emacs itself here. This
should not be happening. However, it turns out that your eln-cache is
always first on the native load path and thus already compiled files
won't be found.¹ Try adding 
--eval='(setq native-comp-jit-compilation nil)'
and see whether you can load natively compiled procedures and have them
show as natively compiled.

Cheers

¹ Maybe there's a smarter way to locate them files? Did I go wrong in
one of my patches?
L
L
Liliana Marie Prikler wrote on 27 Dec 2023 21:44
ba5cda373f039cec9729dbc1ee27ed00423d0c14.camel@gmail.com
Am Mittwoch, dem 27.12.2023 um 21:03 +0100 schrieb Liliana Marie
Prikler:
Toggle quote (2 lines)
> Turns out you also need to do this with emacs-no-x due to emacs-
> libgit.
… or not, as emacs-libgit is not pulled in by emacs-magit.
Still a potential problem, however.

Cheers
A
A
Andrew Tropin wrote on 28 Dec 2023 06:56
87r0j6g9a8.fsf@trop.in
On 2023-12-27 21:03, Liliana Marie Prikler wrote:

Toggle quote (64 lines)
> Am Mittwoch, dem 27.12.2023 um 21:27 +0300 schrieb Andrew Tropin:
>> On 2023-12-27 17:40, Liliana Marie Prikler wrote:
>>
>> > Am Mittwoch, dem 27.12.2023 um 14:00 +0300 schrieb Andrew Tropin:
>> > > On 2023-11-25 12:13, Liliana Marie Prikler wrote:
>> > >
>> > > > * gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-
>> > > > trampolines’.
>> > > >
>> > > > Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
>> > > > ---
>> > > >  gnu/packages/emacs.scm | 5 ++++-
>> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
>> > > >
>> > > > diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
>> > > > index b9d9e2b891..55eab48c25 100644
>> > > > --- a/gnu/packages/emacs.scm
>> > > > +++ b/gnu/packages/emacs.scm
>> > > > @@ -327,7 +327,10 @@ (define-public emacs-no-x
>> > > >                      (string-append
>> > > >                       "-B" #$(this-package-input "libgccjit")
>> > > > "/lib/")
>> > > >                      (string-append
>> > > > -                     "-B" #$(this-package-input "libgccjit")
>> > > > "/lib/gcc/"))))))))))
>> > > > +                     "-B" #$(this-package-input "libgccjit")
>> > > > "/lib/gcc/"))))))
>> > > > +            (add-after 'build 'build-trampolines
>> > > > +              (lambda* (#:key make-flags #:allow-other-keys)
>> > > > +                (apply invoke "make" "trampolines" make-
>> > > > flags)))))))
>> > > >      (inputs
>> > > >       (modify-inputs (package-inputs emacs-minimal)
>> > > >         (prepend gnutls
>> > > >
>> > > > base-commit: 60c97924e9519361494aaf0686e28eb831a42315
>> > >
>> > > Applied the patch series v4 to emacs-team branch, removed all eln
>> > > files
>> > > in ~/.cache/emacs and ~/.config/emacs, executed
>> > >
>> > > --8<---------------cut here---------------start------------->8---
>> > > ./pre-inst-env guix shell emacs-pgtk emacs-magit \
>> > > --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
>> > > # M-S-: (require 'magit) RET
>> > > --8<---------------cut here---------------end--------------->8---
>> > You're missing --with-input=emacs-minimal=emacs.  You are not
>> > natively compiling emacs-magit atm.
>>
>> Right, thank you!
> Turns out you also need to do this with emacs-no-x due to emacs-libgit.
>
> Friendly reminder that we don't have build system/packaging utilities
> to easily replace emacs versions yet, so magit might not have been the
> wisest choice to showcase here.
>
> More worryingly, it appears you're recompiling Emacs itself here. This
> should not be happening. However, it turns out that your eln-cache is
> always first on the native load path and thus already compiled files
> won't be found.¹ Try adding 
> --eval='(setq native-comp-jit-compilation nil)'
> and see whether you can load natively compiled procedures and have them
> show as natively compiled.

Toggle snippet (7 lines)
native-comp-eln-load-path is a variable defined in ‘C source code’.

Its value is
("/home/bob/.config/emacs/eln-cache/" "/gnu/store/lxf6aqh5b1zzaclfxcivk8vw1q4fhrrn-profile/lib/emacs/native-site-lisp" "../native-lisp/")


Toggle snippet (8 lines)
ls ~/.config/emacs/eln-cache/**/
/home/bob/.config/emacs/eln-cache/:
29.1-5c9913f6/

/home/bob/.config/emacs/eln-cache/29.1-5c9913f6/:
subr--trampoline-6d616b652d70726f63657373_make_process_0.eln

magit-status is an interactive native-compiled Lisp function in
‘magit-status.el’.

Toggle quote (7 lines)
>
> Cheers
>
> ¹ Maybe there's a smarter way to locate them files? Did I go wrong in
> one of my patches?
>

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmWNDf8ACgkQIgjSCVjB
3rDBUQ/5AWm+ZhW9xlkZzBUx47n0uPqaq08EmSTDjKtwVCYVwkzxpzOnVrsxY3go
vVmpheF0VajfOUn7VvgSB0M4v7oWyIfCSmTgyXmm5ykpfb1Kglq+4Uy+G22wmCdi
oD8oT+Yhdix1MsR2qrlOXoSSRNgxoJJNaVg9a6pCi20Y1FnAYtfrTGxBviVrMTKu
5ha5xNqITBOdnn6Xmp1HXSDdB6paAZTp0b5xqTIVl5VzOyHiQhOC5mMKRJmiGjkp
mNzhIVmfVzsXAULML/gXP6/52lAHG0TIKvpUW6lZmx8/6hzmoPD4gTRzXbgW2yFr
G7/4W7VtoXLiB3f/X3SOK7DYBTPjMTx/rE2X8LtWBTeRYmJlXpidTU3olmntKsUs
vAdj7wgj0hmHnww20Tb2cTbk2jv4MpYLmedQUOpwFx+YKH1/ABjH1npnLcrKKV0J
Wcj4d3a7ZhSNEzeJjZ3Sml/AVJkT5WO2twoghxObNY/q+VqMjLkwSZMsLCimsdnK
VRYV3/QLJcqFWqO/SZhybrPn9m7C2FNAomW9JXl90MhAgxNP5sPuzcweBVeSnpYi
h1mocFdwvZPFxUed5vwD9DmA4Fe0h/kMfjSIN4VUHlOGMRdy1msZIxV8wwVnoCx/
sZfFhNwEuSBMojN+egEyqKT+Fq92PTFvWAfxsAd9f/vzTINnxUI=
=fjbk
-----END PGP SIGNATURE-----

S
S
Suhail wrote on 18 Jan 06:55 +0100
[bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
(address . 67260@debbugs.gnu.org)
<878r4ngp7e.fsf@>
Reporting some observations for the benefit of the community.

I managed to install the following sequence of patches on emacs-team
commit 60c97924e9 :
- v3 1/3
- v3 2/3
- v3 3/3
- v4 4/5
- v4 5/5

I was able to build emacs, emacs-org and a few additional packages using
the options "--no-grafts --with-input=emacs-minimal=emacs". When
building "emacs-org-contrib" the additional option
"--without-tests=emacs-clojure-mode" was needed as well.

Having done so, upon starting emacs via guix-shell, I noticed a few
messages in *Async-native-compile-log* which noted that libraries such
as rx.el.gz and cl-macs.el.gz were being compiled. I observed
native-compiled versions of these show up in ~/.emacs.d/eln-cache. Now
this seems similar to the behaviour I observe in a non-Guix host where
Emacs 29.1 is installed via the OS. There too my ~/.emacs.d/eln-cache
has a number of entries that I was a little surprised to see such as
those corresponding to rx and cl-macs.

One difference, however, is in the names and the relative locations of
these natively-compiled files. Outside of the guix shell (i.e., using
the OS's native Emacs package) the eln files are named like
~/.emacs.d/eln-cache/29.1-115521d4/cl-macs-7ae82f81-e626a10e.eln whereas
within the Guix shell using Emacs built from the installed patches you
get names like
~/.emacs.d/eln-cache/29.1-c187d49d/emacs-lisp/cl-macs.eln. Note the
sub-directory within the 29.1-* directory present within guix-shell
container, as well as the lack of hash fingerprint in the *.eln file
itself.

I do not know if these differences are to be expected, or whether or not
they're material in any way.

Thoughts? Can this patch series be installed into emacs-team as-is? If
not, what are the current blockers, if any? On a somewhat related note,
when is the next merge from emacs-team to master expected to be?

--
Suhail

This email is not an offer capable of acceptance, does not evidence an
intention to enter into an agreement, has no operative effect until a
definitive agreement is signed in writing by both parties, and that no
party should act in reliance on the email or any representations of the
sender until a definitive agreement is signed in writing by both
parties.
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v5 1/6] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)
24d0c763983a33d62027d70af67118b9821bdc26.1705846445.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (20 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..e4119ec21d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -376,7 +376,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls

base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v5 2/6] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
388d3766e6908331c0704687141f33aeae7ee969.1705846445.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 197 ++++++++++++++++++
3 files changed, 199 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (229 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e4119ec21d..182de0204d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..714b707e47
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,197 @@
+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.
+
+Index: emacs-29.1/src/comp.c
+===================================================================
+--- emacs-29.1.orig/src/comp.c
++++ emacs-29.1/src/comp.c
+@@ -4396,26 +4396,18 @@ 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. Further, if the NATIVE_COMP_BOGUS_DIRS environment variable is set,
++the first matching prefix mentioned in it will be stripped as well. */)
+ (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);
+
+@@ -4423,64 +4415,53 @@ 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.
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- '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))
++ FOR_EACH_TAIL_SAFE (tail)
+ {
+- 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 lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
+ {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil);
++ filename = Fsubstring (filename, Fadd1 (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))
++ filename = rel_name;
++
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
++
++ if (!NILP (bogus_dirs))
++ {
++ tail = CALL2I (split-string, bogus_dirs, build_string (":"));
++
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (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,
+@@ -4494,13 +4475,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;
+@@ -4541,19 +4516,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+Index: emacs-29.1/src/Makefile.in
+===================================================================
+--- emacs-29.1.orig/src/Makefile.in
++++ emacs-29.1/src/Makefile.in
+@@ -553,6 +553,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.
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v5 5/6] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)
f3f93cb1c0769edf81b2da580e0c2317682b93b9.1705846445.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 15:09 +0100
[PATCH v5 6/6] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)
0e8f58759ef025b3fc010b021a157a80babfea18.1705846445.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 182de0204d..c83d6114ef 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..3320fda779
--- /dev/null
+++ b/gnu/packages/patches/emacs-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, with this switch enabled, Emacs will recompile libraries
++that were already natively compiled with Guix, so use it with
++caution. */);
++ native_comp_jit_compilation = false;
+
+ DEFSYM (Qnative_comp_speed, "native-comp-speed");
+ DEFSYM (Qnative_comp_debug, "native-comp-debug");
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v5 4/6] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)
f9f793c552db50f15ffdbc2c559b36b323e5b6b8.1705846445.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v5 3/6] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
4da49fbeb3bebc49b852e2f8d3af8655d7b55dba.1705846445.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
S
S
Suhail wrote on 22 Jan 05:16 +0100
Re: [bug#67260] [PATCH v5 6/6] gnu: emacs: Disable jit compilation.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87sf2qator.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (10 lines)
> * gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register it here.
> * gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
> ---
> gnu/local.mk | 1 +
> gnu/packages/emacs.scm | 3 ++-
> .../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
> 3 files changed, 22 insertions(+), 1 deletion(-)
> create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

I don't believe this patch is sufficient. It seems that the variable
'native-comp-eln-load-path may also need to be tweaked. The path to the
"native-lisp" directory needs to be specified absolutely to make it not
be dependent on the invocation-directory. Details below.

#+begin_src bash :results replace
emacs --batch --eval "(message \"%s\" (car (split-string (describe-function 'describe-function) \"\n\")))"
#+end_src

#+RESULTS:
: Type q in help window to delete it
: describe-function is an autoloaded interactive byte-compiled Lisp

#+begin_src bash :results replace
type emacs
ls ~/.guix-profile/lib/emacs/29.2/native-lisp/29.2-e9db68ab/help-fns.eln
ls ~/.guix-profile/lib/emacs/29.2/native-lisp/29.2-e9db68ab/*.eln | wc -l
ls ~/.guix-profile/lib/emacs/native-site-lisp/29.2-e9db68ab/*.eln | wc -l
emacs --batch --eval "(message \"%s\" native-comp-eln-load-path)"
#+end_src

#+RESULTS:
: emacs is hashed (/home/user/.guix-profile/bin/emacs)
: /home/user/.guix-profile/lib/emacs/29.2/native-lisp/29.2-e9db68ab/help-fns.eln
: 1715
: 236
: (/home/user/.emacs.d/eln-cache/ /home/user/.guix-profile/lib/emacs/native-site-lisp ../native-lisp/)

#+begin_src bash :results replace
emacs --batch --eval "(message \"%s\" (progn (add-to-list 'native-comp-eln-load-path \"/home/user/.guix-profile/lib/emacs/29.2/native-lisp\") (car (split-string (describe-function 'describe-function) \"\n\"))))"
#+end_src

#+RESULTS:
: Type q in help window to delete it
: describe-function is an autoloaded interactive native-compiled Lisp

--
Suhail

This email is not an offer capable of acceptance, does not evidence an
intention to enter into an agreement, has no operative effect until a
definitive agreement is signed in writing by both parties, and that no
party should act in reliance on the email or any representations of the
sender until a definitive agreement is signed in writing by both
parties.
S
S
Suhail wrote on 22 Jan 05:36 +0100
(address . 67260@debbugs.gnu.org)
<87o7deasrx.fsf@>
Suhail via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (5 lines)
> I don't believe this patch is sufficient. It seems that the variable
> 'native-comp-eln-load-path may also need to be tweaked. The path to the
> "native-lisp" directory needs to be specified absolutely to make it not
> be dependent on the invocation-directory.

Or it's possible that a patch that ensures that
'native-comp-eln-load-path contains the absolute value of the
"native-lisp" directory obviates this one (6/6) in its entirety.

--
Suhail
L
L
Liliana Marie Prikler wrote on 22 Jan 21:21 +0100
[PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(address . 67260@debbugs.gnu.org)
cd8877121c4b0b761e4de3fd2388cbcb615a932d.1705957032.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
Am Montag, dem 22.01.2024 um 04:36 +0000 schrieb Suhail:
Toggle quote (10 lines)
> Suhail via Guix-patches via <guix-patches@gnu.org> writes:
>
> > I don't believe this patch is sufficient.  It seems that the
> > variable 'native-comp-eln-load-path may also need to be tweaked.
> > The path to the "native-lisp" directory needs to be specified
> > absolutely to make it not be dependent on the invocation-directory.
>
> Or it's possible that a patch that ensures that
> 'native-comp-eln-load-path contains the absolute value of the
> "native-lisp" directory obviates this one (6/6) in its entirety.
This was the most cryptic hint towards the actual issue, but I've
managed to resolve it anyhow. We still shouldn't enable jit compilation
however; I've updated our reason as to why.

gnu/packages/emacs.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..2cdc9b8bca 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -273,7 +273,11 @@ (define-public emacs-minimal
(let* ((out (assoc-ref outputs "out"))
(lisp-dirs (find-files (string-append out "/share/emacs")
"^lisp$"
- #:directories? #t)))
+ #:directories? #t))
+ (native-lisp-dirs (find-files
+ (string-append out "/lib/emacs")
+ "^native-lisp$"
+ #:directories? #t)))
(for-each
(lambda (prog)
(wrap-program prog
@@ -285,7 +289,11 @@ (define-public emacs-minimal
(list (search-input-file inputs "/bin/gzip")
;; for coreutils
(search-input-file inputs "/bin/yes"))))
- `("EMACSLOADPATH" suffix ,lisp-dirs)))
+ `("EMACSLOADPATH" suffix ,lisp-dirs)
+ ;; Note: the interpretation order of EMACSNATIVELOADPATH
+ ;; is reversed, so 'prefix functions just like 'suffix
+ ;; for EMACSLOADPATH.
+ `("EMACSNATIVELOADPATH" prefix ,native-lisp-dirs)))
(find-files (string-append out "/bin")
;; Matches versioned and unversioned emacs binaries.
;; We don't patch emacsclient, because it takes its

base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v6 2/7] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)
75fc54d6051c02ab2edc333de71ee4689a287ed0.1705957032.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2cdc9b8bca..0292b1bd16 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -384,7 +384,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v6 4/7] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
e4e06a0fb918b0a80a45581bd7aa896426570aa2.1705957032.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v6 3/7] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
aad2e3895e09474924d466b8c6c2cd15cd90e857.1705957032.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 197 ++++++++++++++++++
3 files changed, 199 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (229 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0292b1bd16..1caa2cbee0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..714b707e47
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,197 @@
+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.
+
+Index: emacs-29.1/src/comp.c
+===================================================================
+--- emacs-29.1.orig/src/comp.c
++++ emacs-29.1/src/comp.c
+@@ -4396,26 +4396,18 @@ 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. Further, if the NATIVE_COMP_BOGUS_DIRS environment variable is set,
++the first matching prefix mentioned in it will be stripped as well. */)
+ (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);
+
+@@ -4423,64 +4415,53 @@ 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.
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- '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))
++ FOR_EACH_TAIL_SAFE (tail)
+ {
+- 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 lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
+ {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil);
++ filename = Fsubstring (filename, Fadd1 (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))
++ filename = rel_name;
++
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
++
++ if (!NILP (bogus_dirs))
++ {
++ tail = CALL2I (split-string, bogus_dirs, build_string (":"));
++
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (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,
+@@ -4494,13 +4475,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;
+@@ -4541,19 +4516,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+Index: emacs-29.1/src/Makefile.in
+===================================================================
+--- emacs-29.1.orig/src/Makefile.in
++++ emacs-29.1/src/Makefile.in
+@@ -553,6 +553,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.
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v6 5/7] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)
b8db981e179262e22a6950fd5ece71b9173e9f98.1705957032.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v6 6/7] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)
d53688d90483d6964421629d64bd98fe0d6d32cc.1705957032.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 15:09 +0100
[PATCH v6 7/7] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)
bbac5f822a8d0f4b0c82c5ffd00247f5f50369f8.1705957032.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1caa2cbee0..03c50eba6d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-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
++frm 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");
--
2.41.0
S
S
Suhail wrote on 26 Jan 00:53 +0100
Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87r0i5otqu.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (9 lines)
>> Suhail via Guix-patches via <guix-patches@gnu.org> writes:
>>
>> > I don't believe this patch is sufficient.  It seems that the
>> > variable 'native-comp-eln-load-path may also need to be tweaked.
>> > The path to the "native-lisp" directory needs to be specified
>> > absolutely to make it not be dependent on the invocation-directory.
>>
> ... I've managed to resolve it

I can confirm that Emacs built by installing v6 patches on emacs-team
branch and built with --no-grafts is now able to locate
natively-compiled versions of features like help-fns etc. (which it
couldn't with v5 patches).

#+begin_src bash :results replace
emacs --batch --eval "(message \"%s\" (car (split-string (describe-function 'describe-function) \"\n\")))"
#+end_src

#+RESULTS:
: Type q in help window to delete it
: describe-function is an autoloaded interactive native-compiled Lisp


However, there may be a spurious entry in native-comp-eln-load-path that
should probably be removed.

#+begin_src bash :results replace
emacs --batch --eval "(message \"%s\" native-comp-eln-load-path)"
#+end_src

#+RESULTS:
: (/home/user/.emacs.d/eln-cache/ /home/user/.guix-profile/lib/emacs/native-site-lisp /gnu/store/4jvap9wxifizm56p6pmxc6rk0zyvm5zc-emacs-29.2/lib/emacs/29.2/native-lisp ../native-lisp/)


The "../native-lisp/" entry above, seems out of place. Based on the
documentation of native-comp-eln-load-path:

Toggle quote (3 lines)
> If the name of a directory in this list is not absolute, it is assumed
> to be relative to invocation-directory.

Contrasting the above with an Emacs 29.1 installation on a non-Guix
system, I notice that the latter doesn't have any non-absolute paths in
native-comp-eln-load-path. Thoughts?

--
Suhail
L
L
Liliana Marie Prikler wrote on 26 Jan 06:29 +0100
(name . Suhail)(address . suhail@bayesians.ca)
b610cbed9da74e261ef20cd3e4847cbd56c4358e.camel@gmail.com
Hi,

Am Donnerstag, dem 25.01.2024 um 23:53 +0000 schrieb Suhail:
Toggle quote (51 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > > Suhail via Guix-patches via <guix-patches@gnu.org> writes:
> > >
> > > > I don't believe this patch is sufficient.  It seems that the
> > > > variable 'native-comp-eln-load-path may also need to be
> > > > tweaked.
> > > > The path to the "native-lisp" directory needs to be specified
> > > > absolutely to make it not be dependent on the invocation-
> > > > directory.
> > >
> > ... I've managed to resolve it
>
> I can confirm that Emacs built by installing v6 patches on emacs-team
> branch and built with --no-grafts is now able to locate
> natively-compiled versions of features like help-fns etc. (which it
> couldn't with v5 patches).
>
> #+begin_src bash :results replace
>   emacs --batch --eval "(message \"%s\" (car (split-string (describe-
> function 'describe-function) \"\n\")))"
> #+end_src
>
> #+RESULTS:
> : Type q in help window to delete it
> : describe-function is an autoloaded interactive native-compiled Lisp
>
>
> However, there may be a spurious entry in native-comp-eln-load-path
> that should probably be removed.
>
> #+begin_src bash :results replace
>   emacs --batch --eval "(message \"%s\" native-comp-eln-load-path)"
> #+end_src
>
> #+RESULTS:
> : (/home/user/.emacs.d/eln-cache/ /home/user/.guix-
> profile/lib/emacs/native-site-lisp
> /gnu/store/4jvap9wxifizm56p6pmxc6rk0zyvm5zc-emacs-
> 29.2/lib/emacs/29.2/native-lisp ../native-lisp/)
>
>
> The "../native-lisp/" entry above, seems out of place.  Based on the
> documentation of native-comp-eln-load-path:
>
> > If the name of a directory in this list is not absolute, it is
> > assumed to be relative to invocation-directory.
>
> Contrasting the above with an Emacs 29.1 installation on a non-Guix
> system, I notice that the latter doesn't have any non-absolute paths
> in native-comp-eln-load-path.  Thoughts?
I have noticed this myself, but I don't think that it's related to this
series. Can you try 29.2 without the patches? It might be related to
that bump.

Cheers
S
S
Suhail wrote on 26 Jan 08:49 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87sf2kedp8.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (6 lines)
>> Contrasting the above with an Emacs 29.1 installation on a non-Guix
>> system, I notice that the latter doesn't have any non-absolute paths
>> in native-comp-eln-load-path.  Thoughts?
> I have noticed this myself, but I don't think that it's related to this
> series.

It seems to be. It's possible that it may also be related to other
things already in the emacs-team branch (e.g. if the patch series is
only responsible for uncovering a pre-existing defect as opposed to
causing it), but the relative path only shows up during the series.

Toggle quote (2 lines)
> Can you try 29.2 without the patches?

emacs-team branch at aae61f54ff doesn't have the relative path in
native-comp-eln-load-path. The relative path shows up only after
[PATCH v6 3/7] is applied. Hope this helps and hopefully the patch
series can soon be merged into master for general availability.


[PATCH v6 3/7] gnu: emacs: Don't hash file names in native compilation.

--
Suhail
S
S
Suhail wrote on 26 Jan 09:20 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87o7d8ec9p.fsf@>
Suhail via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (3 lines)
> hopefully the patch series can soon be merged into master for general
> availability.

Btw, does every package require something like [PATCH v6 5/7] or
[PATCH v6 6/7] in order for it to be natively compiled?

--
Suhail
L
L
Liliana Marie Prikler wrote on 26 Jan 17:10 +0100
(name . Suhail)(address . suhail@bayesians.ca)
1b318d43c307818b765c41e58cf528ec4a09f9ac.camel@gmail.com
Am Freitag, dem 26.01.2024 um 08:20 +0000 schrieb Suhail:
Toggle quote (7 lines)
> Suhail via Guix-patches via <guix-patches@gnu.org> writes:
>
> > hopefully the patch series can soon be merged into master for
> > general availability.
>
> Btw, does every package require something like [PATCH v6 5/7] or
> [PATCH v6 6/7] in order for it to be natively compiled?
No, these patches are only for natively compiled packages that don't
use emacs-build-system. That being said, this is likely an incomplete
list.

Cheers
S
S
Suhail wrote on 26 Jan 23:45 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<874jezemss.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (5 lines)
>> Btw, does every package require something like [PATCH v6 5/7] or
>> [PATCH v6 6/7] in order for it to be natively compiled?
> No, these patches are only for natively compiled packages that don't
> use emacs-build-system.

I.e., any and all packages using the emacs-build-system should be
natively-compiled? If so, I believe I've found a counter-example.

After installing v6 series and building emacs-htmlize my expectation is
that functions provided by it, such as htmlize-buffer, would be
natively-compiled. However, I get:

Toggle quote (3 lines)
> htmlize-buffer is an autoloaded interactive Lisp function in
> `htmlize.el'.

Note the lack of "native-compiled" in the above.

--
Suhail
L
L
Liliana Marie Prikler wrote on 27 Jan 08:00 +0100
(name . Suhail)(address . suhail@bayesians.ca)
c74272c92319ae309feab71ba3aff2ab45979284.camel@gmail.com
Am Freitag, dem 26.01.2024 um 22:45 +0000 schrieb Suhail:
Toggle quote (9 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > > Btw, does every package require something like [PATCH v6 5/7] or
> > > [PATCH v6 6/7] in order for it to be natively compiled?
> > No, these patches are only for natively compiled packages that
> > don't use emacs-build-system.
>
> I.e., any and all packages using the emacs-build-system should be
> natively-compiled?  If so, I believe I've found a counter-example.
No, but packages using emacs-build-system should not need any changes
to accomodate the currently existing hack of adding the option 
--with-input=emacs-minimal=emacs
to ‘guix build’, ‘guix package’, ‘guix shell’, etc.

Toggle quote (8 lines)
> After installing v6 series and building emacs-htmlize my expectation
> is that functions provided by it, such as htmlize-buffer, would be
> natively-compiled.  However, I get:
>
> > htmlize-buffer is an autoloaded interactive Lisp function in
> > `htmlize.el'.
>
> Note the lack of "native-compiled" in the above.
If you compile with emacs-minimal, that's the expected results.
Different builds of emacs are still incompatible w.r.t. native code and
produce directories with different hashes. We'll have to see as to
whether this bugs grafts, but I'm hoping it doesn't.

Cheers
L
L
Liliana Marie Prikler wrote on 22 Jan 21:21 +0100
[PATCH v7 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(address . 67260@debbugs.gnu.org)
cd8877121c4b0b761e4de3fd2388cbcb615a932d.1706339016.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
gnu/packages/emacs.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..2cdc9b8bca 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -273,7 +273,11 @@ (define-public emacs-minimal
(let* ((out (assoc-ref outputs "out"))
(lisp-dirs (find-files (string-append out "/share/emacs")
"^lisp$"
- #:directories? #t)))
+ #:directories? #t))
+ (native-lisp-dirs (find-files
+ (string-append out "/lib/emacs")
+ "^native-lisp$"
+ #:directories? #t)))
(for-each
(lambda (prog)
(wrap-program prog
@@ -285,7 +289,11 @@ (define-public emacs-minimal
(list (search-input-file inputs "/bin/gzip")
;; for coreutils
(search-input-file inputs "/bin/yes"))))
- `("EMACSLOADPATH" suffix ,lisp-dirs)))
+ `("EMACSLOADPATH" suffix ,lisp-dirs)
+ ;; Note: the interpretation order of EMACSNATIVELOADPATH
+ ;; is reversed, so 'prefix functions just like 'suffix
+ ;; for EMACSLOADPATH.
+ `("EMACSNATIVELOADPATH" prefix ,native-lisp-dirs)))
(find-files (string-append out "/bin")
;; Matches versioned and unversioned emacs binaries.
;; We don't patch emacsclient, because it takes its

base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v7 2/7] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)
75fc54d6051c02ab2edc333de71ee4689a287ed0.1706339016.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2cdc9b8bca..0292b1bd16 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -384,7 +384,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 15:09 +0100
[PATCH v7 4/7] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)
61d7784b8133fe9e806f0c88a66a88c62772f35d.1706339016.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1caa2cbee0..03c50eba6d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-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
++frm 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");
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v7 5/7] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
174b0112dccebee22b08fc6931980766c0653c1f.1706339016.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v7 3/7] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
2093303b8a10981cbc420e90f5912d49b39146e3.1706339016.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 291 ++++++++++++++++++
3 files changed, 293 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (323 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0292b1bd16..1caa2cbee0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..d4bddc5901
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,291 @@
+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-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -4396,26 +4396,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);
+
+@@ -4423,64 +4414,53 @@ 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);
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- if (suffix_p (filename, ".gz"))
+- filename = Fsubstring (filename, Qnil, make_fixnum (-3));
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (len), Qnil);
++ break;
++ }
++ }
+
+- /* We create eln filenames with an hash in order to look-up these
+- starting from the source filename, IOW have a relation
++ if (Ffile_name_absolute_p (filename))
++ filename = rel_name;
+
+- /absolute/path/filename.el + content ->
+- eln-cache/filename-path_hash-content_hash.eln.
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
+
+- '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 (bogus_dirs))
++ {
++ tail = CALL2I (split-string, bogus_dirs, build_string (":"));
++
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (len), Qnil);
++ break;
++ }
++ }
++ }
+
+- 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));
+- }
++ if (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
+- {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, 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));
++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)),
++ build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
+@@ -4494,13 +4474,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;
+@@ -4541,19 +4515,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+@@ -5859,10 +5821,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-29.2/lisp/startup.el
+===================================================================
+--- emacs-29.2.orig/lisp/startup.el
++++ emacs-29.2/lisp/startup.el
+@@ -545,9 +545,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.
+@@ -558,22 +555,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 normal-top-level ()
+ "Emacs calls this function when it first starts up.
+ It sets `command-line-processed', processes the command-line,
+@@ -1362,12 +1347,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
+@@ -1502,12 +1481,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-29.2/src/Makefile.in
+===================================================================
+--- emacs-29.2.orig/src/Makefile.in
++++ emacs-29.2/src/Makefile.in
+@@ -553,6 +553,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.
+Index: emacs-29.2/Makefile.in
+===================================================================
+--- emacs-29.2.orig/Makefile.in
++++ emacs-29.2/Makefile.in
+@@ -329,6 +329,7 @@ TRANSFORM = @program_transform_name@
+
+ # Prevent any settings in the user environment causing problems.
+ unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH
++export EMACSNATIVELOADPATH = @abs_top_builddir@/native-lisp
+
+ # What emacs should be called when installed.
+ EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v7 6/7] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)
035c884186662330fe3a3d72153e8d57046df525.1706339016.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v7 7/7] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)
000095599a15a189aeb1063d433d5105b9bca698.1706339017.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
S
S
Suhail wrote on 27 Jan 16:36 +0100
Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<871qa2aivy.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (2 lines)
> If you compile with emacs-minimal, that's the expected results.

It was compiled with emacs-minimal=emacs. For reference, I have inlined
the manifest file that was used (with the --no-grafts CLI option to
guix-package) towards the end of this email. I'm sharing the one that
was actually used, but it could be minimized.

I believe there are two issues (not including the spurious entry in
native-comp-eln-load-path which may already have been resolved in v7 of
the series). All my observations below are based on v6 patch series.

For emacs-htmlize, I believe the issue may stem from the fact that some
.eln files are available from entries in native-comp-eln-load-path only
via symlinks and the .eln loader may not be able to load symlinks.
Packages such as ox-html are available from two locations in the
native-comp-eln-load-path. In one location they are symlinked, but
(presumably because org is a builtin package) it is also available from
another location in the native-comp-eln-load-path and in the latter
location it's not symlinked in. I believe this difference is why for
some packages natively-compiled versions are loaded (e.g. org, ox-html
etc) whereas for others it's not the case.

In addition, I believe there's another issue. Some packages' names are
getting truncated. For instance, instead of uniquify.eln, I observe
niquify.eln. In this case, the .eln isn't symlinked (presumably because
it's a builtin), but due to the name being messed up (perhaps too
aggressive a truncation of hashes?) the natively compiled version is not
available:

Toggle quote (2 lines)
> uniquify-item-p is a byte-compiled Lisp function in `uniquify.el'.

The manifest file that was used is below.

#+begin_src scheme
(use-modules (guix transformations)
(gnu packages))

(define transform1
(options->transformation
'((with-input . "emacs-minimal=emacs")
(without-tests . "emacs-clojure-mode"))))

(packages->manifest
(list (transform1 (specification->package "bash"))
(transform1 (specification->package "coreutils"))
(transform1 (specification->package "git"))
(transform1 (specification->package "make"))
(transform1 (specification->package "emacs"))
(transform1 (specification->package "emacs-org"))
(transform1
(specification->package "emacs-org-contrib"))
(transform1
(specification->package "emacs-citeproc-el"))
(transform1
(specification->package "emacs-engrave-faces"))
(transform1
(specification->package "emacs-haskell-mode"))
(transform1
(specification->package "emacs-htmlize"))
(transform1
(specification->package "emacs-markdown-mode"))
(transform1
(specification->package
"emacs-org-pandoc-import"))
(transform1 (specification->package "pandoc"))
))
#+end_src

Thank you for your continued work on this!

--
Suhail

This email is not an offer capable of acceptance, does not evidence an
intention to enter into an agreement, has no operative effect until a
definitive agreement is signed in writing by both parties, and that no
party should act in reliance on the email or any representations of the
sender until a definitive agreement is signed in writing by both
parties.
S
S
Suhail wrote on 27 Jan 17:24 +0100
(name . Suhail via Guix-patches via)(address . guix-patches@gnu.org)
<87wmru922o.fsf@>
Suhail via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (4 lines)
> I believe there are two issues (not including the spurious entry in
> native-comp-eln-load-path which may already have been resolved in v7 of
> the series). All my observations below are based on v6 patch series.

I can confirm that the v7 series fixes the spurious entry in
native-comp-eln-load-path.

However, the 2 issues pointed out in the previous email remain:

1. failure to load natively-compiled version of non-builtin libraries
like emacs-htmlize possibly due to symlinks, and

2. failure to load natively-compiled version of some builtin libraries
like uniquify due to incorrect naming of .eln files

--
Suhail
L
L
Liliana Marie Prikler wrote on 27 Jan 17:50 +0100
(name . Suhail)(address . suhail@bayesians.ca)
070e018eb1d848cf296791672ffa6499995ffef3.camel@gmail.com
Am Samstag, dem 27.01.2024 um 15:36 +0000 schrieb Suhail:
Toggle quote (6 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> […]
> For emacs-htmlize, I believe the issue may stem from the fact that
> some .eln files are available from entries in native-comp-eln-load-
> path only via symlinks and the .eln loader may not be able to load
> symlinks.  
Would you care to debug this a bit more and report your findings?

Toggle quote (7 lines)
> Packages such as ox-html are available from two locations in the
> native-comp-eln-load-path.  In one location they are symlinked, but
> (presumably because org is a builtin package) it is also available
> from another location in the native-comp-eln-load-path and in the
> latter location it's not symlinked in.  I believe this difference is
> why for some packages natively-compiled versions are loaded (e.g.
> org, ox-html, etc) whereas for others it's not the case.
Well, as pointed out in the deleted code, dlopen has a "one shared
library per file name" limitation. I don't think we're hit by that
thanks to unique hashes in the store directory, but I might be wrong
about that. Maybe we have to do java-style FQDNs instead.

Toggle quote (6 lines)
> In addition, I believe there's another issue.  Some packages' names
> are getting  truncated.  For instance, instead of uniquify.eln, I
> observe niquify.eln.  In this case, the .eln isn't symlinked
> (presumably because it's a builtin), but due to the name being messed
> up (perhaps too aggressive a truncation of hashes?) the natively
> compiled version is not available:
I am not truncating any hashes, I'm not even computing them in the
first place. The functions I'm modifying are publicly callable, namely
comp-el-to-eln-rel-filename for the relative file names, and
comp-el-to-eln-filename for the absolute ones.

There could be an off-by-one error hidden in the stripping of the
BOGUS_DIRS, however. Let's investigate that.

Toggle quote (38 lines)
> > uniquify-item-p is a byte-compiled Lisp function in `uniquify.el'.
>
> The manifest file that was used is below.
>
> #+begin_src scheme
>   (use-modules (guix transformations)
>                (gnu packages))
>
>   (define transform1
>     (options->transformation
>      '((with-input . "emacs-minimal=emacs")
>        (without-tests . "emacs-clojure-mode"))))
>
>   (packages->manifest
>     (list (transform1 (specification->package "bash"))
>           (transform1 (specification->package "coreutils"))
>           (transform1 (specification->package "git"))
>           (transform1 (specification->package "make"))
>           (transform1 (specification->package "emacs"))
>           (transform1 (specification->package "emacs-org"))
>           (transform1
>             (specification->package "emacs-org-contrib"))
>           (transform1
>             (specification->package "emacs-citeproc-el"))
>           (transform1
>             (specification->package "emacs-engrave-faces"))
>           (transform1
>             (specification->package "emacs-haskell-mode"))
>           (transform1
>             (specification->package "emacs-htmlize"))
>           (transform1
>             (specification->package "emacs-markdown-mode"))
>           (transform1
>             (specification->package
>               "emacs-org-pandoc-import"))
>           (transform1 (specification->package "pandoc"))
>           ))
> #+end_src
Note, that you can map transform1, saving some typing overhead, and
since you are transforming all of your packages you could compose that
with specification->package.

Cheers
S
S
Suhail wrote on 27 Jan 18:15 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87sf2i8zpa.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (2 lines)
> Would you care to debug this a bit more and report your findings?

The locations in question are in the store and hence write-protected.
What's a "safe" way to debug this?

Toggle quote (12 lines)
>> Packages such as ox-html are available from two locations in the
>> native-comp-eln-load-path.  In one location they are symlinked, but
>> (presumably because org is a builtin package) it is also available
>> from another location in the native-comp-eln-load-path and in the
>> latter location it's not symlinked in.  I believe this difference is
>> why for some packages natively-compiled versions are loaded (e.g.
>> org, ox-html, etc) whereas for others it's not the case.
> Well, as pointed out in the deleted code, dlopen has a "one shared
> library per file name" limitation. I don't think we're hit by that
> thanks to unique hashes in the store directory, but I might be wrong
> about that. Maybe we have to do java-style FQDNs instead.

Perhaps. I'd wondered, more simply, if symlinked .eln files were ever
being loaded. In the limited testing I did, I didn't find such an
instance. For what it's worth, only one of the entries in
native-comp-eln-load-path seems to have symlinked entries (namely,
~/.guix-profile/lib/emacs/native-site-lisp).

Toggle quote (14 lines)
>> In addition, I believe there's another issue.  Some packages' names
>> are getting  truncated.  For instance, instead of uniquify.eln, I
>> observe niquify.eln.  In this case, the .eln isn't symlinked
>> (presumably because it's a builtin), but due to the name being messed
>> up (perhaps too aggressive a truncation of hashes?) the natively
>> compiled version is not available:
> I am not truncating any hashes, I'm not even computing them in the
> first place. The functions I'm modifying are publicly callable, namely
> comp-el-to-eln-rel-filename for the relative file names, and
> comp-el-to-eln-filename for the absolute ones.
>
> There could be an off-by-one error hidden in the stripping of the
> BOGUS_DIRS, however. Let's investigate that.

Were you thinking out loud, or are there specific steps you'd like me to
help with?

Toggle quote (4 lines)
> Note, that you can map transform1, saving some typing overhead, and
> since you are transforming all of your packages you could compose that
> with specification->package.

Appreciate the tips, but I should clarify that the manifest file in
question was generated by way of guix shell --export-manifest. I'd
omitted the header.

--
Suhail

This email is not an offer capable of acceptance, does not evidence an
intention to enter into an agreement, has no operative effect until a
definitive agreement is signed in writing by both parties, and that no
party should act in reliance on the email or any representations of the
sender until a definitive agreement is signed in writing by both
parties.
L
L
Liliana Marie Prikler wrote on 27 Jan 18:54 +0100
(name . Suhail)(address . suhail@bayesians.ca)
0c562727fbdf32273bb372c677e4fa68652cf709.camel@gmail.com
Am Samstag, dem 27.01.2024 um 17:15 +0000 schrieb Suhail:
Toggle quote (25 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > Would you care to debug this a bit more and report your findings?
>
> The locations in question are in the store and hence write-protected.
> What's a "safe" way to debug this?
>
> > > Packages such as ox-html are available from two locations in the
> > > native-comp-eln-load-path.  In one location they are symlinked,
> > > but (presumably because org is a builtin package) it is also
> > > available from another location in the native-comp-eln-load-path
> > > and in the latter location it's not symlinked in.  I believe this
> > > difference is why for some packages natively-compiled versions
> > > are loaded (e.g. org, ox-html, etc) whereas for others it's not
> > > the case.
> > Well, as pointed out in the deleted code, dlopen has a "one shared
> > library per file name" limitation.  I don't think we're hit by that
> > thanks to unique hashes in the store directory, but I might be
> > wrong about that.  Maybe we have to do java-style FQDNs instead.
>
> Perhaps.  I'd wondered, more simply, if symlinked .eln files were
> ever being loaded.  In the limited testing I did, I didn't find such
> an instance.  For what it's worth, only one of the entries in
> native-comp-eln-load-path seems to have symlinked entries (namely,
> ~/.guix-profile/lib/emacs/native-site-lisp).
You could try stepping through loading a natively-compiled, but
symlinked library, either with the emacs debugger or gdb. I sadly
don't have more hints to give; you probably know more about this bug
than I do.

Alternatively, you could try union-building emacs + your libraries and
resolving those symlinks as you do. This should give us a clear hint
that it's the symlinks and not something else that goes wrong.

In addition, you might want to verify that comp-el-to-*-filename
matches the files you want to load. We could try resolving symlinks in
there with realpath as well.

Toggle quote (16 lines)
> > > In addition, I believe there's another issue.  Some packages'
> > > names are getting  truncated.  For instance, instead of
> > > uniquify.eln, I observe niquify.eln.  In this case, the .eln
> > > isn't symlinked (presumably because it's a builtin), but due to
> > > the name being messed up (perhaps too aggressive a truncation of
> > > hashes?) the natively compiled version is not available:
> > I am not truncating any hashes, I'm not even computing them in the
> > first place.  The functions I'm modifying are publicly callable,
> > namely comp-el-to-eln-rel-filename for the relative file names, and
> > comp-el-to-eln-filename for the absolute ones.
> >
> > There could be an off-by-one error hidden in the stripping of the
> > BOGUS_DIRS, however.  Let's investigate that.
>
> Were you thinking out loud, or are there specific steps you'd like me
> to help with?
That last sentence is me thinking loud for a solution that I'll try for
v8.

Cheers
S
S
Suhail wrote on 27 Jan 20:39 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87wmrumupy.fsf@>
Suhail via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (2 lines)
> However, the 2 issues pointed out in the previous email remain:

Correction, there's only 1 issue. The first issue was a false positive.
Apologies for the noise.

Toggle quote (3 lines)
> 1. failure to load natively-compiled version of non-builtin libraries
> like emacs-htmlize possibly due to symlinks, and

This was a false positive. Turns out, if the function in question is
only autoloaded describe-function won't correctly identify the function
as being natively-compiled. This is consistent with what happens on
Emacs 29.1 on a non-Guix system. Not an issue.

Toggle quote (3 lines)
> 2. failure to load natively-compiled version of some builtin libraries
> like uniquify due to incorrect naming of .eln files

This issue remains as of v7 of the patch series.

--
Suhail
L
L
Liliana Marie Prikler wrote on 27 Jan 21:11 +0100
(name . Suhail)(address . suhail@bayesians.ca)
d61896605ee729f88639750f3712d3b91d44d5a2.camel@gmail.com
Am Samstag, dem 27.01.2024 um 19:39 +0000 schrieb Suhail:
Toggle quote (14 lines)
> Suhail via Guix-patches via <guix-patches@gnu.org> writes:
>
> > However, the 2 issues pointed out in the previous email remain:
>
> Correction, there's only 1 issue.  The first issue was a false
> positive. Apologies for the noise.
>
> > 1. failure to load natively-compiled version of non-builtin
> > libraries like emacs-htmlize possibly due to symlinks, and
>
> This was a false positive.  Turns out, if the function in question is
> only autoloaded describe-function won't correctly identify the
> function as being natively-compiled.  This is consistent with what
> happens on Emacs 29.1 on a non-Guix system.  Not an issue.
Interesting, but probably not avoidable. There's only so much
information you can put into autoloads.

Toggle quote (4 lines)
> > 2. failure to load natively-compiled version of some builtin
> > libraries like uniquify due to incorrect naming of .eln files
>
> This issue remains as of v7 of the patch series.
I fixed this one locally, but ‘uniquify’ remains byte-compiled for no
explainable reason. Will send v8 soon.

Cheer
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v8 2/7] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)
75fc54d6051c02ab2edc333de71ee4689a287ed0.1706389058.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2cdc9b8bca..0292b1bd16 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -384,7 +384,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 22 Jan 21:21 +0100
[PATCH v8 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(address . 67260@debbugs.gnu.org)
cd8877121c4b0b761e4de3fd2388cbcb615a932d.1706389058.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
gnu/packages/emacs.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..2cdc9b8bca 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -273,7 +273,11 @@ (define-public emacs-minimal
(let* ((out (assoc-ref outputs "out"))
(lisp-dirs (find-files (string-append out "/share/emacs")
"^lisp$"
- #:directories? #t)))
+ #:directories? #t))
+ (native-lisp-dirs (find-files
+ (string-append out "/lib/emacs")
+ "^native-lisp$"
+ #:directories? #t)))
(for-each
(lambda (prog)
(wrap-program prog
@@ -285,7 +289,11 @@ (define-public emacs-minimal
(list (search-input-file inputs "/bin/gzip")
;; for coreutils
(search-input-file inputs "/bin/yes"))))
- `("EMACSLOADPATH" suffix ,lisp-dirs)))
+ `("EMACSLOADPATH" suffix ,lisp-dirs)
+ ;; Note: the interpretation order of EMACSNATIVELOADPATH
+ ;; is reversed, so 'prefix functions just like 'suffix
+ ;; for EMACSLOADPATH.
+ `("EMACSNATIVELOADPATH" prefix ,native-lisp-dirs)))
(find-files (string-append out "/bin")
;; Matches versioned and unversioned emacs binaries.
;; We don't patch emacsclient, because it takes its

base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v8 5/7] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
45656b35960c59a586547bca0b9c80491a77a027.1706389058.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 15:09 +0100
[PATCH v8 4/7] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)
2a1785ea1709b6bca18fb5c92a506cb373757186.1706389058.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1caa2cbee0..03c50eba6d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-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
++frm 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");
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v8 3/7] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
90158d146ad5fb93c944a67d8a4af204249794df.1706389058.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 292 ++++++++++++++++++
3 files changed, 294 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (324 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0292b1bd16..1caa2cbee0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..8e7edfe5c3
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,292 @@
+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-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -4396,26 +4396,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);
+
+@@ -4423,64 +4414,54 @@ 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);
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- if (suffix_p (filename, ".gz"))
+- filename = Fsubstring (filename, Qnil, make_fixnum (-3));
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (len), Qnil);
++ break;
++ }
++ }
+
+- /* We create eln filenames with an hash in order to look-up these
+- starting from the source filename, IOW have a relation
++ if (Ffile_name_absolute_p (filename))
++ filename = rel_name;
+
+- /absolute/path/filename.el + content ->
+- eln-cache/filename-path_hash-content_hash.eln.
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
+
+- '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 (bogus_dirs))
++ {
++ tail = CALL2I (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 (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));
+- }
++ if (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
+- {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, 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));
++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)),
++ build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
+@@ -4494,13 +4474,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;
+@@ -4541,19 +4515,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+@@ -5859,10 +5821,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-29.2/lisp/startup.el
+===================================================================
+--- emacs-29.2.orig/lisp/startup.el
++++ emacs-29.2/lisp/startup.el
+@@ -545,9 +545,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.
+@@ -558,22 +555,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 normal-top-level ()
+ "Emacs calls this function when it first starts up.
+ It sets `command-line-processed', processes the command-line,
+@@ -1362,12 +1347,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
+@@ -1502,12 +1481,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-29.2/src/Makefile.in
+===================================================================
+--- emacs-29.2.orig/src/Makefile.in
++++ emacs-29.2/src/Makefile.in
+@@ -553,6 +553,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.
+Index: emacs-29.2/Makefile.in
+===================================================================
+--- emacs-29.2.orig/Makefile.in
++++ emacs-29.2/Makefile.in
+@@ -329,6 +329,7 @@ TRANSFORM = @program_transform_name@
+
+ # Prevent any settings in the user environment causing problems.
+ unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH
++export EMACSNATIVELOADPATH = @abs_top_builddir@/native-lisp
+
+ # What emacs should be called when installed.
+ EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v8 6/7] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)
8aeec12dcad684a53ca8ed955f74e9bd2dc8fb19.1706389058.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 21 Jan 13:12 +0100
[PATCH v8 7/7] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)
d5dcb1f4606e204c0777d1ec28b22445f1b76801.1706389058.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
S
S
Suhail wrote on 28 Jan 01:13 +0100
Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87ede22u3m.fsf@>
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (6 lines)
>> > 2. failure to load natively-compiled version of some builtin
>> > libraries like uniquify due to incorrect naming of .eln files
>>
>> This issue remains as of v7 of the patch series.
> I fixed this one locally,

I can confirm that the .eln filenames are no longer truncated (as far as
I can tell).

Toggle quote (2 lines)
> but ‘uniquify’ remains byte-compiled for no explainable reason.

And too that as of v8 patch, uniquify still isn't natively-compiled.
However, if you unload it and then reload it, it becomes
natively-compiled.

#+begin_src bash
emacs --batch --eval "(message \"%s\" (progn (unload-feature 'uniquify) (require 'uniquify) (take 1 (split-string (substring-no-properties (describe-function 'uniquify-item-p)) \"\\n\" t))))"
#+end_src

#+RESULTS:
: Type q in help window to delete it
: (uniquify-item-p is a native-compiled Lisp function in `uniquify.el'.)


I think the issue is because uniquify (along with some others such as
prog-mode, backquote etc that I tested) are preloaded in Emacs. I
believe that these preloaded packages need to be treated specially. In
a non-Guix system, these preloaded packages have their .eln files stored
under something like
<native-comp-eln-load-path-entry>/29.x-<hash>/preloaded/ , whereas in
the v8 series there is no "preloaded" directory. Instead .eln files for
packages such as uniquify, prog-mode, backquote etc. are in various
locations:

- uniquify :: <n-c-e-l-p-entry>/29.2-<hash>/uniquify.eln
- prog-mode :: <n-c-e-l-p-entry>/29.2-<hash>/progmodes/prog-mode.eln
- backquote :: <n-c-e-l-p-entry>/29.2-<hash>/emacs-lisp/backquote.eln

I suspect that the code which does the preloading may need to be patched
and/or the preloaded packages may need to have their .eln files
generated under a preloaded sub-directory (similar to what happens in
non-Guix systems).

Below is a list of .eln files that exist in the preloaded sub-directory
in Emacs 29.1 on a non-Guix system. It's possible that the set of
preloaded packages on Emacs 29.2 is different. I suspect that all of
these packages are similarly affected.

#+begin_example
abbrev.eln
backquote.eln
bindings.eln
buff-menu.eln
burmese.eln
button.eln
byte-run.eln
case-table.eln
cconv.eln
cham.eln
characters.eln
chinese.eln
cl-generic.eln
cl-preloaded.eln
common-win.eln
composite.eln
cp51932.eln
cus-face.eln
cus-start.eln
custom.eln
cyrillic.eln
czech.eln
debug-early.eln
disp-table.eln
dnd.eln
dos-fns.eln
dos-vars.eln
dos-w32.eln
dynamic-setting.eln
easymenu.eln
ediff-hook.eln
eldoc.eln
electric.eln
elisp-mode.eln
english.eln
env.eln
epa-hook.eln
ethiopic.eln
eucjp-ms.eln
european.eln
faces.eln
files.eln
fill.eln
float-sup.eln
font-core.eln
font-lock.eln
fontset.eln
format.eln
frame.eln
fringe.eln
georgian.eln
greek.eln
haiku-win.eln
hebrew.eln
help.eln
image.eln
indent.eln
indian.eln
indonesian.eln
internal.eln
isearch.eln
iso-transl.eln
japanese.eln
jit-lock.eln
jka-cmpr-hook.eln
keymap.eln
khmer.eln
korean.eln
lao.eln
lisp.eln
lisp-mode.eln
ls-lisp.eln
macroexp.eln
map-ynp.eln
menu-bar.eln
minibuffer.eln
misc-lang.eln
mouse.eln
mule.eln
mule-cmds.eln
mule-conf.eln
mule-util.eln
mwheel.eln
nadvice.eln
newcomment.eln
ns-win.eln
obarray.eln
oclosure.eln
page.eln
paragraphs.eln
paren.eln
pc-win.eln
pgtk-dnd.eln
pgtk-win.eln
philippine.eln
prog-mode.eln
regexp-opt.eln
register.eln
replace.eln
rfn-eshadow.eln
rmc.eln
romanian.eln
scroll-bar.eln
select.eln
seq.eln
shorthands.eln
simple.eln
sinhala.eln
slovak.eln
startup.eln
subr.eln
syntax.eln
tab-bar.eln
tabulated-list.eln
tai-viet.eln
text-mode.eln
thai.eln
tibetan.eln
timer.eln
tool-bar.eln
tooltip.eln
tty-colors.eln
ucs-normalize.eln
uniquify.eln
utf-8-lang.eln
vc-hooks.eln
version.eln
vietnamese.eln
w32-fns.eln
w32-vars.eln
w32-win.eln
widget.eln
window.eln
x-dnd.eln
x-win.eln
#+end_example


--
Suhail

This email is not an offer capable of acceptance, does not evidence an
intention to enter into an agreement, has no operative effect until a
definitive agreement is signed in writing by both parties, and that no
party should act in reliance on the email or any representations of the
sender until a definitive agreement is signed in writing by both
parties.
S
S
Suhail wrote on 28 Jan 01:18 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87a5oq2tv8.fsf@>
Suhail via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (3 lines)
> Below is a list of .eln files that exist in the preloaded
> sub-directory in Emacs 29.1 on a non-Guix system.

Minor correction. The list of files I posted was /adapted/ from the
list of files in the preloaded sub-directory on a non-Guix system (with
Emacs 29.1). Specifically, the list I shared had the hash suffix
removed to make comparison with the .eln file on Guix easier.

--
Suhail
L
L
Liliana Marie Prikler wrote on 28 Jan 10:51 +0100
(name . Suhail)(address . suhail@bayesians.ca)
96b31b76703e740065654996acd74e44a6be97c1.camel@gmail.com
Am Sonntag, dem 28.01.2024 um 00:13 +0000 schrieb Suhail:
Toggle quote (38 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> [...]
> > but ‘uniquify’ remains byte-compiled for no explainable reason.
>
> And too that as of v8 patch, uniquify still isn't natively-compiled.
> However, if you unload it and then reload it, it becomes
> natively-compiled.
>
> #+begin_src bash
>   emacs --batch --eval "(message \"%s\" (progn (unload-feature
> 'uniquify) (require 'uniquify) (take 1 (split-string (substring-no-
> properties (describe-function 'uniquify-item-p)) \"\\n\" t))))"
> #+end_src
>
> #+RESULTS:
> : Type q in help window to delete it
> : (uniquify-item-p is a native-compiled Lisp function in
> `uniquify.el'.)
>
>
> I think the issue is because uniquify (along with some others such as
> prog-mode, backquote etc that I tested) are preloaded in Emacs.  I
> believe that these preloaded packages need to be treated specially. 
> In a non-Guix system, these preloaded packages have their .eln files
> stored under something like
> <native-comp-eln-load-path-entry>/29.x-<hash>/preloaded/ , whereas in
> the v8 series there is no "preloaded" directory.  Instead .eln files
> for packages such as uniquify, prog-mode, backquote etc. are in
> various locations:
>
> - uniquify :: <n-c-e-l-p-entry>/29.2-<hash>/uniquify.eln
> - prog-mode :: <n-c-e-l-p-entry>/29.2-<hash>/progmodes/prog-mode.eln
> - backquote :: <n-c-e-l-p-entry>/29.2-<hash>/emacs-lisp/backquote.eln
>
> I suspect that the code which does the preloading may need to be
> patched and/or the preloaded packages may need to have their .eln
> files generated under a preloaded sub-directory (similar to what
> happens in non-Guix systems).
From my experiments, the installing of these files is a red herring. I
instrumented lread.c to print the relative and absolute file names
tried, and it appears that these aren't loaded at all after install
while EMACSNATIVELOADPATH is ignored when dumping.

Cheers
S
S
Suhail wrote on 28 Jan 17:17 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
<87il3dph3s.fsf@>
I'm assuming you're able to reproduce the issue on your end as well with
other features like prog-mode, backquote etc.

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (4 lines)
> I instrumented lread.c to print the relative and absolute file names
> tried, and it appears that these aren't loaded at all after install
> while EMACSNATIVELOADPATH is ignored when dumping.

Interesting. I did a grep of the Emacs source (branch emacs-29) and
line 1770 of src/lread.c (in maybe_swap_for_eln) seemed relevant:

Toggle quote (3 lines)
> /* Look also in preloaded subfolder of the last entry in
> `comp-eln-load-path'. */

What surprised me was that not only was the "preloaded" directory
special-cased, but so too was the last entry of "comp-eln-load-path"
(which I imagine is referring to native-comp-eln-load-path). Judging by
your message, I'm guessing you're well aware of this. I, unfortunately,
have no additional insights or suggestions.

However, given that ensuring Emacs is able to find the natively-compiled
version of files seems non-trivial, it might help for a future patch
series to be accompanied with tests. Thoughts?

--
Suhail
L
L
Liliana Marie Prikler wrote on 28 Jan 17:50 +0100
(name . Suhail)(address . suhail@bayesians.ca)
b36b2dacc7e96906388462f91157ad8186df7156.camel@gmail.com
Am Sonntag, dem 28.01.2024 um 16:17 +0000 schrieb Suhail:
Toggle quote (25 lines)
> I'm assuming you're able to reproduce the issue on your end as well
> with
> other features like prog-mode, backquote etc.
>
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>
> > I instrumented lread.c to print the relative and absolute file
> > names tried, and it appears that these aren't loaded at all after
> > install while EMACSNATIVELOADPATH is ignored when dumping.
>
> Interesting.  I did a grep of the Emacs source (branch emacs-29) and
> line 1770 of src/lread.c (in maybe_swap_for_eln) seemed relevant:
>
> >   /* Look also in preloaded subfolder of the last entry in
> >      `comp-eln-load-path'.  */
>
> What surprised me was that not only was the "preloaded" directory
> special-cased, but so too was the last entry of "comp-eln-load-path"
> (which I imagine is referring to native-comp-eln-load-path).  Judging
> by your message, I'm guessing you're well aware of this.  I,
> unfortunately, have no additional insights or suggestions.
>
> However, given that ensuring Emacs is able to find the natively-
> compiled version of files seems non-trivial, it might help for a
> future patch series to be accompanied with tests.  Thoughts?
On upstream, this would add ../native-lisp/preloaded to the search
(since everything is dropped in one directory, this probably works as
expected), but with our patch, we do multiple directories *and* drop
../native-lisp from that early. We could try expanding
EMACSNATIVELOADPATH earlier, but we can't yet use Fgetenv_internal.

But yeah, we're looking at the same source file right now.

Cheers
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(address . 67260@debbugs.gnu.org)
f338ca94952ca0c16fce803022dd6a6c1dc6e13e.1707852049.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
gnu/packages/emacs.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..2cdc9b8bca 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -273,7 +273,11 @@ (define-public emacs-minimal
(let* ((out (assoc-ref outputs "out"))
(lisp-dirs (find-files (string-append out "/share/emacs")
"^lisp$"
- #:directories? #t)))
+ #:directories? #t))
+ (native-lisp-dirs (find-files
+ (string-append out "/lib/emacs")
+ "^native-lisp$"
+ #:directories? #t)))
(for-each
(lambda (prog)
(wrap-program prog
@@ -285,7 +289,11 @@ (define-public emacs-minimal
(list (search-input-file inputs "/bin/gzip")
;; for coreutils
(search-input-file inputs "/bin/yes"))))
- `("EMACSLOADPATH" suffix ,lisp-dirs)))
+ `("EMACSLOADPATH" suffix ,lisp-dirs)
+ ;; Note: the interpretation order of EMACSNATIVELOADPATH
+ ;; is reversed, so 'prefix functions just like 'suffix
+ ;; for EMACSLOADPATH.
+ `("EMACSNATIVELOADPATH" prefix ,native-lisp-dirs)))
(find-files (string-append out "/bin")
;; Matches versioned and unversioned emacs binaries.
;; We don't patch emacsclient, because it takes its

base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 2/7] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)
4fe9c932cc5f7d959df5cbc801dfe43f7f817385.1707852049.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2cdc9b8bca..0292b1bd16 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -384,7 +384,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 4/7] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)
2188ddbfcdabbba12df18a4c3af34b123ea8448d.1707852049.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1caa2cbee0..03c50eba6d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-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
++frm 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");
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 5/7] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)
3604eaa2d70ad07a9c80c5166f42fad536b63a77.1707852049.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 6/7] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)
7946bcd3c810575ddb31ff84bce16b42375b7513.1707852049.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 3/7] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)
60a52b40655fd27afa7d35564fb640c435c215b1.1707852049.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---

Am Sonntag, dem 28.01.2024 um 16:17 +0000 schrieb Suhail:
Toggle quote (5 lines)
> What surprised me was that not only was the "preloaded" directory
> special-cased, but so too was the last entry of "comp-eln-load-path"
> (which I imagine is referring to native-comp-eln-load-path). Judging
> by your message, I'm guessing you're well aware of this. I,
> unfortunately, have no additional insights or suggestions.
Welp, I managed to find a workaround. The emacs produced by this patch
has its own native-lisp directory twice (once per wrapping, once per
bootstrap), but it ought to load your natively-compiled whatever fine.

Cheers

gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 322 ++++++++++++++++++
3 files changed, 324 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (354 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0292b1bd16..1caa2cbee0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..8e9f9a8fd6
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,322 @@
+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-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -4396,26 +4396,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);
+
+@@ -4423,64 +4414,54 @@ 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);
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- if (suffix_p (filename, ".gz"))
+- filename = Fsubstring (filename, Qnil, make_fixnum (-3));
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object len = Flength (XCAR (tail));
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ XCAR (tail), make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, Fadd1 (len), Qnil);
++ break;
++ }
++ }
+
+- /* We create eln filenames with an hash in order to look-up these
+- starting from the source filename, IOW have a relation
++ if (Ffile_name_absolute_p (filename))
++ filename = rel_name;
+
+- /absolute/path/filename.el + content ->
+- eln-cache/filename-path_hash-content_hash.eln.
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
+
+- '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 (bogus_dirs))
++ {
++ tail = CALL2I (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 (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));
+- }
++ if (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
+- {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, 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));
++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)),
++ build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
+@@ -4494,13 +4475,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;
+@@ -4541,19 +4516,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+@@ -5863,10 +5826,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-29.2/lisp/startup.el
+===================================================================
+--- emacs-29.2.orig/lisp/startup.el
++++ emacs-29.2/lisp/startup.el
+@@ -545,9 +545,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.
+@@ -558,22 +555,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 normal-top-level ()
+ "Emacs calls this function when it first starts up.
+ It sets `command-line-processed', processes the command-line,
+@@ -1362,12 +1347,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
+@@ -1502,12 +1481,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-29.2/src/Makefile.in
+===================================================================
+--- emacs-29.2.orig/src/Makefile.in
++++ emacs-29.2/src/Makefile.in
+@@ -553,6 +553,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 = emacs-lisp
+ lisp = $(addprefix ${lispsource}/,${shortlisp})
+
+ ## Construct full set of libraries to be linked.
+Index: emacs-29.2/Makefile.in
+===================================================================
+--- emacs-29.2.orig/Makefile.in
++++ emacs-29.2/Makefile.in
+@@ -329,6 +329,7 @@ TRANSFORM = @program_transform_name@
+
+ # Prevent any settings in the user environment causing problems.
+ unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH
++export EMACSNATIVELOADPATH = @abs_top_builddir@/native-lisp
+
+ # What emacs should be called when installed.
+ EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
+Index: emacs-29.2/lisp/loadup.el
+===================================================================
+--- emacs-29.2.orig/lisp/loadup.el
++++ emacs-29.2/lisp/loadup.el
+@@ -53,6 +53,13 @@
+ (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)
++ (equal dump-mode "pdump")
++ (setq
++ native-comp-eln-load-path
++ (cons (expand-file-name "../native-lisp" invocation-directory)
++ native-comp-eln-load-path)))
+
+ ;; Add subdirectories to the load-path for files that might get
+ ;; autoloaded when bootstrapping or running Emacs normally.
+Index: emacs-29.2/lisp/Makefile.in
+===================================================================
+--- emacs-29.2.orig/lisp/Makefile.in
++++ emacs-29.2/lisp/Makefile.in
+@@ -110,6 +110,7 @@ MAIN_FIRST = ./emacs-lisp/eieio.el ./ema
+
+ # Prevent any settings in the user environment causing problems.
+ unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH
++export NATIVE_COMP_BOGUS_DIRS = emacs-lisp:international:language:progmodes:term:textmodes:vc
+
+ # The actual Emacs command run in the targets below.
+ emacs = '$(EMACS)' $(EMACSOPT)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH v7 7/7] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)
eb76eb48ab0ab6bc9b030fd40ccaf0425b70445d.1707852049.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
S
S
Suhail wrote on 14 Feb 01:56 +0100
[bug#67260] [PATCH emacs-team v9*] Think ahead when compiling
(name . bug#67260)(address . 67260@debbugs.gnu.org)
87o7cjkgnb.fsf@gmail.com
The latest patch series (titled v7, but really v9) shows some
improvement, however, there are still some issues.

Specifically, functions from preloaded library uniquify are now
correctly noted as being natively-compiled. The functions that were
confirmed were uniquify-item-base and uniquify-item-p.

However, functions from certain other preloaded libraries are still
noted as being byte-compiled instead. At the very least this set
includes backquote and eldoc.

#+begin_src sh
emacs --batch --eval (message "%s" (take 1 (split-string (substring-no-properties (describe-function 'backquote-process)) "\n" t)))
#+end_src

#+RESULTS:
: Type q in help window to delete it
: (backquote-process is a byte-compiled Lisp function in `backquote.el'.)

#+begin_src sh
emacs --batch --eval (message "%s" (take 1 (split-string (substring-no-properties (describe-function 'eldoc-mode)) "\n" t)))
#+end_src

#+RESULTS:
: Type q in help window to delete it
: (eldoc-mode is an interactive byte-compiled Lisp function in)


--
Suhail
S
S
Suhail wrote on 14 Feb 09:41 +0100
Re: [bug#67260] [PATCH emacs-team v9*] Test for AOT native-comp
(name . bug#67260)(address . 67260@debbugs.gnu.org)
87bk8jbfpu.fsf_-_@gmail.com
So I wrote some code to make it easier to report on the state of
native-comp for some of the packages previously mentioned (the *.eln
files for these packages reside under the "preloaded" directory in a
non-Guix distribution). I'm including below both the contents of the
script as well as the results.

First the results. Assuming that the file
test-native-comp-p--preloaded.el exists, evaluating the below:

#+begin_src sh :results replace
emacs -Q --batch \
-l path/to/test-native-comp-p--preloaded.el \
--eval "(princ (report/compilation-status/run))"
#+end_src

With a non-Guix Emacs results in:

#+RESULTS:
: [97/97] passed. Success!

Whereas with the latest patch-series it results in 41 failing cases:

#+RESULTS:
#+begin_example
[56/97] passed. 41 failing cases below:

((backquote-process . byte-compiled)
(byte-run-strip-symbol-positions . byte-compiled)
(cconv-convert . byte-compiled)
(use-default-char-width-table . byte-compiled)
(cl-generic-p . byte-compiled)
(cl-struct-define . byte-compiled)
(x-setup-function-keys . byte-compiled)
(debug-early . byte-compiled)
(easy-menu-item-present-p . byte-compiled)
(eldoc-mode . byte-compiled)
(elisp-mode-syntax-propertize . byte-compiled)
(fill-region . byte-compiled)
(fontset-plain-name . byte-compiled)
(indian-compose-regexp . byte-compiled)
(msdos-setup-keyboard . byte-compiled)
(iso-transl-set-language . byte-compiled)
(forward-sexp . byte-compiled)
(lisp-string-in-doc-position-p . byte-compiled)
(macroexp-compiling-p . byte-compiled)
(map-y-or-n-p . byte-compiled)
(egyptian-shape-grouping . byte-compiled)
(convert-define-charset-argument . byte-compiled)
(coding-system-change-eol-conversion . byte-compiled)
(store-substring . byte-compiled)
(advice-function-mapc . byte-compiled)
(oclosure-type . byte-compiled)
(forward-page . byte-compiled)
(sentence-end . byte-compiled)
(prog-context-menu . byte-compiled)
(regexp-opt . byte-compiled)
(read-multiple-choice . byte-compiled)
(seq-first . byte-compiled)
(hack-read-symbol-shorthands . byte-compiled)
(syntax-propertize-multiline . byte-compiled)
(tabulated-list-put-tag . byte-compiled)
(text-mode . byte-compiled)
(timer-activate . byte-compiled)
(tty-color-desc . byte-compiled)
(ucs-normalize-hfs-nfd-comp-p . byte-compiled)
(vc-mode . byte-compiled)
(x-handle-no-bitmap-icon . byte-compiled))
#+end_example

The content of test-native-comp-p--preloaded.el are as follows:

#+begin_src elisp :eval never
(require 'help-fns)
(defun report/compilation-status (fun &optional feature)
"Report on the compilation status of function FUN.
Optionally load FEATURE before reporting on compilation status."
(when feature
(require feature))
(let ((descstr (substring-no-properties
(with-output-to-string
(help-fns-function-description-header fun)))))
(cons fun
(cond
((string-search " native-compiled" descstr) 'native-compiled)
((string-search " byte-compiled" descstr) 'byte-compiled)
(t descstr)))))

;; [[/usr/share/emacs/29.2/lisp]]
(defvar report/compilation-status/cases/preloaded nil
"Functions that ought to be natively-compiled.")
(setq report/compilation-status/cases/preloaded
'((abbrev-mode)
(backquote-process)
(mode-line-widen)
(buffer-menu)
;; burmese
(button-mode)
(byte-run-strip-symbol-positions)
(case-table-get-table)
(cconv-convert)
;; cham
(use-default-char-width-table)
;; chinese
(cl-generic-p)
(cl-struct-define)
(x-setup-function-keys)
(encode-composition-rule)
;; cp51932
(custom-declare-face)
(minibuffer-prompt-properties--setter) ;; cus-start.el
(custom-add-choice)
;; cyrillic
;; czech
(debug-early)
(display-table-slot disp-table) ;; disp-table.eln exists
(dnd-open-file)
(dos-mode25 dos-fns) ;; dos-fns.eln exists
;; dos-vars
(find-file-text dos-w32) ;; dos-w32.eln exists
(dynamic-setting-handle-config-changed-event)
(easy-menu-item-present-p)
;; ediff-hook
(eldoc-mode)
(electric-indent-mode)
(elisp-mode-syntax-propertize)
;; english
(getenv)
(epa-file-find-file-hook)
;; ethiopic
;; eucjp-ms
;; european
(face-list)
(find-file-noselect)
(fill-region)
;; float-sup
(font-lock-change-mode)
(font-lock-add-keywords)
(fontset-plain-name)
(format-read)
(frame-edges)
(fringe-mode)
;; georgian
;; greek
;; haiku-win
;; hebrew
(help-quick)
(image-type)
(indent-region)
(indian-compose-regexp)
;; indonesian
(msdos-setup-keyboard term/internal) ;; internal.eln exists
(isearch-abort)
(iso-transl-set-language)
;; japanese
(jit-lock-mode)
(jka-compr-build-file-regexp)
(keymap-global-set)
;; khmer
;; korean
;; lao
(forward-sexp)
(lisp-string-in-doc-position-p)
(ls-lisp-set-options ls-lisp) ;; ls-lisp.eln exists
(macroexp-compiling-p)
(map-y-or-n-p)
(menu-find-file-existing)
(completion-boundaries)
(egyptian-shape-grouping)
(mouse-double-click-time)
(convert-define-charset-argument)
(coding-system-change-eol-conversion)
;; mule-conf.eln
(store-substring mule-util) ;; mule-util.eln exists
(mouse-wheel-change-button)
(advice-function-mapc)
(comment-string-strip)
;; (ns-handle-nxopen term/ns-win)
(obarray-make)
(oclosure-type)
(forward-page)
(sentence-end)
(show-paren-function)
;; (msdos-face-setup term/pc-win)
(pgtk-dnd-init-frame pgtk-dnd) ;; pgtk-dnd.eln exists
;; (pgtk-drag-n-drop term/pgtk-win)
;; philippine
(prog-context-menu)
(regexp-opt)
(get-register)
(query-replace-descr)
(rfn-eshadow-setup-minibuffer)
(read-multiple-choice)
;; romanian
(scroll-bar-scale)
(gui-select-text)
(seq-first)
(hack-read-symbol-shorthands)
(next-error-find-buffer)
;; sinhala
;; slovak
(exit-splash-screen)
(buffer-local-boundp)
(syntax-propertize-multiline)
(tab-bar-mode)
(tabulated-list-put-tag)
;; tai-viet
(text-mode)
;; thai
;; tibetan
(timer-activate)
(tool-bar-mode)
(tooltip-mode)
(tty-color-desc)
(ucs-normalize-hfs-nfd-comp-p ucs-normalize) ;; ucs-normalize.eln exists
(uniquify-item-p)
;; utf-8-lang.eln
(vc-mode)
(emacs-version)
;; vietnamese
;; (w32-shell-name)
;; w32-vars.eln
;; (w32-handle-dropped-file 'term/w32-win)
(define-widget)
(window-right)
(x-dnd-init-frame)
(x-handle-no-bitmap-icon)))

(defun report/compilation-status/run ()
"Run all cases and report those that aren't native-compiled."
(let* ((results (mapcar (lambda (args) (apply #'report/compilation-status args))
report/compilation-status/cases/preloaded))
(failing (seq-filter (lambda (x) (not (eq (cdr x) 'native-compiled)))
results))
(numtotal (seq-length results))
(numfailing (seq-length failing))
(numpassing (- numtotal numfailing)))
(concat (format "[%s/%s] passed."
numpassing numtotal)
(if failing
(concat (format " %s failing cases below:\n\n" numfailing)
(pp-to-string failing))
" Success!"))))
#+end_src

Hope this helps!

--
Suhail
L
L
Liliana Marie Prikler wrote on 16 Feb 16:09 +0100
[PATCH emacs-team v10 0/7] Preload most of the things
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
cover.1708096198.git.liliana.prikler@gmail.com
Am Mittwoch, dem 14.02.2024 um 08:41 +0000 schrieb Suhail:
Toggle quote (17 lines)
> So I wrote some code to make it easier to report on the state of
> native-comp for some of the packages previously mentioned (the *.eln
> files for these packages reside under the "preloaded" directory in a
> non-Guix distribution). I'm including below both the contents of the
> script as well as the results.
> [...]
> With a non-Guix Emacs results in:
>
> #+RESULTS:
> : [97/97] passed. Success!
>
> Whereas with the latest patch-series it results in 41 failing cases:
>
> #+RESULTS:
> #+begin_example
> [56/97] passed.  41 failing cases below:

With this series I get 94/97. The remaining three don't appear to be
preloaded through the loadup script, so I have no idea how to catch them
or whether it's even worth doing so.

Liliana Marie Prikler (7):
gnu: emacs: Wrap EMACSNATIVELOADPATH.
gnu: emacs: Build trampolines.
gnu: emacs: Don't hash file names in native compilation.
gnu: emacs: Disable jit compilation.
build-system: emacs: Compute relative file names.
gnu: emacs-org: Fix native builds.
gnu: emacs-magit: Fix native builds.

gnu/local.mk | 2 +
gnu/packages/emacs-xyz.scm | 10 +-
gnu/packages/emacs.scm | 21 +-
.../emacs-disable-jit-compilation.patch | 19 +
.../emacs-native-comp-fix-filenames.patch | 329 ++++++++++++++++++
guix/build/emacs-utils.scm | 4 +-
6 files changed, 379 insertions(+), 6 deletions(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch


base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 2/7] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
4fe9c932cc5f7d959df5cbc801dfe43f7f817385.1708096198.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2cdc9b8bca..0292b1bd16 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -384,7 +384,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 4/7] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
c60de8789ff5d9ac25a2858d0ee35d2308fd1677.1708096198.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1caa2cbee0..03c50eba6d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-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
++frm 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");
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
f338ca94952ca0c16fce803022dd6a6c1dc6e13e.1708096198.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
gnu/packages/emacs.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..2cdc9b8bca 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -273,7 +273,11 @@ (define-public emacs-minimal
(let* ((out (assoc-ref outputs "out"))
(lisp-dirs (find-files (string-append out "/share/emacs")
"^lisp$"
- #:directories? #t)))
+ #:directories? #t))
+ (native-lisp-dirs (find-files
+ (string-append out "/lib/emacs")
+ "^native-lisp$"
+ #:directories? #t)))
(for-each
(lambda (prog)
(wrap-program prog
@@ -285,7 +289,11 @@ (define-public emacs-minimal
(list (search-input-file inputs "/bin/gzip")
;; for coreutils
(search-input-file inputs "/bin/yes"))))
- `("EMACSLOADPATH" suffix ,lisp-dirs)))
+ `("EMACSLOADPATH" suffix ,lisp-dirs)
+ ;; Note: the interpretation order of EMACSNATIVELOADPATH
+ ;; is reversed, so 'prefix functions just like 'suffix
+ ;; for EMACSLOADPATH.
+ `("EMACSNATIVELOADPATH" prefix ,native-lisp-dirs)))
(find-files (string-append out "/bin")
;; Matches versioned and unversioned emacs binaries.
;; We don't patch emacsclient, because it takes its
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 3/7] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
5967a1c96c2437f36922991d2889c39a31e5a74c.1708096198.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 329 ++++++++++++++++++
3 files changed, 331 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (361 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0292b1bd16..1caa2cbee0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..bb6ab312c3
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,329 @@
+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.
+
+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-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -4396,26 +4396,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);
+
+@@ -4423,64 +4414,71 @@ 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);
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- if (suffix_p (filename, ".gz"))
+- filename = Fsubstring (filename, Qnil, make_fixnum (-3));
++ 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;
++ }
++ }
+
+- /* We create eln filenames with an hash in order to look-up these
+- starting from the source filename, IOW have a relation
++ if (Ffile_name_absolute_p (filename))
++ filename = rel_name;
+
+- /absolute/path/filename.el + content ->
+- eln-cache/filename-path_hash-content_hash.eln.
++ /* In case the file being compiled is found in 'LISP_PRELOADED' or
++ `comp-file-preloaded-p' is non-nil target for output the
++ 'preloaded' subfolder. */
++ Lisp_Object lisp_preloaded =
++ Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
++ bool preloaded = comp_file_preloaded_p;
++ if (!preloaded && !NILP (lisp_preloaded))
++ preloaded =
++ !NILP (Fmember (CALL1I (file-name-sans-extension, filename),
++ Fmapcar (intern_c_string ("file-name-sans-extension"),
++ CALL1I (split-string, lisp_preloaded))));
++
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
++
++ if (!NILP (bogus_dirs))
++ {
++ tail = CALL2I (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;
++ }
++ }
++ }
+
+- '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 (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+
+- 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));
+- }
++ if (preloaded)
++ filename = concat2 (build_string ("preloaded/"),
++ Ffile_name_nondirectory (filename));
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
+- {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
+- {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, 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));
++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)),
++ build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
+@@ -4494,13 +4492,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;
+@@ -4541,19 +4533,7 @@ the latter is supposed to be used by the
+
+ if (!file_name_absolute_p (SSDATA (base_dir)))
+ base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
+-
+- /* In case the file being compiled is found in 'LISP_PRELOADED' or
+- `comp-file-preloaded-p' is non-nil target for output the
+- 'preloaded' subfolder. */
+- Lisp_Object lisp_preloaded =
+- Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
+- if (comp_file_preloaded_p
+- || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
+- CALL1I (split-string, lisp_preloaded))))))
+- base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+ return Fexpand_file_name (filename, base_dir);
+ }
+@@ -5863,10 +5843,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-29.2/lisp/startup.el
+===================================================================
+--- emacs-29.2.orig/lisp/startup.el
++++ emacs-29.2/lisp/startup.el
+@@ -545,9 +545,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.
+@@ -558,22 +555,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 normal-top-level ()
+ "Emacs calls this function when it first starts up.
+ It sets `command-line-processed', processes the command-line,
+@@ -1362,12 +1347,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
+@@ -1502,12 +1481,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-29.2/lisp/loadup.el
+===================================================================
+--- emacs-29.2.orig/lisp/loadup.el
++++ emacs-29.2/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.
+@@ -557,7 +565,9 @@ lost after dumping")))
+ (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)
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 6/7] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
04e0fd37245f7e6bff11de512e901792a27ff1bc.1708096198.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 7/7] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
f110b938f222a38522849c82a27f3cf70b5d7505.1708096198.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v10 5/7] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
583c5ca9ccdc597fb9e1be59ed86193299d68715.1708096198.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
S
S
Suhail wrote on 17 Feb 15:49 +0100
Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
875xyndu36.fsf@bayesians.ca
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (2 lines)
> With this series I get 94/97.

I was able to confirm that as well.

Toggle quote (2 lines)
> The remaining three

Namely, the 'ucs-normalize, 'mule-util, and 'term/internal features.
For each of these the .eln files exist, but the version that gets loaded
in Guix is the byte-compiled one, unless some extra steps are taken.

Toggle quote (3 lines)
> ... don't appear to be preloaded through the loadup script, so I have
> no idea how to catch them or whether it's even worth doing so.

I dug into this a little deeper. It seems that by adjusting the
load-path one is able to load the natively-compiled variants instead of
the byte-compiled for these features. Oddly, this adjustment doesn't
seem to be needed in non-Guix Emacs which may suggest the presence of a
bug. I'm hoping you have some insight that explains this difference in
behaviour.

After modifying the previous test-native-comp-p--preloaded.el (in
hindsight, the preloaded part may be a misnomer) with the below patch I
got all the 97 cases passing.

#+begin_src diff
diff -u ./test-native-comp-p--preloaded.el ./test-native-comp-p--preloaded.el
--- ./test-native-comp-p--preloaded.el 2024-02-17 08:49:36.294930488 -0500
+++ ./test-native-comp-p--preloaded.el 2024-02-17 08:38:45.102839041 -0500
@@ -155,8 +155,50 @@
(x-dnd-init-frame)
(x-handle-no-bitmap-icon)))
+(defun hack/tweak-load-path-in-guix ()
+ "Tweak `load-path' to allow natively compiled versions to be loaded.
+
+If we ensure that the `load-path' entries for `term/internal',
+`mule-util' and `ucs-normalize' exist and they occur before the
+share/emacs/<emacs-version>/lisp entry then we are able to load
+the natively compiled versions of these libraries. Of those
+three, the entry for `term/internal' is missing whereas the
+others currently occur after the share/emacs/<emacs-version>/lisp
+entry. We remedy that here.
+
+Notably, in non-Guix Emacs this isn't needed. I.e., the fact
+that the share/emacs/<emacs-version>/lisp entry precedes the
+entries for `mule-util' and `ucs-normalize' is okay as is the
+fact that the entry for `term/internal' is missing."
+ (when (getenv "GUIX_ENVIRONMENT")
+ (require 'find-func)
+ ;; first we'll add the missing entry for `term/internal'
+ (add-to-list 'load-path
+ (directory-file-name
+ (file-name-directory
+ (find-library-name (symbol-name 'term/internal))))
+ ;; NOTE: we don't need to append; doing so simply to confirm that
+ ;; it's only the relative position wrt the
+ ;; share/emacs/<emacs-version>/lisp entry that matters.
+ t)
+ ;; then we'll ensure that the entry for share/emacs/<emacs-version>/lisp is at
+ ;; the end
+ (let* ((sitelisppath (format "/share/emacs/%s/lisp"
+ emacs-version))
+ (pathsuffix (seq-filter
+ #'(lambda (x)
+ (string-suffix-p sitelisppath x))
+ load-path))
+ (pathprefix (seq-filter
+ #'(lambda (x)
+ (not
+ (string-suffix-p sitelisppath x)))
+ load-path)))
+ (setq load-path (append pathprefix pathsuffix)))))
+
(defun report/compilation-status/run ()
"Run all cases and report those that aren't native-compiled."
+ (hack/tweak-load-path-in-guix)
(let* ((results (mapcar (lambda (args) (apply #'report/compilation-status args))
report/compilation-status/cases/preloaded))
(failing (seq-filter (lambda (x) (not (eq (cdr x) 'native-compiled)))
@@ -169,5 +211,5 @@
(if failing
(concat (format " %s failing cases below:\n\n" numfailing)
(pp-to-string failing))
- " Success!"))))
+ " Success!\n"))))
;; guix/hacking/reviews/emacs-aot/test-native-comp-p/preloaded ends here

Diff finished. Sat Feb 17 08:50:04 2024
#+end_src

I'm also attaching, for reference, the updated
test-native-comp-p--preloaded.el in its entirety.


--
Suhail
L
L
Liliana Marie Prikler wrote on 17 Feb 16:15 +0100
(name . Suhail)(address . suhail@bayesians.ca)
e03e61ea80a06889c254c75ac6d78db2729baa53.camel@gmail.com
Am Samstag, dem 17.02.2024 um 14:49 +0000 schrieb Suhail:
Toggle quote (10 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> > ... don't appear to be preloaded through the loadup script, so I
> > have no idea how to catch them or whether it's even worth doing so.
>
> I dug into this a little deeper.  It seems that by adjusting the
> load-path one is able to load the natively-compiled variants instead
> of the byte-compiled for these features.  Oddly, this adjustment
> doesn't seem to be needed in non-Guix Emacs which may suggest the
> presence of a bug.  I'm hoping you have some insight that explains
> this difference in behaviour.
We adjust our load paths with environment variables. I don't think our
choice of putting Emacs itself last is wrong here.

Toggle quote (82 lines)
> After modifying the previous test-native-comp-p--preloaded.el (in
> hindsight, the preloaded part may be a misnomer) with the below patch
> I got all the 97 cases passing.
>
> #+begin_src diff
>   diff -u ./test-native-comp-p--preloaded.el ./test-native-comp-p--
> preloaded.el
>   --- ./test-native-comp-p--preloaded.el        2024-02-17
> 08:49:36.294930488 -0500
>   +++ ./test-native-comp-p--preloaded.el        2024-02-17
> 08:38:45.102839041 -0500
>   @@ -155,8 +155,50 @@
>            (x-dnd-init-frame)
>            (x-handle-no-bitmap-icon)))
>  
>   +(defun hack/tweak-load-path-in-guix ()
>   +  "Tweak `load-path' to allow natively compiled versions to be
> loaded.
>   +
>   +If we ensure that the `load-path' entries for `term/internal',
>   +`mule-util' and `ucs-normalize' exist and they occur before the
>   +share/emacs/<emacs-version>/lisp entry then we are able to load
>   +the natively compiled versions of these libraries.  Of those
>   +three, the entry for `term/internal' is missing whereas the
>   +others currently occur after the share/emacs/<emacs-version>/lisp
>   +entry.  We remedy that here.
>   +
>   +Notably, in non-Guix Emacs this isn't needed.  I.e., the fact
>   +that the share/emacs/<emacs-version>/lisp entry precedes the
>   +entries for `mule-util' and `ucs-normalize' is okay as is the
>   +fact that the entry for `term/internal' is missing."
>   +  (when (getenv "GUIX_ENVIRONMENT")
>   +    (require 'find-func)
>   +    ;; first we'll add the missing entry for `term/internal'
>   +    (add-to-list 'load-path
>   +                 (directory-file-name
>   +                  (file-name-directory
>   +                   (find-library-name (symbol-name
> 'term/internal))))
>   +                 ;; NOTE: we don't need to append; doing so simply
> to confirm that
>   +                 ;; it's only the relative position wrt the
>   +                 ;; share/emacs/<emacs-version>/lisp entry that
> matters.
>   +                 t)
>   +    ;; then we'll ensure that the entry for share/emacs/<emacs-
> version>/lisp is at
>   +    ;; the end
>   +    (let* ((sitelisppath (format "/share/emacs/%s/lisp"
>   +                                 emacs-version))
>   +           (pathsuffix (seq-filter
>   +                        #'(lambda (x)
>   +                            (string-suffix-p sitelisppath x))
>   +                        load-path))
>   +           (pathprefix (seq-filter
>   +                        #'(lambda (x)
>   +                            (not
>   +                             (string-suffix-p sitelisppath x)))
>   +                        load-path)))
>   +      (setq load-path (append pathprefix pathsuffix)))))
>   +
>    (defun report/compilation-status/run ()
>      "Run all cases and report those that aren't native-compiled."
>   +  (hack/tweak-load-path-in-guix)
>      (let* ((results (mapcar (lambda (args) (apply
> #'report/compilation-status args))
>                              report/compilation-
> status/cases/preloaded))
>             (failing (seq-filter (lambda (x) (not (eq (cdr x)
> 'native-compiled)))
>   @@ -169,5 +211,5 @@
>                (if failing
>                    (concat (format "  %s failing cases below:\n\n"
> numfailing)
>                            (pp-to-string failing))
>   -              " Success!"))))
>   +              " Success!\n"))))
>    ;; guix/hacking/reviews/emacs-aot/test-native-comp-p/preloaded
> ends here
>
>   Diff finished.  Sat Feb 17 08:50:04 2024
> #+end_src
This won't work for the common use case of running Emacs from the
store. Can you do some more research as to how this confusion comes to
be?

Cheers
S
S
Suhail wrote on 18 Feb 01:56 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87il2megkb.fsf@gmail.com
"Liliana Marie Prikler" <liliana.prikler@gmail.com> writes:

Toggle quote (2 lines)
> I don't think our choice of putting Emacs itself last is wrong here.

I'm not sure I understand. Just to be clear (please ignore in case this
was already clear), in non-Guix Emacs the situation is as follows:

1. The directory where 'mule-util and 'ucs-normalize are located
("/usr/share/emacs/29.2/lisp/international") occurs in the load-path.
And this entry occurs in the load-path AFTER
"/usr/share/emacs/29.2/lisp".

2. The directory where 'term/internal is located
("/usr/share/emacs/29.2/lisp/international") does NOT occur in the
load-path (and thus trivially doesn't occur before the
"share/emacs/29.2/lisp" entry).

After installing the v10 patch series, both 1 and 2 hold in Guix Emacs
as well. However, Guix Emacs's behaviour when locating/loading
natively-compiled versions of the above three features differs from the
behaviour in non-Guix Emacs. Specifically, 1 and 2 above seem to pose a
problem for only Guix Emacs and after remedying 1 and 2 above, as in the
test script, the tests pass.

All this to say, if by "putting Emacs itself last" you meant the change
I made to the test script to make the tests pass, then while it may not
be wrong, it also isn't correct either (seeing how it's not needed in
non-Guix Emacs). My goal in sharing the patch was not to suggest a fix,
but rather to possibly highlight something correlated with the cause of
the problem we're observing.

Toggle quote (2 lines)
> Can you do some more research as to how this confusion comes to be?

Since I have less familiarity with the internals of how Emacs locates
natively-compiled features and loads them, I'm not sure where to begin.
Do you have some concrete suggestions?

What (I believe) we know:

- Not all the .eln entries in the "preloaded" native-comp-eln-load-path
directory in Emacs are actually loaded by default. This doesn't
directly concern the issue, but it's to clarify that my use of the
term "preloaded" in this thread is regarding the former and not the
latter.

- The issue of
whether-natively-compiled-variants-are-loaded-or-not-depends-on-order-in-load-path
doesn't seem to affect packages that aren't built-in. Specifically,
if the load-entry for a not-built-in package is put after the
"share/emacs/29.2/lisp" entry, Guix Emacs is still able to load the
natively-compiled variant.

- It is unclear why other packages such 'log-edit, 'find-func
etc. (built-in, but not loaded by default, having their load-entry
after the "share/emacs/29.2/lisp" entry) aren't affected.

--
Suhail

This email is not an offer capable of acceptance, does not evidence an
intention to enter into an agreement, has no operative effect until a
definitive agreement is signed in writing by both parties, and that no
party should act in reliance on the email or any representations of the
sender until a definitive agreement is signed in writing by both
parties.
L
L
Liliana Marie Prikler wrote on 18 Feb 10:19 +0100
(name . Suhail)(address . suhail@bayesians.ca)
c07dc3d6c7bec323f8ea19561a7f08398f972a67.camel@gmail.com
Am Sonntag, dem 18.02.2024 um 00:56 +0000 schrieb Suhail:
Toggle quote (19 lines)
> "Liliana Marie Prikler" <liliana.prikler@gmail.com> writes:
>
> > I don't think our choice of putting Emacs itself last is wrong
> > here.
>
> I'm not sure I understand.  Just to be clear (please ignore in case
> this was already clear), in non-Guix Emacs the situation is as
> follows:
>
> 1. The directory where 'mule-util and 'ucs-normalize are located
>    ("/usr/share/emacs/29.2/lisp/international") occurs in the load-
> path.
>    And this entry occurs in the load-path AFTER
>    "/usr/share/emacs/29.2/lisp".
>
> 2. The directory where 'term/internal is located
>    ("/usr/share/emacs/29.2/lisp/international") does NOT occur in the
>    load-path (and thus trivially doesn't occur before the
>    "share/emacs/29.2/lisp" entry).
Directory (2) is the same as directory (1). I think you meant
$prefix/share/emacs/$emacs_version/lisp/term?

Toggle quote (6 lines)
> After installing the v10 patch series, both 1 and 2 hold in Guix
> Emacs as well.  However, Guix Emacs's behaviour when locating/loading
> natively-compiled versions of the above three features differs from
> the behaviour in non-Guix Emacs.  Specifically, 1 and 2 above seem to
> pose a problem for only Guix Emacs and after remedying 1 and 2 above,
> as in the test script, the tests pass.
From my understanding (1) poses a problem because it messes up the way
our patch computes relative file names. We could fix that with the
newly introduced NATIVE_COMP_BOGUS_DIRS… hopefully.

Toggle quote (4 lines)
> All this to say, if by "putting Emacs itself last" you meant the
> change I made to the test script to make the tests pass, then while
> it may not be wrong, it also isn't correct either (seeing how it's
> not needed in non-Guix Emacs).  
The last (first) directory in EMACSLOADPATH (EMACSNATIVELOADPATH) is
$prefix/share/emacs/$emacs_version/lisp ($prefix/lib/emacs/…) on Guix
System.

Toggle quote (18 lines)
> My goal in sharing the patch was not to suggest a fix, but rather to
> possibly highlight something correlated with the cause of the problem
> we're observing.
>
> > Can you do some more research as to how this confusion comes to be?
>
> Since I have less familiarity with the internals of how Emacs locates
> natively-compiled features and loads them, I'm not sure where to
> begin. Do you have some concrete suggestions?


> What (I believe) we know:
>
> - Not all the .eln entries in the "preloaded"
> native-comp-eln-load-path directory in Emacs are actually loaded by
> default.  This doesn't directly concern the issue, but it's to
> clarify that my use of the term "preloaded" in this thread is
> regarding the former and not the latter.
Well, it does concern the issue in that locating such files becomes
even harder. We need some place to put them and complicating these
things for preloaded packages (for no real reason, might I add) is not
fun.

Toggle quote (6 lines)
> - The issue of whether natively compiled variants are loaded or
> depending on load-path order doesn't seem to affect packages that
> aren't built-in.  Specifically, if the load-entry for a
> not-built-in package is put after the "share/emacs/29.2/lisp"
> entry, Guix Emacs is still able to load the natively-compiled
> variant.
Well, obviously not. Those are found under their packages and are
probably still within a flat directory hierarchy.

Toggle quote (3 lines)
> - It is unclear why other packages such 'log-edit, 'find-func
>   etc. (built-in, but not loaded by default, having their load-entry
>   after the "share/emacs/29.2/lisp" entry) aren't affected.
Update your script to account for them and we shall find out.

Cheers
S
S
Suhail wrote on 19 Feb 22:42 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87ttm4uo4h.fsf@gmail.com
"Liliana Marie Prikler" <liliana.prikler@gmail.com> writes:

Toggle quote (14 lines)
> Am Sonntag, dem 18.02.2024 um 00:56 +0000 schrieb Suhail:
>> 1. The directory where 'mule-util and 'ucs-normalize are located
>>    ("/usr/share/emacs/29.2/lisp/international") occurs in the load-
>> path.
>>    And this entry occurs in the load-path AFTER
>>    "/usr/share/emacs/29.2/lisp".
>>
>> 2. The directory where 'term/internal is located
>>    ("/usr/share/emacs/29.2/lisp/international") does NOT occur in the
>>    load-path (and thus trivially doesn't occur before the
>>    "share/emacs/29.2/lisp" entry).
> Directory (2) is the same as directory (1). I think you meant
> $prefix/share/emacs/$emacs_version/lisp/term?

I did; thank you for catching that.

Toggle quote (5 lines)
>> - It is unclear why other packages such 'log-edit, 'find-func
>>   etc. (built-in, but not loaded by default, having their load-entry
>>   after the "share/emacs/29.2/lisp" entry) aren't affected.
> Update your script to account for them and we shall find out.

See the updated test script below. The above are accounted for in the
third test case.

The result of invoking the test script using the following invocation:

#+begin_src sh :results replace
emacs -Q --batch \
-l path/to/test-native-comp-p.el \
-f ert-run-tests-batch-and-exit 2>&1
#+end_src

On non-Guix Emacs results in:

#+begin_example
Running 5 tests (2024-02-19 16:35:27-0500, selector ‘t’)
passed 1/5 01-natively-compiled-features-passing-as-of-v10 (0.000035 sec)
passed 2/5 02-natively-compiled-features-failing-as-of-v10 (0.000016 sec)
passed 3/5 03-some-features-in-later-load-path-entries-are-still-natively-compiled (0.000012 sec)
passed 4/5 04-load-path-order-should-not-determine-natively-compiled-status (0.000015 sec)
passed 5/5 05-there-exists-load-path-order-where-all-tests-pass (0.000010 sec)

Ran 5 tests, 5 results as expected, 0 unexpected (2024-02-19 16:35:27-0500, 0.000206 sec)
#+end_example

And with v10 patch series on Guix Emacs results in:

#+begin_example
Running 5 tests (2024-02-19 21:36:32+0000, selector `t')
passed 1/5 01-natively-compiled-features-passing-as-of-v10 (0.000066 sec)
failed 2/5 02-natively-compiled-features-failing-as-of-v10 (0.000034 sec)
passed 3/5 03-some-features-in-later-load-path-entries-are-still-natively-compiled (0.000013 sec)
failed 4/5 04-load-path-order-should-not-determine-natively-compiled-status (0.000034 sec)
passed 5/5 05-there-exists-load-path-order-where-all-tests-pass (0.000014 sec)

Ran 5 tests, 5 results as expected, 0 unexpected (2024-02-19 21:36:32+0000, 0.000322 sec)
2 expected failures
#+end_example

The test script (test-native-comp-p.el):

#+begin_src elisp :eval never
;;; Code:
(require 'ert)
(setq ert-quiet nil
ert-batch-print-level 10
ert-batch-print-length 10
ert-batch-backtrace-line-length t)

;;; utils/
(eval-and-compile
(require 'help-fns)
(defmacro utils/report-compilation-status (fun &optional feature)
"Report on the compilation status of function FUN.
Optionally load FEATURE before reporting on compilation status."
`(progn
(eval-when-compile
(when ',feature
(require ',feature)))
(let ((descstr (substring-no-properties
(with-output-to-string
(help-fns-function-description-header ',fun)))))
(cons ',fun
(cond
((string-search " native-compiled" descstr) 'native-compiled)
;; ((string-search " autoloaded" descstr) descstr)
((string-search " byte-compiled" descstr) 'byte-compiled)
(t descstr))))))

(defun utils/report-compilation-status/apply (fun &optional feature)
"Invoke `utils/report-compilation-status' with FUN and FEATURE."
(eval `(utils/report-compilation-status ,fun ,feature)))

(require 'find-func)
(defun utils/find-library-dir (feature)
"Output directory where FEATURE resides."
(directory-file-name
(file-name-directory
(find-library-name (symbol-name feature)))))

(defun utils/report-failing-cases (cases)
"From CASES, report failing tests.
Test failure are those where `utils/report-compilation-status' doesn't
report natively-compiled. CASES is a list where each element are
ARGUMENTS for `utils/report-compilation-status'."
(let ((results (mapcar (lambda (args)
(apply #'utils/report-compilation-status/apply args))
cases)))
(seq-filter (lambda (x) (not (eq (cdr x) 'native-compiled)))
results))))

;;; hack/
(eval-and-compile
(defun hack/new-load-path-that-can-make-v10-test-failures-pass ()
"Return a list that can be used as the `load-path'.

The returned list is assured to have the entry for
share/emacs/<emacs-version>/lisp occur after the entry for
lisp/international (corresponding to the `mule-util' and
`ucs-normalize' failing test cases) and the entry for lisp/term
(corresponding to the `term/internal' failing test case).

If the `load-path' is set to the returned value, all tests pass
in v10. Notably, in non-Guix Emacs this isn't needed. I.e., the
fact that the share/emacs/<emacs-version>/lisp entry precedes the
entries for `mule-util' and `ucs-normalize' is okay as is the
fact that the entry for `term/internal' is missing."
(eval-when-compile
(require 'find-func))
;; we'll ensure that the entry for share/emacs/<emacs-version>/lisp comes
;; after the lisp/international and lisp/term entries
(let* ((new-load-path load-path)
;; add the missing entry for `term/internal'
(_ (add-to-list 'new-load-path
(utils/find-library-dir 'term/internal)
;; NOTE: we don't need to append; doing so simply to confirm that
;; it's only the relative position wrt the
;; share/emacs/<emacs-version>/lisp entry that matters.
t))
(sitelisppath (format "/share/emacs/%s/lisp"
emacs-version))
(pathsuffix (seq-filter
(lambda (x)
(string-suffix-p sitelisppath x))
new-load-path))
(pathprefix (seq-filter
(lambda (x)
(not
(string-suffix-p sitelisppath x)))
new-load-path)))
(append pathprefix pathsuffix))))

;;; cases/
;; [[/usr/share/emacs/29.2/lisp]]
(eval-when-compile
(defvar cases/eln-in-preloaded-dir nil
"Functions that ought to be natively-compiled.")
(setq cases/eln-in-preloaded-dir
'((abbrev-mode)
(backquote-process)
(mode-line-widen)
(buffer-menu)
;; burmese
(button-mode)
(byte-run-strip-symbol-positions)
(case-table-get-table)
(cconv-convert)
;; cham
(use-default-char-width-table)
;; chinese
(cl-generic-p)
(cl-struct-define)
(x-setup-function-keys)
(encode-composition-rule)
;; cp51932
(custom-declare-face)
(minibuffer-prompt-properties--setter) ;; cus-start.el
(custom-add-choice)
;; cyrillic
;; czech
(debug-early)
(display-table-slot disp-table) ;; disp-table.eln exists
(dnd-open-file)
(dos-mode25 dos-fns) ;; dos-fns.eln exists
;; dos-vars
(find-file-text dos-w32) ;; dos-w32.eln exists
(dynamic-setting-handle-config-changed-event)
(easy-menu-item-present-p)
;; ediff-hook
(eldoc-mode)
(electric-indent-mode)
(elisp-mode-syntax-propertize)
;; english
(getenv)
(epa-file-find-file-hook)
;; ethiopic
;; eucjp-ms
;; european
(face-list)
(find-file-noselect)
(fill-region)
;; float-sup
(font-lock-change-mode)
(font-lock-add-keywords)
(fontset-plain-name)
(format-read)
(frame-edges)
(fringe-mode)
;; georgian
;; greek
;; haiku-win
;; hebrew
(help-quick)
(image-type)
(indent-region)
(indian-compose-regexp)
;; indonesian
(msdos-setup-keyboard term/internal) ;; internal.eln exists
(isearch-abort)
(iso-transl-set-language)
;; japanese
(jit-lock-mode)
(jka-compr-build-file-regexp)
(keymap-global-set)
;; khmer
;; korean
;; lao
(forward-sexp)
(lisp-string-in-doc-position-p)
(ls-lisp-set-options ls-lisp) ;; ls-lisp.eln exists
(macroexp-compiling-p)
(map-y-or-n-p)
(menu-find-file-existing)
(completion-boundaries)
(egyptian-shape-grouping)
(mouse-double-click-time)
(convert-define-charset-argument)
(coding-system-change-eol-conversion)
;; mule-conf.eln
(store-substring mule-util) ;; mule-util.eln exists
(mouse-wheel-change-button)
(advice-function-mapc)
(comment-string-strip)
;; (ns-handle-nxopen term/ns-win)
(obarray-make)
(oclosure-type)
(forward-page)
(sentence-end)
(show-paren-function)
;; (msdos-face-setup term/pc-win)
(pgtk-dnd-init-frame pgtk-dnd) ;; pgtk-dnd.eln exists
;; (pgtk-drag-n-drop term/pgtk-win)
;; philippine
(prog-context-menu)
(regexp-opt)
(get-register)
(query-replace-descr)
(rfn-eshadow-setup-minibuffer)
(read-multiple-choice)
;; romanian
(scroll-bar-scale)
(gui-select-text)
(seq-first)
(hack-read-symbol-shorthands)
(next-error-find-buffer)
;; sinhala
;; slovak
(exit-splash-screen)
(buffer-local-boundp)
(syntax-propertize-multiline)
(tab-bar-mode)
(tabulated-list-put-tag)
;; tai-viet
(text-mode)
;; thai
;; tibetan
(timer-activate)
(tool-bar-mode)
(tooltip-mode)
(tty-color-desc)
(ucs-normalize-hfs-nfd-comp-p ucs-normalize) ;; ucs-normalize.eln exists
(uniquify-item-p)
;; utf-8-lang.eln
(vc-mode)
(emacs-version)
;; vietnamese
;; (w32-shell-name)
;; w32-vars.eln
;; (w32-handle-dropped-file 'term/w32-win)
(define-widget)
(window-right)
(x-dnd-init-frame)
(x-handle-no-bitmap-icon))))

;;; ERT tests
(ert-deftest 01-natively-compiled-features-passing-as-of-v10 ()
"The 94 cases which pass for v10 patch series.
These cases are taken from .eln files that are located in the preloaded
directory for non-Guix Emacs."
(eval-when-compile
(let ((cases (seq-filter (lambda (x)
(not (memq (cadr x) '(mule-util term/internal ucs-normalize))))
cases/eln-in-preloaded-dir)))
(should-not (utils/report-failing-cases cases)))))

(ert-deftest 02-natively-compiled-features-failing-as-of-v10 ()
"The 3 cases which fail for v10 patch series on Guix Emacs.
These cases are taken from .eln files that are located in the preloaded
directory for non-Guix Emacs."
:expected-result (if (getenv "GUIX_ENVIRONMENT")
:failed
:passed)
(should-not
(eval-when-compile
(let ((cases (seq-filter (lambda (x)
(memq (cadr x) '(mule-util term/internal ucs-normalize)))
cases/eln-in-preloaded-dir)))
(utils/report-failing-cases cases)))))

(ert-deftest 03-some-features-in-later-load-path-entries-are-still-natively-compiled ()
"These cases pass as of v10 of the patch.
These cases share the fact that their directory entries occur in
the `load-path' after the $prefix/share/emacs/$emacs_version/lisp
entry. This is something these cases have in common with the
three cases that are known to fail, however, unlike them these
succeed (i.e., natively-compiled variants are loaded)."
(eval-when-compile
(let* ((cases '((cl-position cl-seq)
(find-library-name find-func)
(log-edit log-edit)))
(failing (utils/report-failing-cases cases))
(features-loadpath-entries (mapcar #'utils/find-library-dir
(mapcar #'cadr cases)))
(features-entry-pos (mapcar (lambda (x)
(cl-position
(utils/find-library-dir (cadr x))
load-path :test #'equal))
cases))
(share-emacs-lisp-entry-pos (cl-position "/share/emacs/29.2/lisp"
load-path
:test #'string-suffix-p)))
(should-not failing)
(should-not (seq-filter (lambda (x) (< x share-emacs-lisp-entry-pos))
features-entry-pos)))))

(ert-deftest 04-load-path-order-should-not-determine-natively-compiled-status ()
"This seems like an invariant that would be useful to have.
It is unclear if this is guaranteed by upstream Emacs, but
observations seem consistent with it."
:expected-result (if (getenv "GUIX_ENVIRONMENT")
:failed
:passed)
(eval-when-compile
(defvar original-load-path load-path))
(let ((failures-prior-to-load-path-shuffle
(eval-when-compile
(utils/report-failing-cases cases/eln-in-preloaded-dir)))
(failures-post-load-path-shuffle
(eval-when-compile
(progn
(setq load-path
(hack/new-load-path-that-can-make-v10-test-failures-pass))
(dolist (item cases/eln-in-preloaded-dir)
(when (cadr item)
(unload-feature (cadr item))))
(utils/report-failing-cases cases/eln-in-preloaded-dir)))))
(should (equal failures-prior-to-load-path-shuffle
failures-post-load-path-shuffle))))

(ert-deftest 05-there-exists-load-path-order-where-all-tests-pass ()
"Proof witness that the v10 failing cases relate to load-path ordering."
(should-not (eval-when-compile
(when (and (boundp 'original-load-path) original-load-path)
(setq load-path original-load-path)
(dolist (item cases/eln-in-preloaded-dir)
(when (cadr item)
(unload-feature (cadr item)))))
(defvar original-load-path load-path)
(setq load-path
(hack/new-load-path-that-can-make-v10-test-failures-pass))
(utils/report-failing-cases cases/eln-in-preloaded-dir))))

;;; test-native-comp-p.el ends here
#+end_src

--
Suhail
L
L
Liliana Marie Prikler wrote on 20 Feb 18:51 +0100
(name . Suhail)(address . suhail@bayesians.ca)
76a4267be5c73908490e5d70bf22d109aca395cb.camel@gmail.com
Am Montag, dem 19.02.2024 um 21:42 +0000 schrieb Suhail:
Toggle quote (28 lines)
> "Liliana Marie Prikler" <liliana.prikler@gmail.com> writes:
>
> > Am Sonntag, dem 18.02.2024 um 00:56 +0000 schrieb Suhail:
> > > 1. The directory where 'mule-util and 'ucs-normalize are located
> > >    ("/usr/share/emacs/29.2/lisp/international") occurs in the
> > > load-
> > > path.
> > >    And this entry occurs in the load-path AFTER
> > >    "/usr/share/emacs/29.2/lisp".
> > >
> > > 2. The directory where 'term/internal is located
> > >    ("/usr/share/emacs/29.2/lisp/international") does NOT occur in
> > > the
> > >    load-path (and thus trivially doesn't occur before the
> > >    "share/emacs/29.2/lisp" entry).
> > Directory (2) is the same as directory (1).  I think you meant
> > $prefix/share/emacs/$emacs_version/lisp/term?
>
> I did; thank you for catching that.
>
> > > - It is unclear why other packages such 'log-edit, 'find-func
> > >   etc. (built-in, but not loaded by default, having their load-
> > > entry
> > >   after the "share/emacs/29.2/lisp" entry) aren't affected.
> > Update your script to account for them and we shall find out.
>
> See the updated test script below.  The above are accounted for in
> the third test case.
We still only have 97 tests squashed to 5 cases IIUC. There's some
1000 files in the native-lisp directory. What I was actually hoping
for is more or less one test per feature.

Toggle quote (315 lines)
> The result of invoking the test script using the following
> invocation:
>
> #+begin_src sh :results replace
>   emacs -Q --batch \
>         -l path/to/test-native-comp-p.el \
>         -f ert-run-tests-batch-and-exit 2>&1
> #+end_src
>
> On non-Guix Emacs results in:
>
> #+begin_example
>   Running 5 tests (2024-02-19 16:35:27-0500, selector ‘t’)
>      passed  1/5  01-natively-compiled-features-passing-as-of-v10
> (0.000035 sec)
>      passed  2/5  02-natively-compiled-features-failing-as-of-v10
> (0.000016 sec)
>      passed  3/5  03-some-features-in-later-load-path-entries-are-
> still-natively-compiled (0.000012 sec)
>      passed  4/5  04-load-path-order-should-not-determine-natively-
> compiled-status (0.000015 sec)
>      passed  5/5  05-there-exists-load-path-order-where-all-tests-
> pass (0.000010 sec)
>
>   Ran 5 tests, 5 results as expected, 0 unexpected (2024-02-19
> 16:35:27-0500, 0.000206 sec)
> #+end_example
>
> And with v10 patch series on Guix Emacs results in:
>
> #+begin_example
>   Running 5 tests (2024-02-19 21:36:32+0000, selector `t')
>      passed  1/5  01-natively-compiled-features-passing-as-of-v10
> (0.000066 sec)
>      failed  2/5  02-natively-compiled-features-failing-as-of-v10
> (0.000034 sec)
>      passed  3/5  03-some-features-in-later-load-path-entries-are-
> still-natively-compiled (0.000013 sec)
>      failed  4/5  04-load-path-order-should-not-determine-natively-
> compiled-status (0.000034 sec)
>      passed  5/5  05-there-exists-load-path-order-where-all-tests-
> pass (0.000014 sec)
>
>   Ran 5 tests, 5 results as expected, 0 unexpected (2024-02-19
> 21:36:32+0000, 0.000322 sec)
>   2 expected failures
> #+end_example
>
> The test script (test-native-comp-p.el):
>
> #+begin_src elisp :eval never
>   ;;; Code:
>   (require 'ert)
>   (setq ert-quiet nil
>         ert-batch-print-level 10
>         ert-batch-print-length 10
>         ert-batch-backtrace-line-length t)
>
>   ;;; utils/
>   (eval-and-compile
>     (require 'help-fns)
>     (defmacro utils/report-compilation-status (fun &optional feature)
>       "Report on the compilation status of function FUN.
>   Optionally load FEATURE before reporting on compilation status."
>       `(progn
>          (eval-when-compile
>            (when ',feature
>              (require ',feature)))
>          (let ((descstr (substring-no-properties
>                          (with-output-to-string
>                            (help-fns-function-description-header
> ',fun)))))
>            (cons ',fun
>                  (cond
>                   ((string-search " native-compiled" descstr)
> 'native-compiled)
>                   ;; ((string-search " autoloaded" descstr) descstr)
>                   ((string-search " byte-compiled" descstr) 'byte-
> compiled)
>                   (t descstr))))))
>
>     (defun utils/report-compilation-status/apply (fun &optional
> feature)
>       "Invoke `utils/report-compilation-status' with FUN and
> FEATURE."
>       (eval `(utils/report-compilation-status ,fun ,feature)))
>
>     (require 'find-func)
>     (defun utils/find-library-dir (feature)
>       "Output directory where FEATURE resides."
>       (directory-file-name
>        (file-name-directory
>         (find-library-name (symbol-name feature)))))
>
>     (defun utils/report-failing-cases (cases)
>       "From CASES, report failing tests.
>   Test failure are those where `utils/report-compilation-status'
> doesn't
>   report natively-compiled.  CASES is a list where each element are
>   ARGUMENTS for `utils/report-compilation-status'."
>       (let ((results (mapcar (lambda (args)
>                                (apply #'utils/report-compilation-
> status/apply args))
>                              cases)))
>         (seq-filter (lambda (x) (not (eq (cdr x) 'native-compiled)))
>                     results))))
>
>   ;;; hack/
>   (eval-and-compile
>     (defun hack/new-load-path-that-can-make-v10-test-failures-pass ()
>       "Return a list that can be used as the `load-path'.
>
>   The returned list is assured to have the entry for
>   share/emacs/<emacs-version>/lisp occur after the entry for
>   lisp/international (corresponding to the `mule-util' and
>   `ucs-normalize' failing test cases) and the entry for lisp/term
>    (corresponding to the `term/internal' failing test case).
>
>   If the `load-path' is set to the returned value, all tests pass
>   in v10.  Notably, in non-Guix Emacs this isn't needed.  I.e., the
>   fact that the share/emacs/<emacs-version>/lisp entry precedes the
>   entries for `mule-util' and `ucs-normalize' is okay as is the
>   fact that the entry for `term/internal' is missing."
>       (eval-when-compile
>         (require 'find-func))
>       ;; we'll ensure that the entry for share/emacs/<emacs-
> version>/lisp comes
>       ;; after the lisp/international and lisp/term entries
>       (let* ((new-load-path load-path)
>              ;; add the missing entry for `term/internal'
>              (_ (add-to-list 'new-load-path
>                              (utils/find-library-dir 'term/internal)
>                              ;; NOTE: we don't need to append; doing
> so simply to confirm that
>                              ;; it's only the relative position wrt
> the
>                              ;; share/emacs/<emacs-version>/lisp
> entry that matters.
>                              t))
>              (sitelisppath (format "/share/emacs/%s/lisp"
>                                    emacs-version))
>              (pathsuffix (seq-filter
>                           (lambda (x)
>                             (string-suffix-p sitelisppath x))
>                           new-load-path))
>              (pathprefix (seq-filter
>                           (lambda (x)
>                             (not
>                              (string-suffix-p sitelisppath x)))
>                           new-load-path)))
>         (append pathprefix pathsuffix))))
>
>   ;;; cases/
>   ;; [[/usr/share/emacs/29.2/lisp]]
>   (eval-when-compile
>     (defvar cases/eln-in-preloaded-dir nil
>       "Functions that ought to be natively-compiled.")
>     (setq cases/eln-in-preloaded-dir
>           '((abbrev-mode)
>             (backquote-process)
>             (mode-line-widen)
>             (buffer-menu)
>             ;; burmese
>             (button-mode)
>             (byte-run-strip-symbol-positions)
>             (case-table-get-table)
>             (cconv-convert)
>             ;; cham
>             (use-default-char-width-table)
>             ;; chinese
>             (cl-generic-p)
>             (cl-struct-define)
>             (x-setup-function-keys)
>             (encode-composition-rule)
>             ;; cp51932
>             (custom-declare-face)
>             (minibuffer-prompt-properties--setter) ;; cus-start.el
>             (custom-add-choice)
>             ;; cyrillic
>             ;; czech
>             (debug-early)
>             (display-table-slot disp-table) ;; disp-table.eln exists
>             (dnd-open-file)
>             (dos-mode25 dos-fns)    ;; dos-fns.eln exists
>             ;; dos-vars
>             (find-file-text dos-w32) ;; dos-w32.eln exists
>             (dynamic-setting-handle-config-changed-event)
>             (easy-menu-item-present-p)
>             ;; ediff-hook
>             (eldoc-mode)
>             (electric-indent-mode)
>             (elisp-mode-syntax-propertize)
>             ;; english
>             (getenv)
>             (epa-file-find-file-hook)
>             ;; ethiopic
>             ;; eucjp-ms
>             ;; european
>             (face-list)
>             (find-file-noselect)
>             (fill-region)
>             ;; float-sup
>             (font-lock-change-mode)
>             (font-lock-add-keywords)
>             (fontset-plain-name)
>             (format-read)
>             (frame-edges)
>             (fringe-mode)
>             ;; georgian
>             ;; greek
>             ;; haiku-win
>             ;; hebrew
>             (help-quick)
>             (image-type)
>             (indent-region)
>             (indian-compose-regexp)
>             ;; indonesian
>             (msdos-setup-keyboard term/internal) ;; internal.eln
> exists
>             (isearch-abort)
>             (iso-transl-set-language)
>             ;; japanese
>             (jit-lock-mode)
>             (jka-compr-build-file-regexp)
>             (keymap-global-set)
>             ;; khmer
>             ;; korean
>             ;; lao
>             (forward-sexp)
>             (lisp-string-in-doc-position-p)
>             (ls-lisp-set-options ls-lisp) ;; ls-lisp.eln exists
>             (macroexp-compiling-p)
>             (map-y-or-n-p)
>             (menu-find-file-existing)
>             (completion-boundaries)
>             (egyptian-shape-grouping)
>             (mouse-double-click-time)
>             (convert-define-charset-argument)
>             (coding-system-change-eol-conversion)
>             ;; mule-conf.eln
>             (store-substring mule-util) ;; mule-util.eln exists
>             (mouse-wheel-change-button)
>             (advice-function-mapc)
>             (comment-string-strip)
>             ;; (ns-handle-nxopen term/ns-win)
>             (obarray-make)
>             (oclosure-type)
>             (forward-page)
>             (sentence-end)
>             (show-paren-function)
>             ;; (msdos-face-setup term/pc-win)
>             (pgtk-dnd-init-frame pgtk-dnd) ;; pgtk-dnd.eln exists
>             ;; (pgtk-drag-n-drop term/pgtk-win)
>             ;; philippine
>             (prog-context-menu)
>             (regexp-opt)
>             (get-register)
>             (query-replace-descr)
>             (rfn-eshadow-setup-minibuffer)
>             (read-multiple-choice)
>             ;; romanian
>             (scroll-bar-scale)
>             (gui-select-text)
>             (seq-first)
>             (hack-read-symbol-shorthands)
>             (next-error-find-buffer)
>             ;; sinhala
>             ;; slovak
>             (exit-splash-screen)
>             (buffer-local-boundp)
>             (syntax-propertize-multiline)
>             (tab-bar-mode)
>             (tabulated-list-put-tag)
>             ;; tai-viet
>             (text-mode)
>             ;; thai
>             ;; tibetan
>             (timer-activate)
>             (tool-bar-mode)
>             (tooltip-mode)
>             (tty-color-desc)
>             (ucs-normalize-hfs-nfd-comp-p ucs-normalize) ;; ucs-
> normalize.eln exists
>             (uniquify-item-p)
>             ;; utf-8-lang.eln
>             (vc-mode)
>             (emacs-version)
>             ;; vietnamese
>             ;; (w32-shell-name)
>             ;; w32-vars.eln
>             ;; (w32-handle-dropped-file 'term/w32-win)
>             (define-widget)
>             (window-right)
>             (x-dnd-init-frame)
>             (x-handle-no-bitmap-icon))))
>
>   ;;; ERT tests
>   (ert-deftest 01-natively-compiled-features-passing-as-of-v10 ()
>     "The 94 cases which pass for v10 patch series.
>   These cases are taken from .eln files that are located in the
> preloaded
>   directory for non-Guix Emacs."
>     (eval-when-compile
>       (let ((cases (seq-filter (lambda (x)
>                                  (not (memq (cadr x) '(mule-util
> term/internal ucs-normalize))))
>                                cases/eln-in-preloaded-dir)))
>         (should-not (utils/report-failing-cases cases)))))
>
>   (ert-deftest 02-natively-compiled-features-failing-as-of-v10 ()
>     "The 3 cases which fail for v10 patch series on Guix Emacs.
>   These cases are taken from .eln files that are located in the
> preloaded
>   directory for non-Guix Emacs."
>     :expected-result (if (getenv "GUIX_ENVIRONMENT")
That is not a good way of checking whether it's Guix' emacs or not. I
propose doing a per-file deftest instead.
Toggle quote (91 lines)
>                          :failed
>                        :passed)
>     (should-not
>      (eval-when-compile
>        (let ((cases (seq-filter (lambda (x)
>                                   (memq (cadr x) '(mule-util
> term/internal ucs-normalize)))
>                                 cases/eln-in-preloaded-dir)))
>          (utils/report-failing-cases cases)))))
>
>   (ert-deftest 03-some-features-in-later-load-path-entries-are-still-
> natively-compiled ()
>     "These cases pass as of v10 of the patch.
>   These cases share the fact that their directory entries occur in
>   the `load-path' after the $prefix/share/emacs/$emacs_version/lisp
>   entry.  This is something these cases have in common with the
>   three cases that are known to fail, however, unlike them these
>   succeed (i.e., natively-compiled variants are loaded)."
>     (eval-when-compile
>       (let* ((cases '((cl-position cl-seq)
>                       (find-library-name find-func)
>                       (log-edit log-edit)))
>              (failing (utils/report-failing-cases cases))
>              (features-loadpath-entries (mapcar #'utils/find-library-
> dir
>                                                 (mapcar #'cadr
> cases)))
>              (features-entry-pos (mapcar (lambda (x)
>                                            (cl-position
>                                             (utils/find-library-dir
> (cadr x))
>                                             load-path :test #'equal))
>                                          cases))
>              (share-emacs-lisp-entry-pos (cl-position
> "/share/emacs/29.2/lisp"
>                                                       load-path
>                                                       :test #'string-
> suffix-p)))
>         (should-not failing)
>         (should-not (seq-filter (lambda (x) (< x share-emacs-lisp-
> entry-pos))
>                                 features-entry-pos)))))
>
>   (ert-deftest 04-load-path-order-should-not-determine-natively-
> compiled-status ()
>     "This seems like an invariant that would be useful to have.
>   It is unclear if this is guaranteed by upstream Emacs, but
>   observations seem consistent with it."
>     :expected-result (if (getenv "GUIX_ENVIRONMENT")
>                          :failed
>                        :passed)
>     (eval-when-compile
>       (defvar original-load-path load-path))
>     (let ((failures-prior-to-load-path-shuffle
>            (eval-when-compile
>              (utils/report-failing-cases cases/eln-in-preloaded-
> dir)))
>           (failures-post-load-path-shuffle
>            (eval-when-compile
>              (progn
>                (setq load-path
>                      (hack/new-load-path-that-can-make-v10-test-
> failures-pass))
>                (dolist (item cases/eln-in-preloaded-dir)
>                  (when (cadr item)
>                    (unload-feature (cadr item))))
>                (utils/report-failing-cases cases/eln-in-preloaded-
> dir)))))
>       (should (equal failures-prior-to-load-path-shuffle
>                      failures-post-load-path-shuffle))))
>
>   (ert-deftest 05-there-exists-load-path-order-where-all-tests-pass
> ()
>     "Proof witness that the v10 failing cases relate to load-path
> ordering."
>     (should-not (eval-when-compile
>                   (when (and (boundp 'original-load-path) original-
> load-path)
>                     (setq load-path original-load-path)
>                     (dolist (item cases/eln-in-preloaded-dir)
>                       (when (cadr item)
>                         (unload-feature (cadr item)))))
>                   (defvar original-load-path load-path)
>                   (setq load-path
>                         (hack/new-load-path-that-can-make-v10-test-
> failures-pass))
>                   (utils/report-failing-cases cases/eln-in-preloaded-
> dir))))
>
>   ;;; test-native-comp-p.el ends here
> #+end_src
Could you do a MIME attachment next time? I think I know the heart of
the issue now, but I still need to code up a solution.

Cheers
S
S
Suhail wrote on 20 Feb 19:41 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
878r3f3rme.fsf@bayesians.ca
"Liliana Marie Prikler" <liliana.prikler@gmail.com> writes:

Toggle quote (2 lines)
> We still only have 97 tests squashed to 5 cases IIUC.

Yes.

Toggle quote (3 lines)
> There's some 1000 files in the native-lisp directory. What I was
> actually hoping for is more or less one test per feature.

Yes, I agree that that would be useful, but doing so was (is) more than
what I was (am) able to do in the time I was (am) able to commit (at
present).

I believe it would be valuable to have such an exhaustive test included
as part of the patch submission to prevent future regressions.

Toggle quote (2 lines)
> That is not a good way of checking whether it's Guix' emacs or not.

What would be a better way? Matching against the --prefix value in the
output of emacs-build-description function?

Toggle quote (2 lines)
> I propose doing a per-file deftest instead.

I don't understand the connection between a per-file deftest and the
manner in which guix-emacs-or-not is tested, but otherwise agree on the
utility of per-feature deftests.

Toggle quote (2 lines)
> Could you do a MIME attachment next time?

Sure. For now, for what it's worth and in case it helps, please see
attached a copy of the same file as before.


--
Suhail
L
L
Liliana Marie Prikler wrote on 24 Feb 07:18 +0100
[PATCH emacs-team v11 3/7] gnu: emacs: Check integrity of native-compiled files.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
35fc3027f372eddbd21a2c6b5a591453591a6825.1708761863.git.liliana.prikler@gmail.com
In the previous commit, we've added a patch that potentially messes with
how built-in (especially preloaded) Lisp libraries are loaded. Thus, we
might want to assert that these files still load fine, as reported when
querying the builtin documentation of functions provided by them.

* gnu/packages/aux-files/emacs/comp-integrity.el: New file.
* gnu/Makefile.am (dist_noinst_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘validate-comp-integrity’.
---
Makefile.am | 1 +
.../aux-files/emacs/comp-integrity.el | 126 ++++++++++++++++++
gnu/packages/emacs.scm | 13 +-
3 files changed, 139 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el

Toggle diff (170 lines)
diff --git a/Makefile.am b/Makefile.am
index d3b9532c7a..6837c4c87c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -421,6 +421,7 @@ dist_noinst_DATA = \
# Auxiliary files for packages.
AUX_FILES = \
gnu/packages/aux-files/chromium/master-preferences.json \
+ gnu/packages/aux-files/emacs/comp-integrity.el \
gnu/packages/aux-files/emacs/guix-emacs.el \
gnu/packages/aux-files/findclass.php \
gnu/packages/aux-files/guix.vim \
diff --git a/gnu/packages/aux-files/emacs/comp-integrity.el b/gnu/packages/aux-files/emacs/comp-integrity.el
new file mode 100644
index 0000000000..ed6a348fed
--- /dev/null
+++ b/gnu/packages/aux-files/emacs/comp-integrity.el
@@ -0,0 +1,126 @@
+(require 'ert)
+
+(eval-when-compile
+ (require 'help-fns)
+
+ (defmacro expect-help (fun result &optional feature)
+ `(progn
+ (eval-when-compile (when ',feature
+ (require ',feature)))
+
+ (ert-deftest ,(intern (concat "expect-" (symbol-name fun)
+ "-" (symbol-name result)))
+ ()
+ (should
+ (eq ',result
+ (let ((desc (substring-no-properties
+ (with-output-to-string
+ (help-fns-function-description-header ',fun)))))
+ (cond ((string-search "native-compiled" desc) 'native)
+ ((string-search "byte-compiled" desc) 'byte)
+ ((string-search "built-in" desc) 'built-in)
+ (t nil))))))))
+
+ (defmacro expect-native (fun &optional feature)
+ `(progn (expect-help ,fun native ,feature)))
+
+ (defmacro expect-builtin (fun &optional feature)
+ `(progn (expect-help ,fun built-in ,feature))))
+
+(expect-native abbrev-mode)
+(expect-native backquote-process)
+(expect-native mode-line-widen)
+(expect-native buffer-menu)
+(expect-native button-mode)
+(expect-native byte-run-strip-symbol-positions)
+(expect-native case-table-get-table)
+(expect-native cconv-convert)
+(expect-native use-default-char-width-table)
+(expect-native cl-generic-p)
+(expect-native cl-struct-define)
+(expect-native x-setup-function-keys)
+(expect-native encode-composition-rule)
+(expect-native custom-declare-face)
+(expect-native minibuffer-prompt-properties--setter)
+(expect-native custom-add-choice)
+(expect-native debug-early)
+(expect-native display-table-slot disp-table)
+(expect-native dnd-open-file)
+(expect-native dos-mode25 dos-fns)
+(expect-native find-file-text dos-w32)
+(expect-native dynamic-setting-handle-config-changed-event)
+(expect-native easy-menu-item-present-p)
+(expect-native eldoc-mode)
+(expect-native electric-indent-mode)
+(expect-native elisp-mode-syntax-propertize)
+(expect-native getenv)
+(expect-native epa-file-find-file-hook)
+(expect-native face-list)
+(expect-native find-file-noselect)
+(expect-native fill-region)
+(expect-native font-lock-change-mode)
+(expect-native font-lock-add-keywords)
+(expect-native fontset-plain-name)
+(expect-native format-read)
+(expect-native frame-edges)
+(expect-native fringe-mode)
+(expect-native help-quick)
+(expect-native image-type)
+(expect-native indent-region)
+(expect-native indian-compose-regexp)
+(expect-native msdos-setup-keyboard term/internal)
+(expect-native isearch-abort)
+(expect-native iso-transl-set-language)
+(expect-native jit-lock-mode)
+(expect-native jka-compr-build-file-regexp)
+(expect-native keymap-global-set)
+(expect-native forward-sexp)
+(expect-native lisp-string-in-doc-position-p)
+(expect-native ls-lisp-set-options ls-lisp)
+(expect-native macroexp-compiling-p)
+(expect-native map-y-or-n-p)
+(expect-native menu-find-file-existing)
+(expect-native completion-boundaries)
+(expect-native egyptian-shape-grouping)
+(expect-native mouse-double-click-time)
+(expect-native convert-define-charset-argument)
+(expect-native coding-system-change-eol-conversion)
+(expect-native store-substring mule-util)
+(expect-native mouse-wheel-change-button)
+(expect-native advice-function-mapc)
+(expect-native comment-string-strip)
+(expect-native obarray-make)
+(expect-native oclosure-type)
+(expect-native forward-page)
+(expect-native sentence-end)
+(expect-native show-paren-function)
+(expect-native pgtk-dnd-init-frame pgtk-dnd)
+(expect-native prog-context-menu)
+(expect-native regexp-opt)
+(expect-native get-register)
+(expect-native query-replace-descr)
+(expect-native rfn-eshadow-setup-minibuffer)
+(expect-native read-multiple-choice)
+(expect-native scroll-bar-scale)
+(expect-native gui-select-text)
+(expect-native seq-first)
+(expect-native hack-read-symbol-shorthands)
+(expect-native next-error-find-buffer)
+(expect-native exit-splash-screen)
+(expect-native buffer-local-boundp)
+(expect-native syntax-propertize-multiline)
+(expect-native tab-bar-mode)
+(expect-native tabulated-list-put-tag)
+(expect-native text-mode)
+(expect-native timer-activate)
+(expect-native tool-bar-mode)
+(expect-native tooltip-mode)
+(expect-native tty-color-desc)
+(expect-native ucs-normalize-hfs-nfd-comp-p ucs-normalize)
+(expect-native uniquify-item-p)
+(expect-native vc-mode)
+(expect-native emacs-version)
+(expect-native define-widget)
+(expect-native window-right)
+(expect-native x-dnd-init-frame)
+(expect-native x-handle-no-bitmap-icon)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 182de0204d..f0200ad27c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -380,7 +380,18 @@ (define-public emacs-no-x
"-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
(add-after 'build 'build-trampolines
(lambda* (#:key make-flags #:allow-other-keys)
- (apply invoke "make" "trampolines" make-flags)))))))
+ (apply invoke "make" "trampolines" make-flags)))
+ (add-after 'validate-runpath 'validate-comp-integrity
+ (lambda* (#:key outputs #:allow-other-keys)
+ (if #$(%current-target-system)
+ (display "Cannot validate native-comp on cross builds.\n")
+ (invoke
+ (string-append (assoc-ref outputs "out") "/bin/emacs")
+ "--batch"
+ "--load"
+ #$(local-file
+ (search-auxiliary-file "emacs/comp-integrity.el"))
+ "-f" "ert-run-tests-batch-and-exit"))))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v11 7/7] gnu: emacs-magit: Fix native builds.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
9160cccd767cdfa55f7a460750c6b0f7544c12eb.1708761863.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-magit)[#:phases]: Also wrap ‘build’ in
a directory excursion.

Change-Id: I332325989a1bbaa95552c2cbf50f336f0075c1c4
---
gnu/packages/emacs-xyz.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e2aebe971e..a0ac8f5a57 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1590,7 +1590,11 @@ (define-public emacs-magit
(replace 'install
(lambda args
(with-directory-excursion "lisp"
- (apply (assoc-ref %standard-phases 'install) args)))))))
+ (apply (assoc-ref %standard-phases 'install) args))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args)))))))
(native-inputs
(list texinfo))
(inputs
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v11 6/7] gnu: emacs-org: Fix native builds.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
6c43744210652d4031a4ca0dd5b6630b6adc40e1.1708761863.git.liliana.prikler@gmail.com
* gnu/packages/emacs-xyz.scm (emacs-org)[#:phases]: Wrap ‘build’ in a
directory excursion to the actual lisp directory.

Change-Id: Ifa10f9e91fe21cd4c34da11b68ddb77a03d847ca
---
gnu/packages/emacs-xyz.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fc3c9e00be..e2aebe971e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -16752,6 +16752,10 @@ (define-public emacs-org
(substitute* "testing/lisp/test-org.el"
(("test-org/org-(encode-time|time-string-to-time) .*" all)
(string-append all " (skip-unless nil)\n")))))
+ (replace 'build
+ (lambda args
+ (with-directory-excursion "lisp"
+ (apply (assoc-ref %standard-phases 'build) args))))
(replace 'install
(lambda _
(let ((elpa (elpa-directory #$output))
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v11 2/7] gnu: emacs: Don't hash file names in native compilation.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
e2b04973fdcf835d6e6bb9dab1375d7653108f76.1708761863.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[source]: Use it here.

Change-Id: I2b7f6b45742a985760f0097bb53910f068e3d8e5
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 1 +
.../emacs-native-comp-fix-filenames.patch | 338 ++++++++++++++++++
3 files changed, 340 insertions(+)
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch

Toggle diff (370 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 3d1afd4555..7e6a0c5006 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1121,6 +1121,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-kv-fix-tests.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \
%D%/packages/patches/emacs-next-exec-path.patch \
%D%/packages/patches/emacs-next-native-comp-driver-options.patch \
%D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e4119ec21d..182de0204d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -111,6 +111,7 @@ (define-public emacs-minimal
(patches (search-patches "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
+ "emacs-native-comp-fix-filenames.patch"
"emacs-pgtk-super-key-fix.patch"))
(modules '((guix build utils)))
(snippet
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..169323f290
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,338 @@
+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-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -4396,26 +4396,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);
+
+@@ -4423,64 +4414,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 (file_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 = CALL2I (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,
+@@ -4494,13 +4476,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;
+@@ -4548,10 +4524,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 (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
++ && !NILP (Fmember (CALL1I (file-name-sans-extension, source_filename),
++ Fmapcar (intern_c_string ("file-name-sans-extension"),
+ CALL1I (split-string, lisp_preloaded))))))
+ base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+@@ -5863,10 +5840,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-29.2/lisp/startup.el
+===================================================================
+--- emacs-29.2.orig/lisp/startup.el
++++ emacs-29.2/lisp/startup.el
+@@ -545,9 +545,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.
+@@ -558,22 +555,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 normal-top-level ()
+ "Emacs calls this function when it first starts up.
+ It sets `command-line-processed', processes the command-line,
+@@ -1362,12 +1347,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
+@@ -1502,12 +1481,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-29.2/lisp/loadup.el
+===================================================================
+--- emacs-29.2.orig/lisp/loadup.el
++++ emacs-29.2/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.
+@@ -494,22 +502,20 @@ lost after dumping")))
+ (concat eln-dest-dir "native-lisp/" comp-native-version-dir "/"))
+ (maphash (lambda (_ 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)
+- bin-dest-dir)
++ (file-relative-name
++ (expand-file-name
++ (save-match-data
++ (string-match native-lisp-needle file)
++ (substring file (match-end 0)))
++ eln-dest-dir)
++ bin-dest-dir)
+ ;; Relative filename from the built uninstalled binary.
+ (file-relative-name file invocation-directory)))))
+ comp-loaded-comp-units-h)))
+@@ -557,7 +563,9 @@ lost after dumping")))
+ (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-29.2/src/Makefile.in
+===================================================================
+--- emacs-29.2.orig/src/Makefile.in
++++ emacs-29.2/src/Makefile.in
+@@ -553,6 +553,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.
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v11 1/7] gnu: emacs: Build trampolines.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
833ccf20a947e44b0eac3cefdaa185f0eb05b027.1708761863.git.liliana.prikler@gmail.com
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘build-trampolines’.

Change-Id: I33303bcbaf6cbda15867a5546e793c05d1f0e67b
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5f27c551e0..e4119ec21d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -376,7 +376,10 @@ (define-public emacs-no-x
(string-append
"-B" #$(this-package-input "libgccjit") "/lib/")
(string-append
- "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))))))
+ "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
+ (add-after 'build 'build-trampolines
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "trampolines" make-flags)))))))
(inputs
(modify-inputs (package-inputs emacs-minimal)
(prepend gnutls
--
2.41.0
L
L
Liliana Marie Prikler wrote on 24 Feb 09:04 +0100
[PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio!
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
cover.1708761863.git.liliana.prikler@gmail.com
After a week of debugging the internals of how Emacs compiles, loads,
and dumps (!) its .eln-files, I finally came up with the perfectly
cursed mix that enables us to actually load *and* graft our natively
compiled packages with ease.

In unrelated news, I feel like I should wear a witch hat for faster
development cycles.

Liliana Marie Prikler (7):
gnu: emacs: Build trampolines.
gnu: emacs: Don't hash file names in native compilation.
gnu: emacs: Check integrity of native-compiled files.
gnu: emacs: Disable jit compilation.
build-system: emacs: Compute relative file names.
gnu: emacs-org: Fix native builds.
gnu: emacs-magit: Fix native builds.

Makefile.am | 1 +
gnu/local.mk | 2 +
.../aux-files/emacs/comp-integrity.el | 126 +++++++
gnu/packages/emacs-xyz.scm | 10 +-
gnu/packages/emacs.scm | 20 +-
.../emacs-disable-jit-compilation.patch | 19 +
.../emacs-native-comp-fix-filenames.patch | 338 ++++++++++++++++++
guix/build/emacs-utils.scm | 4 +-
8 files changed, 516 insertions(+), 4 deletions(-)
create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch
create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch


base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v11 4/7] gnu: emacs: Disable jit compilation.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
3621493e4cc9f83253d7f191b783fd11212c7045.1708761863.git.liliana.prikler@gmail.com
* gnu/packages/patches/emacs-disable-jit-compilation.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-minimal)[patches]: Use it here.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 3 ++-
.../emacs-disable-jit-compilation.patch | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch

Toggle diff (53 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7e6a0c5006..9121f13b39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1112,6 +1112,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
+ %D%/packages/patches/emacs-disable-jit-compilation.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-git-email-missing-parens.patch \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index f0200ad27c..e6f2b699ac 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -108,7 +108,8 @@ (define-public emacs-minimal
(sha256
(base32
"1p3h4sz8da8vhix5140g2qkdy8mz11d7mmvsym5vy847k1428gbx"))
- (patches (search-patches "emacs-exec-path.patch"
+ (patches (search-patches "emacs-disable-jit-compilation.patch"
+ "emacs-exec-path.patch"
"emacs-fix-scheme-indent-function.patch"
"emacs-native-comp-driver-options.patch"
"emacs-native-comp-fix-filenames.patch"
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-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
++frm 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");
--
2.41.0
L
L
Liliana Marie Prikler wrote on 13 Feb 19:30 +0100
[PATCH emacs-team v11 5/7] build-system: emacs: Compute relative file names.
(address . 67260@debbugs.gnu.org)(name . Suhail)(address . suhail@bayesians.ca)
56a7c1308a1f1601299b8c7706fb4d00d5c185d0.1708761863.git.liliana.prikler@gmail.com
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less. To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
---
guix/build/emacs-utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8e12b5b6d4..eca42bf305 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -146,7 +146,9 @@ (define* (emacs-compile-directory dir)
(cadr native-comp-eln-load-path))))
(if byte+native-compile
(native-compile file
- (comp-el-to-eln-filename file eln-dir))
+ (comp-el-to-eln-filename
+ (file-relative-name file ,dir)
+ eln-dir))
(byte-compile-file file))
;; After native compilation, write the bytecode file.
(unless (null byte-to-native-output-buffer-file)
--
2.41.0
S
S
Suhail wrote on 1 Mar 18:35 +0100
Re: [bug#67260] [PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio!
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
878r31onwr.fsf@bayesians.ca
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (3 lines)
> I finally came up with the perfectly cursed mix that enables us to
> actually load *and* graft our natively compiled packages with ease.

I can confirm that all the features being checked show up as natively
compiled as default - yay!

However, there seems to be some brittleness in whether or not
natively-compiled versions can be located. Specifically, by reordering
the entries of the load-path, unloading previously loaded features, and
then reloading them some features will be reported as being
byte-compiled instead of natively-compiled. Is my expectation that
reordering entries in the load-path shouldn't affect the
natively-compiled status misplaced?

From the previously shared test script, cases 01, 02, 03 pass now.
However, case
04-load-path-order-should-not-determine-natively-compiled-status still
fails. Where in v10 it failed because 3 features previously reported as
being byte-compiled became natively-compiled, now it fails because the
same 3 features go from being natively-compiled to byte-compiled after
reordering load-path. The features in question are the same ones that
were problematic in v10:

- term/internal
- mule-util
- ucs-normalize

My opinion: v11 seems to be an improvement over v10. While I don't
believe that v11 is free of *all* bugs, I don't believe that that should
be a necessary pre-requisite before merging in. I believe it would be
beneficial to merge v11 into emacs-team soon(ish) and for the emacs-team
branch to be merged into master soon thereafter. A separate bug issue
can be created to track the peculiar dependence of the
native-compilation status on the ordering of entries in load-path.

Thoughts?

--
Suhail
L
L
Liliana Marie Prikler wrote on 1 Mar 20:40 +0100
(name . Suhail)(address . suhail@bayesians.ca)
f95bd8666337a2b783157ebc3e2f16ca13c57466.camel@gmail.com
Am Freitag, dem 01.03.2024 um 17:35 +0000 schrieb Suhail:
Toggle quote (2 lines)
> Is my expectation that reordering entries in the load-path shouldn't
> affect the natively-compiled status misplaced?
Yes. We take the first prefix match and compute the file names from
there. This is consistent with emacs matching the first file it finds
on the load-path. You can't do much better, because your load path may
only be partially specified at compile time and later expanded with
normal-top-level-add-to-load-path.

Toggle quote (4 lines)
> Where in v10 it failed because 3 features previously reported as
> being byte-compiled became natively-compiled, now it fails because
> the same 3 features go from being natively-compiled to byte-compiled
> after reordering load-path.
The expectation that load-path order does not matter is imho quite
unfounded. Note that we do ship the actually important test cases with
v11.

Toggle quote (3 lines)
> A separate bug issue can be created to track the peculiar dependence
> of the native-compilation status on the ordering of entries in load-
> path.
Well, to me it's not peculiar as I wrote the code, but I'm not sure how
familiar you are with Emacs' internals. If you feel up for it, go for
it, but I'd rather tackle other problems related to our emacs
ecosystem.

Anyway, as you said, I'm pushing this now so that we can do a double
merge dance (i.e. master → emacs-team, then request the other way)
starting early tomorrow.

Cheers
Closed
A
A
Andrew Tropin wrote on 4 Mar 08:13 +0100
87il22bhal.fsf@trop.in
On 2024-02-24 09:04, Liliana Marie Prikler wrote:

Toggle quote (33 lines)
> After a week of debugging the internals of how Emacs compiles, loads,
> and dumps (!) its .eln-files, I finally came up with the perfectly
> cursed mix that enables us to actually load *and* graft our natively
> compiled packages with ease.
>
> In unrelated news, I feel like I should wear a witch hat for faster
> development cycles.
>
> Liliana Marie Prikler (7):
> gnu: emacs: Build trampolines.
> gnu: emacs: Don't hash file names in native compilation.
> gnu: emacs: Check integrity of native-compiled files.
> gnu: emacs: Disable jit compilation.
> build-system: emacs: Compute relative file names.
> gnu: emacs-org: Fix native builds.
> gnu: emacs-magit: Fix native builds.
>
> Makefile.am | 1 +
> gnu/local.mk | 2 +
> .../aux-files/emacs/comp-integrity.el | 126 +++++++
> gnu/packages/emacs-xyz.scm | 10 +-
> gnu/packages/emacs.scm | 20 +-
> .../emacs-disable-jit-compilation.patch | 19 +
> .../emacs-native-comp-fix-filenames.patch | 338 ++++++++++++++++++
> guix/build/emacs-utils.scm | 4 +-
> 8 files changed, 516 insertions(+), 4 deletions(-)
> create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el
> create mode 100644 gnu/packages/patches/emacs-disable-jit-compilation.patch
> create mode 100644 gnu/packages/patches/emacs-native-comp-fix-filenames.patch
>
>
> base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660

For usual emacs it seems to work, (require 'magit) with clean eln cache
doesn't trigger any builds. For emacs-pgtk it fails to build emacs:

guix time-machine --url='https://git.guix-patches.cbaines.net/git/guix-patches'--branch=issue-67260 --disable-authentication -- shell emacs-pgtk emacs-magit --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q

Toggle snippet (59 lines)
passed 94/97 expect-window-right-native (0.002412 sec)
Test expect-x-dnd-init-frame-native backtrace:
signal(void-function (x-dnd-init-frame))
apply(signal (void-function (x-dnd-init-frame)))
(setq value-477 (apply fn-475 args-476))
(unwind-protect (setq value-477 (apply fn-475 args-476)) (setq form-
(if (unwind-protect (setq value-477 (apply fn-475 args-476)) (setq f
(let (form-description-479) (if (unwind-protect (setq value-477 (app
(let ((value-477 'ert-form-evaluation-aborted-478)) (let (form-descr
(let* ((fn-475 #'eq) (args-476 (condition-case err (let ((signal-hoo
(lambda nil (let* ((fn-475 #'eq) (args-476 (condition-case err (let
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name expect-x-dnd-init-frame-native :docum
ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-map
ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
ert-run-tests-batch(nil)
ert-run-tests-batch-and-exit()
command-line-1(("--load" "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3
command-line()
normal-top-level()
Test expect-x-dnd-init-frame-native condition:
(void-function x-dnd-init-frame)
FAILED 95/97 expect-x-dnd-init-frame-native (0.000082 sec) at ../../../gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el:1
Test expect-x-handle-no-bitmap-icon-native backtrace:
signal(void-function (x-handle-no-bitmap-icon))
apply(signal (void-function (x-handle-no-bitmap-icon)))
(setq value-482 (apply fn-480 args-481))
(unwind-protect (setq value-482 (apply fn-480 args-481)) (setq form-
(if (unwind-protect (setq value-482 (apply fn-480 args-481)) (setq f
(let (form-description-484) (if (unwind-protect (setq value-482 (app
(let ((value-482 'ert-form-evaluation-aborted-483)) (let (form-descr
(let* ((fn-480 #'eq) (args-481 (condition-case err (let ((signal-hoo
(lambda nil (let* ((fn-480 #'eq) (args-481 (condition-case err (let
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name expect-x-handle-no-bitmap-icon-native
ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-map
ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
ert-run-tests-batch(nil)
ert-run-tests-batch-and-exit()
command-line-1(("--load" "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3
command-line()
normal-top-level()
Test expect-x-handle-no-bitmap-icon-native condition:
(void-function x-handle-no-bitmap-icon)
FAILED 96/97 expect-x-handle-no-bitmap-icon-native (0.000111 sec) at ../../../gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el:1
passed 97/97 expect-x-setup-function-keys-native (0.004165 sec)

Ran 97 tests, 95 results as expected, 2 unexpected (2024-03-02 05:46:28+0000, 0.361428 sec)

2 unexpected results:
FAILED expect-x-dnd-init-frame-native
FAILED expect-x-handle-no-bitmap-icon-native

error: in phase 'validate-comp-integrity': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/m01icx06dw1vs1krcj4jbmw71nv430dp-emacs-pgtk-29.2/bin/emacs" arguments: ("--batch" "--load" "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el" "-f" "ert-run-tests-batch-and-exit") exit-status: 1 term-signal: #f stop-signal: #f>
phase `validate-comp-integrity' failed after 0.5 seconds
command "/gnu/store/m01icx06dw1vs1krcj4jbmw71nv430dp-emacs-pgtk-29.2/bin/emacs" "--batch" "--load" "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el" "-f" "ert-run-tests-batch-and-exit" failed with status 1

Thank you very much for working on it!

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmXldLIACgkQIgjSCVjB
3rC+1Q//X3JpdkDsnwKiPL2JtQfvM752bc4j6yzbfagzL5wIRlgIQOx/85l7mAvR
PPYv5oJHylThpFmSc0DztbqiHBpy/g0bPonTglzD6ojcCcIteBjP2mSCIiYMut0r
qdUIADt3D5KRpqIRz4nFzyxes4qvEPJTELa4IYe2S8qWtLGBek7lXtuTIwOi3q8P
tcVezQ2SqwHnxLKyCCVRYprtkFW+NlYwSzlds1Xb6dR8JoscRONR0J6jEjkqgBiV
nwvUYz9YsdWf7dEKm6pVrRyGRih9Zje0npY4AAF1SHS2PLcD7ybQY9dN1flC0jiQ
R1BZ9JRTSpD7wefUR3533ofTIGnRWa7U/wWiAeWNLmHHnlwqshoiN6uW0YVowxs4
g/7WgwUJaLc4PRbhoBOOczIZTDLFSUUI+ivPtDmQYLls46ob5TxwHJ3Xms/6EAxo
KWPQjKlgaMSASPtAr0Sl4Of0JxWgToPKdKQSjggjmYpjamyvF+/wObgOleU6ZEKz
G3qGD3oglC4weh9mKo9FjMqlh0D1bd+RMpABYjn7+QayPuwLAGoZwPH52RtOp2Rc
svTjp5Go2wk4rVEgRk7JPyMPSh1iDtBRaxYLIBFus2h5vhJbBawV9VCUdeGajTIM
8VbgQmAZvrQbBIBZ3n9fSV9aQfM4HuBEZzYuHVwgwT+w5C/23i4=
=DpsA
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 4 Mar 20:59 +0100
6eb2791017ee33d78afc480d9aa68498c1c5a8c1.camel@gmail.com
Am Montag, dem 04.03.2024 um 10:13 +0300 schrieb Andrew Tropin:
Toggle quote (143 lines)
> On 2024-02-24 09:04, Liliana Marie Prikler wrote:
>
> > After a week of debugging the internals of how Emacs compiles,
> > loads,
> > and dumps (!) its .eln-files, I finally came up with the perfectly
> > cursed mix that enables us to actually load *and* graft our
> > natively
> > compiled packages with ease.
> >
> > In unrelated news, I feel like I should wear a witch hat for faster
> > development cycles.
> >
> > Liliana Marie Prikler (7):
> >   gnu: emacs: Build trampolines.
> >   gnu: emacs: Don't hash file names in native compilation.
> >   gnu: emacs: Check integrity of native-compiled files.
> >   gnu: emacs: Disable jit compilation.
> >   build-system: emacs: Compute relative file names.
> >   gnu: emacs-org: Fix native builds.
> >   gnu: emacs-magit: Fix native builds.
> >
> >  Makefile.am                                   |   1 +
> >  gnu/local.mk                                  |   2 +
> >  .../aux-files/emacs/comp-integrity.el         | 126 +++++++
> >  gnu/packages/emacs-xyz.scm                    |  10 +-
> >  gnu/packages/emacs.scm                        |  20 +-
> >  .../emacs-disable-jit-compilation.patch       |  19 +
> >  .../emacs-native-comp-fix-filenames.patch     | 338
> > ++++++++++++++++++
> >  guix/build/emacs-utils.scm                    |   4 +-
> >  8 files changed, 516 insertions(+), 4 deletions(-)
> >  create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el
> >  create mode 100644 gnu/packages/patches/emacs-disable-jit-
> > compilation.patch
> >  create mode 100644 gnu/packages/patches/emacs-native-comp-fix-
> > filenames.patch
> >
> >
> > base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
>
> For usual emacs it seems to work, (require 'magit) with clean eln
> cache
> doesn't trigger any builds. For emacs-pgtk it fails to build emacs:
>
> guix time-machine --
> url='https://git.guix-patches.cbaines.net/git/guix-patches' --
> branch=issue-67260 --disable-authentication -- shell emacs-pgtk
> emacs-magit --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
>
> --8<---------------cut here---------------start------------->8---
>    passed  94/97  expect-window-right-native (0.002412 sec)
> Test expect-x-dnd-init-frame-native backtrace:
>   signal(void-function (x-dnd-init-frame))
>   apply(signal (void-function (x-dnd-init-frame)))
>   (setq value-477 (apply fn-475 args-476))
>   (unwind-protect (setq value-477 (apply fn-475 args-476)) (setq
> form-
>   (if (unwind-protect (setq value-477 (apply fn-475 args-476)) (setq
> f
>   (let (form-description-479) (if (unwind-protect (setq value-477
> (app
>   (let ((value-477 'ert-form-evaluation-aborted-478)) (let (form-
>