GNU bug report logs - #76690
[PATCH emacs-team 0/4] Emacs build fixes + enable native comp by default?

Previous Next

Package: guix-patches;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Sun, 2 Mar 2025 20:59:01 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 76690 in the body.
You can then email your comments to 76690 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, csantosb <at> inventati.org, divya <at> subvertising.org, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 20:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Morgan Smith <Morgan.J.Smith <at> outlook.com>:
New bug report received and forwarded. Copy sent to andrew <at> trop.in, csantosb <at> inventati.org, divya <at> subvertising.org, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org. (Sun, 02 Mar 2025 20:59:02 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: guix-patches <at> gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH emacs-team 0/4] Emacs build fixes + enable native comp by
 default?
Date: Sun,  2 Mar 2025 15:52:34 -0500
I got a couple fixes here:

1. simple fix.  plz apply

2. Maybe involves a discussion.  Upstream has enabled native compilation by
default so it'd be nice for us to do the same.  However, this bumps the
closure size of emacs-minimal up by 500MiB which is substantial.  It also
increases compile time of both emacs-minimal and now all emacs packages
substantially.

Note: You can install the other 3 patches and just leave this one out for now
if you'd like.

3 and 4. We have many packages (like emacs-stgit) that have a 'chdir' phase.
This messes with the emacs build system so those packages don't have their
autoloads generated, a description generated, the load path stuff is messed
up, and native compilation files get installed into the wrong directories.


Morgan Smith (4):
  gnu: emacs->emacs-next: Don't use file that doesn't exist
  gnu: emacs-minimal: Enable native compilations
  guix: emacs-build-system: Add 'lisp-directory' key
  Use #:lisp-directory instead of a custom phase

 gnu/packages/agda.scm             |   5 +-
 gnu/packages/cmake.scm            |   7 +-
 gnu/packages/emacs-xyz.scm        | 144 ++++++++--------------------
 gnu/packages/emacs.scm            | 153 +++++++++++++-----------------
 gnu/packages/engineering.scm      |   8 +-
 gnu/packages/erlang.scm           |   5 +-
 gnu/packages/mail.scm             |   6 +-
 gnu/packages/music.scm            |   5 +-
 gnu/packages/protobuf.scm         |   5 +-
 gnu/packages/scheme.scm           |   5 +-
 gnu/packages/version-control.scm  |   4 +-
 guix/build-system/emacs.scm       |   2 +
 guix/build/emacs-build-system.scm |   6 +-
 13 files changed, 120 insertions(+), 235 deletions(-)


base-commit: 725917beddf8454f92d01de7a3cfcc283100f43b
-- 
2.48.1





Information forwarded to andrew <at> trop.in, divya <at> subvertising.org, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:06:01 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: 76690 <at> debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH 1/4] gnu: emacs->emacs-next: Don't use file that doesn't exist
Date: Sun,  2 Mar 2025 16:04:56 -0500
* gnu/packages/emacs.scm(emacs->emacs-next): Remove reference to deleted file
'comp-integrity-next.el'.  It will now use the inherited phase that refers to
an existing file.

Change-Id: Iea026528d2293538ab6d89e02d8d8a2a86fa0f1d
---
 gnu/packages/emacs.scm | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5de87720b4..deebb7282d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -607,28 +607,7 @@ (define* (emacs->emacs-next emacs #:optional name
                                   (string-drop (package-name emacs)
                                                (string-length "emacs"))))))
     (version version)
-    (source source)
-    (arguments
-     (substitute-keyword-arguments (package-arguments emacs)
-       ((#:phases phases)
-        #~(modify-phases #$phases
-            (replace 'validate-comp-integrity
-              (lambda* (#:key outputs #:allow-other-keys)
-                #$(cond
-                   ((%current-target-system)
-                    #~(display
-                       "Cannot validate native compilation on cross builds.\n"))
-                   ((member (%current-system) '("armhf-linux" "i686-linux"))
-                    #~(display "Integrity test is broken on 32 bit systems.\n"))
-                   (else
-                    #~(invoke
-                       (string-append (assoc-ref outputs "out") "/bin/emacs")
-                       "--batch"
-                       "--load"
-                       #$(local-file
-                          (search-auxiliary-file
-                           "emacs/comp-integrity-next.el"))
-                       "-f" "ert-run-tests-batch-and-exit")))))))))))
+    (source source)))
 
 (define-public emacs-next (emacs->emacs-next emacs))
 (define-public emacs-next-pgtk (emacs->emacs-next emacs-pgtk))
-- 
2.48.1





Information forwarded to andrew <at> trop.in, divya <at> subvertising.org, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:06:02 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: 76690 <at> debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH 2/4] gnu: emacs-minimal: Enable native compilations
Date: Sun,  2 Mar 2025 16:04:57 -0500
* gnu/packages/emacs.scm(emacs-no-x): Move native compilation settings from
here to ...
(emacs-minimal): ... here.

Change-Id: Ib549f0e7435cab0c891bb8d6cec9b1af041ab7c4
---
 gnu/packages/emacs.scm | 130 ++++++++++++++++++++---------------------
 1 file changed, 64 insertions(+), 66 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index deebb7282d..1e0c046989 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -154,7 +154,8 @@ (define-public emacs-minimal
      (list
       #:tests? #f                       ; no check target
       #:modules (%emacs-modules build-system)
-      #:configure-flags #~(list "--with-gnutls=no" "--disable-build-details")
+      #:configure-flags #~(list "--with-native-compilation=aot"
+                                "--with-gnutls=no" "--disable-build-details")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'enable-elogind
@@ -239,6 +240,57 @@ (define-public emacs-minimal
               (substitute* (find-files "." "^Makefile\\.in$")
                 (("/bin/pwd")
                  "pwd"))))
