Emacs autocomplete-mode extension for ESS and R - r

Is there an R-extension to Emacs autocomplete-mode that can be used with ESS?
If the extension doesn't exist I'd also appreciate any hints for writing one!

There is an ac-source for R here. I recall struggling with it and finally wrote my own which at that time was much faster, but buggy since I didn't manage to make prefix regexp work properly.
EDIT: the newest ESS (only svn currently) has out-of-the-box integration with auto-complete. I have added the instructions to the wiki.

auto-complete-acr is auto-complete sources.
it is more useful than ac-R.
add to .emacs below.
(require ‘auto-complete)
(require ‘auto-complete-acr)

Related

Export output and command lines in R [duplicate]

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?
In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.
I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.
Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.
Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):
"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."
r-help
Check out the savehistory() command
I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.
Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:
http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux
It works brilliantly and has a tiny memory footprint.

emacs: using mmm-mode to combine markdown-mode and ESS for editing rmarkdown files

I'm playing with mmm-mode to combine markdown-mode and ESS for editing Rmarkdown files. I'm using gnu emacs 24.3 on Windows 7 and up-to-date version of the aforementioned modes. This is what I've got in my .emacs file:
(require 'mmm-mode) ;;; possibly init with (require 'mmm-auto) instead
(mmm-add-classes
'((rmarkdown
:submode r-mode
:face mmm-declaration-submode-face
:front "^```[{]r.*[}] *$"
:back "^``` *$")))
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'markdown-mode "\\.rmd\\'" 'rmarkdown)
That works so far as within a buffer showing an rmarkdown file, R code blocks are recognized and I get proper syntactically aware font-locking within both R code blocks and markdown blocks. More, when I have the point in an R code block I get ESS and Imenu-R menus and when it's in a markdown region I get a markdown menu. So far so good.
Here are my issues. Within R code blocks electric left assignment doesn't work. I can't simply hit the underscore key to get '<-' and to toggle between that and '_'.
Also, I don't get syntactically aware auto indentation for R code.
Both of these things work when I'm using ESS to edit files containing pure R code.
Any thoughts on how to tune this up? I'm aware of this previous post from nearly a year ago: How can I use Emacs ESS mode with R markdown? and the pointer to polymode, but polymode seems to be advancing slowly. I've also seen other pointers to org-mode for similar functionality and while that's a plunge I may take at some point, today my questions are about getting the most out of the combination of mmm-mode, markdown-mode and ESS. Thanks for your help.
Polymode is the way to go. Unfortunately still in development, but works for most of the things.

ESS cannot find documentations in specified packages

I am using ESS(12.04), emacs(23.3.1) and R(2.14.1). It works very well except that I cannot open a help from R if the function is inside an package. For example:
In R(iESS mode)
> ?ls
I will get the help file, but if I run
> ?caTools::runmean
I will get "No documentation for 'caTools::runmean' in specified packages and libraries:
you could try '??caTools::runmean'".
I am sure that this is a problem of ESS because that if I run the command in R Console, it works perfectly fine. The following is the part of my .emacs file that relevant to ESS:
;; ESS mode
(require 'ess-tracebug)
(add-hook 'ess-post-run-hook 'ess-tracebug)
;; Set to open help in a webbrowser
;;(setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
;;(setq ess-help-own-frame t)
;; ESS-R_object-tooltip
;(require 'ess-R-object-tooltip)
;; Auto completion for R
;;(require 'ac-R)
;;(make-local-variable ac-ignore-case)
I have comment out most of my customization trying to identify the problem without luck. If anyone have any comments or suspects, please kindly point it to me. It has been bothering me for a while. Thanks a lot.
After updated to ESS version 12.09 and Emacs 24.2. The problem disappeared. I assume it is becomes some small bugs in ESS.

Adding Color Themes to Lispbox

I'm new to using Common Lisp and currently using Lispbox.
I would like to add a color-theme package to Lispbox running on OSX to change the color theme.
I'm currently trying to use the command:
(add-to-list 'load-path "~/desktop/colortheme/")
However I keep getting the same error:
Undefined function ADD-TO-LIST called with arguments (LOAD-PATH "/desktop/colortheme/").
Can someone please help me as to what to do from here?
Thanks in advance,
Cameron
As far as I know, Lispbox is simply a preconfigured bundle of Emacs, Slime, and Clozure CL. I think that you might be confusing the Emacs Lisp and the Common Lisp parts of that bundle. You need to put the snippet you showed into the Emacs Lisp part, i.e. (to get that configuration at startup) the .emacs configuration file. The REPL, that is, the CL-USER > prompt, is the Common Lisp interface and has nothing to do with Emacs' inner workings.

maintaining an input / output log in R

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?
In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.
I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.
Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.
Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):
"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."
r-help
Check out the savehistory() command
I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.
Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:
http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux
It works brilliantly and has a tiny memory footprint.

Resources