emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel-R  and windows ?
@ 2010-01-12 13:24 d.tchin
  2010-01-12 14:56 ` [babel] " Giovanni Ridolfi
  2010-01-12 17:43 ` Dan Davison
  0 siblings, 2 replies; 12+ messages in thread
From: d.tchin @ 2010-01-12 13:24 UTC (permalink / raw)
  To: emacs-orgmode


I need help to be able to use org-babel functionality. 
I use emacs 22.3.1 in windows XP and org-mode 6.34.

I have the following instructions in .emacs

(require 'org-install)
(require 'org-plot)
(require 'org-babel-init)  
(require 'org-babel-R)         ;; requires R and ess-mode
(require 'org-babel-python)    ;; requires python, and python-mode
(require 'org-babel-ditaa)

ESS module is loaded before :

(load "~/emacs/emacs-22.3/site-lisp/ess-5.7.1/lisp/ess-site")


I don't manage to get any output with R Software. 

Below you will find test I have done :

#+srcname:trial
#+begin_src sh
  echo output
#+end_src

#+results: trial
: output

#+srcname:trial
#+begin_src R
  c(4,5,6,7,8,9)
#+end_src


I manage to have shell output, but when I tried R procedure,
I have the following output in *Messages* buffer

executing R source code block...
Syntaxe du nom de fichier, de répertoire ou de volume incorrecte.
Source block produced no output

I have a look on temporary directory and I have the folllowing
file :

R-in-functional-results4452lyl

Inside the following source code :

main <- function ()
{

c(4,5,6,7,8,9)


}
write.table(main(), file="c:/Temp/emacs/tmp/R-out-functional-results4452y8r", 
sep="\t", na="nil",row.names=FALSE, col.names=FALSE, quote=FALSE)


The file  R-out-functional-results4452y8r exists but is empty.
What I miss to make it work ?

Regards

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [babel] org-babel-R  and windows ?
  2010-01-12 13:24 org-babel-R and windows ? d.tchin
@ 2010-01-12 14:56 ` Giovanni Ridolfi
  2010-01-12 17:05   ` Manish
  2010-01-12 17:43 ` Dan Davison
  1 sibling, 1 reply; 12+ messages in thread
From: Giovanni Ridolfi @ 2010-01-12 14:56 UTC (permalink / raw)
  To: d.tchin; +Cc: emacs-orgmode

d.tchin <d.tchin@voila.fr> writes:

Hi, d.tchin ,

> I need help to be able to use org-babel functionality. 
> I use emacs 22.3.1 in windows XP and org-mode 6.34.
>
> I have the following instructions in .emacs
>
> (require 'org-install)
> (require 'org-plot)
> (require 'org-babel-init)  
> (require 'org-babel-R)         ;; requires R and ess-mode
> (require 'org-babel-python)    ;; requires python, and python-mode
> (require 'org-babel-ditaa)
>
> ESS module is loaded before :
>
> (load "~/emacs/emacs-22.3/site-lisp/ess-5.7.1/lisp/ess-site")
>
> I don't manage to get any output with R Software. 
>
> Below you will find test I have done :
>
> #+srcname:trial
> #+begin_src sh
>   echo output
> #+end_src
>
> #+results: trial
> : output
>
> #+srcname:trial
> #+begin_src R
>   c(4,5,6,7,8,9)
> #+end_src
>
> I manage to have shell output, but when I tried R procedure,
> I have the following output in *Messages* buffer
>
> executing R source code block...
> Syntaxe du nom de fichier, de répertoire ou de volume incorrecte.
joking: "what does that mean in *English*, you French-centric guy?!"  ;-)
ah,yes,  google translator is my friend:

Syntax of the file name, directory or volume error.

I suspect that R is not loaded/called correctly from org-babel

+ can you run R from emacs shell?
+ is the R executable in the path?
+ do you have all the backslashes defined correctly when you call the R executable?

cheers,
Giovanni

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [babel] org-babel-R and windows ?
  2010-01-12 14:56 ` [babel] " Giovanni Ridolfi
@ 2010-01-12 17:05   ` Manish
  0 siblings, 0 replies; 12+ messages in thread
From: Manish @ 2010-01-12 17:05 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode, d.tchin

On Tue, Jan 12, 2010 at 8:26 PM, Giovanni Ridolfi wrote:
> d.tchin writes:
>
> Hi, d.tchin ,
>
>> I need help to be able to use org-babel functionality.
>> I use emacs 22.3.1 in windows XP and org-mode 6.34.
>>
>> I have the following instructions in .emacs
>>
>> (require 'org-install)
>> (require 'org-plot)
>> (require 'org-babel-init)
>> (require 'org-babel-R)         ;; requires R and ess-mode
>> (require 'org-babel-python)    ;; requires python, and python-mode
>> (require 'org-babel-ditaa)
>>
>> ESS module is loaded before :
>>
>> (load "~/emacs/emacs-22.3/site-lisp/ess-5.7.1/lisp/ess-site")
>>
>> I don't manage to get any output with R Software.
>>
>> Below you will find test I have done :
>>
>> #+srcname:trial
>> #+begin_src sh
>>   echo output
>> #+end_src
>>
>> #+results: trial
>> : output
>>
>> #+srcname:trial
>> #+begin_src R
>>   c(4,5,6,7,8,9)
>> #+end_src
>>
>> I manage to have shell output, but when I tried R procedure,
>> I have the following output in *Messages* buffer
>>
>> executing R source code block...
>> Syntaxe du nom de fichier, de répertoire ou de volume incorrecte.
> joking: "what does that mean in *English*, you French-centric guy?!"  ;-)
> ah,yes,  google translator is my friend:
>
> Syntax of the file name, directory or volume error.

I face the exact same problem on:
 - Windows XP SP 2
 - R 2.10.0
 - ESS 5.3.11
 - Emacs 23.1.1
 - bleeding edge Org.

> I suspect that R is not loaded/called correctly from org-babel

Ruby calls from Org babel work.  And R was configured the same way.
The temporary files are created in $TEMP but the out file is empty.

>
> + can you run R from emacs shell?

Yes.

> + is the R executable in the path?

Yes.

> + do you have all the backslashes defined correctly when you call the R executable?

Yes.


-- 
Manish

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: org-babel-R  and windows ?
  2010-01-12 13:24 org-babel-R and windows ? d.tchin
  2010-01-12 14:56 ` [babel] " Giovanni Ridolfi
@ 2010-01-12 17:43 ` Dan Davison
  2010-01-12 18:05   ` Eric Schulte
                     ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Dan Davison @ 2010-01-12 17:43 UTC (permalink / raw)
  To: d.tchin; +Cc: emacs-orgmode

"d.tchin" <d.tchin@voila.fr> writes:

> I need help to be able to use org-babel functionality. 
> I use emacs 22.3.1 in windows XP and org-mode 6.34.
>
> I have the following instructions in .emacs
>
> (require 'org-install)
> (require 'org-plot)
> (require 'org-babel-init)  
> (require 'org-babel-R)         ;; requires R and ess-mode
> (require 'org-babel-python)    ;; requires python, and python-mode
> (require 'org-babel-ditaa)
>
> ESS module is loaded before :
>
> (load "~/emacs/emacs-22.3/site-lisp/ess-5.7.1/lisp/ess-site")
>
>
> I don't manage to get any output with R Software. 
>
> Below you will find test I have done :
>
> #+srcname:trial
> #+begin_src sh
>   echo output
> #+end_src
>
> #+results: trial
> : output
>
> #+srcname:trial
> #+begin_src R
>   c(4,5,6,7,8,9)
> #+end_src
>
>
> I manage to have shell output, but when I tried R procedure,
> I have the following output in *Messages* buffer
>
> executing R source code block...
> Syntaxe du nom de fichier, de répertoire ou de volume incorrecte.
> Source block produced no output

The org-babel default is to invoke R as an external shell command, and I
think this is what is causing the problem. It requires that the emacs
function shell-command can use the string "R" to invoke an R process,
i.e. the R installation and the shell path must be such that this is the
case.

Seeing as you have ESS installed, how about using session-based
evaluation? This means that org-babel uses an interactive R session
running under the control of ESS. In general it is a better way to work
with R in org-babel. It is described in the section "Session-based
Evaluation" in

http://orgmode.org/worg/org-contrib/babel/intro.php

and also in the reference manual:

http://orgmode.org/worg/org-contrib/babel/reference.php#header-argument-session

basically you just set the :session header argument, e.g.

#+srcname:trial
#+begin_src R :session org-babel-R-session
   c(4,5,6,7,8,9)
#+end_src

Have a look here to see the different methods you can use to make this
the default (without having to explicitly set the header arg each time)

http://orgmode.org/worg/org-contrib/babel/reference.php#sec-3.1

Dan

>
> I have a look on temporary directory and I have the folllowing
> file :
>
> R-in-functional-results4452lyl
>
> Inside the following source code :
>
> main <- function ()
> {
>
> c(4,5,6,7,8,9)
>
>
> }
> write.table(main(), file="c:/Temp/emacs/tmp/R-out-functional-results4452y8r", 
> sep="\t", na="nil",row.names=FALSE, col.names=FALSE, quote=FALSE)
>
>
> The file  R-out-functional-results4452y8r exists but is empty.
> What I miss to make it work ?
>
> Regards
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: org-babel-R  and windows ?
  2010-01-12 17:43 ` Dan Davison
@ 2010-01-12 18:05   ` Eric Schulte
  2010-01-13  4:16   ` Manish
  2010-01-13  9:20   ` d.tchin
  2 siblings, 0 replies; 12+ messages in thread
From: Eric Schulte @ 2010-01-12 18:05 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode, d.tchin

Dan Davison <davison@stats.ox.ac.uk> writes:

[...]

>
> The org-babel default is to invoke R as an external shell command, and I
> think this is what is causing the problem. It requires that the emacs
> function shell-command can use the string "R" to invoke an R process,
> i.e. the R installation and the shell path must be such that this is the
> case.
>

If the "R" command turns out to be the culprit it would be an easy fix
to make the command used to run R externally a user-defined variable.

 -- Eric

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: org-babel-R and windows ?
  2010-01-12 17:43 ` Dan Davison
  2010-01-12 18:05   ` Eric Schulte
@ 2010-01-13  4:16   ` Manish
  2010-01-13  9:20   ` d.tchin
  2 siblings, 0 replies; 12+ messages in thread
From: Manish @ 2010-01-13  4:16 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode, d.tchin

On Tue, Jan 12, 2010 at 11:13 PM, Dan Davison wrote:
[snip:  snipped (43 lines)]
>
> The org-babel default is to invoke R as an external shell command, and I
> think this is what is causing the problem. It requires that the emacs
> function shell-command can use the string "R" to invoke an R process,
> i.e. the R installation and the shell path must be such that this is the
> case.
>
> Seeing as you have ESS installed, how about using session-based
> evaluation? This means that org-babel uses an interactive R session
> running under the control of ESS. In general it is a better way to work
> with R in org-babel. It is described in the section "Session-based
> Evaluation" in
>
> http://orgmode.org/worg/org-contrib/babel/intro.php
>
> and also in the reference manual:
>
> http://orgmode.org/worg/org-contrib/babel/reference.php#header-argument-session
>
> basically you just set the :session header argument, e.g.
>
> #+srcname:trial
> #+begin_src R :session org-babel-R-session
>   c(4,5,6,7,8,9)
> #+end_src
>

Thanks for the advice regarding using sessions.  It works now.  But I
have something interesting to report.

With following test org file, evaluation of R block fails to produce
desired results.  If the lines with "require" are removed, the
evaluation works fine.  R session buffer contents are pasted below as
well just in case they are of any help.

--8<---------------cut here---------------start------------->8---
* Test

Here's how to set it up.

(require 'org_babel_init)
(require 'org_babel_R)
(org_babel_load_library_of_babel)

#+srcname: strings
#+begin_src R :colnames t :session org-babel-R-strings
  t(sort(table(tolower(scan("~/personal/test-org-babel.org", what="",
na.strings="|"))), decreasing=TRUE)[1:10])
#+end_src

#+results: strings
--8<---------------cut here---------------end--------------->8---


--8<---------------cut here---------------start------------->8---
R version 2.10.0 (2009-10-26)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> options(chmhelp = FALSE)
> options(STERM='iESS', editor='gnuclient.exe')
>
t(sort(table(tolower(scan("~/personal/test-org-babel.org", what="",
na.strings="|"))), decreasing=TRUE)[1:10])
write.table(.Last.value, file="d:/home/zms/tmp/org-babel-R1752nPK",
sep="\t", na="nil",row.names=FALSE, col.names=TRUE, quote=FALSE)
'org_babel_R_eoe'

> t(sort(table(tolower(scan("~/personal/test-org-babel.org", what="", na.strings="|"))), decreasing=TRUE)[1:10])
Read 27 items

       strings #+begin_src #+end_src #+results: #+srcname:
  [1,]       2           1         1          1          1

       (org_babel_load_library_of_babel) (require * :colnames :session
  [1,]                                 1        1 1         1        1
> write.table(.Last.value, file="d:/home/zms/tmp/org-babel-R1752nPK", sep="\t", na="nil",row.names=FALSE, col.names=TRUE, quote=FALSE)
> 'org_babel_R_eoe'
[1] "org_babel_R_eoe"
>
--8<---------------cut here---------------end--------------->8---

Thank you
-- 
Manish

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: org-babel-R  and windows ?
  2010-01-12 17:43 ` Dan Davison
  2010-01-12 18:05   ` Eric Schulte
  2010-01-13  4:16   ` Manish
@ 2010-01-13  9:20   ` d.tchin
  2010-01-13 19:39     ` Dan Davison
  2 siblings, 1 reply; 12+ messages in thread
From: d.tchin @ 2010-01-13  9:20 UTC (permalink / raw)
  To: emacs-orgmode

Dan Davison <davison <at> stats.ox.ac.uk> writes:
> The org-babel default is to invoke R as an external shell command, and I
> think this is what is causing the problem. It requires that the emacs
> function shell-command can use the string "R" to invoke an R process,
> i.e. the R installation and the shell path must be such that this is the
> case.

Thank you for the information and explanation.
It seems that the problem comes from the windows shell. 

I try the following :  I explicitely told emacs to use bash 
with the following instructions :
(setq explicit-shell-file-name "C:/msys/1.0/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)

It works with bash.


> 
> #+srcname:trial
> #+begin_src R :session org-babel-R-session
>    c(4,5,6,7,8,9)
> #+end_src

The "session" way works too.

Thank you.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: org-babel-R  and windows ?
  2010-01-13  9:20   ` d.tchin
@ 2010-01-13 19:39     ` Dan Davison
  2010-01-14  8:37       ` Sébastien Vauban
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Davison @ 2010-01-13 19:39 UTC (permalink / raw)
  To: d.tchin; +Cc: emacs-orgmode

"d.tchin" <d.tchin@voila.fr> writes:

> Dan Davison <davison <at> stats.ox.ac.uk> writes:
>> The org-babel default is to invoke R as an external shell command, and I
>> think this is what is causing the problem. It requires that the emacs
>> function shell-command can use the string "R" to invoke an R process,
>> i.e. the R installation and the shell path must be such that this is the
>> case.
>
> Thank you for the information and explanation.
> It seems that the problem comes from the windows shell. 
>
> I try the following :  I explicitely told emacs to use bash 
> with the following instructions :
> (setq explicit-shell-file-name "C:/msys/1.0/bin/bash.exe")
> (setq shell-file-name explicit-shell-file-name)
>
> It works with bash.

Thanks for that, I've stored your solution in the org-babel development
repo with a view to modifying our code so that these probloems are minimised in
the future, and we'll also make sure the documentation addresses this.
Dan

>
>
>> 
>> #+srcname:trial
>> #+begin_src R :session org-babel-R-session
>>    c(4,5,6,7,8,9)
>> #+end_src
>
> The "session" way works too.
>
> Thank you.
>
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: org-babel-R  and windows ?
  2010-01-13 19:39     ` Dan Davison
@ 2010-01-14  8:37       ` Sébastien Vauban
  2010-01-14 17:39         ` [babel] " Dan Davison
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Vauban @ 2010-01-14  8:37 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Dan,

Dan Davison wrote:
> "d.tchin" <d.tchin-7V4A5QgKqXk@public.gmane.org> writes:
>> Dan Davison <davison <at> stats.ox.ac.uk> writes:
>>> The org-babel default is to invoke R as an external shell command, and I
>>> think this is what is causing the problem. It requires that the emacs
>>> function shell-command can use the string "R" to invoke an R process, i.e.
>>> the R installation and the shell path must be such that this is the case.
>>
>> Thank you for the information and explanation. It seems that the problem
>> comes from the windows shell.
>>
>> I try the following :  I explicitely told emacs to use bash
>> with the following instructions :
>> (setq explicit-shell-file-name "C:/msys/1.0/bin/bash.exe")
>> (setq shell-file-name explicit-shell-file-name)
>>
>> It works with bash.
>
> Thanks for that, I've stored your solution in the org-babel development repo
> with a view to modifying our code so that these probloems are minimised in
> the future, and we'll also make sure the documentation addresses this.

I'm a Windows user *and* an Ubuntu user for years, now, with one single common
`.emacs' file for both OS.

Therefore, I'll show you what I have in my `.emacs':

--8<---------------cut here---------------start------------->8---
;;*** ----[ 41.1 Single Shell

;; for single shell commands
(setq shell-file-name "bash")  ;; must be in the `PATH' (Windows users)


;;*** ----[ 41.2 Interactive Shell

;; for the interactive (sub)shell
(setq explicit-shell-file-name shell-file-name)
--8<---------------cut here---------------end--------------->8---

Almost the same, except the order (not important) and the fact that bash is
written in its simplest form: no hard-coded path, and no `.exe' suffix, so
that it works for both Win32 and Linux.

The only thing to do, for Windows users, is ensure that `bash.exe' (generally
located in `C:\cygwin\bin') is in the Windows PATH environment variable.

I would advice keeping such a construct, instead of full paths.

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [babel] Re: org-babel-R  and windows ?
  2010-01-14  8:37       ` Sébastien Vauban
@ 2010-01-14 17:39         ` Dan Davison
  2010-01-14 19:39           ` Sébastien Vauban
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Davison @ 2010-01-14 17:39 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Dan,
>
> Dan Davison wrote:
>> "d.tchin" <d.tchin@voila.fr> writes:
>>> Dan Davison <davison <at> stats.ox.ac.uk> writes:
>>>> The org-babel default is to invoke R as an external shell command, and I
>>>> think this is what is causing the problem. It requires that the emacs
>>>> function shell-command can use the string "R" to invoke an R process, i.e.
>>>> the R installation and the shell path must be such that this is the case.
>>>
>>> Thank you for the information and explanation. It seems that the problem
>>> comes from the windows shell.
>>>
>>> I try the following :  I explicitely told emacs to use bash
>>> with the following instructions :
>>> (setq explicit-shell-file-name "C:/msys/1.0/bin/bash.exe")
>>> (setq shell-file-name explicit-shell-file-name)
>>>
>>> It works with bash.
>>
>> Thanks for that, I've stored your solution in the org-babel development repo
>> with a view to modifying our code so that these probloems are minimised in
>> the future, and we'll also make sure the documentation addresses this.
>
> I'm a Windows user *and* an Ubuntu user for years, now, with one single common
> `.emacs' file for both OS.
>
> Therefore, I'll show you what I have in my `.emacs':
>
> ;;*** ----[ 41.1 Single Shell
>
> ;; for single shell commands
> (setq shell-file-name "bash")  ;; must be in the `PATH' (Windows users)
>
>
> ;;*** ----[ 41.2 Interactive Shell
>
> ;; for the interactive (sub)shell
> (setq explicit-shell-file-name shell-file-name)
>
> Almost the same, except the order (not important) and the fact that bash is
> written in its simplest form: no hard-coded path, and no `.exe' suffix, so
> that it works for both Win32 and Linux.
>
> The only thing to do, for Windows users, is ensure that `bash.exe' (generally
> located in `C:\cygwin\bin') is in the Windows PATH environment variable.
>
> I would advice keeping such a construct, instead of full paths.

Thanks Seb,

That's really helpful. I'm really ignorant about this Windows stuff. So
let me get the basics straight: is it the case that, if a user does
*not* have a UNIX emulation environment installed under Windows
(e.g. cygwin, msys, mingw?) then there is no way that org-babel external
shell evaluation is going to work? Or does that statement need to be
qualified according to language (R, shell, ruby, ...)? I.e., when a
Windows user just has emacs and the native windows/dos shell, are these
things just not going to work?

Dan

>
> Best regards,
>   Seb

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [babel] Re: org-babel-R  and windows ?
  2010-01-14 17:39         ` [babel] " Dan Davison
@ 2010-01-14 19:39           ` Sébastien Vauban
  2010-01-15  9:32             ` Stefan Vollmar
  0 siblings, 1 reply; 12+ messages in thread
From: Sébastien Vauban @ 2010-01-14 19:39 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Dan,

Dan Davison wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Dan Davison wrote:
>>> "d.tchin" <d.tchin-7V4A5QgKqXk@public.gmane.org> writes:
>>>> Dan Davison <davison <at> stats.ox.ac.uk> writes:
>>>>>
>>>>> The org-babel default is to invoke R as an external shell command, and I
>>>>> think this is what is causing the problem. It requires that the emacs
>>>>> function shell-command can use the string "R" to invoke an R process,
>>>>> i.e. the R installation and the shell path must be such that this is the
>>>>> case.
>>>>
>>>> Thank you for the information and explanation. It seems that the problem
>>>> comes from the windows shell.
>>>>
>>>> I try the following :  I explicitely told emacs to use bash
>>>> with the following instructions :
>>>> (setq explicit-shell-file-name "C:/msys/1.0/bin/bash.exe")
>>>> (setq shell-file-name explicit-shell-file-name)
>>>>
>>>> It works with bash.
>>>
>>> Thanks for that, I've stored your solution in the org-babel development
>>> repo with a view to modifying our code so that these probloems are
>>> minimised in the future, and we'll also make sure the documentation
>>> addresses this.
>>
>> I'm a Windows user *and* an Ubuntu user for years, now, with one single
>> common `.emacs' file for both OS.
>>
>> Therefore, I'll show you what I have in my `.emacs':
>>
>> ;;*** ----[ 41.1 Single Shell
>>
>> ;; for single shell commands
>> (setq shell-file-name "bash")  ;; must be in the `PATH' (Windows users)
>>
>>
>> ;;*** ----[ 41.2 Interactive Shell
>>
>> ;; for the interactive (sub)shell
>> (setq explicit-shell-file-name shell-file-name)
>>
>> Almost the same, except the order (not important) and the fact that bash is
>> written in its simplest form: no hard-coded path, and no `.exe' suffix, so
>> that it works for both Win32 and Linux.
>>
>> The only thing to do, for Windows users, is ensure that `bash.exe'
>> (generally located in `C:\cygwin\bin') is in the Windows PATH environment
>> variable.
>>
>> I would advice keeping such a construct, instead of full paths.
>
> Thanks Seb,
>
> That's really helpful.

You're (more than) welcome. My goal is the same as yours: making this whole
stuff more open, more easy, more powerful, and more reliable. Do I miss
something? ;-))


> I'm really ignorant about this Windows stuff. So let me get the basics
> straight: is it the case that, if a user does *not* have a UNIX emulation
> environment installed under Windows (e.g. cygwin, msys, mingw?) then there
> is no way that org-babel external shell evaluation is going to work? Or does
> that statement need to be qualified according to language (R, shell, ruby,
> ...)? I.e., when a Windows user just has emacs and the native windows/dos
> shell, are these things just not going to work?

I have to be honest. I will give more impressions than facts, for the simple
reason that Cygwin is well implanted in my Windows, and that for more than 10
years now: I began using Emacs in 1999, and have Cygwin bundled with it since
then (as Windows is pretty useless without a better shell than `cmd.exe').

So, trying to answer your question, I would split it in two parts:

- calling scripts,
- calling applications with some data or description.

First case: script written for the shell. Without cygwin, your interpreter is
`cmd.exe', so pretty limited. And, here, we come back to one question I had
some weeks ago about which interpreter is chosen when executing the snippet:
bash, Zsh, etc. Same problem here, with a third possible command interpreter.

Second case: "applications" like R, ditaa, etc. There, I don't see any problem
for calling them with some data to feed them. The only real condition is that
the program must be found in the PATH (or the full path to the executable has
to be given).

Am I answering you in the intended way?  Do you want me to make some tests?
Don't hesitate...

Best regards,
  Seb

-- 
Sébastien Vauban



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [babel] Re: org-babel-R  and windows ?
  2010-01-14 19:39           ` Sébastien Vauban
@ 2010-01-15  9:32             ` Stefan Vollmar
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Vollmar @ 2010-01-15  9:32 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Dan Davison, Sébastien Vauban

Dear Sébastien,
dear Dan,

On 14.01.2010, at 20:39, Sébastien Vauban wrote:

> Hi Dan,
> 
> Dan Davison wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> [...]
> So, trying to answer your question, I would split it in two parts:
> 
> - calling scripts,
> - calling applications with some data or description.
> 
> First case: script written for the shell. Without cygwin, your interpreter is
> `cmd.exe', so pretty limited. And, here, we come back to one question I had
> some weeks ago about which interpreter is chosen when executing the snippet:
> bash, Zsh, etc. Same problem here, with a third possible command interpreter.
> 
> Second case: "applications" like R, ditaa, etc. There, I don't see any problem
> for calling them with some data to feed them. The only real condition is that
> the program must be found in the PATH (or the full path to the executable has
> to be given).

I would like to add something which we had to learn the hard way when working on a platform-independent project with a commandline-interface: the native commandline in MS Windows (cmd.exe) can only digest input with significantly fewer characters than the usual shells in Linux and Solaris - and then you get really strange and unhelpful error messages. The number of characters for Windows XP is 8191 characters, for older systems (Windows 2000) it is about 2000 characters. This was a showstopper-class problem for us (we worked around this by putting all previous commandline arguments into an optional parameter file), much later we found an official Microsoft article on this: http://support.microsoft.com/kb/830473/EN-US

Warm regards,
 Stefan 
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-01-15  9:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-12 13:24 org-babel-R and windows ? d.tchin
2010-01-12 14:56 ` [babel] " Giovanni Ridolfi
2010-01-12 17:05   ` Manish
2010-01-12 17:43 ` Dan Davison
2010-01-12 18:05   ` Eric Schulte
2010-01-13  4:16   ` Manish
2010-01-13  9:20   ` d.tchin
2010-01-13 19:39     ` Dan Davison
2010-01-14  8:37       ` Sébastien Vauban
2010-01-14 17:39         ` [babel] " Dan Davison
2010-01-14 19:39           ` Sébastien Vauban
2010-01-15  9:32             ` Stefan Vollmar

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).