ob-eval.el (org-babel-shell-command-on-region): Use `executable-find' for local ...
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 9 Jan 2013 12:48:30 +0000 (13:48 +0100)
committerBastien Guerry <bzg@altern.org>
Wed, 9 Jan 2013 13:11:08 +0000 (14:11 +0100)
* ob-eval.el (org-babel-shell-command-on-region): Use
`executable-find' for local `shell-file-name'.

lisp/ob-eval.el

index 5884d33..22d2bcf 100644 (file)
@@ -137,11 +137,17 @@ specifies the value of ERROR-BUFFER."
                       t)))
   (let ((input-file (org-babel-temp-file "input-"))
        (error-file (if error-buffer (org-babel-temp-file "scor-") nil))
+       ;; Unfortunately, `executable-find' does not support file name
+       ;; handlers.  Therefore, we could use it in the local case
+       ;; only.
        (shell-file-name
-        (if (file-executable-p
-             (concat (file-remote-p default-directory) shell-file-name))
-            shell-file-name
-          "/bin/sh"))
+        (cond ((and (not (file-remote-p default-directory))
+                    (executable-find shell-file-name))
+               shell-file-name)
+              ((file-executable-p
+                (concat (file-remote-p default-directory) shell-file-name))
+               shell-file-name)
+              ("/bin/sh")))
        exit-status)
     ;; There is an error in `process-file' when `error-file' exists.
     ;; This is fixed in Emacs trunk as of 2012-12-21; let's use this