From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Albinus Subject: Re: org mode R remote code evaluation Date: Fri, 27 Sep 2013 13:39:50 +0200 Message-ID: <87vc1mijcp.fsf@gmx.de> References: <87d2ownbtv.fsf@hornfels.zedat.fu-berlin.de> <87r4ce2x8k.fsf@gmx.de> <87mwn22vy8.fsf@gmx.de> <878uymyser.fsf@gmx.de> <87y56li3je.fsf@gmx.de> <87mwn0u5sh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPWP1-0007q3-AR for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 07:40:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPWOv-0005Fl-Fc for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 07:40:07 -0400 Received: from mout.gmx.net ([212.227.17.20]:62995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPWOv-0005Eu-6L for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 07:40:01 -0400 Received: from detlef.gmx.de ([93.202.49.126]) by mail.gmx.com (mrgmx002) with ESMTPS (Nemesis) id 0Lvl0u-1VvSSn3d1w-017XXF for ; Fri, 27 Sep 2013 13:39:58 +0200 In-Reply-To: <87mwn0u5sh.fsf@gmail.com> (Eric Schulte's message of "Wed, 25 Sep 2013 12:15:10 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Loris Bennett , emacs-orgmode , Alexander Vorobiev , Johannes Rainer --=-=-= Content-Type: text/plain Eric Schulte writes: > I'd rather not hard-code the value of "/tmp/". Perhaps you could rework > the patch so that it introduces a new customizable variable (including a > documentation string) so that users can set the value for their system. > > Also, please package the patch with git format-patch. Patch is appended. > Thanks, Best regards, Michael. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ob-core.el-org-babel-local-file-name-Simplify.patch >From 2b8db5486de75ec35c2c0d3e6063847cf582ace7 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 27 Sep 2013 13:34:03 +0200 Subject: [PATCH] * ob-core.el (org-babel-local-file-name): Simplify. (org-babel-process-file-name): Apply `expand-file-name' first. (org-babel-remote-temporary-directory): New defcustom. (org-babel-temp-file): Use it. --- lisp/ob-core.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 5a032a1..a7c227b 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2680,11 +2680,7 @@ Fixes a bug in `tramp-handle-call-process-region'." (defun org-babel-local-file-name (file) "Return the local name component of FILE." - (if (file-remote-p file) - (let (localname) - (with-parsed-tramp-file-name file nil - localname)) - file)) + (or (file-remote-p file 'localname) file)) (defun org-babel-process-file-name (name &optional no-quote-p) "Prepare NAME to be used in an external process. @@ -2694,7 +2690,10 @@ remotely. The file name is then processed by `expand-file-name'. Unless second argument NO-QUOTE-P is non-nil, the file name is additionally processed by `shell-quote-argument'" ((lambda (f) (if no-quote-p f (shell-quote-argument f))) - (expand-file-name (org-babel-local-file-name name)))) + ;; We must apply `expand-file-name' on the whole filename. If we + ;; would apply it on the local filename only, undesired effects + ;; like prepending a drive letter on MS Windows could happen. + (org-babel-local-file-name (expand-file-name name)))) (defvar org-babel-temporary-directory) (unless (or noninteractive (boundp 'org-babel-temporary-directory)) @@ -2707,6 +2706,11 @@ additionally processed by `shell-quote-argument'" Used by `org-babel-temp-file'. This directory will be removed on Emacs shutdown.")) +(defcustom org-babel-remote-temporary-directory "/tmp/" + "Directory to hold temporary files on remote hosts." + :group 'org-babel + :type 'string) + (defmacro org-babel-result-cond (result-params scalar-form &rest table-forms) "Call the code to parse raw string results according to RESULT-PARAMS." (declare (indent 1) @@ -2736,7 +2740,8 @@ of `org-babel-temporary-directory'." (if (file-remote-p default-directory) (let ((prefix (concat (file-remote-p default-directory) - (expand-file-name prefix temporary-file-directory)))) + (expand-file-name + prefix org-babel-remote-temporary-directory)))) (make-temp-file prefix nil suffix)) (let ((temporary-file-directory (or (and (boundp 'org-babel-temporary-directory) -- 1.8.1.2 --=-=-=--