GNU bug report logs - #67260
[PATCH emacs-team 0/2] Think ahead when compiling

Previous Next

Package: guix-patches;

Reported by: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Date: Sat, 18 Nov 2023 13:50:02 UTC

Severity: normal

Tags: patch

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67260 in the body.
You can then email your comments to 67260 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 18 Nov 2023 13:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
New bug report received and forwarded. Copy sent to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org. (Sat, 18 Nov 2023 13:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH emacs-team 0/2] Think ahead when compiling
Date: Sat, 18 Nov 2023 14:42:06 +0100
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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 18 Nov 2023 14:51:01 GMT) Full text and rfc822 format available.

Message #8 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH emacs-team 2/2] gnu: emacs: Don't hash file names in native
 compilation.
Date: Sat, 18 Nov 2023 14:38:46 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 18 Nov 2023 15:45:02 GMT) Full text and rfc822 format available.

Message #11 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com
Subject: Re: [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
Date: Sat, 18 Nov 2023 19:44:05 +0400
[Message part 1 (text/plain, inline)]
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---

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 18 Nov 2023 15:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>, 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com
Subject: Re: [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
Date: Sat, 18 Nov 2023 16:51:07 +0100
Am Samstag, dem 18.11.2023 um 19:44 +0400 schrieb Andrew Tropin:
> 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.





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 22 Nov 2023 12:17:01 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mekeor Melire <mekeor <at> posteo.de>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, guix-patches <at> gnu.org,
 andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
Date: Wed, 22 Nov 2023 12:09:35 +0000
2023-11-18 14:42 liliana.prikler <at> 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.




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 22 Nov 2023 12:17:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 22 Nov 2023 17:40:01 GMT) Full text and rfc822 format available.

Message #23 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Mekeor Melire <mekeor <at> posteo.de>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
Date: Wed, 22 Nov 2023 18:39:17 +0100
Am Mittwoch, dem 22.11.2023 um 12:09 +0000 schrieb Mekeor Melire:
> 2023-11-18 14:42 liliana.prikler <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 25 Nov 2023 08:24:02 GMT) Full text and rfc822 format available.

Message #26 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, cox.katherine.e+guix <at> gmail.com,
 andrew <at> trop.in
Subject: [PATCH emacs-team v2 3/3] build-system: emacs: Compute relative
 file names.
Date: Sat, 25 Nov 2023 09:18:26 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 25 Nov 2023 11:15:02 GMT) Full text and rfc822 format available.

Message #29 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, andrew <at> trop.in
Subject: [PATCH emacs-team v3 1/3] gnu: emacs: Build trampolines.
Date: Sat, 25 Nov 2023 12:13:51 +0100
* 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
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 25 Nov 2023 11:15:03 GMT) Full text and rfc822 format available.

Message #32 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, andrew <at> trop.in
Subject: [PATCH emacs-team v3 2/3] gnu: emacs: Don't hash file names in
 native compilation.
Date: Sat, 25 Nov 2023 12:13:53 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 25 Nov 2023 11:16:02 GMT) Full text and rfc822 format available.

Message #35 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, andrew <at> trop.in
Subject: [PATCH emacs-team v3 3/3] build-system: emacs: Compute relative
 file names.
Date: Sat, 25 Nov 2023 12:13:53 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 08 Dec 2023 11:54:01 GMT) Full text and rfc822 format available.

Message #38 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com, andrew <at> trop.in
Subject: [PATCH v4 4/5] gnu: emacs-org: Fix native builds.
Date: Fri, 8 Dec 2023 12:16:55 +0100
* 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(+)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 08 Dec 2023 11:54:02 GMT) Full text and rfc822 format available.

Message #41 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com, andrew <at> trop.in
Subject: [PATCH v4 5/5] gnu: emacs-magit: Fix native builds.
Date: Fri, 8 Dec 2023 12:45:23 +0100
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 27 Dec 2023 11:01:02 GMT) Full text and rfc822 format available.

Message #44 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com
Subject: Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
Date: Wed, 27 Dec 2023 14:00:15 +0300
[Message part 1 (text/plain, inline)]
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---

*Warnings*:
--8<---------------cut here---------------start------------->8---
... # 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
...
--8<---------------cut here---------------end--------------->8---


