[ESS] Using Rterm under Cygwin Emacs, and future Sweave handling extensions.

Frede Aakmann Tøgersen FredeA.Togersen at agrsci.dk
Fri Nov 25 08:31:01 CET 2005


 
I updated to the recent developement version of ESS in order to check whether the problem that I have had with Cygwins bash shell in Emacs together with ESS. See below for Martin M.'s answer.
 
Last month I succeeded in finding a solution on the web. The problem seems to be related to the the definition of the R function in the 'essd-r.el' file, where the following code sniplet is included:
 
    (if ess-microsoft-p
 (setq default-process-coding-system '(undecided-dos . undecided-dos)))

When setting the process-coding-system to undecided-dos a newline (^L) is appended to a carriage return <CR> which interferes with Cygwin's normal UNIX behaviour. Cygwin expects only a <CR>.
 
I have solved this by putting:
 
(add-to-list 'process-coding-system-alist '("bash" . undecided-unix))
 
into my .emacs. Whether this is the right way to do it I don't known, but it seems to work in the sense that I can now use Cygwin's bash in a shell buffer at the same time as I use R without any problem observed during the last month.
 
I will now check if the new version breaks normal Emacs behaviour.
 
Best regards
 
Frede Aakmann Tøgersen
 
 
 ----------------------------------------------------
 Frede Aakmann Tøgersen
 Statistics and Decision Theory
 Department of Genetics and Biotechnology
 Danish Institute of Agricultural Sciences
 P.O. Box 50,  DK-8830 Tjele,
 --------------------------------------------------------


>>>>>> Reply from Martin M.:

Both 'M-x shell' and 'M-x R'
are based on "comint" , and we do change emacs variables
with names "comint-...".

However, comint has been designed (AFAIK by making all these
variables ``buffer-local'') such that you can have several
comint processes with different settings and shouldn't get
any problems.

I've never heard of problems like these, and cannot even try to
reproduce them.
The two Windows-using ESS developers are now at the joint
meetings and won't get around to fix your problem easily.

I notice from your e-mail that your emacs stems from "MinGW" and
your shell from "Cygwin".  I've heard that mixing the two does
lead to problems....

Maybe you ask on ESS-help for advice from users using such
shells on Windows? 
{ESS-bugs is just gatewayed to the small group of ESS developers}

Regards,
Martin Maechler, ETH Zurich

>>>>> "Frede" == Frede Aakmann Tøgersen <FredeA.Togersen at agrsci.dk>
>>>>>     on Tue, 9 Aug 2005 12:30:55 +0200 writes:

    Frede> Cygwin bash shell commander not working properly when invoked in a buffer after an inferior R process is startet. Bash works properly if invoked before the R process.

    Frede> Using a minimal .emacs as follows:

    Frede> ;; ESS

    Frede> (add-to-list 'load-path "C:/cygwin/usr/local/ess-svn/lisp")
    Frede> (add-to-list 'Info-default-directory-list "C:/cygwin/usr/local/ess-svn/info")
    Frede> (require 'ess-site)

    Frede> (setq-default inferior-R-program-name
    Frede> "c:/Programmer/R/rw2011/bin/Rterm.exe")  ; msdos systems

    Frede> (custom-set-variables
    Frede> ;; custom-set-variables was added by Custom.
    Frede> ;; If you edit it by hand, you could mess it up, so be careful.
    Frede> ;; Your init file should contain only one such instance.
    Frede> ;; If there is more than one, they won't work right.
    Frede> '(explicit-shell-file-name "bash"))
    Frede> (custom-set-faces
    Frede> ;; custom-set-faces was added by Custom.
    Frede> ;; If you edit it by hand, you could mess it up, so be careful.
    Frede> ;; Your init file should contain only one such instance.
    Frede> ;; If there is more than one, they won't work right.
    Frede> )


    Frede> If I start emacs and evoke a shell buffer with M-x shell bash is
    Frede> started in a buffer named *shell* and works properly even if an
    Frede> inferior R process is started with M-x R and R works fine.

    Frede> If I first do M-x R and then M-x shell then R works fine but the bash
    Frede> doesn't work at all. To every command line input it says "command not
    Frede> found", e.g. for a <CR>, pwd and ls I see

    Frede> bash-3.00$
    Frede> : command not found
    Frede> bash-3.00$ pwd
    Frede> : command not found
    Frede> bash-3.00$ ls
    Frede> : command not found
    Frede> bash-3.00$

    Frede> Does ESS overwrites variable definitions that regard to the behaviour of
    Frede> Emacs shell mode and if so which ones?

    Frede> Regards

    Frede> Frede Aakmann Tøgersen




    Frede> ----------------------------------------------------
    Frede> Frede Aakmann Tøgersen
    Frede> Statistics and Decision Theory
    Frede> Department of Genetics and Biotechnology
    Frede> Danish Institute of Agricultural Sciences
    Frede> P.O. Box 50
    Frede> DK-8830 Tjele,
    Frede> --------------------------------------------------------






    Frede> Emacs  : GNU Emacs 21.3.50.1 (i386-mingw-nt5.1.2600)
    Frede> of 2004-07-26 on BERATUNG4
    Frede> Package: ess-mode 5.2.9

    Frede> current state:
    Frede> ==============
    Frede> (setq
    Frede> ess-language "S"
    Frede> ess-dialect "R"
    Frede> ess-ask-for-ess-directory t
    Frede> ess-ask-about-transfile nil
    Frede> ess-directory nil
    Frede> ess-keep-dump-files "always"
    Frede> ess-source-directory "/tmp/"
    Frede> )
    Frede> [ess-site.el]: ess-customize-alist=nil
    Frede> [ess-site.el _2_]: ess-customize-alist=nil
    Frede> (R): ess-rterm-versions-create making M-x defuns for c:/program files/r/rw1091/bin/Rterm.exe c:/program files/r/rw2000/bin/Rterm.exe
    Frede> (R): ess-dialect=nil, buf=*scratch*, start-arg=nil
    Frede> current-prefix-arg=nil
    Frede> (inferior-ess 0): ess-start-args=--ess 
    Frede> ess-setq-vars-default 0: ess-language=Initial, -dialect=nil, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    Frede> ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    Frede> (inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=*scratch*
    Frede> (inf-ess 1.1): procname=R temp-dialect=R, buf-name=*R*
    Frede> (inferior-ess) Method #3 start=c:/Documents and Settings/FAT/My Documents/fat/MyRwork/ buf=*R*
    Frede> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    Frede> (inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R*
    Frede> (inf-ess 2.2): start args = --ess , inf-ess-start-args=--ess 
    Frede> (inf-ess finish [S(R), c:/Programmer/R/rw2011/bin/Rterm.exe(nil,nil)]
    Frede> (ess-multi 0):  inf-ess-start-args=--ess , comint-..echoes=nil
    Frede> (i-ess 1): buf=*R*, lang=S, comint..echo=nil, comint..sender=comint-simple-send,
    Frede> (i-ess 2): buf=*R*, lang=S, comint..echo=t, comint..sender=inferior-R-input-sender,
    Frede> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, comint..sender=inferior-R-input-sender
    Frede> (i-ess 3): curr-buf=*R*, comint..echo=t, comint..sender=inferior-R-input-sender,
    Frede> (ess-multi post inf-ess: start-args=--ess , comint-echoes=t
    Frede> (ess-multi 1):  start-args=--ess 
    Frede> Making Process...Buf *R*, Proc R, Prog c:/Programmer/R/rw2011/bin/Rterm.exe
    Frede> Start File=nil, Args= --ess .
    Frede> (R): inferior-ess-language-start=options(STERM='iESS', editor='gnuclient.exe')

    Frede> (R): ess-dialect=R, buf=.emacs, start-arg=nil
    Frede> current-prefix-arg=nil
    Frede> (inferior-ess 0): ess-start-args=--ess 
    Frede> ess-setq-vars-default 0: ess-language=S, -dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    Frede> ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    Frede> (inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=.emacs
    Frede> (inf-ess 1.1): procname=R:2 temp-dialect=R, buf-name=*R:2*
    Frede> (inferior-ess) Method #3 start=c:/Documents and Settings/FAT/My Documents/fat/MyRwork/ buf=*R:2*
    Frede> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    Frede> (inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R:2*
    Frede> (inf-ess 2.2): start args = --ess , inf-ess-start-args=--ess 
    Frede> (inf-ess finish [S(R), c:/Programmer/R/rw2011/bin/Rterm.exe(R,nil)]
    Frede> (ess-multi 0):  inf-ess-start-args=--ess , comint-..echoes=nil
    Frede> (i-ess 1): buf=*R:2*, lang=S, comint..echo=nil, comint..sender=comint-simple-send,
    Frede> (i-ess 2): buf=*R:2*, lang=S, comint..echo=t, comint..sender=inferior-R-input-sender,
    Frede> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, comint..sender=inferior-R-input-sender
    Frede> (i-ess 3): curr-buf=*R:2*, comint..echo=t, comint..sender=inferior-R-input-sender,
    Frede> (ess-multi post inf-ess: start-args=--ess , comint-echoes=t
    Frede> (ess-multi 1):  start-args=--ess 
    Frede> Making Process...Buf *R:2*, Proc R:2, Prog c:/Programmer/R/rw2011/bin/Rterm.exe
    Frede> Start File=nil, Args= --ess .
    Frede> (R): inferior-ess-language-start=options(STERM='iESS', editor='gnuclient.exe')
    Frede> ----------------------------------------------------
    Frede> Frede Aakmann Tøgersen
    Frede> Afdeling for Genetik og Bioteknologi
    Frede> Danmarks Jordbrugsforskning
    Frede> Postboks 50
    Frede> 8830 Tjele

    Frede> _______________________________________________
    Frede> ESS-bugs ESS-bugs at stat.math.ethz.ch
    Frede> https://stat.ethz.ch/mailman/listinfo/ess-bugs

    Frede> _______________________________________________
    Frede> ESS-core list: https://stat.ethz.ch/mailman/listinfo/ess-core




________________________________

Fra: ess-help-bounces at stat.math.ethz.ch på vegne af A.J. Rossini
Sendt: to 24-11-2005 18:19
Til: ess-help at stat.math.ethz.ch
Emne: [ESS] Using Rterm under Cygwin Emacs,and future Sweave handling extensions.



I've check-in a few changes into the SVN repository for using R with
Cygwin's Emacs.  If anyone would like to check (the svn version) to
make sure it doesn't break normal Emacs/XEmacs under windows before
the 5.2.12 release, I'd appreciate that.

Also, I've got preliminary code for Sweave ala Duncan Murdoch's
workflow suggested sometime recently, I can't recall when; hopefully
it'll be done for the 5.2.12 release.
(i.e. adds 2 commands:  one writes out the output of the R submission
just past the chunk, i.e.

<<ThisChunk>>=
MyRCode()
@
%% <<ThisChunk>>=    time-stamp
%% MyRCode() output
%% @

(replace time-stamp with the Emacs time-stamp command).  If you are
wondering about the time-stamp, think "conditional evaluation".

The other command compares the output in a colorful manner via
ediff-buffers between past and current input and returns true/false.

They definitely need refactoring to "do-the-right-thing".

Thanks to Thomas Gerds at Uni-Freiburg, where I gave a talk last
Friday, for seeding my brain with ideas, emacs-hints, and ruining what
was to be a relaxing weekend.

best,
-tony

blindglobe at gmail.com
Muttenz, Switzerland.
"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).

______________________________________________
ESS-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list