emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Suhail Shergill <suhailshergill@gmail.com>
To: Org mode <emacs-orgmode@gnu.org>
Subject: [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts
Date: Sat, 23 Mar 2013 23:52:07 +0000	[thread overview]
Message-ID: <874ng1znbs.fsf@chaos.shergill.su> (raw)

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

             reply	other threads:[~2013-03-23 23:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 23:52 Suhail Shergill [this message]
2013-03-25  5:10 ` [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874ng1znbs.fsf@chaos.shergill.su \
    --to=suhailshergill@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).