Modified the command
--8<---------------cut here---------------start------------->8---
./pre-inst-env guix shell emacs-pgtk emacs-magit bash \
--pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
# M-S-: (require 'magit) RET
--8<---------------cut here---------------end--------------->8---

*Warnings*:
--8<---------------cut here---------------start------------->8---
⛔ 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
--8<---------------cut here---------------end--------------->8---

*Native-compile-log*:
--8<---------------cut here---------------start------------->8---
Compiling /home/bob/.config/emacs/eln-cache/29.1-5c9913f6/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln...
--8<---------------cut here---------------end--------------->8---

*Async-native-compile-log*:
--8<---------------cut here---------------start------------->8---
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/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-log.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-wip.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-apply.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-repos.el...
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/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-status.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-refs.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-files.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-reset.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-branch.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-merge.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-worktree.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-tag.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-notes.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-sequence.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-commit.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-remote.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-clone.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-fetch.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-push.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-pull.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-bisect.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-reflog.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-stash.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-blame.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-submodule.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-patch.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-subtree.el...
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/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-merg.el.gz...
uncompressing ediff-merg.el.gz...
uncompressing ediff-merg.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-util.el.gz...
uncompressing ediff-util.el.gz...
uncompressing ediff-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff.el.gz...
uncompressing ediff.el.gz...
uncompressing ediff.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-ediff.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-gitignore.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-sparse-checkout.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-extras.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/git-rebase.el...
Compiling /gnu/store/bz2lz2pf5il825aqcsadafpshhd224d2-emacs-magit-3.3.0-6.7a1d503/share/emacs/site-lisp/magit-3.3.0-6.7a1d503/magit-bookmark.el...
Compilation finished.
--8<---------------cut here---------------end--------------->8---

In either cases ~/.config/emacs/eln-cache get populated:

--8<---------------cut here---------------start------------->8---
ls ~/.config/emacs/eln-cache/29.1-5c9913f6 -1 
calendar/
dash.eln
emacs-lisp/
git-commit.eln
git-rebase.eln
gnus/
magit-apply.eln
magit-autorevert.eln
magit-base.eln
magit-bisect.eln
magit-blame.eln
magit-bookmark.eln
magit-branch.eln
magit-clone.eln
magit-commit.eln
magit-diff.eln
magit-ediff.eln
magit.eln
magit-extras.eln
magit-fetch.eln
magit-files.eln
magit-git.eln
magit-gitignore.eln
magit-log.eln
magit-margin.eln
magit-merge.eln
magit-mode.eln
magit-notes.eln
magit-patch.eln
magit-process.eln
magit-pull.eln
magit-push.eln
magit-reflog.eln
magit-refs.eln
magit-remote.eln
magit-repos.eln
magit-reset.eln
magit-section.eln
magit-sequence.eln
magit-sparse-checkout.eln
magit-stash.eln
magit-status.eln
magit-submodule.eln
magit-subtree.eln
magit-tag.eln
magit-transient.eln
magit-wip.eln
magit-worktree.eln
mail/
net/
progmodes/
subr--trampoline-6d616b652d70726f63657373_make_process_0.eln
transient.eln
url/
vc/
with-editor.eln
--8<---------------cut here---------------end--------------->8---

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 27 Dec 2023 16:41:01 GMT) Full text and rfc822 format available.

Message #47 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>, 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com
Subject: Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
Date: Wed, 27 Dec 2023 17:40:22 +0100
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.


Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 27 Dec 2023 18:28:02 GMT) Full text and rfc822 format available.

Message #50 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com
Subject: Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
Date: Wed, 27 Dec 2023 21:27:47 +0300
[Message part 1 (text/plain, inline)]
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!

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix shell bash emacs-pgtk emacs-magit \
--with-input=emacs-minimal=emacs-pgtk --pure \
-E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
--8<---------------cut here---------------end--------------->8---

*Native-compile-log*:
--8<---------------cut here---------------start------------->8---
Compiling /home/bob/.config/emacs/eln-cache/29.1-5c9913f6/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln...
--8<---------------cut here---------------end--------------->8---

*Async-native-compile-log*:
--8<---------------cut here---------------start------------->8---
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/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-merg.el.gz...
uncompressing ediff-merg.el.gz...
uncompressing ediff-merg.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff-util.el.gz...
uncompressing ediff-util.el.gz...
uncompressing ediff-util.el.gz...done
Compiling /gnu/store/8nxkj4291ijn4sscvmqysbf4scg0fvil-emacs-pgtk-29.1/share/emacs/29.1/lisp/vc/ediff.el.gz...
uncompressing ediff.el.gz...
uncompressing ediff.el.gz...done
Compilation finished.
--8<---------------cut here---------------end--------------->8---

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 27 Dec 2023 20:04:01 GMT) Full text and rfc822 format available.

