[ESS] A beginner's questions on starting ESS and typing problem

Paul Johnson pauljohn32 at gmail.com
Fri Mar 25 21:47:35 CET 2011


Hi, answers below

Except for this.

<begin warning/public apology>

When you open an R file in Emacs, do you get the ESS icons with the
blue R.  Can you start R sessions?  If so, ignore the next bit. If
not, here is my warning.

If you are following my advice on R and Emacs, be warned that I am out
of line with the main R windows distributors.  Their way is official,
my way is just one nutty old professor.

I install R in

c:\Program Files\R

and then I add this to the Windows Path

c:\Program Files\R\bin\x86

(Or c:\Program Files\R\bin\i386 for 32 bit).

So Emacs and ESS can find Rterm.exe.

The R core team does not change the Windows path, and they want you to
install in a new folder for each edition of R,

c:\Program Files\R\R-2.12

which I think is confusing and hard to maintain, but nobody agrees
with me, so they keep doing that.  The newer Emacs and ESS looks for
Rterm.exe, but it only looks in folders with names like R\R-2.12. So,
if you installed R the standard way, Emacs-ESS will work, but if you
followed my advice to install R, then Emacs-ESS will not work, it
won't find Rterm, unless you put R\bin\x86 in the path.

<end warning/public apology>

On Thu, Mar 24, 2011 at 10:16 PM, Vincent Goulet
<Vincent.Goulet at act.ulaval.ca> wrote:
> Le 2011-03-24 à 22:53, Yuguang Zhou a écrit :
>
>> Hi all,
>>
>> I am new to ESS and trying to pick up this powerful tool.  Having read the
>> ESS manual and downloaded a ref-card, but still find it hard to start.
>>
>> I used Vincent Goulet's GNU EMacs + ESS installation package and mainly use
>> it for R programming in Windows environment, and would greatly appreciate
>> any input and help:
>>
>> 1, Is there a way to specify folder when opening a code not in my home
>> directory? Do I really need to type the whole path?  Or can I change the
>> default home directory to any one I want?
>
> Well, on Windows you can use the menu File | Visit New File... and navigate through your folders with the usual dialog. That said, I usually find it faster to type in the path in the minibuffer using TAB to complete unique names. You *should* use TAB in the minibuffer!
>

If you used the Emacs config file I recommend (which is possible in
light of your comments below), Emacs does not stop your R session to
ask what you want to use for your data directory.  You may see in that
file, that I don't want emacs to ask me for a directory every time it
starts. Instead, I keep R files in directories, and when I open those
R files with Emacs, then emacs will know to use that file as my
current working directory.


>> 2, When I type "TAB" key to indent the code, it simply doesn't work.  it
>> said to use <TAB> To indent the line on ESS refer card (V 5.3.0), why is
>> that?
>

I do not see that trouble in an R file.  TAB gives me the automatic
indent that R wants. If it does not indent, that means you are not
supposed to have an indentation there.

I wonder if your TAB key has not been damaged somehow. I don't think
anything I did in my startup would damage TAB, though.  The only key
combo I fiddled with was

Shift-Enter

which should send the current line over to the R session.

> TAB will not insert a tabulation per se in your code; it will indent the code automagically for you. What do mean by "it does not work"? Are you in R mode when editing your code? The script file name should end in .r or .R for Emacs to enter R mode automatically.
>
>> 3, I followed Paul E Johnson's advice and installed his startup
>> configuration file for Emacs (
>> http://www.emacswiki.org/emacs/ESSWindowsAdvice). He also mentioned another
>> configuration file "framepop.el" and provided the link for download, but he
>> didn't say how to used that.  Can anyone do me a favor to explain?
>
> FYI, framepop.el is now included in my distribution, but not activated. I don't use it, so can't comment any further.
>

The last time I checked, the framepop.el was not actually in the emacs
packaging for windows. I believe it might have been accidentally
omitted, because Prof Goulet indicated that he did want to package it.
 If you don't find framepop.el in your system, download this:

http://pj.freefaculty.org/Software/WinProgs/framepop.el

And put it under GNUEmacs\site-lisp

How to use it?

Well, it will be automatic once your turn it on with some settings in your

Put this Emacs custom startup file in your GNUEmacs\site-start.d folder



http://pj.freefaculty.org/Software/WinProgs/emacs-ess-ku-framepops.el

(or put it in as your personal emacs config, which, on windows, might
mean re-naming it as ".emacs" or such--I honestly don't understand
what they want you to do these days).

That's basically the same setup I propose in general, except that the
framepops usage is not commented out.  I had to comment out my
previous use of framepop after I found out other people did not have
that el file.

Look in there, here are the lines that make framepop go:

;; Wow. "pop-up-frames" is different from "framepop". Crazy!
;; The framepop package can "catch" some special small buffers and
;; divert them off to a specially configured frame.  I made it pink!
;; The framepop packages is in emacs-goodies on Ubuntu, I hope
;; it is installed in whatever system I use.  If it is installed
;; the following causes useful changes in the way special frames are
;; delivered. It doesn't get all special frames, such as "grep".
;; But it does grab tab completions. That's a big plus.
(require 'advice)
(when window-system
  (require 'framepop)
  (framepop-enable))

(setq framepop-frame-parameters
      '((name . nil)                     ; use buffer name
        (unsplittable . t)               ; always include this
        (menu-bar-lines . 0)             ; no menu bar
        (minibuffer . nil)               ;    or minubuffer
        (left . -1)                      ; top left corner of screen,
        (top . 30)                       ;    away from my main frame
        (width . 71)                     ; narrower, so it fits nicely
        (background-color . "MistyRose")   ; for October.
        (tool-bar-lines . 0)
        (minibuffer)))

(setq framepop-min-frame-size 20)
(setq framepop-use-advice (quote automatic))
(setq framepop-auto-resize t)


Anyway, after you install that, framepop will be automatic.  Many
Emacs messages that would ordinarily go to the minibuffer are not in a
separate popup, for which I chose pink as the background.

>
> HTH  Vincent
>
>>
>> Thank you very much!
>>
>> Best,
>>
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> ESS-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/ess-help
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas



More information about the ESS-help mailing list