aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2012-12-20 14:15:43 +0100
committerMichael Albinus2012-12-20 14:15:43 +0100
commit006faa4118a335844583d73d9fbd2a844e908b2f (patch)
treede2cd82503274ed8e9a676d90ccbcc0151b1da9f
parent91b982a0355d6eff74f7d9df56d5b321b13d2f8a (diff)
downloademacs-006faa4118a335844583d73d9fbd2a844e908b2f.tar.gz
emacs-006faa4118a335844583d73d9fbd2a844e908b2f.zip
* ob.el (org-babel-temp-file): Fix setting of
`temporary-file-directory' on remote hosts. * ob-eval.el (org-babel-shell-command-on-region): Use `process-file' instead of `call-process-region'. The latter one does not work on remote hosts.
-rw-r--r--lisp/org/ChangeLog9
-rw-r--r--lisp/org/ob-eval.el54
-rw-r--r--lisp/org/ob.el14
3 files changed, 43 insertions, 34 deletions
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index f7715198464..ce3fd523b88 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,12 @@
12012-12-20 Michael Albinus <michael.albinus@gmx.de>
2
3 * ob.el (org-babel-temp-file): Fix setting of
4 `temporary-file-directory' on remote hosts.
5
6 * ob-eval.el (org-babel-shell-command-on-region): Use
7 `process-file' instead of `call-process-region'. The latter one
8 does not work on remote hosts.
9
12012-12-13 Bastien Guerry <bzg@gnu.org> 102012-12-13 Bastien Guerry <bzg@gnu.org>
2 11
3 * org-latex.el (org-export-latex-links): Escape raw path when 12 * org-latex.el (org-export-latex-links): Escape raw path when
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index ddad067a560..5489c080669 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -134,14 +134,13 @@ specifies the value of ERROR-BUFFER."
134 current-prefix-arg 134 current-prefix-arg
135 shell-command-default-error-buffer 135 shell-command-default-error-buffer
136 t))) 136 t)))
137 (let ((error-file 137 (let ((input-file (org-babel-temp-file "input-"))
138 (if error-buffer 138 (error-file (if error-buffer (org-babel-temp-file "scor-") nil))
139 (make-temp-file 139 (shell-file-name
140 (expand-file-name "scor" 140 (if (file-executable-p
141 (if (featurep 'xemacs) 141 (concat (file-remote-p default-directory) shell-file-name))
142 (temp-directory) 142 shell-file-name
143 temporary-file-directory))) 143 "/bin/sh"))
144 nil))
145 exit-status) 144 exit-status)
146 (if (or replace 145 (if (or replace
147 (and output-buffer 146 (and output-buffer
@@ -151,12 +150,14 @@ specifies the value of ERROR-BUFFER."
151 ;; Don't muck with mark unless REPLACE says we should. 150 ;; Don't muck with mark unless REPLACE says we should.
152 (goto-char start) 151 (goto-char start)
153 (and replace (push-mark (point) 'nomsg)) 152 (and replace (push-mark (point) 'nomsg))
153 (write-region start end input-file)
154 (delete-region start end)
154 (setq exit-status 155 (setq exit-status
155 (call-process-region start end shell-file-name t 156 (process-file shell-file-name input-file
156 (if error-file 157 (if error-file
157 (list output-buffer error-file) 158 (list output-buffer error-file)
158 t) 159 t)
159 nil shell-command-switch command)) 160 nil shell-command-switch command))
160 ;; It is rude to delete a buffer which the command is not using. 161 ;; It is rude to delete a buffer which the command is not using.
161 ;; (let ((shell-buffer (get-buffer "*Shell Command Output*"))) 162 ;; (let ((shell-buffer (get-buffer "*Shell Command Output*")))
162 ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) 163 ;; (and shell-buffer (not (eq shell-buffer (current-buffer)))
@@ -175,14 +176,14 @@ specifies the value of ERROR-BUFFER."
175 (progn (setq buffer-read-only nil) 176 (progn (setq buffer-read-only nil)
176 (delete-region (max start end) (point-max)) 177 (delete-region (max start end) (point-max))
177 (delete-region (point-min) (min start end)) 178 (delete-region (point-min) (min start end))
179 (write-region (point-min) (point-max) input-file)
180 (delete-region (point-min) (point-max))
178 (setq exit-status 181 (setq exit-status
179 (call-process-region (point-min) (point-max) 182 (process-file shell-file-name input-file
180 shell-file-name t 183 (if error-file
181 (if error-file 184 (list t error-file)
182 (list t error-file) 185 t)
183 t) 186 nil shell-command-switch command)))
184 nil shell-command-switch
185 command)))
186 ;; Clear the output buffer, then run the command with 187 ;; Clear the output buffer, then run the command with
187 ;; output there. 188 ;; output there.
188 (let ((directory default-directory)) 189 (let ((directory default-directory))
@@ -192,11 +193,11 @@ specifies the value of ERROR-BUFFER."
192 (setq default-directory directory)) 193 (setq default-directory directory))
193 (erase-buffer))) 194 (erase-buffer)))
194 (setq exit-status 195 (setq exit-status
195 (call-process-region start end shell-file-name nil 196 (process-file shell-file-name nil
196 (if error-file 197 (if error-file
197 (list buffer error-file) 198 (list buffer error-file)
198 buffer) 199 buffer)
199 nil shell-command-switch command))) 200 nil shell-command-switch command)))
200 ;; Report the output. 201 ;; Report the output.
201 (with-current-buffer buffer 202 (with-current-buffer buffer
202 (setq mode-line-process 203 (setq mode-line-process
@@ -230,6 +231,9 @@ specifies the value of ERROR-BUFFER."
230 ;; (kill-buffer buffer) 231 ;; (kill-buffer buffer)
231 )))) 232 ))))
232 233
234 (when (and input-file (file-exists-p input-file))
235 (delete-file input-file))
236
233 (when (and error-file (file-exists-p error-file)) 237 (when (and error-file (file-exists-p error-file))
234 (if (< 0 (nth 7 (file-attributes error-file))) 238 (if (< 0 (nth 7 (file-attributes error-file)))
235 (with-current-buffer (get-buffer-create error-buffer) 239 (with-current-buffer (get-buffer-create error-buffer)
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index b06aac11f69..32ca7c6ca9e 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -2547,18 +2547,14 @@ Emacs shutdown."))
2547Passes PREFIX and SUFFIX directly to `make-temp-file' with the 2547Passes PREFIX and SUFFIX directly to `make-temp-file' with the
2548value of `temporary-file-directory' temporarily set to the value 2548value of `temporary-file-directory' temporarily set to the value
2549of `org-babel-temporary-directory'." 2549of `org-babel-temporary-directory'."
2550 (if (file-remote-p default-directory) 2550 (let ((temporary-file-directory
2551 (make-temp-file 2551 (if (file-remote-p default-directory)
2552 (concat (file-remote-p default-directory) 2552 (concat (file-remote-p default-directory) "/tmp")
2553 (expand-file-name
2554 prefix temporary-file-directory)
2555 nil suffix))
2556 (let ((temporary-file-directory
2557 (or (and (boundp 'org-babel-temporary-directory) 2553 (or (and (boundp 'org-babel-temporary-directory)
2558 (file-exists-p org-babel-temporary-directory) 2554 (file-exists-p org-babel-temporary-directory)
2559 org-babel-temporary-directory) 2555 org-babel-temporary-directory)
2560 temporary-file-directory))) 2556 temporary-file-directory))))
2561 (make-temp-file prefix nil suffix)))) 2557 (make-temp-file prefix nil suffix)))
2562 2558
2563(defun org-babel-remove-temporary-directory () 2559(defun org-babel-remove-temporary-directory ()
2564 "Remove `org-babel-temporary-directory' on Emacs shutdown." 2560 "Remove `org-babel-temporary-directory' on Emacs shutdown."