[ESS] R in Cygwin Emacs

Sebastien Vauban sva-news at mygooglest.com
Thu Sep 4 13:47:20 CEST 2014


Hi Rodney,

"Sparapani, Rodney" wrote:
>> If I don't set them in the above way, when running `M-x R', I'm blocked
>> with the message:
>> 
>> --8<---------------cut here---------------start------------->8---
>> Warning (emacs): None of 'w32-short-file-name, 'win32-short-file-name,
>> or 'mswindows-short-file-name are defined!
>> You will have to manually set   ess-program-files (in ess-custom.el) to
>> the correct "8.3"-style directory name.
>> --8<---------------cut here---------------end--------------->8---
>
> That's a bug.  We haven't discussed Cygwin recently (mainly because
> Cygwin is not popular anymore; so sue me ;o)  Seriously, I can't
> imagine why anyone would want to use it today.  Cygwin is a
> UNIX/Linux-like environment for Windows; I actually liked it.  But
> instead of doing it the hard way, I just installed Linux on my PC and
> cut out the middle man.  Of course, not everyone can do that.  But,
> there is also VirtualBox.

I have to develop some "shell scripts" running on a Windows machine (at
a client site). Before, I did all the "database to CSV" specific exports
with a combination of Bash, osql, AWK, grep, etc.

Now, I saw the light ;-) and am moving all such scripts to
R-only.

I could use the w32 version of R, and the Cygwin shell for eventual
add-ons to my script (such as sending an email or so). I could also use
the w32 version of Emacs, here at my desk, and there when testing and
deploying. But these are programs needed to be deployed at the client
site as well, and I do have to limit such requirements.

On the other hand, going the Cygwin road seems (seemed?) much more easy:

- Just install Cygwin, with a few additional packages (Emacs, R), and
  that's it!  Nothing else required on machines you don't own and
  manage yourself...

- Cygwin Emacs is more powerful/integrated than w32 Emacs: you can use
  `M-x term' and get the full terminal features inside Emacs (so that
  commands such as `less' and `top' do work! -- that's impossible with
  the w32 binaries of Emacs, even using Cygwin shell inside Emacs [1]).

Graphically, they're exactly the same. So, if Cygwin Emacs does work,
that's quite a big win, when you're stuck on Windows.

> Beyond that, when you are using Cygwin, it should not be looking for
> R for Windows!

I absolutely agree.

> It should be looking for UNIX/Linux R as provided by Cygwin.  Like
> I said, it is a bug if it's not doing that.  But, a bug that we most
> likely will not be setting a high priority on.  You can't anticipate
> every possible configuration that Emacs/ESS/R will be installed in.

Maybe the problem comes from the file name used to search: it seems to
be `Rterm' for Windows and `R' for Cygwin's executable.

@Richard,

> file ess/lisp/ess-compat.el checks for w32-short-file-name on Xemacs
> and sets it if it is missing to either 'win32-short-file-name or
> 'mswindows-short-file-name
>
> The message you quote is given when none of those names exist.
>
> If you can find the correct builtin function in cygwin emacs we can
> add that, too.  Since 8.3 names are part of MS DOS, you might even be
> able to write it based on the DOS command dir /x

I did not find any equivalent function (searching with `M-x
apropos-function' on "w32.*file") in Cygwin Emacs. But, maybe, I (would)
have to load extra packages?

@Vitalie,

> Seb, you can always set `inferior-R-program-name` to the full path. Or
> add R link to executable path, whatever that thing is on Cygwin.

I did this:

--8<---------------cut here---------------start------------->8---
  (when cygwinp                         ; using R from Cygwin

    ;; safe 8.3 name for 32-bit programs
    (setq ess-program-files "c:/PROGRA~2")

    ;; safe 8.3 name for 64-bit programs
    (setq ess-program-files-64 "c:/PROGRA~1")

    ;; program name for invoking an inferior ESS with `M-x R'
    (setq inferior-R-program-name "R")) ; [default: Rterm]
--8<---------------cut here---------------end--------------->8---

With that, I still have the warning about `w32-short-file-name', but
I finally get the iESS buffer open and ready -- even if I still have
small troubles (to be searched and documented in other posts).

Best regards,
  Seb

[1] "Spawning child process: invalid argument"

-- 
Sebastien Vauban



More information about the ESS-help mailing list