Message #53 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>, 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com
Subject: Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
Date: Wed, 27 Dec 2023 21:03:15 +0100
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.

Cheers

¹ Maybe there's a smarter way to locate them files?  Did I go wrong in
one of my patches?





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 27 Dec 2023 20:46:01 GMT) Full text and rfc822 format available.

Message #56 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>, 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com
Subject: Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
Date: Wed, 27 Dec 2023 21:44:54 +0100
Am Mittwoch, dem 27.12.2023 um 21:03 +0100 schrieb Liliana Marie
Prikler:
> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 28 Dec 2023 05:57:01 GMT) Full text and rfc822 format available.

Message #59 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 67260 <at> debbugs.gnu.org
Cc: Mekeor Melire <mekeor <at> posteo.de>, Josselin Poiret <dev <at> jpoiret.xyz>,
 cox.katherine.e+guix <at> gmail.com
Subject: Re: [PATCH v4 1/5] gnu: emacs: Build trampolines.
Date: Thu, 28 Dec 2023 08:56:15 +0300
[Message part 1 (text/plain, inline)]
On 2023-12-27 21:03, Liliana Marie Prikler wrote:

> 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.

--8<---------------cut here---------------start------------->8---
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/")
--8<---------------cut here---------------end--------------->8---


--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---

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

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

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 18 Jan 2024 05:57:01 GMT) Full text and rfc822 format available.

Message #62 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: 67260 <at> debbugs.gnu.org
Subject: [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling
Date: Thu, 18 Jan 2024 05:55:53 +0000
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.





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 21 Jan 2024 14:15:02 GMT) Full text and rfc822 format available.

Message #65 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v5 1/6] gnu: emacs: Build trampolines.
Date: Sun, 21 Jan 2024 13:12:41 +0100
* 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 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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 21 Jan 2024 14:15:02 GMT) Full text and rfc822 format available.

Message #68 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v5 2/6] gnu: emacs: Don't hash file names in native
 compilation.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 21 Jan 2024 14:15:03 GMT) Full text and rfc822 format available.

Message #71 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v5 5/6] gnu: emacs-magit: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 21 Jan 2024 14:15:03 GMT) Full text and rfc822 format available.

Message #74 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v5 6/6] gnu: emacs: Disable jit compilation.
Date: Sun, 21 Jan 2024 15:09:47 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 21 Jan 2024 14:15:04 GMT) Full text and rfc822 format available.

Message #77 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v5 4/6] gnu: emacs-org: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(+)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 21 Jan 2024 14:15:04 GMT) Full text and rfc822 format available.

Message #80 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v5 3/6] build-system: emacs: Compute relative file names.
Date: Sun, 21 Jan 2024 13:12:42 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Mon, 22 Jan 2024 04:18:02 GMT) Full text and rfc822 format available.

Message #83 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v5 6/6] gnu: emacs: Disable jit compilation.
Date: Mon, 22 Jan 2024 04:16:56 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> * 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.





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Mon, 22 Jan 2024 04:38:02 GMT) Full text and rfc822 format available.

Message #86 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v5 6/6] gnu: emacs: Disable jit compilation.
Date: Mon, 22 Jan 2024 04:36:37 +0000
Suhail via Guix-patches via <guix-patches <at> 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.

-- 
Suhail





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:01 GMT) Full text and rfc822 format available.

Message #89 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Mon, 22 Jan 2024 21:21:26 +0100
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
Am Montag, dem 22.01.2024 um 04:36 +0000 schrieb Suhail:
> Suhail via Guix-patches via <guix-patches <at> 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(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:02 GMT) Full text and rfc822 format available.

Message #92 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 2/7] gnu: emacs: Build trampolines.
Date: Sun, 21 Jan 2024 13:12:41 +0100
* 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 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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:02 GMT) Full text and rfc822 format available.

Message #95 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 4/7] build-system: emacs: Compute relative file names.
Date: Sun, 21 Jan 2024 13:12:42 +0100
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(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:03 GMT) Full text and rfc822 format available.

