Re: Report error in scheme evaluation

2022-05-03 Thread Felipe Lema



On 2022-04-30 06:35, Neil Jerram wrote:

On Sat, 30 Apr 2022 at 09:14, Ihor Radchenko  wrote:

Felipe Lema  writes:


I just realized I was un-CCed out of the thread

Here's the updated patch with the requested changes (actually single one)

Lemme know if I'm missing anything else.

Can you update the patch making it a proper patch under your name?
See https://orgmode.org/worg/org-contribute.html#patches for
instructions.

Hi Felipe,

Sorry for not commenting on this back in December.

Is the error that your patch shows equivalent to (or less than) taking
a look at the '*Geiser dbg*' buffer?  If it is, I wonder if it would
be better just to pop up the existing '*Geiser dbg*' buffer?  (Example
appended below.)

Best wishes,
 Neil

--- example of *Geiser dbg* buffer -
geiser-debugger
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Unbound variable: categorize-transactions-by-weeks

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Unbound variable: categorize-transactions-by-weeks

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
Expression evaluated was:

;; -*- geiser-scheme-implementation: guile -*-
(load "nationwide.scm")
(let ((classification '()))
(categorize-transactions-by-weeks (pre-2022 2020)
(two-column-table->alist classification) #t)
)
--- example of *Geiser dbg* buffer -


Hey, Neil


I believe there's an customizable option for that (opening the geiser 
repl with the debugger on). The patch I posted mimics current behavior 
with python, although the latter does have an option to pop the repl.


Lemme check if I can work something out and I'll post a new patch. I'll 
also address  Ihor's request for a proper patch.


Gards

Felipe




Re: [PATCH] update ob-scheme to latest changes in geiser package

2022-04-26 Thread Felipe Lema

I'm Ok with this patch.


Haven't tested it myself, but looks good otherwise (probably Tim has 
been using it for quite a while now)



Felipe

On 2022-04-23 09:29, Tim Van den Langenbergh wrote:

Felipe,

I have taken the liberty of reformatting the patch you created for ob-scheme.
You can find it enclosed.

If it is fine with you and the org-mode maintainers it can be applied as-is,
particularly since it is a tiny change.
I have also added some additional information to the commit message, such as
when the `geiser-eval-region/wait' function was introduced.

Please feel free to contact me in regards to any comments or questions you may
have.

Vale,

- Tim Van den Langenbergh





Re: [PATCH] update ob-scheme to latest changes in geiser package

2021-12-30 Thread Felipe Lema
On Thursday, 30 December 2021 22:50:20 +07 Max Nikulin wrote:
> On Wednesday, 29 December 2021 22.53.18 -03 Felipe Lema wrote:
> > On Wednesday, 29 December 2021 15.03.47 -03 Felipe Lema wrote:
> > > Sup, y'all
> > > 
> > > The geiser package had a recent update in which `geiser-eval-region` 
> > > behaves like an async function and does not return evaluation result. In 
> > > exchange, the newly introduced `geiser-eval-region/wait` does that now.
> > > 
> > > I've attached a patch to update ob-scheme.el to reflect these changes. 
> > > Without them, evaluating scheme dialect code blocks in Org will end up 
> > > with empty results.
> > > 
> > > To learn more about the change (and how it impacted other people's flows) 
> > > see issue thread below
> > > 
> > > https://gitlab.com/emacs-geiser/geiser/-/issues/30
> > > 
> > > Felipe
> > > 
> > > 
> > 
> > I was pointed out that I was missing the corresponding `declare-function`.
> > 
> > I've included it in the attached patch. Sorry about the double-posting
> > 
> > Felipe
> > 
> 
> I am not a geiser user, so maybe I missed something. Does this change mean 
> that org becomes incompatible with older geiser versions? E,g, debian and 
> ubuntu have elpa-geiser system package.
> 
> 
> I would consider testing if `geiser-eval-region/wait' is bound and fallback 
> to `geiser-eval-region' otherwise. 

I've wrapped an `if` to fallback to previous API before this breaking change in 
attached patch.

Felipe
update to new API call to evaluate region and wait for result

* ob-scheme.el replace `geiser-eval-region` with `geiser-eval-region/wait` (only available in newer versions) as the former changed expected behaviour; the latter returns the result of evaluating.
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..ffbd62bf97 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -53,8 +53,6 @@ geiser-repl-window-allow-split

 (declare-function run-geiser "ext:geiser-repl" (impl))
 (declare-function geiser-mode "ext:geiser-mode" ())
-(declare-function geiser-eval-region "ext:geiser-mode"
-  (start end &optional and-go raw nomsg))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
 (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
@@ -176,7 +174,14 @@ org-babel-scheme-execute-with-geiser
 	  (setq geiser-impl--implementation nil)
 	  (let ((geiser-debug-jump-to-debug-p nil)
 		(geiser-debug-show-debug-p nil))
-	(let ((ret (geiser-eval-region (point-min) (point-max
+	(let ((ret (funcall
+			;; use `geiser-eval-region/wait' only when available
+			;; in newer versions of `geiser'
+			(if (fboundp 'geiser-eval-region/wait)
+			'geiser-eval-region/wait
+			  'geiser-eval-region)
+			(point-min)
+			(point-max
 	  (setq result (if output
 			   (or (geiser-eval--retort-output ret)
    "Geiser Interpreter produced no output")


Re: [PATCH] update ob-scheme to latest changes in geiser package

2021-12-29 Thread Felipe Lema
On Wednesday, 29 December 2021 15.03.47 -03 Felipe Lema wrote:
> Sup, y'all
> 
> The geiser package had a recent update in which `geiser-eval-region` behaves 
> like an async function and does not return evaluation result. In exchange, 
> the newly introduced `geiser-eval-region/wait` does that now.
> 
> I've attached a patch to update ob-scheme.el to reflect these changes. 
> Without them, evaluating scheme dialect code blocks in Org will end up with 
> empty results.
> 
> To learn more about the change (and how it impacted other people's flows) see 
> issue thread below
> 
> https://gitlab.com/emacs-geiser/geiser/-/issues/30
> 
> Felipe
> 
> 

I was pointed out that I was missing the corresponding `declare-function`.

I've included it in the attached patch. Sorry about the double-posting

Felipe
update to new API call to evaluate region and wait for result

* ob-scheme.el replace `geiser-eval-region` with `geiser-eval-region/wait` as the former changed expected behaviour; the latter returns the result of evaluating.

diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..bcceba1258 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -53,8 +53,8 @@ geiser-repl-window-allow-split

 (declare-function run-geiser "ext:geiser-repl" (impl))
 (declare-function geiser-mode "ext:geiser-mode" ())
-(declare-function geiser-eval-region "ext:geiser-mode"
-  (start end &optional and-go raw nomsg))
+(declare-function geiser-eval-region/wait "ext:geiser-mode"
+  (start end &optional timeout))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
 (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
@@ -176,7 +176,7 @@ org-babel-scheme-execute-with-geiser
 	  (setq geiser-impl--implementation nil)
 	  (let ((geiser-debug-jump-to-debug-p nil)
 		(geiser-debug-show-debug-p nil))
-	(let ((ret (geiser-eval-region (point-min) (point-max
+	(let ((ret (geiser-eval-region/wait (point-min) (point-max
 	  (setq result (if output
 			   (or (geiser-eval--retort-output ret)
    "Geiser Interpreter produced no output")


[PATCH] update ob-scheme to latest changes in geiser package

2021-12-29 Thread Felipe Lema
Sup, y'all

The geiser package had a recent update in which `geiser-eval-region` behaves 
like an async function and does not return evaluation result. In exchange, the 
newly introduced `geiser-eval-region/wait` does that now.

I've attached a patch to update ob-scheme.el to reflect these changes. Without 
them, evaluating scheme dialect code blocks in Org will end up with empty 
results.

To learn more about the change (and how it impacted other people's flows) see 
issue thread below

https://gitlab.com/emacs-geiser/geiser/-/issues/30

Felipe

update to new API call to evaluate region and wait for result

* ob-scheme.el replace `geiser-eval-region` with `geiser-eval-region/wait` as the former changed expected behaviour; the latter returns the result of evaluating.

diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..89c6abf686 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -176,7 +176,7 @@ org-babel-scheme-execute-with-geiser
 	  (setq geiser-impl--implementation nil)
 	  (let ((geiser-debug-jump-to-debug-p nil)
 		(geiser-debug-show-debug-p nil))
-	(let ((ret (geiser-eval-region (point-min) (point-max
+	(let ((ret (geiser-eval-region/wait (point-min) (point-max
 	  (setq result (if output
 			   (or (geiser-eval--retort-output ret)
    "Geiser Interpreter produced no output")


Re: Report error in scheme evaluation

2021-12-27 Thread Felipe Lema
I just realized I was un-CCed out of the thread

Here's the updated patch with the requested changes (actually single one)

Lemme know if I'm missing anything else.

Felipediff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..8720bd099e 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -39,6 +39,7 @@
 
 ;;; Code:
 (require 'ob)
+(require 'subr-x)
 (require 'geiser nil t)
 (require 'geiser-impl nil t)
 (defvar geiser-repl--repl) ; Defined in geiser-repl.el
@@ -58,6 +59,7 @@ geiser-repl-window-allow-split
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
 (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
+(declare-function geiser-eval--retort-error "ext:geiser-eval" (ret))
 
 (defcustom org-babel-scheme-null-to 'hline
   "Replace `null' and empty lists in scheme tables with this before returning."
@@ -180,8 +182,20 @@ org-babel-scheme-execute-with-geiser
 	  (setq result (if output
 			   (or (geiser-eval--retort-output ret)
    "Geiser Interpreter produced no output")
-			 (geiser-eval--retort-result-str ret "")
-	  (when (not repl)
+			 (geiser-eval--retort-result-str ret "")))
+  (when-let* ((err (geiser-eval--retort-error ret)))
+;; there was an error, report it!
+(org-babel-eval-error-notify
+ -1 ;; filler value, anything non-zero should do
+ (geiser-eval--retort-output ret))
+(save-excursion
+  (when (get-buffer org-babel-error-buffer-name)
+(with-current-buffer org-babel-error-buffer-name
+  (unless (derived-mode-p 'compilation-mode)
+(compilation-mode))
+  ;; Compilation-mode enforces read-only, but Babel expects the buffer modifiable.
+  (setq buffer-read-only nil)))
+  (when (not repl)
 	(save-current-buffer (set-buffer repl-buffer)
  (geiser-repl-exit))
 	(set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)


Re: Report error in scheme evaluation

2021-12-22 Thread Felipe Lema
On Wednesday, 22 December 2021 11.54.33 -03 Ihor Radchenko wrote:
> Felipe Lema  writes:
> 
> > I started using guile with Org Babel and I was a little confused that 
> > errors weren't being reported. The attached patch will report the error the 
> > same way as python evaluation does.
> 
> The patch looks fine to me. Though never used scheme...
> 
> The only thing that can be improved is copy-paste from ob-eval.el It
> might be better to split the compile-mode code into separate function
> and reuse it.

I can do that in a separate patch after this one is merged.

> 
> > Let me know if I'm missing anything so this can be merged. It is correct to 
> > report errors this way, right?
> 
> Should be. Did you have a chance run the code for some time locally
> while actively playing around with scheme?

yup. Seems to work as I expected 

> 
> Best,
> Ihor
> 
Thanks
Felipe





Re: Report error in scheme evaluation

2021-12-21 Thread Felipe Lema
On Tuesday, 21 December 2021 20.07.01 -03 Rudolf Adamkovič wrote:
> Felipe Lema  writes:
> 
> > Sup, y'all
> >
> > I started using guile with Org Babel […]
> 
> Sup! I plan to write some literate Scheme soon as well.  How do you find
> the experience so far?  As of today, I use 'scheme-mode' with a set of
> TAGS files for completion and help, all based on my (incomplete) notes
> about R7RS.  Org requires Geiser to run Scheme, from what I gather.
> Also, do Org bugs cause any issues when writing literate Scheme?  Thanks
> in advance for any insights.  Cheers!
> 
> Rudy
> 
Hey, Rudy

I think this was not clear, but just in case: this patch is not a bugfix. I 
just thought having an error buffer just like with Python is a good idea 
(specially since I'm relatively new to Guile). I also believe that fine-tuning 
a workflow with libre softweare through can be considered an improvement and, 
thus, should be shared for others to use.

For anyone interested about my Org + Babel + GNU Guile flow, read below.

I think the experience is good if you're not picky. This is my opinion for 
Emacs workflows in general. At the same time, I'd say it takes some resources 
(mainly time) to get things running comfortably.

Some context ahead. I'm using Org for Get Things Done workflows in which I 
basically log a shell session (you may think of it as data processing on text 
files too: grep, awk sed... but logged and reproducible). Because of my 
everyday job, I need to switch context several times within a week and I find 
it helpful to use Org for two reasons: 1) When I write stuff myself (describing 
stuff in Org file) I find it easier to remember 2) If I cannot remember, I can 
grep for similar text / tags.

I'm trying GNU Guile as scripting language because... well, for one, that is 
its purpose. And two, because I've mostly discarded other languages as being 
too costly (too slow, too much needs to be done...).

I'd say that geiser transforms Emacs into a full blown IDE: code completion, 
documentation, symbol/tag search... you name it. This also applies to Org when 
you edit the source code using C-c C-c, so that helps a ton with learning the 
language.

Hope this helps. You can contact me privately if you want to follow up.

FelipeL





Report error in scheme evaluation

2021-12-21 Thread Felipe Lema
Sup, y'all

I started using guile with Org Babel and I was a little confused that errors 
weren't being reported. The attached patch will report the error the same way 
as python evaluation does.

Actually, most of the code was taken from ob-python.el

Let me know if I'm missing anything so this can be merged. It is correct to 
report errors this way, right?

Felipereport error in scheme dialect evaluation to user

* ob-scheme.el (org-babel-scheme-execute-with-geiser): paste error into `org-babel-error-buffer-name` and setup buffer to compilation-mode

diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..2828464bb5 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -58,6 +58,7 @@ geiser-repl-window-allow-split
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
 (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
+(declare-function geiser-eval--retort-error "ext:geiser-eval" (ret))

 (defcustom org-babel-scheme-null-to 'hline
   "Replace `null' and empty lists in scheme tables with this before returning."
@@ -180,8 +181,20 @@ org-babel-scheme-execute-with-geiser
 	  (setq result (if output
 			   (or (geiser-eval--retort-output ret)
    "Geiser Interpreter produced no output")
-			 (geiser-eval--retort-result-str ret "")
-	  (when (not repl)
+			 (geiser-eval--retort-result-str ret "")))
+  (when-let* ((err (geiser-eval--retort-error ret)))
+;; there was an error, report it!
+(org-babel-eval-error-notify
+ -1 ;; filler value, anything non-zero should do
+ (geiser-eval--retort-output ret))
+(save-excursion
+  (when (get-buffer org-babel-error-buffer-name)
+(with-current-buffer org-babel-error-buffer-name
+  (unless (derived-mode-p 'compilation-mode)
+(compilation-mode))
+  ;; Compilation-mode enforces read-only, but Babel expects the buffer modifiable.
+  (setq buffer-read-only nil)))
+  (when (not repl)
 	(save-current-buffer (set-buffer repl-buffer)
  (geiser-repl-exit))
 	(set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)


Re: correct remote path handling

2020-02-26 Thread Felipe Lema
Hey, y'all

I found out that ob-shell was more broken than I thought so I had to upgrade 
my sword and get a new shield to fix it.

Tramp support for ob-python and ob-shell look OK now, although still no tests. 
I'll wait until this review is done until I start working on the tests. Will 
probably take a while because I'm thinking of some cross-section code that 
will do the a set of tests (all current? some marked? some new instead?) using 
a remote directory.

Using `ssh localhost` should suffice, but should these remote tests be done by 
default? It's most likely that everyone running tests will require a 
passwordless setup. While I've automatized this for a separate package, it may 
be bothersome to someone else (see [1]).

Anyway, I hope the patch file is correct now. I messed up my mirror repo and I 
/think/ I got it right.

BTW I just got a mail that FSF papers are approved now.

Gards, Felipe

[1]: https://github.com/FelipeLema/emacs-counsel-gtags/blame/
5d2a8c2c2d358e374a576cf8a3a67f7997a8839b/.travis.yml#L6

On Tuesday, 25 February 2020 16:14:05 -03 Bastien wrote:
> Hi Felipe and Jack,
> 
> > Felipe Lema  writes:
> >> I've signed the necessary papers from (to?) the FSF involving org
> >> mode, so I'm ready on my side to add tests and maybe add support
> >> for other tramp-related stuff.
> 
> I've checked and the papers are not yet processed by the FSF.
> 
> > Great, we should add you to the list of copyrighted contributors:
> > https://orgmode.org/worg/org-contribute.html
> 
> Done -  https://orgmode.org/worg/org-contribute.html#org7c578f2
> 
> Let's iterate on this patch and get it ready for 9.5.
> 
> Thanks,

fix tramp support for ob-shell & ob-python

* ob-python.el (org-babel-python-evaluate-session): use file path local to (maybe) remote process.
* ob-shell.el (org-babel-execute:shell, org-babel-sh-evaluate): call-process-…→ process-file-… (tramp aware), wrap :session block in a function, separate "ob overhead" from "eval block", add documentation.

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index dbcfac08d..1afea9cb3 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -327,7 +327,8 @@ last statement in BODY, as elisp."
 		  "python-")))
 			   (with-temp-file tmp-src-file (insert body))
 			   (format org-babel-python--exec-tmpfile
-   tmp-src-file))
+   (org-babel-local-file-name
+	tmp-src-file)))
 			   body)))
 	   (mapconcat
 		#'org-trim
@@ -345,9 +346,10 @@ last statement in BODY, as elisp."
 	  "python-")))
 			   (with-temp-file tmp-src-file (insert body))
 			   (format org-babel-python--eval-ast
-   tmp-src-file
-   (org-babel-comint-with-output
-   (session org-babel-python-eoe-indicator nil body)
+   (org-babel-local-file-name
+tmp-src-file)
+	   (org-babel-comint-with-output
+		   (session org-babel-python-eoe-indicator nil body)
  (let ((comint-process-echoes nil))
(funcall input-body body)
 		   (dolist
diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el
index 347ffedd1..66cdfb94c 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -82,12 +82,17 @@ This function is called by `org-babel-execute-src-block'."
 	 (value-is-exit-status
 	  (member "value" (cdr (assq :result-params params
 	 (cmdline (cdr (assq :cmdline params)))
+	 (shebang (cdr (assq :shebang params)))
+	 (padline (not (equal "no" (cdr (assq :padline params)
+	 (result-params (cdr (assq :result-params params)))
  (full-body (concat
 		 (org-babel-expand-body:generic
 		  body params (org-babel-variable-assignments:shell params))
 		 (when value-is-exit-status "\necho $?"
 (org-babel-reassemble-table
- (org-babel-sh-evaluate session full-body params stdin cmdline)
+ (org-babel-sh-evaluate session full-body
+			stdin cmdline shebang value-is-exit-status padline
+			result-params)
  (org-babel-pick-name
   (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
  (org-babel-pick-name
@@ -206,76 +211,114 @@ var of the same value."
   "String to indicate that evaluation has completed.")
 (defvar org-babel-sh-eoe-output "org_babel_sh_eoe"
   "String to indicate that evaluation has completed.")
+(defvar org-babel-sh-block-function-name "org_babel_block"
+  "Name of the shell function that will hold the code to be executed.")
 
-(defun org-babel-sh-evaluate (session body &optional params stdin cmdline)
-  "Pass BODY to the Shell process in BUFFER.
-If RESULT-TYPE equals `output' then return a list of the outputs
-of the statements in BODY, if RESULT-TYPE equals `value' then
-return the value of the la

correct remote path handling

2020-02-24 Thread Felipe Lema
Hello, there

I bumped into a problem running src blocks using a remote (tramp) :dir. I've 
looked into it and found that the problem is that a temporary file is passed 
as a remote path to the remote process (temp file should be local to remote 
process).

I'm attaching fixes for python and shell src blocks. I didn't add any tests 
because that would require more than 15 LOC. I'm willing to add them, but 
directly to git repo.

I've signed the necessary papers from (to?) the FSF involving org mode, so I'm 
ready on my side to add tests and maybe add support for other tramp-related 
stuff.

Thanks
Felipe>From e902f40842a20baa0c4a2ca462b83d9ce949a19f Mon Sep 17 00:00:00 2001
From: Felipe Lema <1232306+felipel...@users.noreply.github.com>
Date: Fri, 21 Feb 2020 14:34:53 -0300
Subject: [PATCH 1/2] Squashed commit of the following:

commit 6ea888f432b5eeb3559706e336a752791f48d7fb
Author: Felipe Lema <1232306+felipel...@users.noreply.github.com>
Date:   Fri Feb 21 11:25:51 2020 -0300

fix evaluate python code in remote directory

Evaluating an "AST python code" should be local to the process /
directory.

`file-local-name` will do just this (strip the tramp prefix in path)
---
 lisp/ob-python.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index dbcfac08d..85c9644c4 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -345,7 +345,8 @@ last statement in BODY, as elisp."
 	  "python-")))
 			   (with-temp-file tmp-src-file (insert body))
 			   (format org-babel-python--eval-ast
-   tmp-src-file
+   (file-local-name
+tmp-src-file)
(org-babel-comint-with-output
(session org-babel-python-eoe-indicator nil body)
  (let ((comint-process-echoes nil))
-- 
2.16.4

>From d9d1c4180c86f38653ebdb0eb2e0a9d5865df0de Mon Sep 17 00:00:00 2001
From: Felipe Lema <1232306+felipel...@users.noreply.github.com>
Date: Fri, 21 Feb 2020 14:35:35 -0300
Subject: [PATCH 2/2] "use this script file" should be local to interpreter
 we're using

---
 lisp/ob-shell.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el
index 6c8ca9652..8dce9c7dd 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -240,7 +240,8 @@ return the value of the last statement in BODY."
 	  (with-temp-buffer
 		(call-process-shell-command
 		 (concat (if shebang script-file
-			   (format "%s %s" shell-file-name script-file))
+			   (format "%s %s" shell-file-name
+   (file-local-name script-file)))
 			 (and cmdline (concat " " cmdline)))
 		 stdin-file
 		 (current-buffer))
-- 
2.16.4