Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customizing the ESS environment for R

I am trying to optimize my ESS - R environment. So far I make use of the r-autoyas, I set intendation and stuff following style guides, in the mini-buffer there are eldoc hints for function arguments, and I have the option to press a key in order to find information about variable at point (more here).

Are there any other things you use in order to have a nice R environment? Maybe non-ESS people have some nice things to add (I got that info of variable at point from looking at an Eclipser). One example could be an easy way to insert "just-before-defined" variables without typing the variable name (should be something for that?).

(Please help me to change the question instead of "closing" the thread if it is not well formulated)

like image 328
PascalVKooten Avatar asked Oct 14 '12 09:10

PascalVKooten


1 Answers

I am not using autoyas as I find auto-complete integration a better approach.

Insertion of previously defined symbols is a general emacs functionality called 'dabbrev-expand' and is bound to M-/. I have this in my .emacs to make it complete on full symbols:

(setq dabbrev-abbrev-char-regexp "\\sw\\|\\s_\\|s.")
(setq dabbrev-case-fold-search t)

Another thing which I use extensively is imenu-based-jump-to-symbol-definition. It offers similar functionality to emacs tags, but just for open buffers in the same mode as the current buffer. It also uses IDO for queries:

imenu-anywhere screenshot

Put imenu-anywhere.el into your emacs load path and add this:

(require 'imenu-anywhere)
(global-set-key [?\M-o] 'imenu-anywhere)

Now, if I do M-o foo RET emacs jumps to the function/class/method/generic definition of 'foo' as long as 'foo' is defined in one of the open buffers. This of course works whenever a mode defines imenu-tags. ESS defines those, so you should not need to add more.

There is also somewhere a collection of R-yas templates. I didn't get around to starting using them but my guess is that it's a pretty efficient template insertion mechanism.

[edit] Activate tracebug:

(setq ess-use-tracebug t)
like image 199
VitoshKa Avatar answered Sep 22 '22 02:09

VitoshKa