[ESS] How to show R function argument hint?

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Mon Jun 28 11:45:46 CEST 2010


> 
> Just to be clear.  When you are typing in the R script buffer, NOT the
> *R* terminal buffer, then you see tool tips appearing in a minibuffer
> when  you start to type commands?  Do you press a key sequence to get
> them?
> 
> On Linux, I've put (require 'ess-eldoc) in my .emacs file, but I don't
> see any effect.  I fear I've made some other change or installed some
> other package that breaks it.

ess-eldoc is something I wrote a long time ago, and forgot about!

I've just tested it, and it does work in .R buffers.  What you need to
check is that the .R buffer is associated with an *R* process, so that
it can get the function information from *R*. 

So, if you do 

M-x load-library RET ess-eldoc RET

C-x C-f foo.R

you should see the mode line read something like:

foo.R    ... (ESS[S] [none] Rox Ed)

Ed shows you that 'Eldoc' is active; but [none] shows me that foo.R
doesn't yet have a *R* process.  So either associate it with one (C-c
C-s) or create a new one (M-x R) and then you should see:

foo.R    ... (ESS[S] [R:3] Rox Ed)

and now eldoc will work in the .R buffer, as you should see with the
following example mentioned in the ess-eldoc.el file:

;; To use this functionality, simply add 
;;
;; (require 'ess-eldoc)
;;
;; to your .emacs file.  When you visit a R mode, eldoc will be turned
;; on.  However, you will first need to associate the R buffer with an
;; *R* process so that args can be looked up -- otherwise, eldoc will
;; silently not report anything.  So, e.g. try:
;; C-x C-f somefile.R
;; M-x R   (so that somefile.R is associated with *R*)
;; eldoc should then work.

;; e.g. put the following rnorm() command in an R buffer.  The line
;; underneath shows a key of what arg list will be shown as you move
;; across the rnorm line.

;; rnorm(n=100, mean=sqrt(20), sd=10)
;; 1111111111111222223333333311444111
;; 1: rnorm
;; 2: mean
;; 3: sqrt
;; 4: sd
;;


If this works, let me know, and I'll write up some documentation.

Stephen



More information about the ESS-help mailing list