Message #98 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 3/7] gnu: emacs: Don't hash file names in native
 compilation.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:03 GMT) Full text and rfc822 format available.

Message #101 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 5/7] gnu: emacs-org: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(+)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:03 GMT) Full text and rfc822 format available.

Message #104 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 6/7] gnu: emacs-magit: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 09:31:04 GMT) Full text and rfc822 format available.

Message #107 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Subject: [PATCH v6 7/7] gnu: emacs: Disable jit compilation.
Date: Sun, 21 Jan 2024 15:09:47 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 25 Jan 2024 23:54:02 GMT) Full text and rfc822 format available.

Message #110 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Thu, 25 Jan 2024 23:53:18 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

>> Suhail via Guix-patches via <guix-patches <at> 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?

-- 
Suhail





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 26 Jan 2024 05:30:03 GMT) Full text and rfc822 format available.

Message #113 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Fri, 26 Jan 2024 06:29:20 +0100
Hi,

Am Donnerstag, dem 25.01.2024 um 23:53 +0000 schrieb Suhail:
> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:
> 
> > > Suhail via Guix-patches via <guix-patches <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 26 Jan 2024 07:51:02 GMT) Full text and rfc822 format available.

Message #116 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Fri, 26 Jan 2024 07:49:59 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

>> 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.

> 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 26 Jan 2024 08:22:01 GMT) Full text and rfc822 format available.

Message #119 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Fri, 26 Jan 2024 08:20:55 +0000
Suhail via Guix-patches via <guix-patches <at> 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?

-- 
Suhail





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 26 Jan 2024 16:11:01 GMT) Full text and rfc822 format available.

Message #122 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Fri, 26 Jan 2024 17:10:13 +0100
Am Freitag, dem 26.01.2024 um 08:20 +0000 schrieb Suhail:
> Suhail via Guix-patches via <guix-patches <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 26 Jan 2024 22:47:01 GMT) Full text and rfc822 format available.

Message #125 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Fri, 26 Jan 2024 22:45:42 +0000
Liliana Marie Prikler <liliana.prikler <at> 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.

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.

-- 
Suhail





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:02:01 GMT) Full text and rfc822 format available.

Message #128 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 08:00:48 +0100
Am Freitag, dem 26.01.2024 um 22:45 +0000 schrieb Suhail:
> Liliana Marie Prikler <liliana.prikler <at> 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.

> 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:02 GMT) Full text and rfc822 format available.

Message #131 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Mon, 22 Jan 2024 21:21:26 +0100
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
 gnu/packages/emacs.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:02 GMT) Full text and rfc822 format available.

Message #134 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 2/7] gnu: emacs: Build trampolines.
Date: Sun, 21 Jan 2024 13:12:41 +0100
* 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 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:03 GMT) Full text and rfc822 format available.

Message #137 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 4/7] gnu: emacs: Disable jit compilation.
Date: Sun, 21 Jan 2024 15:09:47 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:03 GMT) Full text and rfc822 format available.

Message #140 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 5/7] build-system: emacs: Compute relative file names.
Date: Sun, 21 Jan 2024 13:12:42 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:04 GMT) Full text and rfc822 format available.

Message #143 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 3/7] gnu: emacs: Don't hash file names in native
 compilation.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:04 GMT) Full text and rfc822 format available.

Message #146 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 6/7] gnu: emacs-org: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(+)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 07:05:05 GMT) Full text and rfc822 format available.

Message #149 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 7/7] gnu: emacs-magit: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 15:37:02 GMT) Full text and rfc822 format available.

Message #152 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 15:36:05 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> 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:

> 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.





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 16:26:02 GMT) Full text and rfc822 format available.

Message #155 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Suhail via Guix-patches via <guix-patches <at> gnu.org>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 16:24:35 +0000
Suhail via Guix-patches via <guix-patches <at> gnu.org> writes:

> 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 16:26:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 16:51:02 GMT) Full text and rfc822 format available.

Message #161 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 17:50:02 +0100
Am Samstag, dem 27.01.2024 um 15:36 +0000 schrieb Suhail:
> Liliana Marie Prikler <liliana.prikler <at> 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?

> 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.

> 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.

> > 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 17:17:01 GMT) Full text and rfc822 format available.

Message #164 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 17:15:49 +0000
Liliana Marie Prikler <liliana.prikler <at> 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).

