emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts
@ 2013-03-23 23:52 Suhail Shergill
  2013-03-25  5:10 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Suhail Shergill @ 2013-03-23 23:52 UTC (permalink / raw)
  To: Org mode

[-- Attachment #1: Type: text/plain, Size: 21 bytes --]

see attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts --]
[-- Type: text/x-diff, Size: 2033 bytes --]

From 7037a45f3504a8d95019bd2b496a919081e85331 Mon Sep 17 00:00:00 2001
From: Suhail Shergill <suhailshergill@gmail.com>
Date: Sat, 23 Mar 2013 19:26:31 -0400
Subject: [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts

* lisp/ob.el (org-babel-temp-file): For remote hosts, modify the prefix
  and leave `temporary-file-directory' unchanged.

The reason setting `temporary-file-directory' doesn't work here is
because `make-temp-file' recursively calls itself (indirectly).
Modifying `temporary-file-directly', affects the recursive calls as well,
which results in a "No such file file or directory" error.

The fix is to leave `temporary-file-directory' unaltered, for remote
hosts, and instead modifying the 'prefix' argument to `make-temp-file'
appropriately.

TINYCHANGE
---
 lisp/ob.el |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index 7245714..1493355 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -2547,14 +2547,17 @@ Emacs shutdown."))
 Passes PREFIX and SUFFIX directly to `make-temp-file' with the
 value of `temporary-file-directory' temporarily set to the value
 of `org-babel-temporary-directory'."
-  (let ((temporary-file-directory
-	 (if (file-remote-p default-directory)
-	     (concat (file-remote-p default-directory) "/tmp")
+  (if (file-remote-p default-directory)
+      (let ((prefix
+             (concat (file-remote-p default-directory)
+                     (expand-file-name prefix temporary-file-directory))))
+        (make-temp-file prefix nil suffix))
+    (let ((temporary-file-directory
 	   (or (and (boundp 'org-babel-temporary-directory)
 		    (file-exists-p org-babel-temporary-directory)
 		    org-babel-temporary-directory)
-	       temporary-file-directory))))
-      (make-temp-file prefix nil suffix)))
+	       temporary-file-directory)))
+      (make-temp-file prefix nil suffix))))
 
 (defun org-babel-remove-temporary-directory ()
   "Remove `org-babel-temporary-directory' on Emacs shutdown."
-- 
1.7.10.4


[-- Attachment #3: Type: text/plain, Size: 12 bytes --]


-- 
Suhail

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts
  2013-03-23 23:52 [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts Suhail Shergill
@ 2013-03-25  5:10 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-03-25  5:10 UTC (permalink / raw)
  To: Suhail Shergill; +Cc: Org mode

Hi Suhail,

Suhail Shergill <suhailshergill@gmail.com> writes:

> see attached patch.

Applied, thanks a lot for the detailed change log.

PS: Please submit further patches against the master branch,
not the maint branch.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-25  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-23 23:52 [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts Suhail Shergill
2013-03-25  5:10 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).