Is it possible to get code completion for R in Emacs ESS similar to what is available in Rstudio?

白昼怎懂夜的黑 提交于 2019-11-30 06:39:54

问题


Rstudio has a great code completion feature. It provides a quick view of functions that start with a given string, as well as function and parameter definitions.

ESS is powerful enough, familiar to me, and integrated into Emacs, where I conduct most of my work - so I am hesitant to move, but this feature is making me consider such a move.

Is it possible to integrate this feature into Emacs ESS?

Is there anything similar to this for Emacs ESS?

Any hope that there will be (and if so, how could I support such an effort?)


回答1:


You do get the completion thanks to the rcompgen package by Deepayan (now "promoted" into base R as part of the utils package). So when I type

lm(

and hit TAB a new buffer opens which gets me the left-hand side of your window above: the available options to the function at hand. I don't think you can show the help directly though.

There is / was also a way to get context-sensitive help in the mini-buffer when typing but I have forgottten how/where that gets turned on.




回答2:


[EDIT: This is an old answer and auto-complete package dropped out of fashion since then. Please use company-mode instead. It should work by default. Wiki configuration entry is here.]

Recent versions of ESS (> v.12.02) integrate with auto-complete package out of the box (you need not configure anything, just install auto-complete). It provides help on arguments as well as function help. I added detailed instructions to the wiki

Ess-eldoc was also rewritten and from v.12.02 it's active by default, so you don't need to configure anything.




回答3:


Or maybe we should all use search:

Emacs autocomplete-mode extension for ESS and R

I don't want to be grumpy, I found this few hours ago and I'm still shocked. It works like a charm. Though I still prefer the old-style pop-ups. =)



来源:https://stackoverflow.com/questions/6865344/is-it-possible-to-get-code-completion-for-r-in-emacs-ess-similar-to-what-is-avai

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!