>> 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?

> 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.





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 17:55:01 GMT) Full text and rfc822 format available.

Message #167 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 18:54:26 +0100
Am Samstag, dem 27.01.2024 um 17:15 +0000 schrieb Suhail:
> Liliana Marie Prikler <liliana.prikler <at> 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.

> > > 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 19:41:02 GMT) Full text and rfc822 format available.

Message #170 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 19:39:41 +0000
Suhail via Guix-patches via <guix-patches <at> 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.

> 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:12:01 GMT) Full text and rfc822 format available.

Message #173 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sat, 27 Jan 2024 21:11:04 +0100
Am Samstag, dem 27.01.2024 um 19:39 +0000 schrieb Suhail:
> Suhail via Guix-patches via <guix-patches <at> 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.

> > 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:01 GMT) Full text and rfc822 format available.

Message #176 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 2/7] gnu: emacs: Build trampolines.
Date: Sun, 21 Jan 2024 13:12:41 +0100
* 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 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:01 GMT) Full text and rfc822 format available.

Message #179 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Mon, 22 Jan 2024 21:21:26 +0100
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
 gnu/packages/emacs.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:02 GMT) Full text and rfc822 format available.

Message #182 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 5/7] build-system: emacs: Compute relative file names.
Date: Sun, 21 Jan 2024 13:12:42 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:02 GMT) Full text and rfc822 format available.

Message #185 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 4/7] gnu: emacs: Disable jit compilation.
Date: Sun, 21 Jan 2024 15:09:47 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:03 GMT) Full text and rfc822 format available.

Message #188 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 3/7] gnu: emacs: Don't hash file names in native
 compilation.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:03 GMT) Full text and rfc822 format available.

Message #191 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 6/7] gnu: emacs-org: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(+)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 27 Jan 2024 20:59:04 GMT) Full text and rfc822 format available.

Message #194 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v8 7/7] gnu: emacs-magit: Fix native builds.
Date: Sun, 21 Jan 2024 13:12:42 +0100
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 28 Jan 2024 00:14:01 GMT) Full text and rfc822 format available.

Message #197 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sun, 28 Jan 2024 00:13:21 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

>> > 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).

> 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.





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 28 Jan 2024 00:19:02 GMT) Full text and rfc822 format available.

Message #200 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sun, 28 Jan 2024 00:18:22 +0000
Suhail via Guix-patches via <guix-patches <at> gnu.org> writes:

> 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 28 Jan 2024 09:52:02 GMT) Full text and rfc822 format available.

Message #203 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sun, 28 Jan 2024 10:51:37 +0100
Am Sonntag, dem 28.01.2024 um 00:13 +0000 schrieb Suhail:
> Liliana Marie Prikler <liliana.prikler <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 28 Jan 2024 16:19:02 GMT) Full text and rfc822 format available.

Message #206 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sun, 28 Jan 2024 16:17:47 +0000
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 <at> 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?

-- 
Suhail





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 28 Jan 2024 16:51:02 GMT) Full text and rfc822 format available.

Message #209 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Sun, 28 Jan 2024 17:50:16 +0100
Am Sonntag, dem 28.01.2024 um 16:17 +0000 schrieb Suhail:
> 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 <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:02 GMT) Full text and rfc822 format available.

Message #212 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
 gnu/packages/emacs.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:02 GMT) Full text and rfc822 format available.

Message #215 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 2/7] gnu: emacs: Build trampolines.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:02 GMT) Full text and rfc822 format available.

Message #218 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 4/7] gnu: emacs: Disable jit compilation.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:03 GMT) Full text and rfc822 format available.

Message #221 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 5/7] build-system: emacs: Compute relative file names.
Date: Tue, 13 Feb 2024 19:30:50 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:03 GMT) Full text and rfc822 format available.

Message #224 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 6/7] gnu: emacs-org: Fix native builds.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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(+)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:04 GMT) Full text and rfc822 format available.

Message #227 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 3/7] gnu: emacs: Don't hash file names in native
 compilation.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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:
> 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

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 19:32:05 GMT) Full text and rfc822 format available.

Message #230 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>,
 andrew <at> trop.in
Subject: [PATCH v7 7/7] gnu: emacs-magit: Fix native builds.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 21:02:04 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:04 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 13 Feb 2024 22:33:04 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 14 Feb 2024 00:58:01 GMT) Full text and rfc822 format available.