+          (add-after 'set-paths 'set-libgccjit-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (define (first-subdirectory/absolute directory)
+                (let ((files (scandir
+                              directory
+                              (lambda (file)
+                                (and (not (member file '("." "..")))
+                                     (file-is-directory? (string-append
+                                                          directory "/"
+                                                          file)))))))
+                  (and (not (null? files))
+                       (string-append directory "/" (car files)))))
+              (let* ((libgccjit-libdir
+                      (first-subdirectory/absolute ;; version
+                       (first-subdirectory/absolute ;; host type
+                        (search-input-directory inputs "lib/gcc")))))
+                (setenv "LIBRARY_PATH"
+                        (string-append (getenv "LIBRARY_PATH")
+                                       ":" libgccjit-libdir)))))
+          (add-after 'unpack 'patch-compilation-driver
+            (lambda _
+              (substitute* "lisp/emacs-lisp/comp.el"
+                (("\\(defcustom native-comp-driver-options nil")
+                 (format
+                  #f "(defcustom native-comp-driver-options '(~@{~s~^ ~})"
+                  (string-append
+                   "-B" #$(this-package-input "binutils") "/bin/")
+                  (string-append
+                   "-B" #$(this-package-input "glibc") "/lib/")
+                  (string-append
+                   "-B" #$(this-package-input "libgccjit") "/lib/")
+                  (string-append
+                   "-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)))
+          (add-after 'validate-runpath 'validate-comp-integrity
+            (lambda* (#:key outputs #:allow-other-keys)
+              #$(cond
+                 ((%current-target-system)
+                  #~(display "Cannot validate native-comp on cross builds.\n"))
+                 ((member (%current-system) '("armhf-linux" "i686-linux"))
+                  #~(display "Integrity test is broken on armhf.\n"))
+                 (else
+                  #~(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")))))
           (add-after 'install 'install-site-start
             ;; Use 'guix-emacs' in "site-start.el", which is used autoload the
             ;; Elisp packages found in EMACSLOADPATH.
@@ -308,10 +360,17 @@ (define-public emacs-minimal
                 (copy-file
                  (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
                  "bin/emacs")))))))
-    (inputs (list bash-minimal coreutils findutils gawk gzip ncurses sed))
+    (inputs (list bash-minimal coreutils findutils gawk gzip ncurses sed
+                  ;; To "unshadow" ld-wrapper in native builds
+                  (make-ld-wrapper "ld-wrapper" #:binutils binutils)
+                  ;; For native compilation
+                  binutils
+                  (libc-for-target)
+                  libgccjit
+                  zlib))
     (native-inputs (list autoconf pkg-config texinfo))
     (home-page "https://www.gnu.org/software/emacs/")
-    (synopsis "The extensible text editor (minimal build for byte-compilation)")
+    (synopsis "The extensible text editor (minimal build for elisp compilation)")
     (description
      "GNU Emacs is an extensible and highly customizable text editor.  It is
 based on an Emacs Lisp interpreter with extensions for text editing.  Emacs
@@ -346,70 +405,10 @@ (define-public emacs-no-x
     (arguments
      (substitute-keyword-arguments (package-arguments emacs-minimal)
        ((#:configure-flags flags #~'())
-        #~(cons* "--with-modules" "--with-native-compilation=aot"
-                 (delete "--with-gnutls=no" #$flags)))
-       ((#:phases phases)
-        #~(modify-phases #$phases
-            (add-after 'set-paths 'set-libgccjit-path
-              (lambda* (#:key inputs #:allow-other-keys)
-                (define (first-subdirectory/absolute directory)
-                  (let ((files (scandir
-                                directory
-                                (lambda (file)
-                                  (and (not (member file '("." "..")))
-                                       (file-is-directory? (string-append
-                                                            directory "/"
-                                                            file)))))))
-                    (and (not (null? files))
-                         (string-append directory "/" (car files)))))
-                (let* ((libgccjit-libdir
-                        (first-subdirectory/absolute ;; version
-                         (first-subdirectory/absolute ;; host type
-                          (search-input-directory inputs "lib/gcc")))))
-                  (setenv "LIBRARY_PATH"
-                          (string-append (getenv "LIBRARY_PATH")
-                                         ":" libgccjit-libdir)))))
-            (add-after 'unpack 'patch-compilation-driver
-              (lambda _
-                (substitute* "lisp/emacs-lisp/comp.el"
-                  (("\\(defcustom native-comp-driver-options nil")
-                   (format
-                    #f "(defcustom native-comp-driver-options '(~@{~s~^ ~})"
-                    (string-append
-                     "-B" #$(this-package-input "binutils") "/bin/")
-                    (string-append
-                     "-B" #$(this-package-input "glibc") "/lib/")
-                    (string-append
-                     "-B" #$(this-package-input "libgccjit") "/lib/")
-                    (string-append
-                     "-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)))
-            (add-after 'validate-runpath 'validate-comp-integrity
-              (lambda* (#:key outputs #:allow-other-keys)
-                #$(cond
-                   ((%current-target-system)
-                    #~(display "Cannot validate native-comp on cross builds.\n"))
-                   ((member (%current-system) '("armhf-linux" "i686-linux"))
-                    #~(display "Integrity test is broken on armhf.\n"))
-                   (else
-                    #~(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")))))))))
+        #~(cons* "--with-modules" (delete "--with-gnutls=no" #$flags)))))
     (inputs
      (modify-inputs (package-inputs emacs-minimal)
        (prepend gnutls
-                ;; To "unshadow" ld-wrapper in native builds
-                (make-ld-wrapper "ld-wrapper" #:binutils binutils)
-                ;; For native compilation
-                binutils
-                (libc-for-target)
-                libgccjit
 
                 ;; Avoid Emacs's limited movemail substitute that retrieves POP3
                 ;; email only via insecure channels.
@@ -429,8 +428,7 @@ (define-public emacs-no-x
                 libxml2
                 m17n-lib
                 sqlite
-                tree-sitter
-                zlib)))))
+                tree-sitter)))))
 
 (define-public emacs
   (package/inherit emacs-no-x
-- 
2.48.1





Information forwarded to andrew <at> trop.in, divya <at> subvertising.org, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:06:03 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: 76690 <at> debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH 3/4] guix: emacs-build-system: Add 'lisp-directory' key
Date: Sun,  2 Mar 2025 16:04:58 -0500
* guix/build-system/emacs.scm(emacs-build): Add 'lisp-directory' key.
* guix/build/emacs-build-system.scm(unpack): Change into 'lisp-directory'
after unpacking.

Change-Id: I3991af7188de72b29b1c6985ffe7185216cedb35
---
 guix/build-system/emacs.scm       | 2 ++
 guix/build/emacs-build-system.scm | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index 06eec43ec4..27a029f258 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -87,6 +87,7 @@ (define* (emacs-build name inputs
                       (test-command ''("make" "check"))
                       (phases '%standard-phases)
                       (outputs '("out"))
+                      (lisp-directory ".")
                       (include (quote %default-include))
                       (exclude (quote %default-exclude))
                       (search-paths '())
@@ -105,6 +106,7 @@ (define* (emacs-build name inputs
           (use-modules #$@(sexp->gexp modules))
           (emacs-build #:name #$name
                        #:source #+source
+                       #:lisp-directory #$lisp-directory
                        #:system #$system
                        #:test-command #$test-command
                        #:tests? #$tests?
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index aa083c6409..4e52122f22 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -67,7 +67,7 @@ (define (store-file->elisp-source-file file)
                     (strip-store-file-name file) suffix))))
       (string-append name suffix))))
 
-(define* (unpack #:key source #:allow-other-keys)
+(define* (unpack #:key source lisp-directory #:allow-other-keys)
   "Unpack SOURCE into the build directory.  SOURCE may be a compressed
 archive, a directory, or an Emacs Lisp file."
   (if (string-suffix? ".el" source)
@@ -76,7 +76,9 @@ (define* (unpack #:key source #:allow-other-keys)
         (chdir "source")
         (copy-file source (store-file->elisp-source-file source))
         #t)
-      (gnu:unpack #:source source)))
+      (begin
+        (gnu:unpack #:source source)
+        (chdir lisp-directory))))
 
 (define* (expand-load-path #:key (prepend-source? #t) #:allow-other-keys)
   "Expand EMACSLOADPATH, so that inputs, whose code resides in subdirectories,
-- 
2.48.1





Information forwarded to andrew <at> trop.in, csantosb <at> inventati.org, divya <at> subvertising.org, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:06:04 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: 76690 <at> debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH 4/4] Use #:lisp-directory instead of a custom phase
Date: Sun,  2 Mar 2025 16:04:59 -0500
Using a custom phase might not order the 'chdir' at the correct time and might
cause problems with some of the early phases in the 'emacs-build-system' (like
'ensure-package-description', 'expand-load-path', etc...)

* gnu/packages/agda.scm (emacs-agda2-mode):
* gnu/packages/cmake.scm (emacs-cmake-mode):
* gnu/packages/emacs-xyz.scm (emacs-casual-avy, emacs-casual-calc,
emacs-casual-dired, emacs-casual-info, emacs-chronometrist, emacs-edit-server,
emacs-epkg, emacs-exwm-firefox, emacs-flymake-collection, emacs-forge,
emacs-ghub, emacs-know-your-http-well, emacs-org-contrib, emacs-php-mode,
emacs-stumpwm-mode, emacs-telega-contrib, emacs-transient, emacs-treemacs,
emacs-treemacs-extra, emacs-with-editor, emacs-xenops):
* gnu/packages/engineering.scm (emacs-scad-mode):
* gnu/packages/erlang.scm (emacs-erlang):
* gnu/packages/mail.scm (emacs-notmuch):
* gnu/packages/music.scm (emacs-lilypond-mode):
* gnu/packages/protobuf.scm (emacs-protobuf-mode):
* gnu/packages/scheme.scm (emacs-gerbil-mode):
* gnu/packages/version-control.scm (emacs-stgit): Use '#:lisp-directory'
instead of a custom phase.
---
 gnu/packages/agda.scm            |   5 +-
 gnu/packages/cmake.scm           |   7 +-
 gnu/packages/emacs-xyz.scm       | 144 +++++++++----------------------
 gnu/packages/engineering.scm     |   8 +-
 gnu/packages/erlang.scm          |   5 +-
 gnu/packages/mail.scm            |   6 +-
 gnu/packages/music.scm           |   5 +-
 gnu/packages/protobuf.scm        |   5 +-
 gnu/packages/scheme.scm          |   5 +-
 gnu/packages/version-control.scm |   4 +-
 10 files changed, 49 insertions(+), 145 deletions(-)

diff --git a/gnu/packages/agda.scm b/gnu/packages/agda.scm
index c20549888d..ff23278469 100644
--- a/gnu/packages/agda.scm
+++ b/gnu/packages/agda.scm
@@ -150,10 +150,7 @@ (define-public emacs-agda2-mode
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'enter-elisp-dir
-            (lambda _ (chdir "src/data/emacs-mode"))))))
+      #:lisp-directory "src/data/emacs-mode"))
     (home-page "https://agda.readthedocs.io/en/latest/tools/emacs-mode.html")
     (synopsis "Emacs mode for Agda")
     (description "This Emacs mode enables interactive development with
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 1ddcfa4d80..8c1ee61338 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -532,12 +532,7 @@ (define-public emacs-cmake-mode
     (outputs '("out"))
     (build-system emacs-build-system)
     (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'chdir-elisp
-                 ;; Elisp directory is not in root of the source.
-                 (lambda _
-                   (chdir "Auxiliary"))))))
+     (list #:lisp-directory "Auxiliary"))
     (synopsis "Emacs major mode for editing Cmake expressions")
     (description "@code{cmakeos-mode} provides an Emacs major mode for editing
 Cmake files.  It supports syntax highlighting, indenting and refilling of
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 272be3a275..9bd0846a55 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1703,11 +1703,9 @@ (define-public emacs-with-editor
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "lisp"
       #:phases
       #~(modify-phases %standard-phases
-          (add-before 'install 'enter-lisp-directory
-            (lambda _
-              (chdir "lisp")))
           (add-before 'install 'make-info
             (lambda _
               (with-directory-excursion "../docs"
@@ -2679,20 +2677,12 @@ (define-public emacs-ghub
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "lisp"
       #:phases
       #~(modify-phases %standard-phases
           (add-before 'install 'make-info
             (lambda _
-              (invoke "make" "info")))
-          (add-after 'make-info 'enter-lisp-directory
-            (lambda _
-              (chdir "lisp")))
-          (add-after 'expand-load-path 'add-el-dir-to-emacs-load-path
-            (lambda _
-              (setenv "EMACSLOADPATH"
-                      (string-append (getcwd)
-                                     "/lisp:"
-                                     (getenv "EMACSLOADPATH")))))
+              (invoke "make" "--directory=.." "info")))
           (add-after 'install 'install-info
             (lambda _
               (let ((info (string-append #$output "/share/info")))
@@ -3143,12 +3133,10 @@ (define-public emacs-flymake-collection
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "src"
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _
-              (chdir "src")))
-          (add-after 'chdir 'move-checkers
+          (add-after 'unpack 'move-checkers
             (lambda _
               ;; Move checkers to the top level, which is in the
               ;; EMACSLOADPATH.
@@ -5046,12 +5034,12 @@ (define-public emacs-xenops
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "lisp"
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
+          (add-after 'unpack 'set-home
             (lambda _
-              (setenv "HOME" "/tmp")
-              (chdir "lisp"))))))
+              (setenv "HOME" "/tmp"))))))
     (synopsis "WYSIWYG LaTeX environment")
     (description "This package provides a WYSIWYG LaTeX environment.
 It uses @command{dvisvgm}, @command{xclip}, @command{pngpaste} and
@@ -5337,12 +5325,9 @@ (define-public emacs-chronometrist
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "elisp"
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir-elisp
-            ;; Elisp directory is not in root of the source.
-            (lambda _
-              (chdir "elisp")))
           (add-after 'install 'install-doc
             ;; Documentation consists of several Markdown files.
             (lambda _
@@ -18593,11 +18578,7 @@ (define-public emacs-org-contrib
         (base32 "08m3aa8vsrlkacbvindjwqzviv5r8i9a0vzsrl8rx01xq5b0zd42"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'enter-source-directory
-           (lambda _
-             (chdir "lisp"))))))
+     (list #:lisp-directory "lisp"))
     (propagated-inputs
      (list emacs-org))
     (home-page "https://git.sr.ht/~bzg/org-contrib")
@@ -20870,6 +20851,7 @@ (define-public emacs-php-mode
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "lisp"
       #:tests? #true
       #:test-command #~(list "emacs" "-Q" "--batch"
                              "-l" "../tests/php-mode-test.el"
@@ -20879,11 +20861,8 @@ (define-public emacs-php-mode
           (add-after 'unpack 'prepare-testing-bed
             (lambda _
               ;; This file is necessary for `php-project-root' test.
-              (call-with-output-file "tests/project/1/.git"
-                (const #t))))
-          (add-after 'prepare-testing-bed 'enter-source-directory
-            (lambda _
-              (chdir "lisp"))))))
+              (call-with-output-file "../tests/project/1/.git"
+                (const #t)))))))
     (propagated-inputs (list emacs-projectile))
     (synopsis "Major mode for editing PHP code")
     (description
@@ -25026,26 +25005,17 @@ (define-public emacs-epkg
         (base32 "0zdlymx44jgrzm68cnh636mpdazihqiakf5m3v1c2rhvh6cb6yg6"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
+     `(#:lisp-directory "lisp"
+       #:phases
        (modify-phases %standard-phases
          (add-before 'install 'make-info
            ;; Documentation is located in "docs/".
            (lambda* (#:key outputs #:allow-other-keys)
-             (with-directory-excursion "docs"
+             (with-directory-excursion "../docs"
                (invoke "makeinfo" "-o" "epkg.info" "epkg.texi")
                (let ((info (string-append (assoc-ref outputs "out")
                                           "/share/info")))
-                 (install-file "epkg.info" info)))))
-         (add-after 'make-info 'move-to-lisp-directory
-           ;; Source code is located in "lisp/".
-           (lambda _
-             (chdir "lisp")))
-         (add-after 'expand-load-path 'add-el-dir-to-emacs-load-path
-           (lambda _
-             (setenv "EMACSLOADPATH"
-                     (string-append (getcwd)
-                                    "/lisp:"
-                                    (getenv "EMACSLOADPATH"))))))))
+                 (install-file "epkg.info" info))))))))
     (native-inputs
      (list texinfo))
     (propagated-inputs
@@ -26522,12 +26492,7 @@ (define-public emacs-edit-server
         (base32 "0m7gj224sqxjjw5sxky92fnrxg9jy4nf33kwf0aqxnfhqlgh545k"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'chdir-elisp
-           ;; Elisp directory is not in root of the source.
-           (lambda _
-             (chdir "servers"))))))
+     (list #:lisp-directory "servers"))
     (propagated-inputs (list emacs-ert-async))
     (home-page "https://github.com/stsquad/emacs_chrome")
     (synopsis "Server that responds to edit requests from Chromium")
@@ -27449,20 +27414,17 @@ (define-public emacs-know-your-http-well
        (sha256
         (base32 "1p4ibx0qgznv8ard4a9m7345ay8ij2qzmqdqiqlllndqq6mz62x5"))))
     (arguments
-     `(#:phases
+     `(#:lisp-directory "emacs"
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'install-json-files
            (lambda* (#:key outputs #:allow-other-keys)
              (for-each (lambda (directory)
-                         (copy-recursively directory
+                         (copy-recursively (string-append "../" directory)
                                            (string-append
-                                            (assoc-ref outputs "out")
+                                            (assoc-ref outputs "out") "/"
                                             directory)))
-                       '("js" "json"))))
-         (add-after 'unpack 'chdir-elisp
-           ;; Elisp directory is not in root of the source.
-           (lambda _
-             (chdir "emacs"))))))
+                       '("js" "json")))))))
     (build-system emacs-build-system)
     (home-page "https://github.com/for-GET/know-your-http-well")
     (synopsis "Meaning of HTTP headers codes")
@@ -28285,12 +28247,7 @@ (define-public emacs-stumpwm-mode
                   "0giac390bq95ag41xkxqp8jjrhfx1wpgglz7jg5rkm0wjhcwmyml"))))
       (build-system emacs-build-system)
       (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-after 'unpack 'chdir-elisp
-             ;; Elisp directory is not in root of the source.
-             (lambda _
-               (chdir "util/swm-emacs"))))))
+       (list #:lisp-directory "util/swm-emacs"))
       (home-page "https://github.com/stumpwm/stumpwm-contrib")
       (synopsis "Emacs minor-mode for Stumpwm")
       (description "Emacs minor-mode for Stumpwm")
@@ -33318,20 +33275,17 @@ (define-public emacs-treemacs
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "src/elisp"
       #:tests? #t
       #:test-command #~(list "make" "-C" "../.." "test")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'fix-makefile
             (lambda _
-              (substitute* "Makefile"
+              (substitute* "../../Makefile"
                 (("@\\$\\(CASK\\) exec ") "")
                 ;; Guix does not need to prepare dependencies before testing.
                 (("test: prepare") "test:"))))
-          (add-after 'fix-makefile 'chdir-elisp
-            ;; Elisp directory is not in root of the source.
-            (lambda _
-              (chdir "src/elisp")))
           (add-before 'install 'patch-paths
             (lambda* (#:key inputs #:allow-other-keys)
               (make-file-writable "treemacs-core-utils.el")
@@ -33390,7 +33344,7 @@ (define-public emacs-treemacs-extra
          (package-arguments emacs-treemacs)
        ((#:phases phases)
         #~(modify-phases #$phases
-            (add-after 'chdir-elisp 'copy-extra
+            (add-after 'unpack 'copy-extra
               (lambda _
                 (copy-recursively "../extra" ".")))))))
     (propagated-inputs
@@ -33727,16 +33681,14 @@ (define-public emacs-transient
     (build-system emacs-build-system)
     (arguments
      `(#:tests? #f ;no test suite
+       #:lisp-directory "lisp"
        #:phases (modify-phases %standard-phases
                   (add-after 'unpack 'build-info-manual
                     (lambda _
-                      (invoke "make" "info")
+                      (invoke "make" "--directory=.." "info")
                       ;; Move the info file to lisp so that it gets
                       ;; installed by the emacs-build-system.
-                      (rename-file "docs/transient.info" "lisp/transient.info")))
-                  (add-after 'build-info-manual 'enter-lisp-directory
-                    (lambda _
-                      (chdir "lisp"))))))
+                      (rename-file "../docs/transient.info" "transient.info"))))))
     (native-inputs (list texinfo))
     (propagated-inputs (list emacs-compat))
     (home-page "https://magit.vc/manual/transient")
@@ -33765,17 +33717,15 @@ (define-public emacs-forge
      (build-system emacs-build-system)
      (arguments
       `(#:tests? #f                     ;no tests
+        #:lisp-directory "lisp"
         #:phases
         (modify-phases %standard-phases
           (add-after 'unpack 'build-info-manual
             (lambda _
-              (invoke "make" "info")
+              (invoke "make" "--directory=.." "info")
               ;; Move the info file to lisp so that it gets installed by the
               ;; emacs-build-system.
-              (rename-file "docs/forge.info" "lisp/forge.info")))
-          (add-after 'build-info-manual 'chdir-lisp
-            (lambda _
-              (chdir "lisp"))))))
+              (rename-file "../docs/forge.info" "forge.info"))))))
      (native-inputs
       (list texinfo))
      (propagated-inputs
@@ -34358,10 +34308,7 @@ (define-public emacs-exwm-firefox
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _ (chdir "lisp"))))
+      #:lisp-directory "lisp"
       #:tests? #true
       #:test-command #~(list "emacs" "-Q" "--batch"
                              "-l" "../test/exwm-firefox--tests.el"
@@ -34962,10 +34909,7 @@ (define-public emacs-casual-avy
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _ (chdir "lisp"))))))
+      #:lisp-directory "lisp"))
     (propagated-inputs (list emacs-casual-lib emacs-avy))
     (home-page "https://github.com/kickingvegas/casual-avy")
     (synopsis "Transient-based porcelain for avy")
@@ -34989,10 +34933,7 @@ (define-public emacs-casual-calc
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _ (chdir "lisp"))))))
+      #:lisp-directory "lisp"))
     (propagated-inputs (list emacs-casual-lib))
     (home-page "https://github.com/kickingvegas/casual-calc")
     (synopsis "Transient-based porcelain for calc")
@@ -35016,10 +34957,7 @@ (define-public emacs-casual-dired
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _ (chdir "lisp"))))))
+      #:lisp-directory "lisp"))
     (propagated-inputs (list emacs-casual-lib))
     (home-page "https://github.com/kickingvegas/casual-dired")
     (synopsis "Transient-based porcelain for Dired")
@@ -35043,10 +34981,7 @@ (define-public emacs-casual-info
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _ (chdir "lisp"))))))
+      #:lisp-directory "lisp"))
     (propagated-inputs (list emacs-casual-lib))
     (home-page "https://github.com/kickingvegas/casual-info")
     (synopsis "Transient-based porcelain for info reader")
@@ -37641,11 +37576,10 @@ (define-public emacs-telega-contrib
     (name "emacs-telega-contrib")
     (arguments
      (list
+      #:lisp-directory "contrib"
       #:exclude #~(list "telega-live-location.el")
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'enter-subdirectory
-            (lambda _ (chdir "contrib")))
           (add-before 'install-license-files 'leave-subdirectory
             (lambda _ (chdir ".."))))))
     (inputs '())
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 234f4a2b03..3442705149 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -3121,13 +3121,7 @@ (define-public emacs-scad-mode
     (inputs '())
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'chdir-elisp
-           ;; Elisp directory is not in root of the source.
-           (lambda _
-             (chdir "contrib")
-             #t)))))
+     (list #:lisp-directory "contrib"))
     (synopsis "Emacs major mode for editing editing OpenSCAD code")
     (description "@code{scad-mode} provides an Emacs major mode for editing
 OpenSCAD code.  It supports syntax highlighting, indenting and refilling of
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 8ca46e8bdc..0d86863c94 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -204,10 +204,7 @@ (define-public emacs-erlang
     (source (package-source erlang))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'expand-load-path 'change-working-directory
-           (lambda _ (chdir "lib/tools/emacs") #t)))))
+     (list #:lisp-directory "lib/tools/emacs"))
     (home-page "https://www.erlang.org/")
     (synopsis "Erlang major mode for Emacs")
     (description
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index cffbca087a..16763ebd44 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1533,14 +1533,12 @@ (define-public emacs-notmuch
      (list notmuch))
     (arguments
      (list
+      #:lisp-directory "emacs"
       #:exclude #~(cons* "make-deps.el" "rstdoc.el" %default-exclude)
       #:include #~(cons* "notmuch-logo.svg" %default-include)
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'chdir
-            (lambda _
-              (chdir "emacs")))
-          (add-after 'chdir 'patch-paths
+          (add-after 'unpack 'patch-paths
             (lambda* (#:key inputs #:allow-other-keys)
               (let ((notmuch (search-input-file inputs "/bin/notmuch")))
                 (substitute* "notmuch-lib.el"
diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index bf47489d34..b8a6a2375f 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1759,10 +1759,7 @@ (define-public emacs-lilypond-mode
     (build-system emacs-build-system)
     (arguments
      (list
-      #:phases
-      #~(modify-phases %standard-phases
-          (add-before 'expand-load-path 'change-working-directory
-            (lambda _ (chdir "elisp"))))))
+      #:lisp-directory "elisp"))
     (home-page (package-home-page lilypond))
     (synopsis "Major mode for editing GNU LilyPond music scores")
     (description
diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm
index d4b48e585b..310fd1dde0 100644
--- a/gnu/packages/protobuf.scm
+++ b/gnu/packages/protobuf.scm
@@ -579,10 +579,7 @@ (define-public emacs-protobuf-mode
     (source (package-source protobuf))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'expand-load-path 'change-working-directory
-           (lambda _ (chdir "editors") #t)))))
+     (list #:lisp-directory "editors"))
     (home-page "https://github.com/protocolbuffers/protobuf")
     (synopsis "Protocol buffers major mode for Emacs")
     (description
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 811f74e6d6..8340198135 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -1346,10 +1346,7 @@ (define-public emacs-gerbil-mode
     (version "1.0")
     (build-system emacs-build-system)
     (arguments
-     (list #:phases #~(modify-phases %standard-phases
-                        (add-before 'install 'change-directory
-                          (lambda _
-                            (chdir "etc"))))))
+     (list #:lisp-directory "etc"))
     (synopsis "Emacs major-mode for editing Gerbil code")
     (description
      "Gerbil mode provides font-lock, indentation, navigation, and REPL for
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9ecb5cf98a..068b7f41d5 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -2170,11 +2170,9 @@ (define-public emacs-stgit
     (build-system emacs-build-system)
     (arguments
      (list
+      #:lisp-directory "contrib"
       #:phases
       #~(modify-phases %standard-phases
-          (add-before 'install 'enter-lisp-directory
-            (lambda _
-              (chdir "contrib")))
           (add-before 'install-license-files 'leave-lisp-directory
             (lambda _
               (chdir ".."))))))
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:09:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 76690 <at> debbugs.gnu.org
Cc: Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Ian Eure <ian <at> retrospec.tv>, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#76690] [PATCH 2/4] gnu: emacs-minimal: Enable native
 compilations
Date: Sun, 02 Mar 2025 22:09:17 +0100
Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
> * gnu/packages/emacs.scm(emacs-no-x): Move native compilation
> settings from
> here to ...
> (emacs-minimal): ... here.
> 
> Change-Id: Ib549f0e7435cab0c891bb8d6cec9b1af041ab7c4
> ---
Note: enabling native compilation for emacs-minimal will likely not do
what you think it does.  Unless you use emacs-minimal itself as your
emacs (rather than e.g. emacs-no-x), you will not see any benefit from
this patch.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:10:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 76690 <at> debbugs.gnu.org
Cc: Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Ian Eure <ian <at> retrospec.tv>, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#76690] [PATCH 1/4] gnu: emacs->emacs-next: Don't use file
 that doesn't exist
Date: Sun, 02 Mar 2025 22:09:53 +0100
Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
> * gnu/packages/emacs.scm(emacs->emacs-next): Remove reference to
> deleted file 'comp-integrity-next.el'.  It will now use the inherited
> phase that refers to an existing file.
> 
> Change-Id: Iea026528d2293538ab6d89e02d8d8a2a86fa0f1d
> ---
Nice catch.

Thanks




Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:14:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 76690 <at> debbugs.gnu.org
Cc: Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Ian Eure <ian <at> retrospec.tv>, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#76690] [PATCH 3/4] guix: emacs-build-system: Add
 'lisp-directory' key
Date: Sun, 02 Mar 2025 22:13:54 +0100
Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
> * guix/build-system/emacs.scm(emacs-build): Add 'lisp-directory' key.
> * guix/build/emacs-build-system.scm(unpack): Change into 'lisp-
> directory'
> after unpacking.
> 
> Change-Id: I3991af7188de72b29b1c6985ffe7185216cedb35
> ---
>  guix/build-system/emacs.scm       | 2 ++
>  guix/build/emacs-build-system.scm | 6 ++++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/guix/build-system/emacs.scm b/guix/build-
> system/emacs.scm
> index 06eec43ec4..27a029f258 100644
> --- a/guix/build-system/emacs.scm
> +++ b/guix/build-system/emacs.scm
> @@ -87,6 +87,7 @@ (define* (emacs-build name inputs
>                        (test-command ''("make" "check"))
>                        (phases '%standard-phases)
>                        (outputs '("out"))
> +                      (lisp-directory ".")
>                        (include (quote %default-include))
>                        (exclude (quote %default-exclude))
>                        (search-paths '())
> @@ -105,6 +106,7 @@ (define* (emacs-build name inputs
>            (use-modules #$@(sexp->gexp modules))
>            (emacs-build #:name #$name
>                         #:source #+source
> +                       #:lisp-directory #$lisp-directory
>                         #:system #$system
>                         #:test-command #$test-command
>                         #:tests? #$tests?
> diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-
> build-system.scm
> index aa083c6409..4e52122f22 100644
> --- a/guix/build/emacs-build-system.scm
> +++ b/guix/build/emacs-build-system.scm
> @@ -67,7 +67,7 @@ (define (store-file->elisp-source-file file)
>                      (strip-store-file-name file) suffix))))
>        (string-append name suffix))))
>  
> -(define* (unpack #:key source #:allow-other-keys)
> +(define* (unpack #:key source lisp-directory #:allow-other-keys)
>    "Unpack SOURCE into the build directory.  SOURCE may be a
> compressed
>  archive, a directory, or an Emacs Lisp file."
>    (if (string-suffix? ".el" source)
> @@ -76,7 +76,9 @@ (define* (unpack #:key source #:allow-other-keys)
>          (chdir "source")
>          (copy-file source (store-file->elisp-source-file source))
>          #t)
> -      (gnu:unpack #:source source)))
> +      (begin
> +        (gnu:unpack #:source source)
> +        (chdir lisp-directory))))
I would use (and=> lisp-directory chdir) and allow chdir to be #f.

Cheers

Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:16:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 76690 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Cayetano Santos <csantosb <at> inventati.org>, Andrew Tropin <andrew <at> trop.in>,
 Divya Ranjan Pattanaik <divya <at> subvertising.org>
Subject: Re: [bug#76690] [PATCH 4/4] Use #:lisp-directory instead of a
 custom phase
Date: Sun, 02 Mar 2025 22:16:14 +0100
Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
> Using a custom phase might not order the 'chdir' at the correct time
> and might
> cause problems with some of the early phases in the 'emacs-build-
> system' (like
> 'ensure-package-description', 'expand-load-path', etc...)
> 
> * gnu/packages/agda.scm (emacs-agda2-mode):
> * gnu/packages/cmake.scm (emacs-cmake-mode):
> * gnu/packages/emacs-xyz.scm (emacs-casual-avy, emacs-casual-calc,
> emacs-casual-dired, emacs-casual-info, emacs-chronometrist, emacs-
> edit-server,
> emacs-epkg, emacs-exwm-firefox, emacs-flymake-collection, emacs-
> forge,
> emacs-ghub, emacs-know-your-http-well, emacs-org-contrib, emacs-php-
> mode,
> emacs-stumpwm-mode, emacs-telega-contrib, emacs-transient, emacs-
> treemacs,
> emacs-treemacs-extra, emacs-with-editor, emacs-xenops):
> * gnu/packages/engineering.scm (emacs-scad-mode):
> * gnu/packages/erlang.scm (emacs-erlang):
> * gnu/packages/mail.scm (emacs-notmuch):
> * gnu/packages/music.scm (emacs-lilypond-mode):
> * gnu/packages/protobuf.scm (emacs-protobuf-mode):
> * gnu/packages/scheme.scm (emacs-gerbil-mode):
> * gnu/packages/version-control.scm (emacs-stgit): Use '#:lisp-
> directory'
> instead of a custom phase.
> ---
Note: ChangeLog continuation lines should end with a closing
parenthesis.
Each file should have a message, even if that is "Likewise."

Not sure if one patch is the right approach here.  I think one patch
per package might be a better idea.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 21:52:02 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <morgan.j.smith <at> outlook.com>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>, 76690 <at> debbugs.gnu.org,
 Ian Eure <ian <at> retrospec.tv>, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#76690] [PATCH 2/4] gnu: emacs-minimal: Enable native
 compilations
Date: Sun, 02 Mar 2025 16:51:42 -0500
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
>> * gnu/packages/emacs.scm(emacs-no-x): Move native compilation
>> settings from
>> here to ...
>> (emacs-minimal): ... here.
>> 
>> Change-Id: Ib549f0e7435cab0c891bb8d6cec9b1af041ab7c4
>> ---
> Note: enabling native compilation for emacs-minimal will likely not do
> what you think it does.  Unless you use emacs-minimal itself as your
> emacs (rather than e.g. emacs-no-x), you will not see any benefit from
> this patch.

emacs-minimal is the default-emacs in the emacs-build-system.
Currently, we disable native-compilation of loaded elisp because we want
to use the ahead-of-time native compilation that occurs when building a
package.  However, if we don't build our packages with an emacs that
supports native compilation, then we are effectively disabling the
native compliation feature for all packages.

>
> Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Sun, 02 Mar 2025 22:22:01 GMT) Full text and rfc822 format available.

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

From: Morgan Smith <morgan.j.smith <at> outlook.com>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Cayetano Santos <csantosb <at> inventati.org>, Andrew Tropin <andrew <at> trop.in>,
 76690 <at> debbugs.gnu.org, Divya Ranjan Pattanaik <divya <at> subvertising.org>
Subject: Re: [bug#76690] [PATCH 4/4] Use #:lisp-directory instead of a
 custom phase
Date: Sun, 02 Mar 2025 17:20:36 -0500
[Message part 1 (text/plain, inline)]
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
>> Using a custom phase might not order the 'chdir' at the correct time
>> and might
>> cause problems with some of the early phases in the 'emacs-build-
>> system' (like
>> 'ensure-package-description', 'expand-load-path', etc...)
>> 
>> * gnu/packages/agda.scm (emacs-agda2-mode):
>> * gnu/packages/cmake.scm (emacs-cmake-mode):
>> * gnu/packages/emacs-xyz.scm (emacs-casual-avy, emacs-casual-calc,
>> emacs-casual-dired, emacs-casual-info, emacs-chronometrist, emacs-
>> edit-server,
>> emacs-epkg, emacs-exwm-firefox, emacs-flymake-collection, emacs-
>> forge,
>> emacs-ghub, emacs-know-your-http-well, emacs-org-contrib, emacs-php-
>> mode,
>> emacs-stumpwm-mode, emacs-telega-contrib, emacs-transient, emacs-
>> treemacs,
>> emacs-treemacs-extra, emacs-with-editor, emacs-xenops):
>> * gnu/packages/engineering.scm (emacs-scad-mode):
>> * gnu/packages/erlang.scm (emacs-erlang):
>> * gnu/packages/mail.scm (emacs-notmuch):
>> * gnu/packages/music.scm (emacs-lilypond-mode):
>> * gnu/packages/protobuf.scm (emacs-protobuf-mode):
>> * gnu/packages/scheme.scm (emacs-gerbil-mode):
>> * gnu/packages/version-control.scm (emacs-stgit): Use '#:lisp-
>> directory'
>> instead of a custom phase.
>> ---
> Note: ChangeLog continuation lines should end with a closing
> parenthesis.
> Each file should have a message, even if that is "Likewise."
>
> Not sure if one patch is the right approach here.  I think one patch
> per package might be a better idea.

I've attached the relevant patches to this email.  Let me know if you'd
rather I use 'git send-email' (and how I should do that without filling
up everyone's inbox).

>
> I would use (and=> lisp-directory chdir) and allow chdir to be #f.
>

Done!  See attached

> Cheers

[v2-0001-guix-emacs-build-system-Add-lisp-directory-key.patch (text/x-patch, attachment)]
[v2-0002-gnu-emacs-agda2-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0003-gnu-emacs-cmake-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0004-gnu-emacs-with-editor-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0005-gnu-emacs-ghub-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0006-gnu-emacs-flymake-collection-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0007-gnu-emacs-xenops-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0008-gnu-emacs-chronometrist-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0009-gnu-emacs-org-contrib-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0010-gnu-emacs-php-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0011-gnu-emacs-epkg-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0012-gnu-emacs-edit-server-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0013-gnu-emacs-know-your-http-well-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0014-gnu-emacs-stumpwm-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0015-gnu-emacs-treemacs-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0016-gnu-emacs-treemacs-extra-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0017-gnu-emacs-transient-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0018-gnu-emacs-forge-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0019-gnu-emacs-exwm-firefox-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0020-gnu-emacs-casual-avy-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0021-gnu-emacs-casual-calc-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0022-gnu-emacs-casual-dired-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0023-gnu-emacs-casual-info-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0024-gnu-emacs-telega-contrib-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0025-gnu-emacs-scad-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0026-gnu-emacs-erlang-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0027-gnu-emacs-notmuch-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0028-gnu-emacs-lilypond-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0029-gnu-emacs-protobuf-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0030-gnu-emacs-gerbil-mode-Use-lisp-directory.patch (text/x-patch, attachment)]
[v2-0031-gnu-emacs-stgit-Use-lisp-directory.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Mon, 03 Mar 2025 05:31:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <morgan.j.smith <at> outlook.com>
Cc: Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>, 76690 <at> debbugs.gnu.org,
 Ian Eure <ian <at> retrospec.tv>, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#76690] [PATCH 2/4] gnu: emacs-minimal: Enable native
 compilations
Date: Mon, 03 Mar 2025 06:31:27 +0100
Am Sonntag, dem 02.03.2025 um 16:51 -0500 schrieb Morgan Smith:
> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:
> 
> > Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
> > > * gnu/packages/emacs.scm(emacs-no-x): Move native compilation
> > > settings from here to ...
> > > (emacs-minimal): ... here.
> > > 
> > > Change-Id: Ib549f0e7435cab0c891bb8d6cec9b1af041ab7c4
> > > ---
> > Note: enabling native compilation for emacs-minimal will likely not
> > do what you think it does.  Unless you use emacs-minimal itself as
> > your emacs (rather than e.g. emacs-no-x), you will not see any
> > benefit from this patch.
> 
> emacs-minimal is the default-emacs in the emacs-build-system.
> Currently, we disable native-compilation of loaded elisp because we
> want to use the ahead-of-time native compilation that occurs when
> building a package.  However, if we don't build our packages with an
> emacs that supports native compilation, then we are effectively
> disabling the native compliation feature for all packages.
Yeah, as I thought, you're overestimating the benefits of this patch. 
Natively compiled Emacs packages are incompatible across variants, so
your emacs-minimal AOT'd package won't work with emacs, emacs-pgtk or
emacs-next.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Tue, 04 Mar 2025 00:15:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Cc: Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Cayetano Santos <csantosb <at> inventati.org>, Andrew Tropin <andrew <at> trop.in>,
 76690 <at> debbugs.gnu.org, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Subject: Re: [bug#76690] [PATCH emacs-team 0/4] Emacs build fixes + enable
 native comp by default?
Date: Tue, 04 Mar 2025 09:14:32 +0900
Hi Morgan,

Morgan Smith <Morgan.J.Smith <at> outlook.com> writes:

Thanks for working on this!

[...]

> 2. Maybe involves a discussion.  Upstream has enabled native compilation by
> default so it'd be nice for us to do the same.  However, this bumps the
> closure size of emacs-minimal up by 500MiB which is substantial.  It also
> increases compile time of both emacs-minimal and now all emacs packages
> substantially.

I think following the default behavior makes most sense here; otherwise
we'll have many users wondering why it's not enabled by default and how
to do so.

The time to build packages is not a big concern.  As for the size of
emacs-minimal; that's a bit unfortunate, but one could argue that
'emacs-minimal' is an oxymoron to start with ;-).

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#76690; Package guix-patches. (Tue, 04 Mar 2025 00:32:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Morgan Smith <morgan.j.smith <at> outlook.com>
Cc: Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Cayetano Santos <csantosb <at> inventati.org>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 76690 <at> debbugs.gnu.org,
 Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#76690] [PATCH 4/4] Use #:lisp-directory instead of a
 custom phase
Date: Tue, 04 Mar 2025 09:31:27 +0900
Hello,

Morgan Smith <morgan.j.smith <at> outlook.com> writes:

[...]

> I've attached the relevant patches to this email.  Let me know if you'd
> rather I use 'git send-email' (and how I should do that without filling
> up everyone's inbox).

We accept both, but for various reasons (email notification to teams,
ease of applying, and extra commit metadata as enforced by our git
config template), using 'git send-email' is preferable.

See info '(guix) Sending a Patch Series' for more details; since here we
already have an issue created it's down to something like:

--8<---------------cut here---------------start------------->8---
git send-email --to=76690 <at> debbugs.gnu.org origin/master
--8<---------------cut here---------------end--------------->8---

Assuming your feature branch is tracking the remote master branch.

Another option is to use mumi; you currently must manually format
patches first to send them though:

--8<---------------cut here---------------start------------->8---
git format-patch origin/master -o your-branch-patches
mumi current 76690
mumi send-email your-branch-patches/*.patch
--8<---------------cut here---------------end--------------->8---

I hope that helps.

-- 
Thanks,
Maxim




Reply sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
You have taken responsibility. (Sun, 09 Mar 2025 20:02:02 GMT) Full text and rfc822 format available.

Notification sent to Morgan Smith <Morgan.J.Smith <at> outlook.com>:
bug acknowledged by developer. (Sun, 09 Mar 2025 20:02:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <morgan.j.smith <at> outlook.com>
Cc: 76690-done <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Cayetano Santos <csantosb <at> inventati.org>, Andrew Tropin <andrew <at> trop.in>,
 Divya Ranjan Pattanaik <divya <at> subvertising.org>
Subject: Re: [bug#76690] [PATCH 4/4] Use #:lisp-directory instead of a
 custom phase
Date: Sun, 09 Mar 2025 21:02:01 +0100
Am Sonntag, dem 02.03.2025 um 17:20 -0500 schrieb Morgan Smith:
> Done!  See attached
Aaaaaaaaaaaand it's pushed.

Cheers




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

This bug report was last modified 69 days ago.

Previous Next


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