Subject: [bug#76690] [PATCH 4/4] Use #:lisp-directory instead of a custom phase

From: Morgan Smith <[email-masked]>
Date: Sun, 02 Mar 2025 17:20:36 -0500

Liliana Marie Prikler <[email-masked]> 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

>From d83841617a4b4583cbd3439e662bed75577593b0 Mon Sep 17 00:00:00 2001
Message-ID: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 14:31:29 -0500
Subject: [PATCH v2 01/31] guix: emacs-build-system: Add 'lisp-directory' key

* 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..f5b2cec445 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 #f)
                       (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..d2cf08c4d4 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)
+        (and=> lisp-directory chdir))))
 
 (define* (expand-load-path #:key (prepend-source? #t) #:allow-other-keys)
   "Expand EMACSLOADPATH, so that inputs, whose code resides in subdirectories,

base-commit: 725917beddf8454f92d01de7a3cfcc283100f43b
prerequisite-patch-id: b74e1301201f7e4a2c31e98ad1be38f8c22d6d36
prerequisite-patch-id: 1fc8f754851e8b0bcc1a2f3dd2fe898afc9a7736
-- 
2.48.1

>From 04e003bc1e853fefc4c917a3161d8bb33cf9233a Mon Sep 17 00:00:00 2001
Message-ID: <04e003[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:11 -0500
Subject: [PATCH v2 02/31] gnu: emacs-agda2-mode: Use '#:lisp-directory'.

* gnu/packages/agda.scm (emacs-agda2-mode): Use '#:lisp-directory'.

Change-Id: I8840159c4780d9bcc2e5e13615c353a3836cae10
---
 gnu/packages/agda.scm | 5 +----
 1 file changed, 1 insertion(+), 4 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
-- 
2.48.1

>From 4949dfe27feff34e9b43b02709879c8baff0df5b Mon Sep 17 00:00:00 2001
Message-ID: <4949df[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:11 -0500
Subject: [PATCH v2 03/31] gnu: emacs-cmake-mode: Use '#:lisp-directory'.

* gnu/packages/cmake.scm (emacs-cmake-mode): Use '#:lisp-directory'.

Change-Id: I09668b4377f524e16d9c3e2696893b3e775f634b
---
 gnu/packages/cmake.scm | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

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

>From d639f3a44c3cfd395d7de0485bfd13a63bf8220c Mon Sep 17 00:00:00 2001
Message-ID: <d639f3[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:11 -0500
Subject: [PATCH v2 04/31] gnu: emacs-with-editor: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-with-editor): Use
'#:lisp-directory'.

Change-Id: Ia559ab6b003981faca27bf8f502e320ef5032555
---
 gnu/packages/emacs-xyz.scm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 272be3a275..919c52592a 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"
-- 
2.48.1

>From 5c3d1002306b7051acc912b66012eb1768569981 Mon Sep 17 00:00:00 2001
Message-ID: <5c3d10[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:11 -0500
Subject: [PATCH v2 05/31] gnu: emacs-ghub: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-ghub): Use '#:lisp-directory'.

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

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 919c52592a..e4b06f2214 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -2677,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")))
-- 
2.48.1

>From 8c7bc3e7f5b9514633ff45538ea529d92b51da4c Mon Sep 17 00:00:00 2001
Message-ID: <8c7bc3[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:12 -0500
Subject: [PATCH v2 06/31] gnu: emacs-flymake-collection: Use
 '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-flymake-collection): Use
'#:lisp-directory'.

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

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e4b06f2214..b4f0bb9134 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -3133,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.
-- 
2.48.1

>From af756658c2300416f6ba0ce3f528373b318b2169 Mon Sep 17 00:00:00 2001
Message-ID: <af7566[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:12 -0500
Subject: [PATCH v2 07/31] gnu: emacs-xenops: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-xenops): Use '#:lisp-directory'.

Change-Id: I3ea4e620f5fb96a1ad4f7cd7c47233fd113edb44
---
 gnu/packages/emacs-xyz.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index b4f0bb9134..161a23ee0c 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -5034,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
-- 
2.48.1

>From b601dba1ed3eb1dbbba706a7646734e26da39dde Mon Sep 17 00:00:00 2001
Message-ID: <b601db[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:12 -0500
Subject: [PATCH v2 08/31] gnu: emacs-chronometrist: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-chronometrist): Use
'#:lisp-directory'.

Change-Id: Ieb241549460a4fee0764bc30951f0c40d8bde1c9
---
 gnu/packages/emacs-xyz.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 161a23ee0c..ea3c4e41c5 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -5325,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 _
-- 
2.48.1

>From e0d359dd35ee508e26dfdae7ff9dd3df6f6c7d5d Mon Sep 17 00:00:00 2001
Message-ID: <e0d359[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:12 -0500
Subject: [PATCH v2 09/31] gnu: emacs-org-contrib: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-org-contrib): Use
'#:lisp-directory'.

Change-Id: I9d489850ced426676849e33e33fe7e3f8eb3426e
---
 gnu/packages/emacs-xyz.scm | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index ea3c4e41c5..7adff140ad 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -18578,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")
-- 
2.48.1

>From 0bc121a8e0743c3c2523ff1fbea47f680e007f1c Mon Sep 17 00:00:00 2001
Message-ID: <0bc121[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:12 -0500
Subject: [PATCH v2 10/31] gnu: emacs-php-mode: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-php-mode): Use '#:lisp-directory'.

Change-Id: Ifdd056e0e380697df277ec7c6791c6730704c78a
---
 gnu/packages/emacs-xyz.scm | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 7adff140ad..5d05221d1b 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -20851,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"
@@ -20860,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
-- 
2.48.1

>From 9ff30ff8ca38ceda1f79408ad057367c4b198292 Mon Sep 17 00:00:00 2001
Message-ID: <9ff30f[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:13 -0500
Subject: [PATCH v2 11/31] gnu: emacs-epkg: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-epkg): Use '#:lisp-directory'.

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

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 5d05221d1b..85b39ac59e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -25005,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
-- 
2.48.1

>From c4a2f6f2531bf432ef261f1cff64d15e02d0d4ae Mon Sep 17 00:00:00 2001
Message-ID: <c4a2f6[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:13 -0500
Subject: [PATCH v2 12/31] gnu: emacs-edit-server: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-edit-server): Use
'#:lisp-directory'.

Change-Id: Id7538c97bb4f919f3f81c8e5f11f9356716607f7
---
 gnu/packages/emacs-xyz.scm | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 85b39ac59e..e81f34ebe3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -26492,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")
-- 
2.48.1

>From 72bfad24eec8b529a21123008a5391edec4e1680 Mon Sep 17 00:00:00 2001
Message-ID: <72bfad[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:13 -0500
Subject: [PATCH v2 13/31] gnu: emacs-know-your-http-well: Use
 '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-know-your-http-well): Use
'#:lisp-directory'.

Change-Id: I401730ca43726880edf2e67e21fbc21455197587
---
 gnu/packages/emacs-xyz.scm | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e81f34ebe3..98d9a2f2a7 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -27414,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")
-- 
2.48.1

>From 33034afcb79a30b5b2e89e2732decbb637544a1d Mon Sep 17 00:00:00 2001
Message-ID: <33034a[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:13 -0500
Subject: [PATCH v2 14/31] gnu: emacs-stumpwm-mode: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-stumpwm-mode): Use
'#:lisp-directory'.

Change-Id: Id13b77f343b2edde7ca8a730e970273e80f58a1a
---
 gnu/packages/emacs-xyz.scm | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 98d9a2f2a7..cf25871ecb 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -28247,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")
-- 
2.48.1

>From f733493570fa24c1287eeaf1de6fae4881c58e44 Mon Sep 17 00:00:00 2001
Message-ID: <f73349[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:14 -0500
Subject: [PATCH v2 15/31] gnu: emacs-treemacs: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-treemacs): Use '#:lisp-directory'.

Change-Id: I1e7803f35fde714d9590b63b0ef6ce1ed5d1643e
---
 gnu/packages/emacs-xyz.scm | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index cf25871ecb..504177e41a 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -33275,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")
-- 
2.48.1

>From cafd2dde3a25bcd9647a941653f58c8989872619 Mon Sep 17 00:00:00 2001
Message-ID: <cafd2d[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:14 -0500
Subject: [PATCH v2 16/31] gnu: emacs-treemacs-extra: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-treemacs-extra): Use
'#:lisp-directory'.

Change-Id: I1e03a7d2feb03e6f0a5634c9dee06d45d152391d
---
 gnu/packages/emacs-xyz.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 504177e41a..e440827dc1 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -33344,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
-- 
2.48.1

>From d1fc6844b9f37bff8cd42ec25c6b7e4100b9f032 Mon Sep 17 00:00:00 2001
Message-ID: <d1fc68[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:14 -0500
Subject: [PATCH v2 17/31] gnu: emacs-transient: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-transient): Use '#:lisp-directory'.

Change-Id: I6ad22a39e7a6e778e8d77c79230419befd65427f
---
 gnu/packages/emacs-xyz.scm | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e440827dc1..7ef2d28a0e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -33681,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")
-- 
2.48.1

>From c50ce3902456a09a47c2fadffa66ff2dcd1fb281 Mon Sep 17 00:00:00 2001
Message-ID: <c50ce3[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:14 -0500
Subject: [PATCH v2 18/31] gnu: emacs-forge: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-forge): Use '#:lisp-directory'.

Change-Id: I8d5bda9cff4122e54fad0a41846f532aabb9b7fc
---
 gnu/packages/emacs-xyz.scm | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 7ef2d28a0e..d8b43418fa 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -33717,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
-- 
2.48.1

>From 0354648d3438927188c43f156d5df57211bdbe1f Mon Sep 17 00:00:00 2001
Message-ID: <035464[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:14 -0500
Subject: [PATCH v2 19/31] gnu: emacs-exwm-firefox: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-exwm-firefox): Use
'#:lisp-directory'.

Change-Id: I5d2e4739b8a8f51fcc8e3fc4ea6b4233635a5e57
---
 gnu/packages/emacs-xyz.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index d8b43418fa..c87ca49d45 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -34308,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"
-- 
2.48.1

>From c269e1b8c466e0950e43398f1889d14b99277ef4 Mon Sep 17 00:00:00 2001
Message-ID: <c269e1[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:15 -0500
Subject: [PATCH v2 20/31] gnu: emacs-casual-avy: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-casual-avy): Use '#:lisp-directory'.

Change-Id: Ibc306ede41f52e4b9a7240f16d5ea4c67daa965b
---
 gnu/packages/emacs-xyz.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index c87ca49d45..edceef213d 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -34909,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")
-- 
2.48.1

>From ad1f2fb203690e4639a5f7854e98369c4105d881 Mon Sep 17 00:00:00 2001
Message-ID: <ad1f2f[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:15 -0500
Subject: [PATCH v2 21/31] gnu: emacs-casual-calc: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-casual-calc): Use
'#:lisp-directory'.

Change-Id: Ib823c05f173afe86b4443716dad9b2c0d4c7d8d1
---
 gnu/packages/emacs-xyz.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index edceef213d..0805d5d76a 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -34933,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")
-- 
2.48.1

>From e4fcd4d14d7ac11b7716f09ed1f3a0afe7dfe64a Mon Sep 17 00:00:00 2001
Message-ID: <e4fcd4[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:15 -0500
Subject: [PATCH v2 22/31] gnu: emacs-casual-dired: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-casual-dired): Use
'#:lisp-directory'.

Change-Id: I84b9d957b6523286bdedb1e457b9767491188088
---
 gnu/packages/emacs-xyz.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 0805d5d76a..7d615202a3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -34957,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")
-- 
2.48.1

>From 166eb4b9fd751925c88d0880443a97ae4fe9daa7 Mon Sep 17 00:00:00 2001
Message-ID: <166eb4[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:15 -0500
Subject: [PATCH v2 23/31] gnu: emacs-casual-info: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-casual-info): Use
'#:lisp-directory'.

Change-Id: I99a5ce0498b20ac9144843bae363a95a415d8601
---
 gnu/packages/emacs-xyz.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 7d615202a3..8bf774c976 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -34981,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")
-- 
2.48.1

>From 5c1b3fd5529dc0501872b87154597f6205135dfc Mon Sep 17 00:00:00 2001
Message-ID: <5c1b3f[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:16 -0500
Subject: [PATCH v2 24/31] gnu: emacs-telega-contrib: Use '#:lisp-directory'.

* gnu/packages/emacs-xyz.scm (emacs-telega-contrib): Use
'#:lisp-directory'.

Change-Id: I5386c33e365a011019b0a9b004beb87512b68495
---
 gnu/packages/emacs-xyz.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 8bf774c976..9bd0846a55 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -37576,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 '())
-- 
2.48.1

>From dbc233a311e0476cff07e51df9fd870f60813a2e Mon Sep 17 00:00:00 2001
Message-ID: <dbc233[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:16 -0500
Subject: [PATCH v2 25/31] gnu: emacs-scad-mode: Use '#:lisp-directory'.

* gnu/packages/engineering.scm (emacs-scad-mode): Use
'#:lisp-directory'.

Change-Id: Ifc4257992edcfcca523d6b4a78f6bca41d614b53
---
 gnu/packages/engineering.scm | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

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

>From d04b4a8595e5438bf51f95f79d61ebcbf6ce56fd Mon Sep 17 00:00:00 2001
Message-ID: <d04b4a[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:16 -0500
Subject: [PATCH v2 26/31] gnu: emacs-erlang: Use '#:lisp-directory'.

* gnu/packages/erlang.scm (emacs-erlang): Use '#:lisp-directory'.

Change-Id: I8740df89586a8718c003e409b0db6cc5c60d99a2
---
 gnu/packages/erlang.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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

>From 737fcee2882be2bb4db04fcffcd41cf74e528c41 Mon Sep 17 00:00:00 2001
Message-ID: <737fce[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:16 -0500
Subject: [PATCH v2 27/31] gnu: emacs-notmuch: Use '#:lisp-directory'.

* gnu/packages/mail.scm (emacs-notmuch): Use '#:lisp-directory'.

Change-Id: I7cfdf87f368c979bc076adc6a7ecad08886a2bb9
---
 gnu/packages/mail.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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

>From d5867ac4ab5b629447f784ff1844726cbdbc5867 Mon Sep 17 00:00:00 2001
Message-ID: <d5867a[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:16 -0500
Subject: [PATCH v2 28/31] gnu: emacs-lilypond-mode: Use '#:lisp-directory'.

* gnu/packages/music.scm (emacs-lilypond-mode): Use '#:lisp-directory'.

Change-Id: I9c81488d386e70689165d160b255c4db5d420cf5
---
 gnu/packages/music.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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

>From c2694284c6ad217f40ef35b64709e9d7b9a4da40 Mon Sep 17 00:00:00 2001
Message-ID: <c26942[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:16 -0500
Subject: [PATCH v2 29/31] gnu: emacs-protobuf-mode: Use '#:lisp-directory'.

* gnu/packages/protobuf.scm (emacs-protobuf-mode): Use
'#:lisp-directory'.

Change-Id: If9b39106954fa66b64ef333def79989a61ac0e68
---
 gnu/packages/protobuf.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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

>From 1c5a643145630641436e7e3804c9847f1830a88d Mon Sep 17 00:00:00 2001
Message-ID: <1c5a64[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:17 -0500
Subject: [PATCH v2 30/31] gnu: emacs-gerbil-mode: Use '#:lisp-directory'.

* gnu/packages/scheme.scm (emacs-gerbil-mode): Use '#:lisp-directory'.

Change-Id: If6d2721b6a0124fa65e4f6eb59489c18d3f6fbf8
---
 gnu/packages/scheme.scm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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

>From afe7b9102706ae94041658ff01ec125ddb9a920a Mon Sep 17 00:00:00 2001
Message-ID: <afe7b9[email-masked]>
In-Reply-To: <d83841[email-masked]>
References: <d83841[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Sun, 2 Mar 2025 17:15:17 -0500
Subject: [PATCH v2 31/31] gnu: emacs-stgit: Use '#:lisp-directory'.

* gnu/packages/version-control.scm (emacs-stgit): Use
'#:lisp-directory'.

Change-Id: Ib8367e7822a4a17190552164cb7fa2ffcfd918bf
---
 gnu/packages/version-control.scm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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