Message #275 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: bug#67260 <67260 <at> debbugs.gnu.org>
Subject: [bug#67260] [PATCH emacs-team v9*] Think ahead when compiling
Date: Wed, 14 Feb 2024 00:56:35 +0000
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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Wed, 14 Feb 2024 08:43:02 GMT) Full text and rfc822 format available.

Message #278 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: bug#67260 <67260 <at> debbugs.gnu.org>
Subject: Re: [bug#67260] [PATCH emacs-team v9*] Test for AOT native-comp
Date: Wed, 14 Feb 2024 08:41:30 +0000
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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:02 GMT) Full text and rfc822 format available.

Message #281 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 0/7] Preload most of the things
Date: Fri, 16 Feb 2024 16:09:58 +0100
Am Mittwoch, dem 14.02.2024 um 08:41 +0000 schrieb Suhail:
> 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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:02 GMT) Full text and rfc822 format available.

Message #284 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 2/7] gnu: emacs: Build trampolines.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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 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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:03 GMT) Full text and rfc822 format available.

Message #287 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 4/7] gnu: emacs: Disable jit compilation.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:03 GMT) Full text and rfc822 format available.

Message #290 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* gnu/packages/emacs.scm (emacs-minimal)[wrap-emacs-paths]: Also wrap
EMACSNATIVELOADPATH.
---
 gnu/packages/emacs.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:04 GMT) Full text and rfc822 format available.

Message #293 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 3/7] gnu: emacs: Don't hash file names in
 native compilation.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:04 GMT) Full text and rfc822 format available.

Message #296 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 6/7] gnu: emacs-org: Fix native builds.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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(+)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:05 GMT) Full text and rfc822 format available.

Message #299 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 7/7] gnu: emacs-magit: Fix native builds.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 16 Feb 2024 15:13:05 GMT) Full text and rfc822 format available.

Message #302 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v10 5/7] build-system: emacs: Compute relative
 file names.
Date: Tue, 13 Feb 2024 19:30:50 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 17 Feb 2024 14:50:01 GMT) Full text and rfc822 format available.

Message #305 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Sat, 17 Feb 2024 14:49:22 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> With this series I get 94/97.

I was able to confirm that as well.

> 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.

> ... 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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 17 Feb 2024 15:17:01 GMT) Full text and rfc822 format available.

Message #308 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Sat, 17 Feb 2024 16:15:18 +0100
Am Samstag, dem 17.02.2024 um 14:49 +0000 schrieb Suhail:
> Liliana Marie Prikler <liliana.prikler <at> 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.

> 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


Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 18 Feb 2024 00:57:02 GMT) Full text and rfc822 format available.

Message #311 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Sun, 18 Feb 2024 00:56:09 +0000
"Liliana Marie Prikler" <liliana.prikler <at> 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).

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.

> 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.





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sun, 18 Feb 2024 09:22:01 GMT) Full text and rfc822 format available.

Message #314 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Sun, 18 Feb 2024 10:19:56 +0100
Am Sonntag, dem 18.02.2024 um 00:56 +0000 schrieb Suhail:
> "Liliana Marie Prikler" <liliana.prikler <at> 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?  

> 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.

> 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.

> 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.

> - 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.

> - 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Mon, 19 Feb 2024 21:44:02 GMT) Full text and rfc822 format available.

Message #317 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Mon, 19 Feb 2024 21:42:59 +0000
"Liliana Marie Prikler" <liliana.prikler <at> 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.

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 20 Feb 2024 17:53:02 GMT) Full text and rfc822 format available.

Message #320 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Tue, 20 Feb 2024 18:51:01 +0100
Am Montag, dem 19.02.2024 um 21:42 +0000 schrieb Suhail:
> "Liliana Marie Prikler" <liliana.prikler <at> 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.

> 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.
>                          :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


Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Tue, 20 Feb 2024 18:43:02 GMT) Full text and rfc822 format available.

Message #323 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things
Date: Tue, 20 Feb 2024 18:41:50 +0000
[Message part 1 (text/plain, inline)]
"Liliana Marie Prikler" <liliana.prikler <at> gmail.com> writes:

> We still only have 97 tests squashed to 5 cases IIUC.

Yes.

> 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.

> 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?

> 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.

> 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
[test-native-comp-p.el (text/x-emacs-lisp, attachment)]

Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:16:01 GMT) Full text and rfc822 format available.

