R-autoyas in Emacs

I am trying to get r-autoyas to work on Emacs 23.3.1

I installed yasnippet and it works great on its own. For example: TAB after 'for' in C ++ mode automatically expands. Then I continued with r-autoyas. I followed the instructions given in the github repository, but could not get TAB to extend even the built-in functions in the R buffer.

If I type rnorm (and then press TAB, the minibuffer opens, which shows me the various arguments of the functions. Is this the default behavior? Or should it fill the default input arguments and let me change them to one?

I searched the Internet to find out if anyone else had this problem. One forum mentioned that it might be due to the autocomplete feature in Emacs.

I have the following lines in the init.el file that were specified in the instructions:

(requires "r-autoyas")

(add-hook 'ess-mode-hook' r-autoyas-ess-activate)

(add-hook 'ess-mode' yas / minor-mode-on)

+4
source share
1 answer

You need to add your own yasnippets for ESS / R for any yasnippet extension to work. By default there are none.

The behavior you see when you type rnorm(<TAB> has nothing to do with yasnippet, this is the behavior that ESS provides to simplify your R-coding.

So, you will need to create your own fragments for R. You need to do this in the text-mode/ess-mode , wherever your yasnippets are located (you need to create the ess-mode directory).

Here are some of my fragments of R. I thought I would use them more, but I really only use the setGeneric and setMethod ... and that's not all, that bullet of evidence.

+2
source

Source: https://habr.com/ru/post/1412533/


All Articles