guix_mirror_bot pushed a commit to branch emacs-team
in repository guix.

commit a5bb8b0452325db44909fdfd3fb72404244120a2
Author: Morgan Smith <[email protected]>
AuthorDate: Thu Jul 23 11:59:12 2026 -0400

    gnu: emacs-minimal: Patch tramp-encoding-shell.
    
    This was already done in our emacs-tramp package but not in Emacs proper.
    
    Also move tramp configurations to their own phase so we can later duplicate
    them in the emacs-tramp package.
    
    * gnu/packages/emacs.scm (emacs-minimal)[#:phases]: Move all tramp
    related changes to ‘patch-tramp’.  Patch “/bin/sh” in tramp.el to patch
    “tramp-encoding-shell”.
    
    Signed-off-by: Liliana Marie Prikler <[email protected]>
---
 gnu/packages/emacs.scm | 53 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 6a620c0fc8..74c6df4ce0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -334,19 +334,6 @@
                    (if replacement
                        (string-append "\"" replacement "\"")
                        all))))
-              ;; Make sure Tramp looks for binaries in the right places on
-              ;; remote Guix System machines, where 'getconf PATH' returns
-              ;; something bogus.
-              (substitute* "lisp/net/tramp.el"
-                ;; Patch the line after "(defcustom tramp-remote-path".
-                (("\\(tramp-default-remote-path")
-                 (format
-                  #f "(tramp-default-remote-path ~s ~s ~s ~s ~s ~s ~s "
-                  "/run/privileged/bin"
-                  "~/.guix-profile/bin" "~/.guix-profile/sbin"
-                  "~/.guix-home/bin" "~/.guix-home/sbin"
-                  "/run/current-system/profile/bin"
-                  "/run/current-system/profile/sbin")))
 
               ;; Make sure Man and ffap looks for C header files in the right
               ;; places.
@@ -357,14 +344,38 @@
                         "\"~/.guix-profile/include\""
                         "\"~/.guix-home/include\""
                         "\"/run/current-system/profile/include\"")
-                  " ")))
-
-              ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
-              ;; respectively when looking for GVFS processes.
-              (substitute* "lisp/net/tramp-gvfs.el"
-                (("\\(tramp-process-running-p \"(.*)\"\\)" all process)
-                 (format #f "(or ~a (tramp-process-running-p ~s))"
-                         all (string-append "." process "-real"))))))
+                  " ")))))
+          (add-after 'patch-program-file-names 'patch-tramp
+            ;; This phase is duplicated in the emacs-tramp package.  Please
+            ;; ensure they stay in sync
+            (lambda* (#:key inputs #:allow-other-keys)
+              (with-directory-excursion "lisp/net"
+                ;; All but one "/bin/" directory refer to remote
+                ;; environments, which may not be Guix.  Do not patch them
+                ;; blindly.  However, tramp-encoding-shell has to be patched.
+                (substitute* "tramp.el"
+                  (("\"/bin/sh\"")
+                   (format #f "~s" (search-input-file inputs "bin/sh")))
+
+                  ;; Make sure Tramp looks for binaries in the right places on
+                  ;; remote Guix System machines, where 'getconf PATH' returns
+                  ;; something bogus.
+                  ;; Patch the line after "(defcustom tramp-remote-path".
+                  (("\\(tramp-default-remote-path")
+                   (format
+                    #f "(tramp-default-remote-path ~s ~s ~s ~s ~s ~s ~s "
+                    "/run/privileged/bin"
+                    "~/.guix-profile/bin" "~/.guix-profile/sbin"
+                    "~/.guix-home/bin" "~/.guix-home/sbin"
+                    "/run/current-system/profile/bin"
+                    "/run/current-system/profile/sbin")))
+
+                ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
+                ;; respectively when looking for GVFS processes.
+                (substitute* "tramp-gvfs.el"
+                  (("\\(tramp-process-running-p \"(.*)\"\\)" all process)
+                   (format #f "(or ~a (tramp-process-running-p ~s))"
+                           all (string-append "." process "-real")))))))
           (add-before 'configure 'fix-/bin/pwd
             (lambda _
               ;; Use `pwd', not `/bin/pwd'.

Reply via email to