Message #326 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 3/7] gnu: emacs: Check integrity of
 native-compiled files.
Date: Sat, 24 Feb 2024 07:18:52 +0100
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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:16:02 GMT) Full text and rfc822 format available.

Message #329 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 7/7] gnu: emacs-magit: Fix native builds.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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(-)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:23:01 GMT) Full text and rfc822 format available.

Message #332 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 6/7] gnu: emacs-org: Fix native builds.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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(+)

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:23:02 GMT) Full text and rfc822 format available.

Message #335 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 2/7] gnu: emacs: Don't hash file names in
 native compilation.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:24:01 GMT) Full text and rfc822 format available.

Message #338 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 1/7] gnu: emacs: Build trampolines.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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 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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:25:02 GMT) Full text and rfc822 format available.

Message #341 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 0/7] You thought it was term/internal.el,
 but it was me, Dio!
Date: Sat, 24 Feb 2024 09:04:23 +0100
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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:25:02 GMT) Full text and rfc822 format available.

Message #344 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 4/7] gnu: emacs: Disable jit compilation.
Date: Tue, 13 Feb 2024 19:30:50 +0100
* 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

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





Information forwarded to andrew <at> trop.in, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Sat, 24 Feb 2024 08:41:03 GMT) Full text and rfc822 format available.

Message #347 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: 67260 <at> debbugs.gnu.org
Cc: Suhail <suhail <at> bayesians.ca>
Subject: [PATCH emacs-team v11 5/7] build-system: emacs: Compute relative
 file names.
Date: Tue, 13 Feb 2024 19:30:50 +0100
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 01 Mar 2024 17:37:01 GMT) Full text and rfc822 format available.

Message #350 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Suhail <suhail <at> bayesians.ca>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: cox.katherine.e+guix <at> gmail.com, 67260 <at> debbugs.gnu.org,
 Suhail <suhail <at> bayesians.ca>, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Fri, 01 Mar 2024 17:35:59 +0000
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> 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





Reply sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
You have taken responsibility. (Fri, 01 Mar 2024 19:43:01 GMT) Full text and rfc822 format available.

Notification sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
bug acknowledged by developer. (Fri, 01 Mar 2024 19:43:01 GMT) Full text and rfc822 format available.

Message #355 received at 67260-done <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260-done <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: [bug#67260] [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Fri, 01 Mar 2024 20:40:38 +0100
Am Freitag, dem 01.03.2024 um 17:35 +0000 schrieb Suhail:
> 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.

> 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.

> 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




Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Mon, 04 Mar 2024 07:16:02 GMT) Full text and rfc822 format available.

Message #358 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com,
 Suhail <suhail <at> bayesians.ca>
Subject: Re: [bug#67260] [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Mon, 04 Mar 2024 10:13:54 +0300
[Message part 1 (text/plain, inline)]
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-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
--8<---------------cut here---------------end--------------->8---

Thank you very much for working on it!

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Mon, 04 Mar 2024 20:02:02 GMT) Full text and rfc822 format available.

