summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2013-09-27 13:34:03 +0200
committerEric Schulte <schulte.eric@gmail.com>2013-09-28 05:37:45 -0600
commit89f10a11fb96a2ee73145bf18d256d74063b1e9e (patch)
tree288e09a56cedda0cd477ab363f4c983d84feacc6
parent82837535df3e0ad6edb597ae96dd5fd14abd80e6 (diff)
downloadorg-mode-89f10a11fb96a2ee73145bf18d256d74063b1e9e.tar.gz
* 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.
-rw-r--r--lisp/ob-core.el19
1 files 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)