Michael Albinus <[email protected]> writes:

>> This commit hard codes the temporary directory to "/tmp/" instead of
>> running `(temporary-file-directory)'.  This would fail on any system
>> that has a custom value of `temporary-file-directory'.
>
> So it shall use (temporary-file-directory) indeed. And the temp file on
> the remote host must be configured (the default value is "/tmp"), as
> described in the Tramp manual (info "(tramp) Predefined connection 
> information")
>
> --8<---------------cut here---------------start------------->8---
> (add-to-list 'tramp-connection-properties
>              (list (regexp-quote "/ssh:[email protected]:")
>                    "tmpdir" 
> "/tmp/guix-build-emacs-org-10.0-pre.drv-0/tmp-orgtest/"))
> --8<---------------cut here---------------end--------------->8---

Please see attached two patches.  It seems we like
"(temporary-file-directory)" better then
"org-babel-remote-temporary-directory" so I've deprecated the latter.

I have removed any changes that involve `tramp-encoding-shell' because I
think that needs to be solved on the Guix package side.

Micheal I have a question about how Guix should package Emacs.

Guix does like to hard code the shell path when it can to give users full
control over the packages using their custom stuff.  So when packaging Emacs
for Guix, we have to be careful to only hardcode the local shell paths and not
the remote shell paths.

Should Guix hard-code the shell path to `tramp-encoding-shell'?  I think the
answer is yes but since I have you here I thought I'd ask.

Thank you very much!

Morgan


>From 426b28c5bce9b390222383d37dfcf11b9d1064a3 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Wed, 22 Apr 2026 15:29:06 -0400
Subject: [PATCH 1/2] Testing: TRAMP integration: Use local PATH and tmpdir

* testing/org-test.el (org-test-with-tramp-remote-dir--worker): Set
`tramp-remote-path' and `tramp-tmpdir' to use the local values as this
is a mock TRAMP connection that is actually just the local system.
---
 testing/org-test.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index fc1b2342d..2928fa08c 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -291,8 +291,13 @@ org-test-with-tramp-remote-dir--worker
      (t (require 'tramp)
         (defvar tramp-methods)
         (defvar tramp-default-host-alist)
-        (let ((tramp-methods
-               (cons '("mock"
+        (defvar tramp-remote-path)
+        (let (;; "Remote" PATH is same as local PATH
+              (tramp-remote-path (cons 'tramp-own-remote-path
+                                       tramp-remote-path))
+              (tramp-methods
+               (cons `("mock"
+                       (tramp-tmpdir ,temporary-file-directory)
                        (tramp-login-program        "sh")
                        (tramp-login-args           (("-i")))
                        (tramp-remote-shell         "/bin/sh")

base-commit: 5f8fe990ee539b12d2af4d433ba3f8137c64b671
-- 
2.54.0

>From 0037e96f1096aaa42ab3d1a7abac5c59eb1ed070 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email protected]>
Date: Tue, 19 May 2026 12:35:44 -0400
Subject: [PATCH 2/2] ob-core: Obsolete `org-babel-remote-temporary-directory'

TRAMP is able to determine the remote tmpdir dynamically when the
function `temporary-file-directory' is run.  Lets use that instead of
re-inventing the system ourselves.

* lisp/ob-core.el (org-babel-remote-temporary-directory): Change
default value to nil.  Mark as obsolete.
(org-babel-temp-directory): If `org-babel-remote-temporary-directory'
is not set, run "(temporary-file-directory)".
---
 lisp/ob-core.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 823b27b72..17eb6140f 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -3580,10 +3580,14 @@ org-babel-temporary-stable-directory
 Used by `org-babel-temp-file'.  This directory will be removed on
 Emacs shutdown.")
 
-(defcustom org-babel-remote-temporary-directory "/tmp/"
+(defcustom org-babel-remote-temporary-directory nil
   "Directory to hold temporary files on remote hosts."
   :group 'org-babel
   :type 'string)
+(make-obsolete-variable
+ 'org-babel-remote-temporary-directory
+ "Customize `tramp-connection-properties' to set the \"tmpdir\" property instead."
+ "10.0")
 
 (defmacro org-babel-result-cond (result-params scalar-form &rest table-forms)
   "Call the code to parse raw string results according to RESULT-PARAMS.
@@ -3610,8 +3614,11 @@ org-babel-result-cond
 (defmacro org-babel-temp-directory ()
   "Return temporary directory suitable for `default-directory'."
   `(if (file-remote-p default-directory)
-       (concat (file-remote-p default-directory)
-	       org-babel-remote-temporary-directory)
+       (with-suppressed-warnings ((obsolete org-babel-remote-temporary-directory))
+         (if org-babel-remote-temporary-directory
+             (concat (file-remote-p default-directory)
+	             org-babel-remote-temporary-directory)
+           (temporary-file-directory)))
      (or (and org-babel-temporary-directory
 	      (file-exists-p org-babel-temporary-directory)
 	      org-babel-temporary-directory)
-- 
2.54.0

Reply via email to