Message #361 received at 67260 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>, 67260 <at> debbugs.gnu.org
Cc: cox.katherine.e+guix <at> gmail.com, Suhail <suhail <at> bayesians.ca>
Subject: Re: [bug#67260] [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Mon, 04 Mar 2024 20:59:32 +0100
[Message part 1 (text/plain, inline)]
Am Montag, dem 04.03.2024 um 10:13 +0300 schrieb Andrew Tropin:
> 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-
> 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
> --8<---------------cut here---------------end--------------->8---
> 
> Thank you very much for working on it!
Try the attached patch and let me know if there's other failing
Emacsen.

Cheers
[0001-aux-files-comp-integrity-Adjust-for-emacs-pgtk.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 07 Mar 2024 08:57:01 GMT) Full text and rfc822 format available.

Message #364 received at 67260-done <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Suhail
 <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260-done <at> debbugs.gnu.org
Subject: Re: bug#67260: [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Thu, 07 Mar 2024 11:55:02 +0300
[Message part 1 (text/plain, inline)]
On 2024-03-01 20:40, Liliana Marie Prikler wrote:

> Am Freitag, dem 01.03.2024 um 17:35 +0000 schrieb Suhail:
>> 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.
>
>> 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.
>
>> 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.

Hi Liliana! 

guix time-machine --branch=emacs-team -- shell emacs-pgtk emacs-magit --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q

fails with:

--8<---------------cut here---------------start------------->8---
   passed  94/97  expect-window-right-native (0.002334 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.000067 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.000103 sec) at ../../../gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el:1
   passed  97/97  expect-x-setup-function-keys-native (0.002261 sec)

Ran 97 tests, 95 results as expected, 2 unexpected (2024-03-07 08:50:40+0000, 0.327688 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/lkqd9kx4nb4y6dw58bn8gqhid6q51i30-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/lkqd9kx4nb4y6dw58bn8gqhid6q51i30-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
--8<---------------cut here---------------end--------------->8---

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Thu, 07 Mar 2024 17:54:02 GMT) Full text and rfc822 format available.

Message #367 received at 67260-done <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Andrew Tropin <andrew <at> trop.in>, Suhail <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260-done <at> debbugs.gnu.org
Subject: Re: bug#67260: [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Thu, 07 Mar 2024 18:52:07 +0100
[Message part 1 (text/plain, inline)]
Am Donnerstag, dem 07.03.2024 um 11:55 +0300 schrieb Andrew Tropin:
> Hi Liliana! 
> 
> guix time-machine --branch=emacs-team -- shell emacs-pgtk emacs-magit
> --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
> 
> fails with:
> 
> --8<---------------cut here---------------start------------->8---
> [...]
> --8<---------------cut here---------------end--------------->8---
I already sent you a patch for that.  Attaching it again.


[0001-aux-files-comp-integrity-Adjust-for-emacs-pgtk.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#67260; Package guix-patches. (Fri, 08 Mar 2024 09:22:02 GMT) Full text and rfc822 format available.

Message #370 received at 67260-done <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Suhail
 <suhail <at> bayesians.ca>
Cc: cox.katherine.e+guix <at> gmail.com, 67260-done <at> debbugs.gnu.org
Subject: Re: bug#67260: [PATCH emacs-team v11 0/7] You thought it was
 term/internal.el, but it was me, Dio!
Date: Fri, 08 Mar 2024 12:20:22 +0300
[Message part 1 (text/plain, inline)]
On 2024-03-07 18:52, Liliana Marie Prikler wrote:

> Am Donnerstag, dem 07.03.2024 um 11:55 +0300 schrieb Andrew Tropin:
>> Hi Liliana! 
>> 
>> guix time-machine --branch=emacs-team -- shell emacs-pgtk emacs-magit
>> --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
>> 
>> fails with:
>> 
>> --8<---------------cut here---------------start------------->8---
>> [...]
>> --8<---------------cut here---------------end--------------->8---
> I already sent you a patch for that.  Attaching it again.
>
>
> From 19fc252ab7e86ad1443a8d16f68467c61bf23179 Mon Sep 17 00:00:00 2001
> Message-ID: <19fc252ab7e86ad1443a8d16f68467c61bf23179.1709582330.git.liliana.prikler <at> gmail.com>
> From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
> Date: Mon, 4 Mar 2024 20:54:49 +0100
> Subject: [PATCH] aux-files: comp-integrity: Adjust for emacs-pgtk.
>
> * gnu/packages/aux-files/emacs/comp-integrity.el (x-dnd-init-frame): Require
> x-dnd.
> (x-handle-no-bitmap-icon): Only test this if it's bound.
> ---
>  gnu/packages/aux-files/emacs/comp-integrity.el | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/aux-files/emacs/comp-integrity.el b/gnu/packages/aux-files/emacs/comp-integrity.el
> index 9692d9bf97..191e2ddb98 100644
> --- a/gnu/packages/aux-files/emacs/comp-integrity.el
> +++ b/gnu/packages/aux-files/emacs/comp-integrity.el
> @@ -125,5 +125,6 @@
>  (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)
> +(expect-native x-dnd-init-frame x-dnd)
> +(and (boundp 'x-handle-no-bitmap-icon)
> +     (expect-native x-handle-no-bitmap-icon))
>
> base-commit: 3d4fc910f73220f47e5f2459853333a7c83c5d1d
> prerequisite-patch-id: 96ae24a3419fccea142d2726b11ff20e798bfbd0
> prerequisite-patch-id: e908853224bffffa285088dc6e31abaf12c12e02

Yep, with this patch it seems to build correctly.

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 Apr 2024 11:24:28 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.